This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Configure: avoid here-doc in eval-ed snippet
[perl5.git] / Configure
... / ...
CommitLineData
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 by the tool
15# called "metaconfig". Rather than working with this copy of Configure,
16# you should use metaconfig. Perl uses a modified version of this
17# tool, and this, together with the metaconfig units, are available
18# in the git repository:
19# $ git clone https://github.com/perl5-metaconfig/metaconfig metaconfig
20# The original dist package (including metaconfig) is available on github:
21# $ git clone https://github.com/rmanfredi/dist.git dist-git
22#
23# Though this script was generated by metaconfig from metaunits, it is
24# OK to send patches against Configure itself (but not to commit them
25# to blead). It's up to
26# the Configure maintainers to backport the patch to the metaunits if it
27# is accepted. Exceptions to this rule, and more information, is in
28# Porting/pumpkin.pod.
29
30# Generated using [metaconfig 3.5 PL0]
31# with additional metaconfig patches from https://github.com/Perl/metaconfig
32
33cat >c1$$ <<EOF
34ARGGGHHHH!!!!!
35
36SCO csh still thinks true is false. Write to SCO today and tell them that next
37year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
38
39(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
40we'd have to do is go in and swap the && and || tokens, wherever they are.)
41
42[End of diatribe. We now return you to your regularly scheduled programming...]
43EOF
44cat >c2$$ <<EOF
45
46OOPS! You naughty creature! You didn't run Configure with sh!
47I will attempt to remedy the situation by running sh for you...
48EOF
49
50true || cat c1$$ c2$$
51true || exec sh $0 $argv:q
52
53(exit $?0) || cat c2$$
54(exit $?0) || exec sh $0 $argv:q
55rm -f c1$$ c2$$
56
57if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
58 cat <<EOF
59***
60*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
61*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
62*** Please read the README.plan9 for further instructions.
63*** Cannot continue, aborting.
64***
65EOF
66 exit 1
67fi
68
69if test -f /sys/utilities/MultiView ; then
70 # AmigaOS, test -c for /dev/null is not useful
71 :
72elif test ! -c /dev/null ; then
73 cat <<EOF
74***
75*** I'm sorry, but /dev/null appears to be a file rather than a device.
76*** Please consult your operating sytem's notes for making a device
77*** in /dev.
78*** Cannot continue, aborting.
79***
80EOF
81 exit 1
82fi
83
84: compute my invocation name
85me=$0
86case "$0" in
87*/*)
88 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89 test "$me" || me=$0
90 ;;
91esac
92
93: Proper separator for the PATH environment variable
94p_=:
95: On OS/2 this directory should exist if this is not floppy only system ":-]"
96if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
97 if test -n "$OS2_SHELL"; then
98 p_=\;
99 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101 is_os2=yes
102 elif test -n "$DJGPP"; then
103 case "X${MACHTYPE:-nonesuchmach}" in
104 *cygwin|*msys) ;;
105 *) p_=\; ;;
106 esac
107 fi
108fi
109
110: Proper PATH setting
111paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118paths="$paths /sbin /usr/sbin /usr/libexec"
119paths="$paths /system/gnu_library/bin"
120
121for p in $paths
122do
123 case "$p_$PATH$p_" in
124 *$p_$p$p_*) ;;
125 *) test -d $p && PATH=$PATH$p_$p ;;
126 esac
127done
128
129PATH=.$p_$PATH
130export PATH
131
132: shall we be using ksh?
133inksh=''
134needksh=''
135avoidksh=''
136newsh=/bin/ksh
137changesh=''
138if (PATH=.; alias -x) >/dev/null 2>&1; then
139 inksh=true
140fi
141if test -f /hp-ux -a -f /bin/ksh; then
142 needksh='to avoid sh bug in "here document" expansion'
143fi
144if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145 if test X`/usr/bin/uname -v` = X4; then
146 avoidksh="to avoid AIX 4's /bin/sh"
147 newsh=/usr/bin/bsh
148 fi
149fi
150if test -f /osf_boot -a -f /usr/sbin/setld; then
151 if test X`/usr/bin/uname -s` = XOSF1; then
152 avoidksh="to avoid Digital UNIX' ksh"
153 newsh=/bin/sh
154 unset BIN_SH
155 fi
156fi
157case "$inksh/$needksh" in
158/[a-z]*)
159 ENV=''
160 changesh=true
161 reason="$needksh"
162 ;;
163esac
164case "$inksh/$avoidksh" in
165true/[a-z]*)
166 changesh=true
167 reason="$avoidksh"
168 ;;
169esac
170case "$inksh/$needksh-$avoidksh-" in
171true/--)
172 cat <<EOM
173(I see you are using the Korn shell. Some ksh's blow up on $me,
174mainly on older exotic systems. If yours does, try the Bourne shell instead.)
175EOM
176 ;;
177esac
178case "$changesh" in
179true)
180 export newsh
181 echo "(Feeding myself to $newsh $reason.)"
182 case "$0" in
183 Configure|*/Configure) exec $newsh $0 "$@";;
184 *) exec $newsh Configure "$@";;
185 esac
186 ;;
187esac
188test -x "${newsh}" || unset newsh
189
190: if needed, set CDPATH to a harmless value that is not chatty
191: avoid bash 2.02 problems with empty CDPATH.
192case "$CDPATH" in
193'') ;;
194*) case "$SHELL" in
195 *bash*) CDPATH='.' ;;
196 *) CDPATH='' ;;
197 esac
198 ;;
199esac
200
201: Configure runs within the UU subdirectory
202test -d UU || mkdir UU
203cd UU && rm -f ./*
204
205ccname=''
206ccversion=''
207ccsymbols=''
208cppccsymbols=''
209cppsymbols=''
210from=''
211hostgenerate=''
212hostosname=''
213hostperl=''
214run=''
215targetarch=''
216targetdir=''
217targetenv=''
218targethost=''
219targetmkdir=''
220targetport=''
221to=''
222usecrosscompile=''
223extern_C=''
224mistrustnm=''
225usedevel=''
226perllibs=''
227dynamic_ext=''
228extensions=''
229known_extensions=''
230nonxs_ext=''
231static_ext=''
232uselanginfo=''
233useopcode=''
234useposix=''
235extras=''
236d_bsd=''
237d_eunice=''
238d_xenix=''
239eunicefix=''
240ar=''
241awk=''
242bash=''
243bison=''
244byacc=''
245cat=''
246chgrp=''
247chmod=''
248chown=''
249comm=''
250compress=''
251cp=''
252cpio=''
253cpp=''
254csh=''
255date=''
256echo=''
257egrep=''
258emacs=''
259expr=''
260find=''
261flex=''
262gmake=''
263grep=''
264gzip=''
265inews=''
266ksh=''
267less=''
268line=''
269lint=''
270ln=''
271lp=''
272lpr=''
273ls=''
274mail=''
275mailx=''
276make=''
277mkdir=''
278more=''
279mv=''
280nm=''
281nroff=''
282perl=''
283pg=''
284pmake=''
285pr=''
286rm=''
287rmail=''
288sed=''
289sendmail=''
290shar=''
291sleep=''
292smail=''
293sort=''
294submit=''
295tail=''
296tar=''
297tbl=''
298tee=''
299test=''
300touch=''
301tr=''
302troff=''
303uname=''
304uniq=''
305uuname=''
306vi=''
307zcat=''
308zip=''
309full_ar=''
310full_sed=''
311libswanted=''
312hint=''
313myuname=''
314osname=''
315osvers=''
316Author=''
317Date=''
318Header=''
319Id=''
320Locker=''
321Log=''
322RCSfile=''
323Revision=''
324Source=''
325State=''
326sysroot=''
327_a=''
328_exe=''
329_o=''
330archobjs=''
331exe_ext=''
332firstmakefile=''
333lib_ext=''
334obj_ext=''
335path_sep=''
336rm_try=''
337afs=''
338afsroot=''
339alignbytes=''
340archlib=''
341archlibexp=''
342d_archlib=''
343installarchlib=''
344archname=''
345myarchname=''
346useversionedarchname=''
347d_atolf=''
348d_atoll=''
349baserev=''
350bin=''
351binexp=''
352initialinstalllocation=''
353installbin=''
354userelocatableinc=''
355byteorder=''
356cc=''
357ccflags=''
358cppflags=''
359ldflags=''
360lkflags=''
361locincpth=''
362optimize=''
363cf_email=''
364cf_by=''
365cf_time=''
366charbits=''
367charsize=''
368contains=''
369cpp_stuff=''
370cpplast=''
371cppminus=''
372cpprun=''
373cppstdin=''
374d__fwalk=''
375d_accept4=''
376d_access=''
377d_accessx=''
378d_acosh=''
379d_aintl=''
380d_alarm=''
381asctime_r_proto=''
382d_asctime_r=''
383d_asinh=''
384d_atanh=''
385d_attribute_always_inline=''
386d_attribute_deprecated=''
387d_attribute_format=''
388d_attribute_malloc=''
389d_attribute_nonnull=''
390d_attribute_noreturn=''
391d_attribute_pure=''
392d_attribute_unused=''
393d_attribute_warn_unused_result=''
394d_printf_format_null=''
395d_backtrace=''
396d_builtin_choose_expr=''
397d_builtin_expect=''
398d_builtin_add_overflow=''
399d_builtin_mul_overflow=''
400d_builtin_sub_overflow=''
401d_c99_variadic_macros=''
402d_casti32=''
403castflags=''
404d_castneg=''
405d_cbrt=''
406d_chown=''
407d_chroot=''
408d_chsize=''
409d_class=''
410d_clearenv=''
411d_closedir=''
412d_void_closedir=''
413d_cmsghdr_s=''
414d_copysign=''
415d_copysignl=''
416d_cplusplus=''
417cryptlib=''
418d_crypt=''
419crypt_r_proto=''
420d_crypt_r=''
421d_csh=''
422full_csh=''
423d_ctermid=''
424ctermid_r_proto=''
425d_ctermid_r=''
426ctime_r_proto=''
427d_ctime_r=''
428d_cuserid=''
429d_dbminitproto=''
430d_difftime=''
431d_dir_dd_fd=''
432d_dirfd=''
433d_dladdr=''
434d_dlerror=''
435d_dlopen=''
436d_dlsymun=''
437d_dosuid=''
438d_suidsafe=''
439d_drand48_r=''
440drand48_r_proto=''
441d_drand48proto=''
442d_dup2=''
443d_dup3=''
444d_eaccess=''
445d_endgrent=''
446d_endgrent_r=''
447endgrent_r_proto=''
448d_endhent=''
449d_endhostent_r=''
450endhostent_r_proto=''
451d_endnent=''
452d_endnetent_r=''
453endnetent_r_proto=''
454d_endpent=''
455d_endprotoent_r=''
456endprotoent_r_proto=''
457d_endpwent=''
458d_endpwent_r=''
459endpwent_r_proto=''
460d_endsent=''
461d_endservent_r=''
462endservent_r_proto=''
463d_erf=''
464d_erfc=''
465d_exp2=''
466d_expm1=''
467d_faststdio=''
468d_fchdir=''
469d_fchmod=''
470d_fchown=''
471d_fcntl=''
472d_fcntl_can_lock=''
473d_fd_macros=''
474d_fd_set=''
475d_fds_bits=''
476d_fdclose=''
477d_fdim=''
478d_fegetround=''
479d_fgetpos=''
480d_finite=''
481d_finitel=''
482d_flexfnam=''
483d_flock=''
484d_flockproto=''
485d_fma=''
486d_fmax=''
487d_fmin=''
488d_fork=''
489d_fp_class=''
490d_fp_classl=''
491d_fpclass=''
492d_fp_classify=''
493d_fpclassify=''
494d_fpclassl=''
495d_fpgetround=''
496d_fpos64_t=''
497d_frexpl=''
498d_fs_data_s=''
499d_fchmodat=''
500d_linkat=''
501d_openat=''
502d_renameat=''
503d_unlinkat=''
504d_fseeko=''
505d_fsetpos=''
506d_fstatfs=''
507d_fsync=''
508d_ftello=''
509d_ftime=''
510d_gettimeod=''
511d_futimes=''
512d_gai_strerror=''
513d_Gconvert=''
514d_getaddrinfo=''
515d_getcwd=''
516d_getespwnam=''
517d_getfsstat=''
518d_getgrent=''
519d_getgrent_r=''
520getgrent_r_proto=''
521d_getgrgid_r=''
522getgrgid_r_proto=''
523d_getgrnam_r=''
524getgrnam_r_proto=''
525d_getgrps=''
526d_gethbyaddr=''
527d_gethbyname=''
528d_gethent=''
529aphostname=''
530d_gethname=''
531d_phostname=''
532d_uname=''
533d_gethostbyaddr_r=''
534gethostbyaddr_r_proto=''
535d_gethostbyname_r=''
536gethostbyname_r_proto=''
537d_gethostent_r=''
538gethostent_r_proto=''
539d_gethostprotos=''
540d_getitimer=''
541d_getlogin=''
542d_getlogin_r=''
543getlogin_r_proto=''
544d_getmnt=''
545d_getmntent=''
546d_getnameinfo=''
547d_getnbyaddr=''
548d_getnbyname=''
549d_getnent=''
550d_getnetbyaddr_r=''
551getnetbyaddr_r_proto=''
552d_getnetbyname_r=''
553getnetbyname_r_proto=''
554d_getnetent_r=''
555getnetent_r_proto=''
556d_getnetprotos=''
557d_getpagsz=''
558d_getpent=''
559d_getpgid=''
560d_getpgrp2=''
561d_bsdgetpgrp=''
562d_getpgrp=''
563d_getppid=''
564d_getprior=''
565d_getpbyname=''
566d_getpbynumber=''
567d_getprotobyname_r=''
568getprotobyname_r_proto=''
569d_getprotobynumber_r=''
570getprotobynumber_r_proto=''
571d_getprotoent_r=''
572getprotoent_r_proto=''
573d_getprotoprotos=''
574d_getprpwnam=''
575d_getpwent=''
576d_getpwent_r=''
577getpwent_r_proto=''
578d_getpwnam_r=''
579getpwnam_r_proto=''
580d_getpwuid_r=''
581getpwuid_r_proto=''
582d_getsent=''
583d_getservbyname_r=''
584getservbyname_r_proto=''
585d_getservbyport_r=''
586getservbyport_r_proto=''
587d_getservent_r=''
588getservent_r_proto=''
589d_getservprotos=''
590d_getspnam=''
591d_getspnam_r=''
592getspnam_r_proto=''
593d_getsbyname=''
594d_getsbyport=''
595d_gmtime_r=''
596gmtime_r_proto=''
597d_gnulibc=''
598gnulibc_version=''
599d_hasmntopt=''
600d_htonl=''
601d_hypot=''
602d_ilogb=''
603d_ilogbl=''
604d_inetaton=''
605d_inetntop=''
606d_inetpton=''
607d_int64_t=''
608d_isascii=''
609d_isblank=''
610d_isfinite=''
611d_isfinitel=''
612d_isinf=''
613d_isinfl=''
614d_isless=''
615d_isnan=''
616d_isnanl=''
617d_isnormal=''
618d_j0=''
619d_j0l=''
620d_killpg=''
621d_lc_monetary_2008=''
622d_lchown=''
623d_ldbl_dig=''
624d_lgamma=''
625d_lgamma_r=''
626d_libm_lib_version=''
627d_link=''
628d_llrint=''
629d_llrintl=''
630d_llround=''
631d_llroundl=''
632d_localeconv_l=''
633d_localtime_r=''
634d_localtime_r_needs_tzset=''
635localtime_r_proto=''
636d_locconv=''
637d_lockf=''
638d_log1p=''
639d_log2=''
640d_logb=''
641d_ldexpl=''
642d_long_double_style_ieee=''
643d_long_double_style_ieee_doubledouble=''
644d_long_double_style_ieee_extended=''
645d_long_double_style_ieee_std=''
646d_long_double_style_vax=''
647d_longdbl=''
648longdblkind=''
649longdblsize=''
650d_longlong=''
651longlongsize=''
652d_lrint=''
653d_lrintl=''
654d_lround=''
655d_lroundl=''
656d_lseekproto=''
657d_lstat=''
658d_madvise=''
659d_malloc_good_size=''
660d_malloc_size=''
661d_malloc_usable_size=''
662d_mblen=''
663d_mbrlen=''
664d_mbrtowc=''
665d_mbstowcs=''
666d_mbtowc=''
667d_memmem=''
668d_memrchr=''
669d_mkdir=''
670d_mkdtemp=''
671d_mkfifo=''
672d_mkostemp=''
673d_mkstemp=''
674d_mkstemps=''
675d_mktime=''
676d_mmap=''
677mmaptype=''
678d_modfl=''
679d_modflproto=''
680d_mprotect=''
681d_msg=''
682d_msgctl=''
683d_msgget=''
684d_msghdr_s=''
685d_msgrcv=''
686d_msgsnd=''
687d_msync=''
688d_munmap=''
689d_nan=''
690d_nanosleep=''
691d_nearbyint=''
692d_duplocale=''
693d_freelocale=''
694d_newlocale=''
695d_querylocale=''
696d_uselocale=''
697i_xlocale=''
698d_nextafter=''
699d_nexttoward=''
700d_nice=''
701d_nl_langinfo=''
702d_thread_safe_nl_langinfo_l=''
703d_off64_t=''
704d_open3=''
705d_fpathconf=''
706d_pathconf=''
707d_pause=''
708d_pipe2=''
709d_pipe=''
710d_poll=''
711d_portable=''
712d_prctl=''
713d_prctl_set_name=''
714d_procselfexe=''
715procselfexe=''
716d_old_pthread_create_joinable=''
717old_pthread_create_joinable=''
718d_pthread_atfork=''
719d_pthread_attr_setscope=''
720d_pthread_yield=''
721d_sched_yield=''
722sched_yield=''
723d_ptrdiff_t=''
724d_qgcvt=''
725d_random_r=''
726random_r_proto=''
727d_readdir64_r=''
728readdir64_r_proto=''
729d_readdir=''
730d_rewinddir=''
731d_seekdir=''
732d_telldir=''
733d_readdir_r=''
734readdir_r_proto=''
735d_readlink=''
736d_readv=''
737d_recvmsg=''
738d_re_comp=''
739d_regcmp=''
740d_regcomp=''
741d_remainder=''
742d_remquo=''
743d_rename=''
744d_rint=''
745d_rmdir=''
746d_round=''
747d_sbrkproto=''
748d_scalbn=''
749d_scalbnl=''
750d_select=''
751d_sem=''
752d_semctl=''
753d_semget=''
754d_semop=''
755d_sendmsg=''
756d_setegid=''
757d_seteuid=''
758d_setgrent=''
759d_setgrent_r=''
760setgrent_r_proto=''
761d_setgrps=''
762d_sethent=''
763d_sethostent_r=''
764sethostent_r_proto=''
765d_setitimer=''
766d_setlinebuf=''
767d_has_C_UTF8=''
768d_setlocale=''
769d_setlocale_accepts_any_locale_name=''
770d_setlocale_r=''
771setlocale_r_proto=''
772d_setnent=''
773d_setnetent_r=''
774setnetent_r_proto=''
775d_setpent=''
776d_setpgid=''
777d_setpgrp2=''
778d_bsdsetpgrp=''
779d_setpgrp=''
780d_setprior=''
781d_setproctitle=''
782d_setprotoent_r=''
783setprotoent_r_proto=''
784d_setpwent=''
785d_setpwent_r=''
786setpwent_r_proto=''
787d_setregid=''
788d_setresgid=''
789d_setresuid=''
790d_setreuid=''
791d_setrgid=''
792d_setruid=''
793d_setsent=''
794d_setservent_r=''
795setservent_r_proto=''
796d_setsid=''
797d_setvbuf=''
798d_shm=''
799d_shmat=''
800d_shmatprototype=''
801shmattype=''
802d_shmctl=''
803d_shmdt=''
804d_shmget=''
805d_sigaction=''
806d_siginfo_si_addr=''
807d_siginfo_si_band=''
808d_siginfo_si_errno=''
809d_siginfo_si_fd=''
810d_siginfo_si_pid=''
811d_siginfo_si_status=''
812d_siginfo_si_uid=''
813d_siginfo_si_value=''
814d_signbit=''
815d_sigprocmask=''
816d_sigsetjmp=''
817usesitecustomize=''
818d_snprintf=''
819d_vsnprintf=''
820d_sockatmark=''
821d_sockatmarkproto=''
822d_ip_mreq=''
823d_ip_mreq_source=''
824d_ipv6_mreq=''
825d_ipv6_mreq_source=''
826d_msg_ctrunc=''
827d_msg_dontroute=''
828d_msg_oob=''
829d_msg_peek=''
830d_msg_proxy=''
831d_oldsock=''
832d_scm_rights=''
833d_sin6_scope_id=''
834d_sockaddr_in6=''
835d_sockaddr_sa_len=''
836d_socket=''
837d_sockpair=''
838sockethdr=''
839socketlib=''
840d_socklen_t=''
841d_socks5_init=''
842d_sqrtl=''
843d_srand48_r=''
844srand48_r_proto=''
845d_srandom_r=''
846srandom_r_proto=''
847d_sresgproto=''
848d_sresuproto=''
849d_stat=''
850d_statblks=''
851d_statfs_f_flags=''
852d_statfs_s=''
853d_static_inline=''
854perl_static_inline=''
855d_fstatvfs=''
856d_statvfs=''
857d_stdio_cnt_lval=''
858d_stdio_ptr_lval=''
859d_stdio_ptr_lval_nochange_cnt=''
860d_stdio_ptr_lval_sets_cnt=''
861d_stdiobase=''
862d_stdstdio=''
863stdio_base=''
864stdio_bufsiz=''
865stdio_cnt=''
866stdio_filbuf=''
867stdio_ptr=''
868d_strcoll=''
869d_sysernlst=''
870d_syserrlst=''
871d_strerror_l=''
872d_strerror_r=''
873strerror_r_proto=''
874d_strftime=''
875d_strlcat=''
876d_strlcpy=''
877d_strnlen=''
878d_strtod=''
879d_strtod_l=''
880d_strtol=''
881d_strtold=''
882d_strtold_l=''
883d_strtoll=''
884d_strtoq=''
885d_strtoul=''
886d_strtoull=''
887d_strtouq=''
888d_strxfrm=''
889d_symlink=''
890d_syscall=''
891d_syscallproto=''
892d_sysconf=''
893d_system=''
894d_tcgetpgrp=''
895d_tcsetpgrp=''
896d_telldirproto=''
897d_tgamma=''
898d_time=''
899timetype=''
900d_asctime64=''
901d_ctime64=''
902d_difftime64=''
903d_gmtime64=''
904d_localtime64=''
905d_mktime64=''
906d_timegm=''
907clocktype=''
908d_times=''
909d_tmpnam_r=''
910tmpnam_r_proto=''
911d_towlower=''
912d_towupper=''
913d_trunc=''
914d_truncate=''
915d_truncl=''
916d_ttyname_r=''
917ttyname_r_proto=''
918d_tzname=''
919d_u32align=''
920d_ualarm=''
921d_umask=''
922d_semctl_semid_ds=''
923d_semctl_semun=''
924d_union_semun=''
925d_unordered=''
926d_unsetenv=''
927d_usleep=''
928d_usleepproto=''
929d_ustat=''
930d_pseudofork=''
931d_vfork=''
932usevfork=''
933d_voidsig=''
934signal_t=''
935d_wait4=''
936d_waitpid=''
937d_wcrtomb=''
938d_wcscmp=''
939d_wcstombs=''
940d_wcsxfrm=''
941d_wctomb=''
942d_writev=''
943default_inc_excludes_dot=''
944dlext=''
945bin_ELF=''
946cccdlflags=''
947ccdlflags=''
948dlsrc=''
949ld=''
950ld_can_script=''
951lddlflags=''
952usedl=''
953doublesize=''
954dtraceobject=''
955dtracexnolibs=''
956ebcdic=''
957fflushNULL=''
958fflushall=''
959fpossize=''
960fpostype=''
961gccansipedantic=''
962gccosandvers=''
963gccversion=''
964gidformat=''
965gidsign=''
966gidsize=''
967gidtype=''
968groupstype=''
969h_fcntl=''
970h_sysfile=''
971html1dir=''
972html1direxp=''
973installhtml1dir=''
974html3dir=''
975html3direxp=''
976installhtml3dir=''
977i_arpainet=''
978i_bfd=''
979i_crypt=''
980db_hashtype=''
981db_prefixtype=''
982db_version_major=''
983db_version_minor=''
984db_version_patch=''
985i_db=''
986i_dbm=''
987i_rpcsvcdbm=''
988d_dirnamlen=''
989direntrytype=''
990i_dirent=''
991i_dlfcn=''
992i_execinfo=''
993i_fcntl=''
994i_fenv=''
995i_fp=''
996i_fp_class=''
997i_gdbm=''
998d_grpasswd=''
999i_grp=''
1000i_ieeefp=''
1001i_inttypes=''
1002i_langinfo=''
1003i_libutil=''
1004i_locale=''
1005i_machcthr=''
1006i_malloc=''
1007i_mallocmalloc=''
1008i_mntent=''
1009d_gdbm_ndbm_h_uses_prototypes=''
1010d_gdbmndbm_h_uses_prototypes=''
1011d_ndbm=''
1012d_ndbm_h_uses_prototypes=''
1013i_gdbm_ndbm=''
1014i_gdbmndbm=''
1015i_ndbm=''
1016i_netdb=''
1017i_neterrno=''
1018i_netinettcp=''
1019i_niin=''
1020i_sysin=''
1021i_poll=''
1022i_prot=''
1023i_pthread=''
1024d_pwage=''
1025d_pwchange=''
1026d_pwclass=''
1027d_pwcomment=''
1028d_pwexpire=''
1029d_pwgecos=''
1030d_pwpasswd=''
1031d_pwquota=''
1032i_pwd=''
1033i_quadmath=''
1034i_shadow=''
1035i_socks=''
1036i_stdbool=''
1037i_stdint=''
1038i_stdlib=''
1039i_sunmath=''
1040i_sysaccess=''
1041i_sysdir=''
1042i_sysfile=''
1043d_voidtty=''
1044i_bsdioctl=''
1045i_sysfilio=''
1046i_sysioctl=''
1047i_syssockio=''
1048i_syslog=''
1049i_sysmman=''
1050i_sysmode=''
1051i_sysmount=''
1052i_sysndir=''
1053i_sysparam=''
1054i_syspoll=''
1055i_sysresrc=''
1056i_syssecrt=''
1057i_sysselct=''
1058i_sysstat=''
1059i_sysstatfs=''
1060i_sysstatvfs=''
1061i_systimes=''
1062i_systypes=''
1063i_sysuio=''
1064i_sysun=''
1065i_sysutsname=''
1066i_sysvfs=''
1067i_syswait=''
1068i_sgtty=''
1069i_termio=''
1070i_termios=''
1071d_tm_tm_gmtoff=''
1072d_tm_tm_zone=''
1073i_systime=''
1074i_systimek=''
1075i_time=''
1076timeincl=''
1077i_unistd=''
1078i_ustat=''
1079i_utime=''
1080i_vfork=''
1081i_wchar=''
1082i_wctype=''
1083d_inc_version_list=''
1084inc_version_list=''
1085inc_version_list_init=''
1086doubleinfbytes=''
1087doublenanbytes=''
1088longdblinfbytes=''
1089longdblnanbytes=''
1090installprefix=''
1091installprefixexp=''
1092installstyle=''
1093installusrbinperl=''
1094intsize=''
1095longsize=''
1096shortsize=''
1097issymlink=''
1098libc=''
1099ldlibpthname=''
1100libperl=''
1101shrpenv=''
1102useshrplib=''
1103glibpth=''
1104incpth=''
1105libpth=''
1106loclibpth=''
1107plibpth=''
1108xlibpth=''
1109ignore_versioned_solibs=''
1110libs=''
1111libsdirs=''
1112libsfiles=''
1113libsfound=''
1114libspath=''
1115lns=''
1116d_PRIEUldbl=''
1117d_PRIFUldbl=''
1118d_PRIGUldbl=''
1119d_PRIeldbl=''
1120d_PRIfldbl=''
1121d_PRIgldbl=''
1122d_SCNfldbl=''
1123d_double_has_inf=''
1124d_double_has_nan=''
1125d_double_has_negative_zero=''
1126d_double_has_subnormals=''
1127d_double_style_cray=''
1128d_double_style_ibm=''
1129d_double_style_ieee=''
1130d_double_style_vax=''
1131doublekind=''
1132sPRIEUldbl=''
1133sPRIFUldbl=''
1134sPRIGUldbl=''
1135sPRIeldbl=''
1136sPRIfldbl=''
1137sPRIgldbl=''
1138sSCNfldbl=''
1139lseeksize=''
1140lseektype=''
1141make_set_make=''
1142d_mymalloc=''
1143freetype=''
1144mallocobj=''
1145mallocsrc=''
1146malloctype=''
1147usemallocwrap=''
1148usemymalloc=''
1149installman1dir=''
1150man1dir=''
1151man1direxp=''
1152man1ext=''
1153installman3dir=''
1154man3dir=''
1155man3direxp=''
1156man3ext=''
1157doublemantbits=''
1158longdblmantbits=''
1159nvmantbits=''
1160modetype=''
1161multiarch=''
1162mydomain=''
1163myhostname=''
1164phostname=''
1165c=''
1166n=''
1167d_eofnblk=''
1168eagain=''
1169o_nonblock=''
1170rd_nodata=''
1171need_va_copy=''
1172netdb_hlen_type=''
1173netdb_host_type=''
1174netdb_name_type=''
1175netdb_net_type=''
1176groupcat=''
1177hostcat=''
1178passcat=''
1179orderlib=''
1180ranlib=''
1181d_perl_otherlibdirs=''
1182otherlibdirs=''
1183package=''
1184spackage=''
1185pager=''
1186api_revision=''
1187api_subversion=''
1188api_version=''
1189api_versionstring=''
1190patchlevel=''
1191perl_patchlevel=''
1192revision=''
1193subversion=''
1194version=''
1195version_patchlevel_string=''
1196perl5=''
1197perladmin=''
1198perlpath=''
1199d_nv_preserves_uv=''
1200d_nv_zero_is_allbits_zero=''
1201i16size=''
1202i16type=''
1203i32size=''
1204i32type=''
1205i64size=''
1206i64type=''
1207i8size=''
1208i8type=''
1209ivsize=''
1210ivtype=''
1211nv_overflows_integers_at=''
1212nv_preserves_uv_bits=''
1213nvsize=''
1214nvtype=''
1215u16size=''
1216u16type=''
1217u32size=''
1218u32type=''
1219u64size=''
1220u64type=''
1221u8size=''
1222u8type=''
1223uvsize=''
1224uvtype=''
1225ivdformat=''
1226nvEUformat=''
1227nvFUformat=''
1228nvGUformat=''
1229nveformat=''
1230nvfformat=''
1231nvgformat=''
1232uvXUformat=''
1233uvoformat=''
1234uvuformat=''
1235uvxformat=''
1236pidtype=''
1237prefix=''
1238prefixexp=''
1239installprivlib=''
1240privlib=''
1241privlibexp=''
1242ptrsize=''
1243d_PRIXU64=''
1244d_PRId64=''
1245d_PRIi64=''
1246d_PRIo64=''
1247d_PRIu64=''
1248d_PRIx64=''
1249sPRIXU64=''
1250sPRId64=''
1251sPRIi64=''
1252sPRIo64=''
1253sPRIu64=''
1254sPRIx64=''
1255d_quad=''
1256quadkind=''
1257quadtype=''
1258uquadtype=''
1259drand01=''
1260randbits=''
1261randfunc=''
1262randseedtype=''
1263seedfunc=''
1264installscript=''
1265scriptdir=''
1266scriptdirexp=''
1267selectminbits=''
1268selecttype=''
1269sh=''
1270targetsh=''
1271sig_count=''
1272sig_name=''
1273sig_name_init=''
1274sig_num=''
1275sig_num_init=''
1276sig_size=''
1277d_sitearch=''
1278installsitearch=''
1279sitearch=''
1280sitearchexp=''
1281installsitebin=''
1282sitebin=''
1283sitebinexp=''
1284installsitehtml1dir=''
1285sitehtml1dir=''
1286sitehtml1direxp=''
1287installsitehtml3dir=''
1288sitehtml3dir=''
1289sitehtml3direxp=''
1290installsitelib=''
1291sitelib=''
1292sitelib_stem=''
1293sitelibexp=''
1294installsiteman1dir=''
1295siteman1dir=''
1296siteman1direxp=''
1297installsiteman3dir=''
1298siteman3dir=''
1299siteman3direxp=''
1300siteprefix=''
1301siteprefixexp=''
1302installsitescript=''
1303sitescript=''
1304sitescriptexp=''
1305sizesize=''
1306sizetype=''
1307d_libname_unique=''
1308so=''
1309socksizetype=''
1310sharpbang=''
1311shsharp=''
1312spitshell=''
1313src=''
1314ssizetype=''
1315st_ino_sign=''
1316st_ino_size=''
1317startperl=''
1318startsh=''
1319stdchar=''
1320d_stdio_stream_array=''
1321stdio_stream_array=''
1322sysman=''
1323sGMTIME_max=''
1324sGMTIME_min=''
1325sLOCALTIME_max=''
1326sLOCALTIME_min=''
1327trnl=''
1328uidformat=''
1329uidsign=''
1330uidsize=''
1331uidtype=''
1332archname64=''
1333use64bitall=''
1334use64bitint=''
1335usecbacktrace=''
1336dtrace=''
1337usedtrace=''
1338usefaststdio=''
1339usekernprocpathname=''
1340ccflags_uselargefiles=''
1341ldflags_uselargefiles=''
1342libswanted_uselargefiles=''
1343uselargefiles=''
1344uselongdouble=''
1345usemorebits=''
1346usemultiplicity=''
1347nm_opt=''
1348nm_so_opt=''
1349runnm=''
1350usenm=''
1351usensgetexecutablepath=''
1352useperlio=''
1353usequadmath=''
1354usesocks=''
1355d_oldpthreads=''
1356use5005threads=''
1357useithreads=''
1358usereentrant=''
1359usethreads=''
1360incpath=''
1361mips_type=''
1362usrinc=''
1363d_vendorarch=''
1364installvendorarch=''
1365vendorarch=''
1366vendorarchexp=''
1367d_vendorbin=''
1368installvendorbin=''
1369vendorbin=''
1370vendorbinexp=''
1371installvendorhtml1dir=''
1372vendorhtml1dir=''
1373vendorhtml1direxp=''
1374installvendorhtml3dir=''
1375vendorhtml3dir=''
1376vendorhtml3direxp=''
1377d_vendorlib=''
1378installvendorlib=''
1379vendorlib=''
1380vendorlib_stem=''
1381vendorlibexp=''
1382installvendorman1dir=''
1383vendorman1dir=''
1384vendorman1direxp=''
1385installvendorman3dir=''
1386vendorman3dir=''
1387vendorman3direxp=''
1388usevendorprefix=''
1389vendorprefix=''
1390vendorprefixexp=''
1391d_vendorscript=''
1392installvendorscript=''
1393vendorscript=''
1394vendorscriptexp=''
1395versiononly=''
1396yacc=''
1397yaccflags=''
1398CONFIG=''
1399
1400: Detect odd OSs
1401define='define'
1402undef='undef'
1403smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1404rmlist=''
1405
1406: We must find out about Eunice early
1407eunicefix=':'
1408if test -f /etc/unixtovms; then
1409 eunicefix=/etc/unixtovms
1410fi
1411if test -f /etc/unixtovms.exe; then
1412 eunicefix=/etc/unixtovms.exe
1413fi
1414
1415: Set executable suffix now -- needed before hints available
1416if test -f "/libs/version.library"; then
1417: Amiga OS
1418 _exe=""
1419elif test -f "/system/gnu_library/bin/ar.pm"; then
1420: Stratus VOS
1421 _exe=".pm"
1422elif test -n "$DJGPP"; then
1423: DOS DJGPP
1424 _exe=".exe"
1425elif test -f /kern/cookiejar; then
1426: MiNT
1427 _exe=""
1428elif test -d c:/. -o -n "$is_os2" ; then
1429: OS/2 or cygwin
1430 _exe=".exe"
1431fi
1432
1433groupstype=''
1434i_whoami=''
1435: Possible local include directories to search.
1436: Set locincpth to "" in a hint file to defeat local include searches.
1437locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1438locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1439:
1440: no include file wanted by default
1441inclwanted=''
1442
1443: Enable -DEBUGGING and -DDEBUGGING from the command line
1444EBUGGING=''
1445DEBUGGING=''
1446
1447: Trailing extension. Override this in a hint file, if needed.
1448: Extra object files, if any, needed on this platform.
1449archobjs=''
1450libnames=''
1451: change the next line if compiling for Xenix/286 on Xenix/386
1452xlibpth='/usr/lib/386 /lib/386'
1453: Possible local library directories to search.
1454loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1455loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1456
1457: general looking path for locating libraries
1458glibpth="/lib /usr/lib $xlibpth"
1459glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1460test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1461test -f /shlib/libc.so && glibpth="/shlib $glibpth"
1462test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1463
1464: Private path used by Configure to find libraries. Its value
1465: is prepended to libpth. This variable takes care of special
1466: machines, like the mips. Usually, it should be empty.
1467plibpth=''
1468
1469: default library list
1470libswanted=''
1471: some systems want to use only the non-versioned libso:s
1472ignore_versioned_solibs=''
1473ccname=''
1474ccversion=''
1475perllibs=''
1476: set useposix=false in your hint file to disable the POSIX extension.
1477useposix=true
1478: set useopcode=false in your hint file to disable the Opcode extension.
1479useopcode=true
1480: set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
1481uselanginfo=true
1482archname64=''
1483ccflags_uselargefiles=''
1484ldflags_uselargefiles=''
1485libswanted_uselargefiles=''
1486: set usemultiplicity on the Configure command line to enable multiplicity.
1487: set usesocks on the Configure command line to enable socks.
1488archname=''
1489: set usethreads on the Configure command line to enable threads.
1490usereentrant='undef'
1491: List of libraries we want.
1492: If anyone needs extra -lxxx, put those in a hint file.
1493libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1494libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1495: We probably want to search /usr/shlib before most other libraries.
1496: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1497glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1498glibpth="/usr/shlib $glibpth"
1499: Do not use vfork unless overridden by a hint file.
1500usevfork=false
1501
1502: Find the basic shell for Bourne shell scripts
1503case "$sh" in
1504'')
1505 case "$SYSTYPE" in
1506 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1507 *) xxx='/bin/sh';;
1508 esac
1509 if test -f "$xxx"; then
1510 sh="$xxx"
1511 else
1512 : Build up a list and do a single loop so we can 'break' out.
1513 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1514 for xxx in sh bash ksh pdksh ash; do
1515 for p in $pth; do
1516 try="$try ${p}/${xxx}"
1517 done
1518 done
1519 for xxx in $try; do
1520 if test -f "$xxx"; then
1521 sh="$xxx";
1522 break
1523 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1524 sh="$xxx";
1525 break
1526 elif test -f "$xxx.exe"; then
1527 sh="$xxx";
1528 break
1529 fi
1530 done
1531 fi
1532 ;;
1533esac
1534
1535case "$sh" in
1536'') cat >&2 <<EOM
1537$me: Fatal Error: I can't find a Bourne Shell anywhere.
1538
1539Usually it's in /bin/sh. How did you even get this far?
1540Please contact me (Perl Maintainers) at https://github.com/Perl/perl5/issues
1541and we'll try to straighten this all out.
1542EOM
1543 exit 1
1544 ;;
1545esac
1546
1547: When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1548: default both to the same thing, cross-compilers can then set targetsh differently if they like
1549targetsh=$sh
1550
1551: see if sh knows # comments
1552if `$sh -c '#' >/dev/null 2>&1`; then
1553 shsharp=true
1554 spitshell=cat
1555 xcat=/bin/cat
1556 test -f $xcat$_exe || xcat=/usr/bin/cat
1557 if test ! -f $xcat$_exe; then
1558 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1559 if test -f $p/cat$_exe; then
1560 xcat=$p/cat
1561 break
1562 fi
1563 done
1564 if test ! -f $xcat$_exe; then
1565 echo "Can't find cat anywhere!"
1566 exit 1
1567 fi
1568 fi
1569 echo "#!$xcat" >sharp
1570 $eunicefix sharp
1571 chmod +x sharp
1572 ./sharp > today 2>/dev/null
1573 if test -s today; then
1574 sharpbang='#!'
1575 else
1576 echo "#! $xcat" > sharp
1577 $eunicefix sharp
1578 chmod +x sharp
1579 ./sharp > today 2>/dev/null
1580 if test -s today; then
1581 sharpbang='#! '
1582 else
1583 sharpbang=': use '
1584 fi
1585 fi
1586else
1587 echo " "
1588 echo "Your $sh doesn't grok # comments--I will strip them later on."
1589 shsharp=false
1590 cd ..
1591 echo "exec grep -v '^[ ]*#'" >spitshell
1592 chmod +x spitshell
1593 $eunicefix spitshell
1594 spitshell=`pwd`/spitshell
1595 cd UU
1596 echo "I presume that if # doesn't work, #! won't work either!"
1597 sharpbang=': use '
1598fi
1599rm -f sharp today
1600
1601: figure out how to guarantee sh startup
1602case "$startsh" in
1603'') startsh=${sharpbang}${sh} ;;
1604*)
1605esac
1606cat >sharp <<EOSS
1607$startsh
1608set abc
1609test "$?abc" != 1
1610EOSS
1611
1612chmod +x sharp
1613$eunicefix sharp
1614if ./sharp; then
1615 : echo "Yup, it does."
1616else
1617 echo "Hmm... '$startsh' does not guarantee sh startup..."
1618 echo "You may have to fix up the shell scripts to make sure $sh runs them."
1619fi
1620rm -f sharp
1621
1622: Save command line options in file UU/cmdline.opt for later use in
1623: generating config.sh.
1624cat > cmdline.opt <<EOSH
1625: Configure command line arguments.
1626config_arg0='$0'
1627config_args='$*'
1628config_argc=$#
1629EOSH
1630argn=1
1631args_exp=''
1632args_sep=''
1633for arg in "$@"; do
1634 cat >>cmdline.opt <<EOSH
1635config_arg$argn='$arg'
1636EOSH
1637 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1638$arg
1639EOC
1640 arg_exp=`cat cmdl.opt`
1641 args_exp="$args_exp$args_sep'$arg_exp'"
1642 argn=`expr $argn + 1`
1643 args_sep=' '
1644done
1645rm -f cmdl.opt
1646
1647: produce awk script to parse command line options
1648cat >options.awk <<'EOF'
1649BEGIN {
1650 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
1651
1652 len = length(optstr);
1653 for (i = 1; i <= len; i++) {
1654 c = substr(optstr, i, 1);
1655 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1656 if (a == ":") {
1657 arg[c] = 1;
1658 i++;
1659 }
1660 opt[c] = 1;
1661 }
1662}
1663{
1664 expect = 0;
1665 str = $0;
1666 if (substr(str, 1, 1) != "-") {
1667 printf("'%s'\n", str);
1668 next;
1669 }
1670 len = length($0);
1671 for (i = 2; i <= len; i++) {
1672 c = substr(str, i, 1);
1673 if (!opt[c]) {
1674 printf("-%s\n", substr(str, i));
1675 next;
1676 }
1677 printf("-%s\n", c);
1678 if (arg[c]) {
1679 if (i < len)
1680 printf("'%s'\n", substr(str, i + 1));
1681 else
1682 expect = 1;
1683 next;
1684 }
1685 }
1686}
1687END {
1688 if (expect)
1689 print "?";
1690}
1691EOF
1692
1693: process the command line options
1694set X `for arg in "$@"; do echo "X$arg"; done |
1695 sed -e s/X// | awk -f options.awk`
1696eval "set $*"
1697shift
1698rm -f options.awk
1699
1700: set up default values
1701fastread=''
1702reuseval=false
1703config_sh=''
1704alldone=''
1705error=''
1706silent=''
1707extractsh=''
1708knowitall=''
1709rm -f optdef.sh posthint.sh
1710cat >optdef.sh <<EOS
1711$startsh
1712EOS
1713
1714
1715: option parsing
1716while test $# -gt 0; do
1717 case "$1" in
1718 -d) shift; fastread=yes;;
1719 -e) shift; alldone=cont;;
1720 -f)
1721 shift
1722 cd ..
1723 if test -r "$1"; then
1724 config_sh="$1"
1725 else
1726 echo "$me: cannot read config file $1." >&2
1727 error=true
1728 fi
1729 cd UU
1730 shift;;
1731 --help|\
1732 -h) shift; error=true;;
1733 -r) shift; reuseval=true;;
1734 -s) shift; silent=true; realsilent=true;;
1735 -E) shift; alldone=exit;;
1736 -K) shift; knowitall=true;;
1737 -O) shift;;
1738 -S) shift; silent=true; extractsh=true;;
1739 -D)
1740 shift
1741 case "$1" in
1742 *=)
1743 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1744 echo "$me: ignoring -D $1" >&2
1745 ;;
1746 *=*) echo "$1" | \
1747 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1748 *) echo "$1='define'" >> optdef.sh;;
1749 esac
1750 shift
1751 ;;
1752 -U)
1753 shift
1754 case "$1" in
1755 *=) echo "$1" >> optdef.sh;;
1756 *=*)
1757 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1758 echo "$me: ignoring -U $1" >&2
1759 ;;
1760 *) echo "$1='undef'" >> optdef.sh;;
1761 esac
1762 shift
1763 ;;
1764 -A)
1765 shift
1766 xxx=''
1767 yyy="$1"
1768 zzz=''
1769 uuu=undef
1770 case "$yyy" in
1771 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1772 case "$zzz" in
1773 *:*) zzz='' ;;
1774 *) xxx=append
1775 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1776 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1777 esac
1778 ;;
1779 esac
1780 case "$xxx" in
1781 '') case "$yyy" in
1782 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1783 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1784 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1785 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1786 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1787 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1788 esac
1789 ;;
1790 esac
1791 case "$xxx" in
1792 append)
1793 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
1794 clear)
1795 echo "$yyy=''" >> posthint.sh ;;
1796 define)
1797 case "$zzz" in
1798 '') zzz=define ;;
1799 esac
1800 echo "$yyy='$zzz'" >> posthint.sh ;;
1801 eval)
1802 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
1803 prepend)
1804 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
1805 undef)
1806 case "$zzz" in
1807 '') zzz="$uuu" ;;
1808 esac
1809 echo "$yyy=$zzz" >> posthint.sh ;;
1810 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1811 esac
1812 shift
1813 ;;
1814 -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1815 exit 0;;
1816 --) break;;
1817 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1818 *) break;;
1819 esac
1820done
1821
1822case "$error" in
1823true)
1824 cat >&2 <<EOM
1825Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1826 [-U symbol] [-U symbol=] [-A command:symbol...]
1827 -d : use defaults for all answers.
1828 -e : go on without questioning past the production of config.sh.
1829 -f : specify an alternate default configuration file.
1830 -h : print this help message and exit (with an error status).
1831 -r : reuse C symbols value if possible (skips costly nm extraction).
1832 -s : silent mode, only echoes questions and essential information.
1833 -D : define symbol to have some value:
1834 -D symbol symbol gets the value 'define'
1835 -D symbol=value symbol gets the value 'value'
1836 common used examples (see INSTALL for more info):
1837 -Duse64bitint use 64bit integers
1838 -Duse64bitall use 64bit integers and pointers
1839 -Dusethreads use thread support
1840 -Dinc_version_list=none do not include older perl trees in @INC
1841 -DEBUGGING=none DEBUGGING options
1842 -Dcc=gcc choose your compiler
1843 -Dprefix=/opt/perl5 choose your destination
1844 -E : stop at the end of questions, after having produced config.sh.
1845 -K : do not use unless you know what you are doing.
1846 -O : ignored for backward compatibility
1847 -S : perform variable substitutions on all .SH files (can mix with -f)
1848 -U : undefine symbol:
1849 -U symbol symbol gets the value 'undef'
1850 -U symbol= symbol gets completely empty
1851 e.g.: -Uversiononly
1852 -A : manipulate symbol after the platform specific hints have been applied:
1853 -A append:symbol=value append value to symbol
1854 -A symbol=value like append:, but with a separating space
1855 -A define:symbol=value define symbol to have value
1856 -A clear:symbol define symbol to be ''
1857 -A define:symbol define symbol to be 'define'
1858 -A eval:symbol=value define symbol to be eval of value
1859 -A prepend:symbol=value prepend value to symbol
1860 -A undef:symbol define symbol to be 'undef'
1861 -A undef:symbol= define symbol to be ''
1862 e.g.: -A prepend:libswanted='cl pthread '
1863 -A ccflags=-DSOME_MACRO
1864 -V : print version number and exit (with a zero status).
1865EOM
1866 exit 1
1867 ;;
1868esac
1869
1870: Sanity checks
1871case "$fastread$alldone" in
1872yescont|yesexit) ;;
1873*)
1874 case "$extractsh" in
1875 true) ;;
1876 *)
1877 if test ! -t 0; then
1878 echo "Say 'sh Configure', not 'sh <Configure'"
1879 exit 1
1880 fi
1881 ;;
1882 esac
1883 ;;
1884esac
1885
1886exec 4>&1
1887case "$silent" in
1888true) exec 1>/dev/null;;
1889esac
1890
1891: run the defines and the undefines, if any, but leave the file out there...
1892touch optdef.sh
1893grep '\\' optdef.sh >/dev/null 2>&1
1894if test $? = 0; then
1895 echo "Configure does not support \\ in -D arguments"
1896 exit 1
1897fi
1898. ./optdef.sh
1899: create the posthint manipulation script and leave the file out there...
1900touch posthint.sh
1901
1902: set package name
1903package='perl5'
1904first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1905last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1906case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1907ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1908*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1909esac
1910
1911: Some greps do not return status, grrr.
1912echo "grimblepritz" >grimble
1913if grep blurfldyick grimble >/dev/null 2>&1 ; then
1914 contains=contains
1915elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1916 contains=grep
1917else
1918 contains=contains
1919fi
1920rm -f grimble
1921: the following should work in any shell
1922case "$contains" in
1923contains*)
1924 echo " "
1925 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1926 cat >contains <<'EOSS'
1927grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1928EOSS
1929chmod +x contains
1930esac
1931
1932: Find the path to the source tree
1933case "$src" in
1934'') case "$0" in
1935 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1936 case "$src" in
1937 /*) ;;
1938 .) ;;
1939 *) src=`cd ../$src && pwd` ;;
1940 esac
1941 ;;
1942 *) src='.';;
1943 esac;;
1944esac
1945case "$src" in
1946'') src=/
1947 rsrc=/
1948 ;;
1949/*) rsrc="$src";;
1950*) rsrc="../$src";;
1951esac
1952if test -f $rsrc/Configure && \
1953 $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1954then
1955 : found it, so we are ok.
1956else
1957 rsrc=''
1958 for src in . .. ../.. ../../.. ../../../..; do
1959 if test -f ../$src/Configure && \
1960 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1961 then
1962 rsrc=../$src
1963 break
1964 fi
1965 done
1966fi
1967case "$rsrc" in
1968'')
1969 cat <<EOM >&4
1970
1971Sorry, I can't seem to locate the source dir for $package. Please start
1972Configure with an explicit path -- i.e. /some/path/Configure.
1973
1974EOM
1975 exit 1
1976 ;;
1977../.) rsrc='..';;
1978*)
1979 echo " "
1980 echo "Sources for $package found in \"$src\"." >&4
1981 ;;
1982esac
1983
1984: script used to extract .SH files with variable substitutions
1985cat >extract <<'EOS'
1986PERL_CONFIG_SH=true
1987echo "Doing variable substitutions on .SH files..."
1988if test -f MANIFEST; then
1989 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1990else
1991 echo "(Looking for .SH files under the source directory.)"
1992 set x `(cd "$src"; find . -name "*.SH" -print)`
1993fi
1994shift
1995case $# in
19960) set x `(cd "$src"; echo *.SH)`; shift;;
1997esac
1998if test ! -f "$src/$1"; then
1999 shift
2000fi
2001mkdir_p='
2002name=$1;
2003create="";
2004while test $name; do
2005 if test ! -d "$name"; then
2006 create="$name $create";
2007 name=`echo $name | sed -e "s|^[^/]*$||"`;
2008 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2009 else
2010 name="";
2011 fi;
2012done;
2013for file in $create; do
2014 mkdir $file;
2015done
2016'
2017for file in $*; do
2018 case "$src" in
2019 ".")
2020 case "$file" in
2021 */*)
2022 dir=`expr X$file : 'X\(.*\)/'`
2023 file=`expr X$file : 'X.*/\(.*\)'`
2024 (cd "$dir" && . ./$file)
2025 ;;
2026 *)
2027 . ./$file
2028 ;;
2029 esac
2030 ;;
2031 *)
2032 case "$file" in
2033 */*)
2034 dir=`expr X$file : 'X\(.*\)/'`
2035 file=`expr X$file : 'X.*/\(.*\)'`
2036 (set x $dir; shift; eval $mkdir_p)
2037 sh <"$src/$dir/$file"
2038 ;;
2039 *)
2040 sh <"$src/$file"
2041 ;;
2042 esac
2043 ;;
2044 esac
2045done
2046if test -f "$src/config_h.SH"; then
2047 if test ! -f config.h; then
2048 : oops, they left it out of MANIFEST, probably, so do it anyway.
2049 . "$src/config_h.SH"
2050 fi
2051fi
2052EOS
2053
2054: extract files and exit if asked to do so
2055case "$extractsh" in
2056true)
2057 case "$realsilent" in
2058 true) ;;
2059 *) exec 1>&4;;
2060 esac
2061 case "$config_sh" in
2062 '') config_sh='config.sh';;
2063 esac
2064 echo " "
2065 echo "Fetching answers from $config_sh..."
2066 cd ..
2067 . $config_sh
2068 . UU/optdef.sh
2069 echo " "
2070 . UU/extract
2071 rm -rf UU
2072 echo "Extraction done."
2073 exit 0
2074 ;;
2075esac
2076
2077: Eunice requires " " instead of "", can you believe it
2078echo " "
2079: Here we go...
2080echo "Beginning of configuration questions for $package."
2081
2082trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2083
2084: first determine how to suppress newline on echo command
2085echo " "
2086echo "Checking echo to see how to suppress newlines..."
2087(echo "hi there\c" ; echo " ") >.echotmp
2088if $contains c .echotmp >/dev/null 2>&1 ; then
2089 echo "...using -n."
2090 n='-n'
2091 c=''
2092else
2093 cat <<'EOM'
2094...using \c
2095EOM
2096 n=''
2097 c='\c'
2098fi
2099echo $n "The star should be here-->$c"
2100echo '*'
2101rm -f .echotmp
2102
2103: Now test for existence of everything in MANIFEST
2104echo " "
2105if test -f "$rsrc/MANIFEST"; then
2106 echo "First let's make sure your kit is complete. Checking..." >&4
2107 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2108 (split -l 50 2>/dev/null || split -50)
2109 rm -f missing
2110 tmppwd=`pwd`
2111 for filelist in x??; do
2112 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2113 >/dev/null 2>>"$tmppwd/missing")
2114 done
2115 if test -s missing; then
2116 cat missing >&4
2117 cat >&4 <<'EOM'
2118
2119THIS PACKAGE SEEMS TO BE INCOMPLETE.
2120
2121You have the option of continuing the configuration process, despite the
2122distinct possibility that your kit is damaged, by typing 'y'es. If you
2123do, don't blame me if something goes wrong. I advise you to type 'n'o
2124and contact the author (https://github.com/Perl/perl5/issues).
2125
2126EOM
2127 echo $n "Continue? [n] $c" >&4
2128 read ans
2129 case "$ans" in
2130 y*)
2131 echo "Continuing..." >&4
2132 rm -f missing
2133 ;;
2134 *)
2135 echo "ABORTING..." >&4
2136 kill $$
2137 ;;
2138 esac
2139 else
2140 echo "Looks good..."
2141 fi
2142else
2143 echo "There is no MANIFEST file. I hope your kit is complete !"
2144fi
2145rm -f missing x??
2146
2147: Find the appropriate value for a newline for tr
2148if test -n "$DJGPP"; then
2149 trnl='\012'
2150fi
2151if test X"$trnl" = X; then
2152 case "`echo foo | tr '\n' x 2>/dev/null`" in
2153 foox) trnl='\n' ;;
2154 esac
2155fi
2156if test X"$trnl" = X; then
2157 case "`echo foo | tr '\012' x 2>/dev/null`" in
2158 foox) trnl='\012' ;;
2159 esac
2160fi
2161if test X"$trnl" = X; then
2162 case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2163 fooxy) trnl='\n\r' ;;
2164 esac
2165fi
2166if test X"$trnl" = X; then
2167 cat <<EOM >&2
2168
2169$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2170
2171EOM
2172 exit 1
2173fi
2174
2175: compute the number of columns on the terminal for proper question formatting
2176case "$COLUMNS" in
2177'') COLUMNS='80';;
2178esac
2179
2180: set up the echo used in my read
2181myecho="case \"\$xxxm\" in
2182'') echo $n \"\$rp $c\" >&4;;
2183*) case \"\$rp\" in
2184 '') echo $n \"[\$xxxm] $c\";;
2185 *)
2186 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2187 echo \"\$rp\" >&4
2188 echo $n \"[\$xxxm] $c\" >&4
2189 else
2190 echo $n \"\$rp [\$xxxm] $c\" >&4
2191 fi
2192 ;;
2193 esac;;
2194esac"
2195
2196: now set up to do reads with possible shell escape and default assignment
2197cat <<EOSC >myread
2198$startsh
2199xxxm=\$dflt
2200$myecho
2201ans='!'
2202case "\$fastread" in
2203yes) case "\$dflt" in
2204 '') ;;
2205 *) ans='';
2206 case "\$silent-\$rp" in
2207 true-) ;;
2208 *) echo " " >&4;;
2209 esac;;
2210 esac;;
2211*) case "\$silent" in
2212 true) case "\$rp" in
2213 '') ans='';;
2214 esac;;
2215 esac;;
2216esac
2217while expr "X\$ans" : "X!" >/dev/null; do
2218 read answ
2219 set x \$xxxm
2220 shift
2221 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2222 case "\$answ" in
2223 "!")
2224 sh 1>&4
2225 echo " "
2226 $myecho
2227 ;;
2228 !*)
2229 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2230 shift
2231 sh 1>&4 -c "\$*"
2232 echo " "
2233 $myecho
2234 ;;
2235 "\$ans")
2236 case "\$ans" in
2237 \\&*)
2238 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2239 shift
2240 case "\$1" in
2241 -d)
2242 fastread=yes
2243 echo "(OK, I'll run with -d after this question.)" >&4
2244 ;;
2245 -*)
2246 echo "*** Sorry, \$1 not supported yet." >&4
2247 ;;
2248 esac
2249 $myecho
2250 ans=!
2251 ;;
2252 esac;;
2253 *)
2254 case "\$aok" in
2255 y)
2256 echo "*** Substitution done -- please confirm."
2257 xxxm="\$ans"
2258 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2259 xxxm="\$ans"
2260 ans=!
2261 ;;
2262 *)
2263 echo "*** Error -- try again."
2264 ans=!
2265 ;;
2266 esac
2267 $myecho
2268 ;;
2269 esac
2270 case "\$ans\$xxxm\$nostick" in
2271 '')
2272 ans=!
2273 $myecho
2274 ;;
2275 esac
2276done
2277case "\$ans" in
2278'') ans="\$xxxm";;
2279esac
2280EOSC
2281
2282: create .config dir to save info across Configure sessions
2283test -d ../.config || mkdir ../.config
2284cat >../.config/README <<EOF
2285This directory created by Configure to save information that should
2286persist across sessions for $package.
2287
2288You may safely delete it if you wish.
2289EOF
2290
2291: See if we are using a devel version and want that
2292xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2293case "$usedevel" in
2294$define|true|[yY]*)
2295 usedevel="$define" ;;
2296*) case "$xversion" in
2297 *[13579])
2298 cat >&4 <<EOH
2299*** WHOA THERE!!! ***
2300
2301 This is an UNSTABLE DEVELOPMENT release.
2302 The version of this $package distribution is $xversion, that is, odd,
2303 (as opposed to even) and that signifies a development release.
2304 If you want a maintenance release, you want an even-numbered version.
2305
2306 Do ***NOT*** install this into production use.
2307 Data corruption and crashes are possible.
2308
2309 It is most seriously suggested that you do not continue any further
2310 unless you want to help in developing and debugging Perl.
2311
2312 If you *still* want to build perl, you can answer 'y' now,
2313 or pass -Dusedevel to Configure.
2314
2315EOH
2316 rp='Do you really want to continue?'
2317 dflt='n'
2318 . ./myread
2319 case "$ans" in
2320 [yY]) echo >&4 "Okay, continuing."
2321 usedevel="$define" ;;
2322 *) echo >&4 "Okay, bye."
2323 exit 1
2324 ;;
2325 esac
2326 ;;
2327 esac
2328 usedevel="$undef"
2329 ;;
2330esac
2331case "$usedevel" in
2332$define|true|[yY]*)
2333 case "$versiononly" in
2334 '') versiononly="$define" ;;
2335 esac
2336 case "$installusrbinperl" in
2337 '') installusrbinperl="$undef" ;;
2338 esac
2339 ;;
2340esac
2341
2342: general instructions
2343needman=true
2344firsttime=true
2345user=`(logname) 2>/dev/null`
2346case "$user" in
2347'') user=`whoami 2>&1`;;
2348esac
2349if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2350 firsttime=false
2351 echo " "
2352 rp='Would you like to see the instructions?'
2353 dflt=n
2354 . ./myread
2355 case "$ans" in
2356 [yY]*) ;;
2357 *) needman=false;;
2358 esac
2359fi
2360if $needman; then
2361 cat <<EOH
2362
2363This installation shell script will examine your system and ask you questions
2364to determine how the perl5 package should be installed. If you get
2365stuck on a question, you may use a ! shell escape to start a subshell or
2366execute a command. Many of the questions will have default answers in square
2367brackets; typing carriage return will give you the default.
2368
2369On some of the questions which ask for file or directory names you are allowed
2370to use the ~name construct to specify the login directory belonging to "name",
2371even if you don't have a shell which knows about that. Questions where this is
2372allowed will be marked "(~name ok)".
2373
2374EOH
2375 rp=''
2376 dflt='Type carriage return to continue'
2377 . ./myread
2378 cat <<'EOH'
2379
2380The prompter used in this script allows you to use shell variables and
2381backticks in your answers. You may use $1, $2, etc... to refer to the words
2382in the default answer, as if the default line was a set of arguments given to a
2383script shell. This means you may also use $* to repeat the whole default line,
2384so you do not have to re-type everything to add something to the default.
2385
2386Every time there is a substitution, you will have to confirm. If there is an
2387error (e.g. an unmatched backtick), the default answer will remain unchanged
2388and you will be prompted again.
2389
2390If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2391the questions and use the computed defaults (or the previous answers if there
2392was already a config.sh file). Type 'Configure -h' for a list of options.
2393You may also start interactively and then answer '& -d' at any prompt to turn
2394on the non-interactive behaviour for the remainder of the execution.
2395
2396EOH
2397 . ./myread
2398 cat <<EOH
2399
2400Much effort has been expended to ensure that this shell script will run on any
2401Unix system. If despite that it blows up on yours, your best bet is to edit
2402Configure and run it again. If you can't run Configure for some reason,
2403you'll have to generate a config.sh file by hand. Whatever problems you
2404have, let me (https://github.com/Perl/perl5/issues) know how I blew it.
2405
2406This installation script affects things in two ways:
2407
24081) it may do direct variable substitutions on some of the files included
2409 in this kit.
24102) it builds a config.h file for inclusion in C programs. You may edit
2411 any of these files as the need arises after running this script.
2412
2413If you make a mistake on a question, there is no easy way to back up to it
2414currently. The easiest thing to do is to edit config.sh and rerun all the SH
2415files. Configure will offer to let you do this before it runs the SH files.
2416
2417EOH
2418 dflt='Type carriage return to continue'
2419 . ./myread
2420 case "$firsttime" in
2421 true) echo $user >>../.config/instruct;;
2422 esac
2423fi
2424
2425: Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2426: This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2427if test "X$sysroot" = X; then
2428 sysroot=""
2429else
2430 case "$cc" in
2431 *gcc*|*g++*)
2432 echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2433 # _sysroot is used in places where we need --sysroot=foo
2434 # but using the rest of the flags could cause issues.
2435 _sysroot="--sysroot=$sysroot";
2436 case "$ccflags" in
2437 *sysroot*) ;;
2438 'undef'|*)
2439 ccflags="$ccflags $_sysroot"
2440 esac
2441 case "$ldflags" in
2442 *sysroot*) ;;
2443 'undef'|*)
2444 ldflags="$ldflags $_sysroot"
2445 esac
2446 case "$cppflags" in
2447 *sysroot*) ;;
2448 'undef'|*)
2449 cppflags="$cppflags $_sysroot"
2450 esac
2451 # lddlflags updated below in lddlflags section;
2452 # same with cccdlflags
2453 ;;
2454 esac
2455
2456 # Adjust some defaults to also use $sysroot
2457 for var in xlibpth loclibpth locincpth glibpth; do
2458 eval xxx=\$$var
2459 eval $var=''
2460 for path in $xxx; do
2461 eval $var=\"\$$var $sysroot$path\"
2462 done
2463 done
2464
2465fi
2466
2467: find out where common programs are
2468echo " "
2469echo "Locating common programs..." >&4
2470cat <<EOSC >loc
2471$startsh
2472case \$# in
24730) exit 1;;
2474esac
2475thing=\$1
2476shift
2477dflt=\$1
2478shift
2479for dir in \$*; do
2480 case "\$thing" in
2481 .)
2482 if test -d \$dir/\$thing; then
2483 echo \$dir
2484 exit 0
2485 fi
2486 ;;
2487 *)
2488 for thisthing in \$dir/\$thing; do
2489 : just loop through to pick last item
2490 done
2491 if test -f \$thisthing; then
2492 echo \$thisthing
2493 exit 0
2494 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2495 echo \$thisthing
2496 exit 0
2497 elif test -f \$dir/\$thing.exe; then
2498 if test -n "$DJGPP"; then
2499 echo \$dir/\$thing.exe
2500 elif test "$eunicefix" != ":"; then
2501 : on Eunice apparently
2502 echo \$dir/\$thing
2503 fi
2504 exit 0
2505 fi
2506 ;;
2507 esac
2508done
2509echo \$dflt
2510exit 1
2511EOSC
2512chmod +x loc
2513$eunicefix loc
2514loclist="
2515awk
2516cat
2517chmod
2518comm
2519cp
2520echo
2521expr
2522grep
2523ls
2524mkdir
2525rm
2526sed
2527sort
2528touch
2529tr
2530uniq
2531"
2532trylist="
2533ar
2534bison
2535byacc
2536cpp
2537csh
2538date
2539egrep
2540gmake
2541gzip
2542less
2543ln
2544make
2545more
2546nm
2547nroff
2548perl
2549pg
2550test
2551uname
2552zip
2553"
2554pth=`echo $PATH | sed -e "s/$p_/ /g"`
2555pth="$pth $sysroot/lib $sysroot/usr/lib"
2556for file in $loclist; do
2557 eval xxx=\$$file
2558 case "$xxx" in
2559 /*|?:[\\/]*)
2560 if test -f "$xxx"; then
2561 : ok
2562 else
2563 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2564 xxx=`./loc $file $file $pth`
2565 fi
2566 ;;
2567 '') xxx=`./loc $file $file $pth`;;
2568 *) xxx=`./loc $xxx $xxx $pth`;;
2569 esac
2570 eval $file=$xxx$_exe
2571 eval _$file=$xxx
2572 case "$xxx" in
2573 /*)
2574 echo $file is in $xxx.
2575 ;;
2576 ?:[\\/]*)
2577 echo $file is in $xxx.
2578 ;;
2579 *)
2580 echo "I don't know where '$file' is, and my life depends on it." >&4
2581 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2582 exit 1
2583 ;;
2584 esac
2585done
2586echo " "
2587echo "Don't worry if any of the following aren't found..."
2588say=offhand
2589for file in $trylist; do
2590 eval xxx=\$$file
2591 case "$xxx" in
2592 /*|?:[\\/]*)
2593 if test -f "$xxx"; then
2594 : ok
2595 else
2596 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2597 xxx=`./loc $file $file $pth`
2598 fi
2599 ;;
2600 '') xxx=`./loc $file $file $pth`;;
2601 *) xxx=`./loc $xxx $xxx $pth`;;
2602 esac
2603 eval $file=$xxx$_exe
2604 eval _$file=$xxx
2605 case "$xxx" in
2606 /*)
2607 echo $file is in $xxx.
2608 ;;
2609 ?:[\\/]*)
2610 echo $file is in $xxx.
2611 ;;
2612 *)
2613 echo "I don't see $file out there, $say."
2614 say=either
2615 ;;
2616 esac
2617done
2618case "$egrep" in
2619egrep)
2620 echo "Substituting grep for egrep."
2621 egrep=$grep
2622 _egrep=$grep
2623 ;;
2624esac
2625case "$less" in
2626'') ;;
2627*) if $less -R </dev/null >/dev/null 2>&1; then
2628 echo "Substituting less -R for less."
2629 less="$less -R"
2630 _less=$less
2631 fi
2632 ;;
2633esac
2634case "$ln" in
2635ln)
2636 echo "Substituting cp for ln."
2637 ln=$cp
2638 _ln=$cp
2639 ;;
2640esac
2641case "$make" in
2642make)
2643 case "$gmake" in
2644 gmake)
2645 echo "I can't find make or gmake, and my life depends on it." >&4
2646 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2647 exit 1
2648 ;;
2649 esac
2650 ;;
2651esac
2652case "$gmake" in
2653gmake) ;;
2654*) # We can't have osname yet.
2655 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2656 # Assume that gmake, if found, is definitely GNU make
2657 # and prefer it over the system make.
2658 echo "Substituting gmake for make."
2659 make=$gmake
2660 _make=$gmake
2661 fi
2662 ;;
2663esac
2664case "$test" in
2665test)
2666 echo "Hopefully test is built into your sh."
2667 ;;
2668*)
2669 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2670 echo "Using the test built into your sh."
2671 test=test
2672 _test=test
2673 fi
2674 ;;
2675esac
2676case "$echo" in
2677echo)
2678 echo "Hopefully echo is built into your sh."
2679 ;;
2680'') ;;
2681*)
2682 echo " "
2683echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2684 $echo $n "hi there$c" >foo1
2685 echo $n "hi there$c" >foo2
2686 if cmp foo1 foo2 >/dev/null 2>&1; then
2687 echo "They are compatible. In fact, they may be identical."
2688 else
2689 case "$n" in
2690 '-n') n='' c='\c';;
2691 *) n='-n' c='';;
2692 esac
2693 cat <<FOO
2694They are not compatible! You are probably running ksh on a non-USG system.
2695I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2696have echo built in and we may have to run some Bourne shell scripts. That
2697means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2698
2699FOO
2700 $echo $n "The star should be here-->$c"
2701 $echo "*"
2702 fi
2703 $rm -f foo1 foo2
2704 ;;
2705esac
2706
2707# This question was auctioned at YAPC::Europe-2007 in Vienna
2708# I never promised you could answer it. I only auctioned the question.
2709cat <<FOO
2710The following message is sponsored by
2711
2712 Dresden.pm<--The stars should be here.
2713
2714Dear Perl user, system administrator or package
2715maintainer, the Perl community sends greetings to
2716you. Do you (emblematical) greet back [Y/n]? n
2717
2718FOO
2719
2720: Check what type of C compiler we use
2721cat <<EOS >trygcc
2722$startsh
2723EOS
2724cat <<'EOSC' >>trygcc
2725case "$cc" in
2726'') ;;
2727*) $rm -f try try.*
2728 $cat >try.c <<EOM
2729int main(int argc, char *argv[]) {
2730 return 0;
2731}
2732EOM
2733 if $cc -o try $ccflags $ldflags try.c; then
2734 :
2735 else
2736 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2737 despair=yes
2738 trygcc=yes
2739 case "$cc" in
2740 *gcc*) trygcc=no ;;
2741 esac
2742 # Skip this test because it gives a false match on output like:
2743 # ./trygcc: line 23: cc: command not found
2744 # case "`$cc -v -c try.c 2>&1`" in
2745 # *gcc*) trygcc=no ;;
2746 # esac
2747 if $test X"$trygcc" = Xyes; then
2748 if gcc -o try -c try.c; then
2749 echo " "
2750 echo "You seem to have a working gcc, though." >&4
2751 # Switching compilers may undo the work of hints files.
2752 # The most common problem is -D_REENTRANT for threads.
2753 # This heuristic catches that case, but gets false positives
2754 # if -Dusethreads was not actually specified. Better to
2755 # bail out here with a useful message than fail
2756 # mysteriously later. Should we perhaps just try to
2757 # re-invoke Configure -Dcc=gcc config_args ?
2758 if $test -f usethreads.cbu; then
2759 $cat >&4 <<EOM
2760
2761*** However, any setting of the C compiler flags (e.g. for thread support)
2762*** will be lost. It may be necessary for you to restart Configure and
2763*** add -Dcc=gcc to your Configure command line.
2764
2765EOM
2766 rp="Would you like to go ahead and try gcc anyway?"
2767 dflt=n
2768 else
2769 rp="Would you like to use it?"
2770 dflt=y
2771 fi
2772 if $test -f myread; then
2773 . ./myread
2774 else
2775 if $test -f UU/myread; then
2776 . ./UU/myread
2777 else
2778 echo "Cannot find myread, sorry. Aborting." >&2
2779 exit 1
2780 fi
2781 fi
2782 case "$ans" in
2783 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2784 esac
2785 fi
2786 fi
2787 fi
2788 $rm -f try try.*
2789 ;;
2790esac
2791EOSC
2792
2793cat <<EOS >checkcc
2794$startsh
2795EOS
2796cat <<'EOSC' >>checkcc
2797case "$cc" in
2798'') ;;
2799*) $rm -f try try.*
2800 $cat >try.c <<EOM
2801int main(int argc, char *argv[]) {
2802 return 0;
2803}
2804EOM
2805 if $cc -o try $ccflags $ldflags try.c; then
2806 :
2807 else
2808 if $test X"$despair" = Xyes; then
2809 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2810 fi
2811 $cat >&4 <<EOM
2812You need to find a working C compiler.
2813Either (purchase and) install the C compiler supplied by your OS vendor,
2814or for a free C compiler try http://gcc.gnu.org/
2815I cannot continue any further, aborting.
2816EOM
2817 exit 1
2818 fi
2819 $rm -f try try.*
2820 ;;
2821esac
2822EOSC
2823
2824: determine whether symbolic links are supported
2825echo " "
2826$touch blurfl
2827if $ln -s blurfl sym > /dev/null 2>&1 ; then
2828 echo "Symbolic links are supported." >&4
2829 lns="$ln -s"
2830else
2831 echo "Symbolic links are NOT supported." >&4
2832 lns="$ln"
2833fi
2834$rm -f blurfl sym
2835
2836: determine whether symbolic links are supported
2837echo " "
2838case "$lns" in
2839*"ln"*" -s")
2840 echo "Checking how to test for symbolic links..." >&4
2841 $lns blurfl sym
2842 if $test "X$issymlink" = X; then
2843 case "$newsh" in
2844 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2845 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2846 esac
2847 if test $? = 0; then
2848 issymlink="test -h"
2849 else
2850 echo "Your builtin 'test -h' may be broken." >&4
2851 case "$test" in
2852 /*) ;;
2853 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2854 for p in $pth
2855 do
2856 if test -f "$p/$test"; then
2857 test="$p/$test"
2858 break
2859 fi
2860 done
2861 ;;
2862 esac
2863 case "$test" in
2864 /*)
2865 echo "Trying external '$test -h'." >&4
2866 issymlink="$test -h"
2867 if $test ! -h sym >/dev/null 2>&1; then
2868 echo "External '$test -h' is broken, too." >&4
2869 issymlink=''
2870 fi
2871 ;;
2872 *) issymlink='' ;;
2873 esac
2874 fi
2875 fi
2876 if $test "X$issymlink" = X; then
2877 if $test -L sym 2>/dev/null; then
2878 issymlink="$test -L"
2879 echo "The builtin '$test -L' worked." >&4
2880 fi
2881 fi
2882 if $test "X$issymlink" != X; then
2883 echo "You can test for symbolic links with '$issymlink'." >&4
2884 else
2885 echo "I do not know how you can test for symbolic links." >&4
2886 fi
2887 $rm -f blurfl sym
2888 ;;
2889*) echo "No symbolic links, so not testing for their testing..." >&4
2890 ;;
2891esac
2892
2893: Make symlinks util
2894case "$mksymlinks" in
2895$define|true|[yY]*)
2896 case "$src" in
2897 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2898 exit 1
2899 ;;
2900 *) case "$lns:$issymlink" in
2901 *"ln"*" -s:"*"test -"?)
2902 echo "Creating the symbolic links..." >&4
2903 cd ..
2904 awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2905 awk 'NF == 1 {
2906 dir=".";
2907 file=$1 "";
2908 }
2909 NF == 2 {
2910 dir=$1 "";
2911 file=$2 "";
2912 }
2913 {
2914 print "# dir = ", dir, "file = ", file
2915 mf[dir] = mf[dir]" "source"/"dir"/"file;
2916 } END {
2917 for (d in mf) {
2918 if (d != ".") { print("mkdir -p "d) }
2919 print("ln -sf "mf[d]" "d);
2920 }
2921 }' source="$src" > UU/mksymlinks.$$
2922 sh UU/mksymlinks.$$
2923 rm UU/mksymlinks.$$
2924 # Sanity check 1.
2925 if test ! -d t/base; then
2926 echo "Failed to create the subdirectories. Aborting." >&4
2927 exit 1
2928 fi
2929 # Sanity check 2.
2930 if test ! -f t/base/lex.t; then
2931 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
2932 exit 1
2933 fi
2934 if test ! -f win32/win32.c; then
2935 echo "Failed to create the symlinks (win32/win32.c missing). Aborting." >&4
2936 exit 1
2937 fi
2938 cd UU
2939 ;;
2940 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2941 ;;
2942 esac
2943 ;;
2944 esac
2945 ;;
2946esac
2947
2948: Check for Cross-Compilation
2949if $test "X$targethost" = "X"; then
2950 targethost=""
2951fi
2952if $test "X$targetenv" = "X"; then
2953 targetenv=""
2954fi
2955case "$usecrosscompile" in
2956$define|true|[yY]*)
2957 $echo "Cross-compiling..."
2958 croak=''
2959 case "$cc" in
2960 *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2961 # arm-linux-androideabi-gcc -> arm-linux-androideabi
2962 # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2963 targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2964 ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2965 # leave out ld, choosing it is more complex
2966 nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2967 ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2968 # We are in a weird spot. Just before us, some values
2969 # were 'saved', to be restored after the hints are
2970 # run. This means that the changes we made to ar,
2971 # nm and ranlib will get reverted.
2972 # To avoid that, we hijack the saving mechanism and
2973 # have it save our new values.
2974 for file in ar nm ranlib; do
2975 eval xxx=\$$file
2976 eval $file=$xxx$_exe
2977 eval _$file=$xxx
2978 done
2979 ;;
2980 esac
2981 case "$targetarch" in
2982 '') echo "Targetarch not defined." >&4; croak=y ;;
2983 *) echo "Using targetarch $targetarch." >&4 ;;
2984 esac
2985 case "$targethost" in
2986 '') echo "Targethost not defined." >&4; croak=n ;;
2987 *) echo "Using targethost $targethost." >&4
2988 esac
2989 locincpth=' '
2990 loclibpth=' '
2991 case "$croak" in
2992 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2993 esac
2994 : compile a host miniperl and generate_uudmap, unless we got passed them
2995 if $test "X$hostperl" = X; then
2996 echo "Building host miniperl and generate_uudmap binaries" >&4
2997 before_host=`pwd`
2998 cd ..
2999 cd $src
3000 src=`pwd`
3001 rm -rf $src/host
3002 mkdir $src/host
3003 cd $src/host
3004 $src/Configure -des -Dusedevel -Dmksymlinks
3005 $make miniperl
3006 case "$hostgenerate" in
3007 '') $make generate_uudmap
3008 hostgenerate=$src/host/generate_uudmap
3009 ;;
3010 "$undef") hostgenerate=''
3011 ;;
3012 esac
3013 hostperl=$src/host/miniperl
3014 cd $before_host
3015 fi
3016 hostosname=`$hostperl -le 'print $^O'`
3017 ;;
3018*)
3019 usecrosscompile="$undef"
3020 ;;
3021esac
3022
3023: Define -Dtargethost=somecomputer to run compiled tests on another machine
3024case "$targethost" in
3025 '') echo "Checking for cross-compile" >&4
3026 case "$usecrosscompile$multiarch" in
3027 *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3028 if [ -f Makefile ]; then
3029 echo " "
3030 echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3031 else
3032 echo "Configure done."
3033 fi
3034 exit 0
3035 ;;
3036 *) echo "No targethost for running compiler tests against defined, running locally" >&4
3037 run=''
3038 to=:
3039 from=:
3040 ;;
3041 esac
3042 ;;
3043 *) echo "Using targethost $targethost." >&4
3044 case "$src" in
3045 /*) run=$src/Cross/run
3046 targetmkdir=$src/Cross/mkdir
3047 to=$src/Cross/to
3048 from=$src/Cross/from
3049 ;;
3050 *) pwd=`$test -f ../Configure & cd ..; pwd`
3051 run=$pwd/Cross/run
3052 targetmkdir=$pwd/Cross/mkdir
3053 to=$pwd/Cross/to
3054 from=$pwd/Cross/from
3055 ;;
3056 esac
3057 case "$targetrun" in
3058 '') targetrun=ssh ;;
3059 esac
3060 case "$targetto" in
3061 '') targetto=scp ;;
3062 esac
3063 case "$targetfrom" in
3064 '') targetfrom=scp ;;
3065 esac
3066 run=$run-$targetrun
3067 to=$to-$targetto
3068 from=$from-$targetfrom
3069 case "$targetdir" in
3070 '') targetdir=/tmp
3071 echo "Guessing targetdir $targetdir." >&4
3072 ;;
3073 esac
3074 case "$targetuser" in
3075 '') targetuser=root
3076 echo "Guessing targetuser $targetuser." >&4
3077 ;;
3078 esac
3079 case "$targetport" in
3080 '') targetport=22
3081 echo "Guessing targetport $targetport." >&4
3082 ;;
3083 esac
3084 case "$targetfrom" in
3085 scp) q=-q ;;
3086 *) q='' ;;
3087 esac
3088 case "$targetrun" in
3089 ssh|rsh)
3090 cat >$run <<EOF
3091#!/bin/sh
3092env=''
3093case "\$1" in
3094-cwd)
3095 shift
3096 cwd=\$1
3097 shift
3098 ;;
3099esac
3100case "\$1" in
3101-env)
3102 shift
3103 env=\$1
3104 shift
3105 ;;
3106esac
3107case "\$cwd" in
3108'') cwd=$targetdir ;;
3109esac
3110exe=\$1
3111shift
3112$to \$exe
3113$targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3114EOF
3115 ;;
3116 adb)
3117 $touch $run
3118 ;;
3119 *) echo "Unknown targetrun '$targetrun'" >&4
3120 exit 1
3121 ;;
3122 esac
3123 case "$targetmkdir" in
3124 */Cross/mkdir)
3125 cat >$targetmkdir <<EOF
3126#!/bin/sh
3127$targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3128EOF
3129 $chmod a+rx $targetmkdir
3130 ;;
3131 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
3132 exit 1
3133 ;;
3134 esac
3135 case "$targetto" in
3136 scp|rcp)
3137 cat >$to <<EOF
3138#!/bin/sh
3139for f in \$@
3140do
3141 case "\$f" in
3142 /*)
3143 $targetmkdir \`dirname \$f\`
3144 $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f 2>/dev/null || exit 1
3145 ;;
3146 *)
3147 $targetmkdir $targetdir/\`dirname \$f\`
3148 $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3149 ;;
3150 esac
3151done
3152exit 0
3153EOF
3154 ;;
3155 cp) cat >$to <<EOF
3156#!/bin/sh
3157for f in \$@
3158do
3159 case "\$f" in
3160 /*)
3161 $mkdir -p $targetdir/\`dirname \$f\`
3162 $cp \$f $targetdir/\$f || exit 1
3163 ;;
3164 *)
3165 $targetmkdir $targetdir/\`dirname \$f\`
3166 $cp \$f $targetdir/\$f || exit 1
3167 ;;
3168 esac
3169done
3170exit 0
3171EOF
3172 ;;
3173 *) echo "Unknown targetto '$targetto'" >&4
3174 exit 1
3175 ;;
3176 esac
3177 case "$targetfrom" in
3178 scp|rcp)
3179 cat >$from <<EOF
3180#!/bin/sh
3181for f in \$@
3182do
3183 $rm -f \$f
3184 $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3185done
3186exit 0
3187EOF
3188 ;;
3189 cp) cat >$from <<EOF
3190#!/bin/sh
3191for f in \$@
3192do
3193 $rm -f \$f
3194 cp $targetdir/\$f . || exit 1
3195done
3196exit 0
3197EOF
3198 ;;
3199 *) echo "Unknown targetfrom '$targetfrom'" >&4
3200 exit 1
3201 ;;
3202 esac
3203 if $test ! -f $run; then
3204 echo "Target 'run' script '$run' not found." >&4
3205 else
3206 $chmod a+rx $run
3207 fi
3208 if $test ! -f $to; then
3209 echo "Target 'to' script '$to' not found." >&4
3210 else
3211 $chmod a+rx $to
3212 fi
3213 if $test ! -f $from; then
3214 echo "Target 'from' script '$from' not found." >&4
3215 else
3216 $chmod a+rx $from
3217 fi
3218 if $test ! -f $run -o ! -f $to -o ! -f $from; then
3219 exit 1
3220 fi
3221 cat >&4 <<EOF
3222Using '$run' for remote execution,
3223and '$from' and '$to'
3224for remote file transfer.
3225EOF
3226 ;;
3227*) run=''
3228 to=:
3229 from=:
3230 usecrosscompile="$undef"
3231 targetarch=''
3232 ;;
3233esac
3234
3235: see whether [:lower:] and [:upper:] are supported character classes
3236echo " "
3237case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3238ABYZ-abyz)
3239 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3240 up='[:upper:]'
3241 low='[:lower:]'
3242 ;;
3243*) # There is a discontinuity in EBCDIC between 'R' and 'S'
3244 # (0xd9 and 0xe2), therefore that is a nice testing point.
3245 if test "X$up" = X -o "X$low" = X; then
3246 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3247 rs) up='[A-Z]'
3248 low='[a-z]'
3249 ;;
3250 esac
3251 fi
3252 if test "X$up" = X -o "X$low" = X; then
3253 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3254 rs) up='A-Z'
3255 low='a-z'
3256 ;;
3257 esac
3258 fi
3259 if test "X$up" = X -o "X$low" = X; then
3260 case "`echo RS | od -x 2>/dev/null`" in
3261 *D9E2*|*d9e2*)
3262 echo "Hey, this might be EBCDIC." >&4
3263 if test "X$up" = X -o "X$low" = X; then
3264 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3265 rs) up='[A-IJ-RS-Z]'
3266 low='[a-ij-rs-z]'
3267 ;;
3268 esac
3269 fi
3270 if test "X$up" = X -o "X$low" = X; then
3271 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3272 rs) up='A-IJ-RS-Z'
3273 low='a-ij-rs-z'
3274 ;;
3275 esac
3276 fi
3277 ;;
3278 esac
3279 fi
3280esac
3281case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3282rs)
3283 echo "Using $up and $low to convert case." >&4
3284 ;;
3285*)
3286 echo "I don't know how to translate letters from upper to lower case." >&4
3287 echo "Your tr is not acting any way I know of." >&4
3288 exit 1
3289 ;;
3290esac
3291: set up the translation script tr, must be called with ./tr of course
3292cat >tr <<EOSC
3293$startsh
3294case "\$1\$2" in
3295'[A-Z][a-z]') exec $tr '$up' '$low';;
3296'[a-z][A-Z]') exec $tr '$low' '$up';;
3297esac
3298exec $tr "\$@"
3299EOSC
3300chmod +x tr
3301$eunicefix tr
3302
3303: Try to determine whether config.sh was made on this system
3304case "$config_sh" in
3305'')
3306myuname=`$uname -a 2>/dev/null`
3307$test -z "$myuname" && myuname=`hostname 2>/dev/null`
3308# Downcase everything to avoid ambiguity.
3309# Remove slashes and single quotes so we can use parts of this in
3310# directory and file names.
3311# Remove newlines so myuname is sane to use elsewhere.
3312# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3313# because the A-Z/a-z are not consecutive.
3314myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3315 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3316newmyuname="$myuname"
3317dflt=n
3318case "$knowitall" in
3319'')
3320 if test -f ../config.sh; then
3321 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3322 eval "`grep myuname= ../config.sh`"
3323 fi
3324 if test "X$myuname" = "X$newmyuname"; then
3325 dflt=y
3326 fi
3327 fi
3328 ;;
3329*) dflt=y;;
3330esac
3331
3332: Get old answers from old config file if Configure was run on the
3333: same system, otherwise use the hints.
3334hint=default
3335cd ..
3336if test -f config.sh; then
3337 echo " "
3338 rp="I see a config.sh file. Shall I use it to set the defaults?"
3339 . UU/myread
3340 case "$ans" in
3341 n*|N*) echo "OK, I'll ignore it."
3342 mv config.sh config.sh.old
3343 myuname="$newmyuname"
3344 ;;
3345 *) echo "Fetching default answers from your old config.sh file..." >&4
3346 tmp_n="$n"
3347 tmp_c="$c"
3348 tmp_sh="$sh"
3349 . ./config.sh
3350 cp config.sh UU
3351 n="$tmp_n"
3352 c="$tmp_c"
3353 : Older versions did not always set $sh. Catch re-use of such
3354 : an old config.sh.
3355 case "$sh" in
3356 '') sh="$tmp_sh" ;;
3357 esac
3358 hint=previous
3359 ;;
3360 esac
3361fi
3362. ./UU/checkcc
3363if test ! -f config.sh; then
3364 $cat <<EOM
3365
3366First time through, eh? I have some defaults handy for some systems
3367that need some extra help getting the Configure answers right:
3368
3369EOM
3370 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
3371 dflt=''
3372 : Half the following guesses are probably wrong... If you have better
3373 : tests or hints, please send them to https://github.com/Perl/perl5/issues
3374 : The metaconfig authors would also appreciate a copy...
3375 $test -f /irix && osname=irix
3376 $test -f /xenix && osname=sco_xenix
3377 $test -f /dynix && osname=dynix
3378 $test -f /dnix && osname=dnix
3379 $test -f /lynx.os && osname=lynxos
3380 $test -f /unicos && osname=unicos && osvers=`$uname -r`
3381 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3382 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3383 $test -f /bin/mips && /bin/mips && osname=mips
3384 $test -d /usr/apollo/bin && osname=apollo
3385 $test -f /etc/saf/_sactab && osname=svr4
3386 $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3387 $test -f /system/gnu_library/bin/ar.pm && osname=vos
3388 $test -f /sys/utilities/MultiView && osname=amigaos
3389 if $test -d /MachTen -o -d /MachTen_Folder; then
3390 osname=machten
3391 if $test -x /sbin/version; then
3392 osvers=`/sbin/version | $awk '{print $2}' |
3393 $sed -e 's/[A-Za-z]$//'`
3394 elif $test -x /usr/etc/version; then
3395 osvers=`/usr/etc/version | $awk '{print $2}' |
3396 $sed -e 's/[A-Za-z]$//'`
3397 else
3398 osvers="$2.$3"
3399 fi
3400 fi
3401
3402 $test -f /sys/posix.dll &&
3403 $test -f /usr/bin/what &&
3404 set X `/usr/bin/what /sys/posix.dll` &&
3405 $test "$3" = UWIN &&
3406 osname=uwin &&
3407 osvers="$5"
3408
3409 if $test -f $uname; then
3410 set X $myuname
3411 shift
3412
3413 case "$5" in
3414 fps*) osname=fps ;;
3415 mips*)
3416 case "$4" in
3417 umips) osname=umips ;;
3418 *) osname=mips ;;
3419 esac;;
3420 [23]100) osname=mips ;;
3421 i386*)
3422 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3423 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3424 osname='sco'
3425 osvers=$tmp
3426 elif $test -f /etc/kconfig; then
3427 osname=isc
3428 if test "$lns" = "$ln -s"; then
3429 osvers=4
3430 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3431 osvers=3
3432 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3433 osvers=2
3434 fi
3435 fi
3436 tmp=''
3437 ;;
3438 pc*)
3439 if test -n "$DJGPP"; then
3440 osname=dos
3441 osvers=djgpp
3442 fi
3443 ;;
3444 esac
3445
3446 case "$1" in
3447 aix) osname=aix
3448 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3449 case "$tmp" in
3450 # oslevel can fail with:
3451 # oslevel: Unable to acquire lock.
3452 *not\ found) osvers="$4"."$3" ;;
3453 '<3240'|'<>3240') osvers=3.2.0 ;;
3454 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3455 '=3250'|'>3250') osvers=3.2.5 ;;
3456 *) osvers=$tmp;;
3457 esac
3458 ;;
3459 bitrig) osname=bitrig
3460 osvers="$3"
3461 ;;
3462 bsd386) osname=bsd386
3463 osvers=`$uname -r`
3464 ;;
3465 cygwin*) osname=cygwin
3466 osvers="$3"
3467 ;;
3468 *dc.osx) osname=dcosx
3469 osvers="$3"
3470 ;;
3471 dnix) osname=dnix
3472 osvers="$3"
3473 ;;
3474 domainos) osname=apollo
3475 osvers="$3"
3476 ;;
3477 dgux) osname=dgux
3478 osvers="$3"
3479 ;;
3480 dragonfly) osname=dragonfly
3481 osvers="$3"
3482 ;;
3483 dynixptx*) osname=dynixptx
3484 osvers=`echo "$4"|sed 's/^v//'`
3485 ;;
3486 freebsd) osname=freebsd
3487 osvers="$3" ;;
3488 genix) osname=genix ;;
3489 gnu) osname=gnu
3490 osvers="$3" ;;
3491 hp*) osname=hpux
3492 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3493 ;;
3494 irix*) osname=irix
3495 case "$3" in
3496 4*) osvers=4 ;;
3497 5*) osvers=5 ;;
3498 *) osvers="$3" ;;
3499 esac
3500 ;;
3501 linux) osname=linux
3502 case "$3" in
3503 *) osvers="$3" ;;
3504 esac
3505 $test -f /system/lib/libandroid.so && osname=linux-android
3506 ;;
3507 MiNT) osname=mint
3508 ;;
3509 minix) osname=minix
3510 osvers=`$uname -r`
3511 ;;
3512 netbsd*) osname=netbsd
3513 osvers="$3"
3514 ;;
3515 news-os) osvers="$3"
3516 case "$3" in
3517 4*) osname=newsos4 ;;
3518 *) osname=newsos ;;
3519 esac
3520 ;;
3521 nonstop-ux) osname=nonstopux ;;
3522 openbsd) osname=openbsd
3523 osvers="$3"
3524 ;;
3525 os2) osname=os2
3526 osvers="$4"
3527 ;;
3528 POSIX-BC | posix-bc ) osname=posix-bc
3529 osvers="$3"
3530 ;;
3531 powerux | power_ux | powermax_os | powermaxos | \
3532 powerunix | power_unix) osname=powerux
3533 osvers="$3"
3534 ;;
3535 qnx) osname=qnx
3536 osvers="$4"
3537 ;;
3538 solaris) osname=solaris
3539 case "$3" in
3540 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3541 *) osvers="$3" ;;
3542 esac
3543 ;;
3544 sunos) osname=sunos
3545 case "$3" in
3546 5*) osname=solaris
3547 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3548 *) osvers="$3" ;;
3549 esac
3550 ;;
3551 titanos) osname=titanos
3552 case "$3" in
3553 1*) osvers=1 ;;
3554 2*) osvers=2 ;;
3555 3*) osvers=3 ;;
3556 4*) osvers=4 ;;
3557 *) osvers="$3" ;;
3558 esac
3559 ;;
3560 ultrix) osname=ultrix
3561 osvers="$3"
3562 ;;
3563 osf1|mls+) case "$5" in
3564 alpha)
3565 osname=dec_osf
3566 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3567 case "$osvers" in
3568 [1-9].[0-9]*) ;;
3569 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3570 esac
3571 ;;
3572 hp*) osname=hp_osf1 ;;
3573 mips) osname=mips_osf1 ;;
3574 esac
3575 ;;
3576 # UnixWare 7.1.2 is known as Open UNIX 8
3577 openunix|unixware) osname=svr5
3578 osvers="$4"
3579 ;;
3580 uts) osname=uts
3581 osvers="$3"
3582 ;;
3583 vos) osvers="$3"
3584 ;;
3585 $2) case "$osname" in
3586 *isc*) ;;
3587 *freebsd*) ;;
3588 svr*)
3589 : svr4.x or possibly later
3590 case "svr$3" in
3591 ${osname}*)
3592 osname=svr$3
3593 osvers=$4
3594 ;;
3595 esac
3596 case "$osname" in
3597 svr4.0)
3598 : Check for ESIX
3599 if test -f /stand/boot ; then
3600 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3601 if test -n "$INITPROG" -a -f "$INITPROG"; then
3602 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3603 if test -n "$isesix"; then
3604 osname=esix4
3605 fi
3606 fi
3607 fi
3608 ;;
3609 esac
3610 ;;
3611 *) if test -f /etc/systemid; then
3612 osname=sco
3613 set `echo $3 | $sed 's/\./ /g'` $4
3614 if $test -f $src/hints/sco_$1_$2_$3.sh; then
3615 osvers=$1.$2.$3
3616 elif $test -f $src/hints/sco_$1_$2.sh; then
3617 osvers=$1.$2
3618 elif $test -f $src/hints/sco_$1.sh; then
3619 osvers=$1
3620 fi
3621 else
3622 case "$osname" in
3623 '') : Still unknown. Probably a generic Sys V.
3624 osname="sysv"
3625 osvers="$3"
3626 ;;
3627 esac
3628 fi
3629 ;;
3630 esac
3631 ;;
3632 *) case "$osname" in
3633 '') : Still unknown. Probably a generic BSD.
3634 osname="$1"
3635 osvers="$3"
3636 ;;
3637 esac
3638 ;;
3639 esac
3640 else
3641 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3642 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3643 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3644 osname=news_os
3645 fi
3646 $rm -f UU/kernel.what
3647 elif test -d c:/. -o -n "$is_os2" ; then
3648 set X $myuname
3649 osname=os2
3650 osvers="$5"
3651 fi
3652 fi
3653
3654 case "$targetarch" in
3655 '') ;;
3656 *) hostarch=$osname
3657 case "$targetarch" in
3658 nto*|*-nto-*)
3659 # Will load qnx.sh, which should change osname to nto
3660 osname=qnx
3661 osvers=''
3662 ;;
3663 *linux-android*)
3664 # Catch arm-linux-androideabi, mipsel-linux-android,
3665 # and i686-linux-android
3666 osname=linux-android
3667 osvers=''
3668 ;;
3669 *linux*)
3670 # Something like arm-linux-gnueabihf is really just
3671 # plain linux.
3672 osname=linux
3673 osvers=''
3674 ;;
3675 *solaris*|*sunos*)
3676 osname=solaris
3677 # XXX perhaps we should just assume
3678 # osvers to be 2, or maybe take the value
3679 # from targetarch. Using $run before the
3680 # hints are run is somewhat icky.
3681 set X `$run $uname -a 2>/dev/null`
3682 shift
3683 case "$3" in
3684 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3685 *) osvers="$3" ;;
3686 esac
3687 ;;
3688 *)
3689 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3690 osvers=''
3691 ;;
3692 esac
3693 ;;
3694 esac
3695
3696 : Now look for a hint file osname_osvers, unless one has been
3697 : specified already.
3698 case "$hintfile" in
3699 ''|' ')
3700 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3701 : Also try without trailing minor version numbers.
3702 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3703 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3704 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3705 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3706 case "$file" in
3707 '') dflt=none ;;
3708 *) case "$osvers" in
3709 '') dflt=$file
3710 ;;
3711 *) if $test -f $src/hints/$file.sh ; then
3712 dflt=$file
3713 elif $test -f $src/hints/$xfile.sh ; then
3714 dflt=$xfile
3715 elif $test -f $src/hints/$xxfile.sh ; then
3716 dflt=$xxfile
3717 elif $test -f $src/hints/$xxxfile.sh ; then
3718 dflt=$xxxfile
3719 elif $test -f $src/hints/$xxxxfile.sh ; then
3720 dflt=$xxxxfile
3721 elif $test -f "$src/hints/${osname}.sh" ; then
3722 dflt="${osname}"
3723 else
3724 dflt=none
3725 fi
3726 ;;
3727 esac
3728 ;;
3729 esac
3730 if $test -f Policy.sh ; then
3731 case "$dflt" in
3732 *Policy*) ;;
3733 none) dflt="Policy" ;;
3734 *) dflt="Policy $dflt" ;;
3735 esac
3736 fi
3737 ;;
3738 *)
3739 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3740 ;;
3741 esac
3742
3743 if $test -f Policy.sh ; then
3744 $cat <<EOM
3745
3746There's also a Policy hint file available, which should make the
3747site-specific (policy) questions easier to answer.
3748EOM
3749
3750 fi
3751
3752 $cat <<EOM
3753
3754You may give one or more space-separated answers, or "none" if appropriate.
3755If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3756previous run of Configure, you may specify it as well as or instead of
3757OS-specific hints. If hints are provided for your OS, you should use them:
3758although Perl can probably be built without hints on many platforms, using
3759hints often improve performance and may enable features that Configure can't
3760set up on its own. If there are no hints that match your OS, specify "none";
3761DO NOT give a wrong version or a wrong OS.
3762
3763EOM
3764
3765 rp="Which of these apply, if any?"
3766 . UU/myread
3767 tans=$ans
3768 for file in $tans; do
3769 if $test X$file = XPolicy -a -f Policy.sh; then
3770 . Policy.sh
3771 $cat Policy.sh >> UU/config.sh
3772 elif $test -f $src/hints/$file.sh; then
3773 . $src/hints/$file.sh
3774 $cat $src/hints/$file.sh >> UU/config.sh
3775 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3776 : nothing
3777 else
3778 : Give one chance to correct a possible typo.
3779 echo "$file.sh does not exist"
3780 dflt=$file
3781 rp="hint to use instead?"
3782 . UU/myread
3783 for file in $ans; do
3784 if $test -f "$src/hints/$file.sh"; then
3785 . $src/hints/$file.sh
3786 $cat $src/hints/$file.sh >> UU/config.sh
3787 elif $test X$ans = X -o X$ans = Xnone ; then
3788 : nothing
3789 else
3790 echo "$file.sh does not exist -- ignored."
3791 fi
3792 done
3793 fi
3794 done
3795
3796 hint=recommended
3797 : Remember our hint file for later.
3798 if $test -f "$src/hints/$file.sh" ; then
3799 hintfile="$file"
3800 else
3801 hintfile=''
3802 fi
3803fi
3804cd UU
3805;;
3806*)
3807 echo " "
3808 echo "Fetching default answers from $config_sh..." >&4
3809 tmp_n="$n"
3810 tmp_c="$c"
3811 cd ..
3812 cp $config_sh config.sh 2>/dev/null
3813 chmod +w config.sh
3814 . ./config.sh
3815 cd UU
3816 cp ../config.sh .
3817 n="$tmp_n"
3818 c="$tmp_c"
3819 hint=previous
3820 ;;
3821esac
3822. ./optdef.sh
3823
3824: Restore computed paths
3825for file in $loclist $trylist; do
3826 eval $file="\$_$file"
3827done
3828
3829cat << EOM
3830
3831Configure uses the operating system name and version to set some defaults.
3832The default value is probably right if the name rings a bell. Otherwise,
3833since spelling matters for me, either accept the default or answer "none"
3834to leave it blank.
3835
3836EOM
3837case "$osname" in
3838 ''|' ')
3839 case "$hintfile" in
3840 ''|' '|none) dflt=none ;;
3841 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3842 esac
3843 ;;
3844 *) dflt="$osname" ;;
3845esac
3846rp="Operating system name?"
3847. ./myread
3848case "$ans" in
3849none) osname='' ;;
3850*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3851esac
3852echo " "
3853case "$osvers" in
3854 ''|' ')
3855 case "$hintfile" in
3856 ''|' '|none) dflt=none ;;
3857 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3858 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3859 case "$dflt" in
3860 ''|' ') dflt=none ;;
3861 esac
3862 ;;
3863 esac
3864 ;;
3865 *) dflt="$osvers" ;;
3866esac
3867rp="Operating system version?"
3868. ./myread
3869case "$ans" in
3870none) osvers='' ;;
3871*) osvers="$ans" ;;
3872esac
3873
3874
3875. ./posthint.sh
3876
3877: who configured the system
3878cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3879case "$cf_by" in
3880"")
3881 cf_by=`(logname) 2>/dev/null`
3882 case "$cf_by" in
3883 "")
3884 cf_by=`(whoami) 2>/dev/null`
3885 case "$cf_by" in
3886 "") cf_by=unknown ;;
3887 esac ;;
3888 esac ;;
3889esac
3890
3891: decide how portable to be. Allow command line overrides.
3892case "$d_portable" in
3893"$undef") ;;
3894*) d_portable="$define" ;;
3895esac
3896
3897: set up shell script to do ~ expansion
3898cat >filexp <<EOSS
3899$startsh
3900: expand filename
3901case "\$1" in
3902 \~/*|\~)
3903 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3904 ;;
3905 \~*)
3906 if $test -f /bin/csh; then
3907 /bin/csh -f -c "glob \$1"
3908 failed=\$?
3909 echo ""
3910 exit \$failed
3911 else
3912 name=\`$expr x\$1 : '..\([^/]*\)'\`
3913 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3914 if $test ! -d "\$dir"; then
3915 me=\`basename \$0\`
3916 echo "\$me: can't locate home directory for: \$name" >&2
3917 exit 1
3918 fi
3919 case "\$1" in
3920 */*)
3921 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3922 ;;
3923 *)
3924 echo \$dir
3925 ;;
3926 esac
3927 fi
3928 ;;
3929*)
3930 echo \$1
3931 ;;
3932esac
3933EOSS
3934chmod +x filexp
3935$eunicefix filexp
3936
3937: now set up to get a file name
3938cat <<EOS >getfile
3939$startsh
3940EOS
3941cat <<'EOSC' >>getfile
3942tilde=''
3943fullpath=''
3944already=''
3945skip=''
3946none_ok=''
3947exp_file=''
3948nopath_ok=''
3949orig_rp="$rp"
3950orig_dflt="$dflt"
3951case "$gfpth" in
3952'') gfpth='.' ;;
3953esac
3954
3955case "$fn" in
3956*\(*)
3957 : getfile will accept an answer from the comma-separated list
3958 : enclosed in parentheses even if it does not meet other criteria.
3959 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3960 fn=`echo $fn | sed 's/(.*)//'`
3961 ;;
3962esac
3963
3964case "$fn" in
3965*:*)
3966 loc_file=`expr $fn : '.*:\(.*\)'`
3967 fn=`expr $fn : '\(.*\):.*'`
3968 ;;
3969esac
3970
3971case "$fn" in
3972*~*) tilde=true;;
3973esac
3974case "$fn" in
3975*/*) fullpath=true;;
3976esac
3977case "$fn" in
3978*+*) skip=true;;
3979esac
3980case "$fn" in
3981*n*) none_ok=true;;
3982esac
3983case "$fn" in
3984*e*) exp_file=true;;
3985esac
3986case "$fn" in
3987*p*) nopath_ok=true;;
3988esac
3989
3990case "$fn" in
3991*f*) type='File';;
3992*d*) type='Directory';;
3993*l*) type='Locate';;
3994esac
3995
3996what="$type"
3997case "$what" in
3998Locate) what='File';;
3999esac
4000
4001case "$exp_file" in
4002'')
4003 case "$d_portable" in
4004 "$define") ;;
4005 *) exp_file=true;;
4006 esac
4007 ;;
4008esac
4009
4010cd ..
4011while test "$type"; do
4012 redo=''
4013 rp="$orig_rp"
4014 dflt="$orig_dflt"
4015 case "$tilde" in
4016 true) rp="$rp (~name ok)";;
4017 esac
4018 . UU/myread
4019 if test -f UU/getfile.ok && \
4020 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4021 then
4022 value="$ans"
4023 ansexp="$ans"
4024 break
4025 fi
4026 case "$ans" in
4027 none)
4028 value=''
4029 ansexp=''
4030 case "$none_ok" in
4031 true) type='';;
4032 esac
4033 ;;
4034 *)
4035 case "$tilde" in
4036 '') value="$ans"
4037 ansexp="$ans";;
4038 *)
4039 value=`UU/filexp $ans`
4040 case $? in
4041 0)
4042 if test "$ans" != "$value"; then
4043 echo "(That expands to $value on this system.)"
4044 fi
4045 ;;
4046 *) value="$ans";;
4047 esac
4048 ansexp="$value"
4049 case "$exp_file" in
4050 '') value="$ans";;
4051 esac
4052 ;;
4053 esac
4054 case "$fullpath" in
4055 true)
4056 case "$ansexp" in
4057 /*) value="$ansexp" ;;
4058 [a-zA-Z]:/*) value="$ansexp" ;;
4059 *)
4060 redo=true
4061 case "$already" in
4062 true)
4063 echo "I shall only accept a full path name, as in /bin/ls." >&4
4064 echo "Use a ! shell escape if you wish to check pathnames." >&4
4065 ;;
4066 *)
4067 echo "Please give a full path name, starting with slash." >&4
4068 case "$tilde" in
4069 true)
4070 echo "Note that using ~name is ok provided it expands well." >&4
4071 already=true
4072 ;;
4073 esac
4074 esac
4075 ;;
4076 esac
4077 ;;
4078 esac
4079 case "$redo" in
4080 '')
4081 case "$type" in
4082 File)
4083 for fp in $gfpth; do
4084 if test "X$fp" = X.; then
4085 pf="$ansexp"
4086 else
4087 pf="$fp/$ansexp"
4088 fi
4089 if test -f "$pf"; then
4090 type=''
4091 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4092 then
4093 echo "($value is not a plain file, but that's ok.)"
4094 type=''
4095 fi
4096 if test X"$type" = X; then
4097 value="$pf"
4098 break
4099 fi
4100 done
4101 ;;
4102 Directory)
4103 for fp in $gfpth; do
4104 if test "X$fp" = X.; then
4105 dir="$ans"
4106 direxp="$ansexp"
4107 else
4108 dir="$fp/$ansexp"
4109 direxp="$fp/$ansexp"
4110 fi
4111 if test -d "$direxp"; then
4112 type=''
4113 value="$dir"
4114 break
4115 fi
4116 done
4117 ;;
4118 Locate)
4119 if test -d "$ansexp"; then
4120 echo "(Looking for $loc_file in directory $value.)"
4121 value="$value/$loc_file"
4122 ansexp="$ansexp/$loc_file"
4123 fi
4124 if test -f "$ansexp"; then
4125 type=''
4126 fi
4127 case "$nopath_ok" in
4128 true) case "$value" in
4129 */*) ;;
4130 *) echo "Assuming $value will be in people's path."
4131 type=''
4132 ;;
4133 esac
4134 ;;
4135 esac
4136 ;;
4137 esac
4138
4139 case "$skip" in
4140 true) type='';
4141 esac
4142
4143 case "$type" in
4144 '') ;;
4145 *)
4146 if test "$fastread" = yes; then
4147 dflt=y
4148 else
4149 dflt=n
4150 fi
4151 rp="$what $value doesn't exist. Use that name anyway?"
4152 . UU/myread
4153 dflt=''
4154 case "$ans" in
4155 y*) type='';;
4156 *) echo " ";;
4157 esac
4158 ;;
4159 esac
4160 ;;
4161 esac
4162 ;;
4163 esac
4164done
4165cd UU
4166ans="$value"
4167rp="$orig_rp"
4168dflt="$orig_dflt"
4169rm -f getfile.ok
4170test "X$gfpthkeep" != Xy && gfpth=""
4171EOSC
4172
4173: determine root of directory hierarchy where package will be installed.
4174case "$prefix" in
4175'') dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4176 ;;
4177*) dflt="$prefix"
4178 ;;
4179esac
4180$cat <<EOM
4181
4182By default, $package will be installed in $dflt/bin, manual pages
4183under $dflt/man, etc..., i.e. with $dflt as prefix for all
4184installation directories. Typically this is something like /usr/local.
4185If you wish to have binaries under /usr/bin but other parts of the
4186installation under /usr/local, that's ok: you will be prompted
4187separately for each of the installation directories, the prefix being
4188only used to set the defaults.
4189
4190EOM
4191fn=d~
4192rp='Installation prefix to use?'
4193. ./getfile
4194oldprefix=''
4195case "$prefix" in
4196'') ;;
4197*) case "$ans" in
4198 "$prefix") ;;
4199 *) oldprefix="$prefix";;
4200 esac
4201 ;;
4202esac
4203
4204case "$ans" in
4205*?/) prefix=`echo "$ans" | sed 's/.$//'`
4206 ;;
4207*) prefix="$ans"
4208esac
4209
4210case "$ansexp" in
4211*?/) prefixexp=`echo "$ansexp" | sed 's/.$//'`
4212 ;;
4213*) prefixexp="$ansexp"
4214esac
4215
4216: allow them to override the AFS root
4217case "$afsroot" in
4218'') afsroot=/afs ;;
4219*) afsroot=$afsroot ;;
4220esac
4221
4222: is AFS running?
4223echo " "
4224case "$afs" in
4225$define|true) afs=true ;;
4226$undef|false) afs=false ;;
4227*) if $test -d $afsroot; then
4228 afs=true
4229 else
4230 afs=false
4231 fi
4232 ;;
4233esac
4234if $afs; then
4235 echo "AFS may be running... I'll be extra cautious then..." >&4
4236else
4237 echo "AFS does not seem to be running..." >&4
4238fi
4239
4240: determine installation prefix for where package is to be installed.
4241if $afs; then
4242$cat <<EOM
4243
4244Since you are running AFS, I need to distinguish the directory in which
4245files will reside from the directory in which they are installed (and from
4246which they are presumably copied to the former directory by occult means).
4247
4248EOM
4249 case "$installprefix" in
4250 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4251 *) dflt="$installprefix";;
4252 esac
4253else
4254$cat <<EOM
4255
4256In some special cases, particularly when building $package for distribution,
4257it is convenient to distinguish the directory in which files should be
4258installed from the directory ($prefix) in which they will
4259eventually reside. For most users, these two directories are the same.
4260
4261EOM
4262 case "$installprefix" in
4263 '') dflt=$prefix ;;
4264 *) dflt=$installprefix;;
4265 esac
4266fi
4267fn=d~
4268rp='What installation prefix should I use for installing files?'
4269. ./getfile
4270installprefix="$ans"
4271installprefixexp="$ansexp"
4272
4273: Perform the prefixexp/installprefixexp correction if necessary
4274cat <<EOS >installprefix
4275$startsh
4276EOS
4277cat <<'EOSC' >>installprefix
4278: Change installation prefix, if necessary.
4279if $test X"$prefix" != X"$installprefix"; then
4280 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4281else
4282 eval "install${prefixvar}=\"\$${prefixvar}exp\""
4283fi
4284EOSC
4285chmod +x installprefix
4286$eunicefix installprefix
4287
4288: Set variables such as privlib and privlibexp from the output of ./getfile
4289: performing the prefixexp/installprefixexp correction if necessary.
4290cat <<EOS >setprefixvar
4291$startsh
4292EOS
4293cat <<'EOSC' >>setprefixvar
4294eval "${prefixvar}=\"\$ans\""
4295eval "${prefixvar}exp=\"\$ansexp\""
4296. ./installprefix
4297EOSC
4298chmod +x setprefixvar
4299$eunicefix setprefixvar
4300
4301: set up the script used to warn in case of inconsistency
4302cat <<EOS >whoa
4303$startsh
4304EOS
4305cat <<'EOSC' >>whoa
4306dflt=y
4307case "$hint" in
4308 recommended)
4309 case "$hintfile" in
4310 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4311 ;;
4312 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
4313 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4314 ;;
4315 esac
4316 ;;
4317 *) echo " "
4318 echo "*** WHOA THERE!!! ***" >&4
4319 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
4320 ;;
4321esac
4322rp=" Keep the $hint value?"
4323. ./myread
4324case "$ans" in
4325y) td=$was; tu=$was;;
4326esac
4327EOSC
4328
4329: function used to set '$1' to '$val'
4330setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4331case "$val$was" in
4332$define$undef) . ./whoa; eval "$var=\$td";;
4333$undef$define) . ./whoa; eval "$var=\$tu";;
4334*) eval "$var=$val";;
4335esac'
4336
4337: get the patchlevel
4338echo " "
4339echo "Getting the current patchlevel..." >&4
4340if $test -r $rsrc/patchlevel.h;then
4341 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4342 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4343 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4344 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4345 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4346 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4347 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4348else
4349 revision=0
4350 patchlevel=0
4351 subversion=0
4352 api_revision=0
4353 api_version=0
4354 api_subversion=0
4355 perl_patchlevel=0
4356 $echo "(You do not have patchlevel.h. Eek.)"
4357fi
4358: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4359version_patchlevel_string="version $patchlevel subversion $subversion"
4360case "$perl_patchlevel" in
43610|'') ;;
4362*) perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4363 version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4364 ;;
4365esac
4366
4367$echo "(You have $package $version_patchlevel_string.)"
4368
4369case "$osname" in
4370dos|vms)
4371 : XXX Should be a Configure test for double-dots in filenames.
4372 version=`echo $revision $patchlevel $subversion | \
4373 $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4374 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4375 $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4376 ;;
4377*)
4378 version=`echo $revision $patchlevel $subversion | \
4379 $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4380 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4381 $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4382 ;;
4383esac
4384: Special case the 5.005_xx maintenance series, which used 5.005
4385: without any subversion label as a subdirectory in $sitelib
4386if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4387 api_versionstring='5.005'
4388fi
4389
4390: Do we want threads support and if so, what type
4391case "$usethreads" in
4392$define|true|[yY]*) dflt='y';;
4393*) # Catch case where user specified ithreads or 5005threads but
4394 # forgot -Dusethreads (A.D. 4/2002)
4395 case "$useithreads$use5005threads" in
4396 *$define*) dflt='y';;
4397 *) dflt='n';;
4398 esac
4399 ;;
4400esac
4401cat <<EOM
4402
4403Perl can be built to offer a form of threading support on some systems
4404To do so, Configure can be run with -Dusethreads.
4405
4406Note that Perl built with threading support runs slightly slower
4407and uses slightly more memory than plain Perl.
4408
4409If this doesn't make any sense to you, just accept the default '$dflt'.
4410EOM
4411rp='Build a threading Perl?'
4412. ./myread
4413case "$ans" in
4414y|Y) val="$define" ;;
4415*) val="$undef" ;;
4416esac
4417set usethreads
4418eval $setvar
4419
4420if $test $patchlevel -lt 9; then
4421 case "$usethreads" in
4422 $define)
4423 : Default to ithreads unless overridden on command line or with
4424 : old config.sh
4425 dflt='y'
4426 case "$use5005threads" in
4427 $define|true|[yY]*)
4428 echo "5.005 threads are no longer supported"
4429 exit 1
4430 ;;
4431 esac
4432 case "$useithreads" in
4433 $undef|false|[nN]*) dflt='n';;
4434 esac
4435 rp='Use the newer interpreter-based ithreads?'
4436 . ./myread
4437 case "$ans" in
4438 y|Y) val="$define" ;;
4439 *) val="$undef" ;;
4440 esac
4441 set useithreads
4442 eval $setvar
4443 : Now set use5005threads to the opposite value.
4444 case "$useithreads" in
4445 $define) val="$undef" ;;
4446 *) val="$define" ;;
4447 esac
4448 set use5005threads
4449 eval $setvar
4450 ;;
4451 *)
4452 useithreads="$undef"
4453 use5005threads="$undef"
4454 ;;
4455 esac
4456
4457 case "$useithreads$use5005threads" in
4458 "$define$define")
4459 $cat >&4 <<EOM
4460
4461You cannot have both the ithreads and the 5.005 threads enabled
4462at the same time. Disabling the 5.005 threads since they are
4463much less stable than the ithreads.
4464
4465EOM
4466 use5005threads="$undef"
4467 ;;
4468 esac
4469
4470else
4471: perl-5.9.x and later
4472
4473 if test X"$usethreads" = "X$define"; then
4474 case "$use5005threads" in
4475 $define|true|[yY]*)
4476 $cat >&4 <<EOM
4477
44785.005 threads has been removed for 5.10. Perl will be built using ithreads.
4479
4480EOM
4481 ;;
4482 esac
4483 fi
4484
4485 use5005threads="$undef"
4486 useithreads="$usethreads"
4487fi
4488
4489case "$d_oldpthreads" in
4490'') : Configure tests would be welcome here. For now, assume undef.
4491 val="$undef" ;;
4492*) val="$d_oldpthreads" ;;
4493esac
4494set d_oldpthreads
4495eval $setvar
4496
4497
4498: Look for a hint-file generated 'call-back-unit'. If the
4499: user has specified that a threading perl is to be built,
4500: we may need to set or change some other defaults.
4501if $test -f usethreads.cbu; then
4502 echo "Your platform has some specific hints regarding threaded builds, using them..."
4503 . ./usethreads.cbu
4504else
4505 case "$usethreads" in
4506 "$define"|true|[yY]*)
4507 $cat <<EOM
4508(Your platform does not have any specific hints for threaded builds.
4509 Assuming POSIX threads, then.)
4510EOM
4511 ;;
4512 esac
4513fi
4514
4515: Check if multiplicity is required
4516cat <<EOM
4517
4518Perl can be built so that multiple Perl interpreters can coexist
4519within the same Perl executable.
4520EOM
4521
4522case "$useithreads" in
4523$define)
4524 cat <<EOM
4525This multiple interpreter support is required for interpreter-based threads.
4526EOM
4527 val="$define"
4528 ;;
4529*) case "$usemultiplicity" in
4530 $define|true|[yY]*) dflt='y';;
4531 *) dflt='n';;
4532 esac
4533 echo " "
4534 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4535 rp='Build Perl for multiplicity?'
4536 . ./myread
4537 case "$ans" in
4538 y|Y) val="$define" ;;
4539 *) val="$undef" ;;
4540 esac
4541 ;;
4542esac
4543set usemultiplicity
4544eval $setvar
4545
4546: Check if morebits is requested
4547case "$usemorebits" in
4548"$define"|true|[yY]*)
4549 use64bitint="$define"
4550 uselongdouble="$define"
4551 usemorebits="$define"
4552 ;;
4553*) usemorebits="$undef"
4554 ;;
4555esac
4556
4557: Determine the C compiler to be used
4558echo " "
4559case "$cc" in
4560'') dflt=cc;;
4561*) dflt="$cc";;
4562esac
4563rp="Use which C compiler?"
4564. ./myread
4565cc="$ans"
4566
4567: See whether they have no cc but they do have gcc
4568. ./trygcc
4569if $test -f cc.cbu; then
4570 . ./cc.cbu
4571fi
4572. ./checkcc
4573
4574: make some quick guesses about what we are up against
4575echo " "
4576$echo $n "Hmm... $c"
4577echo exit 1 >bsd
4578echo exit 1 >usg
4579echo exit 1 >v7
4580echo exit 1 >osf1
4581echo exit 1 >eunice
4582echo exit 1 >xenix
4583echo exit 1 >venix
4584echo exit 1 >os2
4585d_bsd="$undef"
4586$cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4587if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4588then
4589 echo "Looks kind of like an OSF/1 system, but we'll see..."
4590 echo exit 0 >osf1
4591elif test `echo abc | $tr a-z A-Z` = Abc ; then
4592 xxx=`./loc addbib blurfl $pth`
4593 if $test -f $xxx; then
4594 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4595 echo exit 0 >bsd
4596 echo exit 0 >usg
4597 else
4598 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4599 echo "Looks kind of like an extended USG system, but we'll see..."
4600 else
4601 echo "Looks kind of like a USG system, but we'll see..."
4602 fi
4603 echo exit 0 >usg
4604 fi
4605elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4606 echo "Looks kind of like a BSD system, but we'll see..."
4607 d_bsd="$define"
4608 echo exit 0 >bsd
4609else
4610 echo "Looks kind of like a Version 7 system, but we'll see..."
4611 echo exit 0 >v7
4612fi
4613case "$eunicefix" in
4614*unixtovms*)
4615 $cat <<'EOI'
4616There is, however, a strange, musty smell in the air that reminds me of
4617something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4618EOI
4619 echo exit 0 >eunice
4620 d_eunice="$define"
4621: it so happens the Eunice I know will not run shell scripts in Unix format
4622 ;;
4623*)
4624 echo " "
4625 echo "Congratulations. You aren't running Eunice."
4626 d_eunice="$undef"
4627 ;;
4628esac
4629: Detect OS2. The p_ variable is set above in the Head.U unit.
4630: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4631: semicolon as a patch separator
4632case "$p_" in
4633:) ;;
4634*)
4635 $cat <<'EOI'
4636I have the feeling something is not exactly right, however...don't tell me...
4637lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4638(Or you may be running DOS with DJGPP.)
4639EOI
4640 echo exit 0 >os2
4641 ;;
4642esac
4643if test -f /xenix; then
4644 echo "Actually, this looks more like a XENIX system..."
4645 echo exit 0 >xenix
4646 d_xenix="$define"
4647else
4648 echo " "
4649 echo "It's not Xenix..."
4650 d_xenix="$undef"
4651fi
4652chmod +x xenix
4653$eunicefix xenix
4654if test -f /venix; then
4655 echo "Actually, this looks more like a VENIX system..."
4656 echo exit 0 >venix
4657else
4658 echo " "
4659 if ./xenix; then
4660 : null
4661 else
4662 echo "Nor is it Venix..."
4663 fi
4664fi
4665chmod +x bsd usg v7 osf1 eunice xenix venix os2
4666$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4667$rm -f foo
4668
4669: Check if we are using GNU gcc and what its version is
4670echo " "
4671echo "Checking for GNU cc in disguise and/or its version number..." >&4
4672$cat >try.c <<EOM
4673#include <stdio.h>
4674int main() {
4675#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4676#ifdef __VERSION__
4677 printf("%s\n", __VERSION__);
4678#else
4679 printf("%s\n", "1");
4680#endif
4681#endif
4682 return(0);
4683}
4684EOM
4685if $cc -o try $ccflags $ldflags try.c; then
4686 gccversion=`$run ./try`
4687 case "$gccversion" in
4688 '') echo "You are not using GNU cc." ;;
4689 *) echo "You are using GNU cc $gccversion."
4690 ccname=gcc
4691 ;;
4692 esac
4693else
4694 echo " "
4695 echo "*** WHOA THERE!!! ***" >&4
4696 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4697 case "$knowitall" in
4698 '')
4699 echo " You'd better start hunting for one and let me know about it." >&4
4700 exit 1
4701 ;;
4702 esac
4703fi
4704$rm -f try try.*
4705case "$gccversion" in
47061.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4707esac
4708case "$gccversion" in
4709'') gccosandvers='' ;;
4710*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4711 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4712 gccshortvers=''
4713 case "$gccosandvers" in
4714 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4715 $osname$osvers) ;; # looking good
4716 $osname*) cat <<EOM >&4
4717
4718*** WHOA THERE!!! ***
4719
4720 Your gcc has not been compiled for the exact release of
4721 your operating system ($gccosandvers versus $osname$osvers).
4722
4723 In general it is a good idea to keep gcc synchronized with
4724 the operating system because otherwise serious problems
4725 may ensue when trying to compile software, like Perl.
4726
4727 I'm trying to be optimistic here, though, and will continue.
4728 If later during the configuration and build icky compilation
4729 problems appear (headerfile conflicts being the most common
4730 manifestation), I suggest reinstalling the gcc to match
4731 your operating system release.
4732
4733EOM
4734 ;;
4735 *) gccosandvers='' ;; # failed to parse, better be silent
4736 esac
4737 ;;
4738esac
4739case "$ccname" in
4740'') ccname="$cc" ;;
4741esac
4742
4743# gcc 3.* complain about adding -Idirectories that they already know about,
4744# so we will take those off from locincpth.
4745case "$gccversion" in
47463.*)
4747 echo "main(){}">try.c
4748 for incdir in $locincpth; do
4749 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4750 grep '^c[cp]p*[01]: warning: changing search order '`
4751 if test "X$warn" != X; then
4752 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4753 fi
4754 done
4755 $rm -f try try.*
4756esac
4757
4758# gcc 4.9 by default does some optimizations that break perl.
4759# see ticket 121505.
4760#
4761# The -fwrapv disables those optimizations (and probably others,) so
4762# for gcc 4.9 (and later, since the optimizations probably won't go
4763# away), add -fwrapv unless the user requests -fno-wrapv, which
4764# disables -fwrapv, or if the user requests -fsanitize=undefined,
4765# which turns the overflows -fwrapv ignores into runtime errors.
4766case "$gccversion" in
47674.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4768 case "$ccflags" in
4769 *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4770 *) ccflags="$ccflags -fwrapv" ;;
4771 esac
4772esac
4773
4774: What should the include directory be ?
4775: Use sysroot if set, so findhdr looks in the right place.
4776echo " "
4777$echo $n "Hmm... $c"
4778dflt="$sysroot/usr/include"
4779incpath=''
4780mips_type=''
4781if $test -f /bin/mips && /bin/mips; then
4782 echo "Looks like a MIPS system..."
4783 $cat >usr.c <<'EOCP'
4784#ifdef SYSTYPE_BSD43
4785/bsd43
4786#endif
4787EOCP
4788 if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4789 dflt='/bsd43/usr/include'
4790 incpath='/bsd43'
4791 mips_type='BSD 4.3'
4792 else
4793 mips_type='System V'
4794 fi
4795 $rm -f usr.c usr.out
4796 echo "and you're compiling with the $mips_type compiler and libraries."
4797 xxx_prompt=y
4798 echo "exit 0" >mips
4799else
4800 echo "Doesn't look like a MIPS system."
4801 xxx_prompt=n
4802 echo "exit 1" >mips
4803fi
4804chmod +x mips
4805$eunicefix mips
4806case "$usrinc" in
4807'') ;;
4808*) dflt="$usrinc";;
4809esac
4810case "$xxx_prompt" in
4811y) fn=d/
4812 echo " "
4813 rp='Where are the include files you want to use?'
4814 . ./getfile
4815 usrinc="$ans"
4816 ;;
4817*) usrinc="$dflt"
4818 ;;
4819esac
4820
4821: see how we invoke the C preprocessor
4822echo " "
4823echo "Now, how can we feed standard input to your C preprocessor..." >&4
4824cat <<'EOT' >testcpp.c
4825#define ABC abc
4826#define XYZ xyz
4827ABC.XYZ
4828EOT
4829cd ..
4830if test ! -f cppstdin; then
4831 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4832 # AIX cc -E doesn't show the absolute headerfile
4833 # locations but we'll cheat by using the -M flag.
4834 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
4835 else
4836 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4837 fi
4838else
4839 echo "Keeping your $hint cppstdin wrapper."
4840fi
4841chmod 755 cppstdin
4842wrapper=`pwd`/cppstdin
4843ok='false'
4844cd UU
4845
4846if $test "X$cppstdin" != "X" && \
4847 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4848 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4849then
4850 echo "You used to use $cppstdin $cppminus so we'll use that again."
4851 case "$cpprun" in
4852 '') echo "But let's see if we can live without a wrapper..." ;;
4853 *)
4854 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4855 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4856 then
4857 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4858 ok='true'
4859 else
4860 echo "(However, $cpprun $cpplast does not work, let's see...)"
4861 fi
4862 ;;
4863 esac
4864else
4865 case "$cppstdin" in
4866 '') ;;
4867 *)
4868 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4869 ;;
4870 esac
4871fi
4872
4873if $ok; then
4874 : nothing
4875elif echo 'Maybe "'"$cc"' -E" will work...'; \
4876 $cc -E <testcpp.c >testcpp.out 2>&1; \
4877 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4878 echo "Yup, it does."
4879 x_cpp="$cc $cppflags -E"
4880 x_minus='';
4881elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4882 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4883 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4884 echo "Yup, it does."
4885 x_cpp="$cc $cppflags -E"
4886 x_minus='-';
4887elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4888 $cc -P <testcpp.c >testcpp.out 2>&1; \
4889 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4890 echo "Yipee, that works!"
4891 x_cpp="$cc $cppflags -P"
4892 x_minus='';
4893elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4894 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4895 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4896 echo "At long last!"
4897 x_cpp="$cc $cppflags -P"
4898 x_minus='-';
4899elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4900 $cpp <testcpp.c >testcpp.out 2>&1; \
4901 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4902 echo "It works!"
4903 x_cpp="$cpp $cppflags"
4904 x_minus='';
4905elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4906 $cpp - <testcpp.c >testcpp.out 2>&1; \
4907 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4908 echo "Hooray, it works! I was beginning to wonder."
4909 x_cpp="$cpp $cppflags"
4910 x_minus='-';
4911elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4912 $wrapper <testcpp.c >testcpp.out 2>&1; \
4913 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4914 x_cpp="$wrapper"
4915 x_minus=''
4916 echo "Eureka!"
4917else
4918 dflt=''
4919 rp="No dice. I can't find a C preprocessor. Name one:"
4920 . ./myread
4921 x_cpp="$ans"
4922 x_minus=''
4923 $x_cpp <testcpp.c >testcpp.out 2>&1
4924 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4925 echo "OK, that will do." >&4
4926 else
4927echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4928 exit 1
4929 fi
4930fi
4931
4932case "$ok" in
4933false)
4934 cppstdin="$x_cpp"
4935 cppminus="$x_minus"
4936 cpprun="$x_cpp"
4937 cpplast="$x_minus"
4938 set X $x_cpp
4939 shift
4940 case "$1" in
4941 "$cpp")
4942 echo "Perhaps can we force $cc -E using a wrapper..."
4943 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4944 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4945 then
4946 echo "Yup, we can."
4947 cppstdin="$wrapper"
4948 cppminus='';
4949 else
4950 echo "Nope, we'll have to live without it..."
4951 fi
4952 ;;
4953 esac
4954 case "$cpprun" in
4955 "$wrapper")
4956 cpprun=''
4957 cpplast=''
4958 ;;
4959 esac
4960 ;;
4961esac
4962
4963case "$cppstdin" in
4964"$wrapper"|'cppstdin') ;;
4965*) $rm -f $wrapper;;
4966esac
4967$rm -f testcpp.c testcpp.out
4968
4969: Adjust cppfilter for path component separator
4970case "$osname" in
4971vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4972os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4973*) cppfilter='' ;;
4974esac
4975
4976: Use gcc to determine libpth and incpth
4977# If using gcc or clang, we can get better values for libpth, incpth
4978# and usrinc directly from the compiler.
4979# Note that ccname for clang is also gcc.
4980case "$ccname" in
4981 gcc)
4982 $echo 'extern int foo;' > try.c
4983 set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4984 shift
4985 if $test $# -gt 0; then
4986 incpth="$incpth $*"
4987 incpth="`$echo $incpth|$sed 's/^ //'`"
4988 for i in $*; do
4989 j="`$echo $i|$sed 's,/include$,/lib,'`"
4990 if $test -d $j; then
4991 libpth="$libpth $j"
4992 fi
4993 done
4994 libpth="`$echo $libpth|$sed 's/^ //'`"
4995 for xxx in $libpth $loclibpth $plibpth $glibpth; do
4996 if $test -d $xxx; then
4997 case " $libpth " in
4998 *" $xxx "*) ;;
4999 *) libpth="$libpth $xxx";;
5000 esac
5001 fi
5002 done
5003 fi
5004 $rm -f try.c
5005 case "$usrinc" in
5006 '') for i in $incpth; do
5007 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
5008 usrinc="$i"
5009 break
5010 fi
5011 done
5012 ;;
5013 esac
5014
5015 case "$usecrosscompile" in
5016 $define|true|[yY]*)
5017 case "$incpth" in
5018 '') echo "Incpth not defined." >&4; croak=y ;;
5019 *) echo "Using incpth '$incpth'." >&4 ;;
5020 esac
5021 case "$libpth" in
5022 '') echo "Libpth not defined." >&4; croak=y ;;
5023 *) echo "Using libpth '$libpth'." >&4 ;;
5024 esac
5025 case "$usrinc" in
5026 '') echo "Usrinc not defined." >&4; croak=y ;;
5027 *) echo "Using usrinc $usrinc." >&4 ;;
5028 esac
5029 case "$croak" in
5030 y)
5031 if test "X$sysroot" = X; then
5032 echo "Cannot continue, aborting." >&4; exit 1
5033 else
5034 echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5035 fi
5036 ;;
5037 esac
5038 ;;
5039 esac
5040 ;;
5041esac
5042
5043: Default value for incpth is just usrinc
5044case "$incpth" in
5045'') incpth="$usrinc";;
5046esac
5047
5048: Set private lib path
5049case "$plibpth" in
5050'') if ./mips; then
5051 plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5052 fi;;
5053esac
5054case "$libpth" in
5055' ') dlist='';;
5056'') dlist="$loclibpth $plibpth $glibpth";;
5057*) dlist="$libpth";;
5058esac
5059
5060: Now check and see which directories actually exist, avoiding duplicates
5061for xxx in $dlist
5062do
5063 if $test -d $xxx; then
5064 case " $libpth " in
5065 *" $xxx "*) ;;
5066 *) libpth="$libpth $xxx";;
5067 esac
5068 fi
5069done
5070$cat <<'EOM'
5071
5072Some systems have incompatible or broken versions of libraries. Among
5073the directories listed in the question below, please remove any you
5074know not to be holding relevant libraries, and add any that are needed.
5075Say "none" for none.
5076
5077EOM
5078
5079if test "X$sysroot" != X; then
5080 $cat <<EOM
5081You have set sysroot to $sysroot, please supply the directories excluding sysroot
5082
5083EOM
5084fi
5085
5086case "$libpth" in
5087'') dflt='none';;
5088*)
5089 set X $libpth
5090 shift
5091 dflt=${1+"$@"}
5092 ;;
5093esac
5094rp="Directories to use for library searches?"
5095. ./myread
5096case "$ans" in
5097none) libpth=' ';;
5098*) libpth="$ans";;
5099esac
5100
5101: compute shared library extension
5102case "$so" in
5103'')
5104 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5105 dflt='sl'
5106 else
5107 dflt='so'
5108 fi
5109 ;;
5110*) dflt="$so";;
5111esac
5112$cat <<EOM
5113
5114On some systems, shared libraries may be available. Answer 'none' if
5115you want to suppress searching of shared libraries for the remainder
5116of this configuration.
5117
5118EOM
5119rp='What is the file extension used for shared libraries?'
5120. ./myread
5121so="$ans"
5122
5123: Does target system insist that shared library basenames are unique
5124$cat << EOM
5125
5126Some dynamic loaders assume that the *basename* of shared library filenames
5127are globally unique. We'll default this to undef as we assume your system
5128is not this weird. Set to defined if you're on one of them.
5129
5130EOM
5131
5132dflt='n'
5133rp='Make shared library basenames unique?'
5134. ./myread
5135case "$ans" in
5136y|Y) val="$define" ;;
5137*) val="$undef" ;;
5138esac
5139set d_libname_unique
5140eval $setvar
5141
5142: Define several unixisms.
5143: Hints files or command line option can be used to override them.
5144: The convoluted testing is in case hints files set either the old
5145: or the new name.
5146case "$_exe" in
5147'') case "$exe_ext" in
5148 '') ;;
5149 *) _exe="$exe_ext" ;;
5150 esac
5151 ;;
5152esac
5153case "$_a" in
5154'') case "$lib_ext" in
5155 '') _a='.a';;
5156 *) _a="$lib_ext" ;;
5157 esac
5158 ;;
5159esac
5160case "$_o" in
5161'') case "$obj_ext" in
5162 '') _o='.o';;
5163 *) _o="$obj_ext";;
5164 esac
5165 ;;
5166esac
5167case "$p_" in
5168'') case "$path_sep" in
5169 '') p_=':';;
5170 *) p_="$path_sep";;
5171 esac
5172 ;;
5173esac
5174exe_ext=$_exe
5175lib_ext=$_a
5176obj_ext=$_o
5177path_sep=$p_
5178
5179rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5180
5181: Which makefile gets called first. This is used by make depend.
5182case "$firstmakefile" in
5183'') firstmakefile='makefile';;
5184esac
5185
5186: Check is we will use socks
5187case "$usesocks" in
5188$define|true|[yY]*) dflt='y';;
5189*) dflt='n';;
5190esac
5191cat <<EOM
5192
5193Perl can be built to use the SOCKS proxy protocol library. To do so,
5194Configure must be run with -Dusesocks. If you use SOCKS you also need
5195to use the PerlIO abstraction layer, this will be implicitly selected.
5196
5197If this doesn't make any sense to you, just accept the default '$dflt'.
5198EOM
5199rp='Build Perl for SOCKS?'
5200. ./myread
5201case "$ans" in
5202y|Y) val="$define" ;;
5203*) val="$undef" ;;
5204esac
5205set usesocks
5206eval $setvar
5207
5208: Check for uselongdouble support
5209case "$ccflags" in
5210*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5211esac
5212
5213case "$uselongdouble" in
5214$define|true|[yY]*) dflt='y';;
5215*) dflt='n';;
5216esac
5217cat <<EOM
5218
5219Perl can be built to take advantage of long doubles which
5220(if available) may give more accuracy and range for floating point numbers.
5221
5222If this doesn't make any sense to you, just accept the default '$dflt'.
5223EOM
5224rp='Try to use long doubles if available?'
5225. ./myread
5226case "$ans" in
5227y|Y) val="$define" ;;
5228*) val="$undef" ;;
5229esac
5230set uselongdouble
5231eval $setvar
5232
5233case "$uselongdouble" in
5234true|[yY]*) uselongdouble="$define" ;;
5235esac
5236
5237: Look for a hint-file generated 'call-back-unit'. If the
5238: user has specified that long doubles should be used,
5239: we may need to set or change some other defaults.
5240if $test -f uselongdouble.cbu; then
5241 echo "Your platform has some specific hints regarding long doubles, using them..."
5242 . ./uselongdouble.cbu
5243else
5244 case "$uselongdouble" in
5245 $define)
5246 $cat <<EOM
5247(Your platform does not have any specific hints for long doubles.)
5248EOM
5249 ;;
5250 esac
5251fi
5252
5253: Check if quadmath is requested
5254case "$usequadmath" in
5255"$define"|true|[yY]*) usequadmath="$define" ;;
5256*) usequadmath="$undef" ;;
5257esac
5258
5259: Fail if both uselongdouble and usequadmath are requested
5260case "$usequadmath:$uselongdouble" in
5261define:define)
5262 $cat <<EOM >&4
5263
5264*** You requested the use of the quadmath library and use
5265*** of long doubles.
5266***
5267*** Please select one or the other.
5268EOM
5269 exit 1
5270 ;;
5271esac
5272
5273: Looking for optional libraries
5274echo " "
5275echo "Checking for optional libraries..." >&4
5276case "$libs" in
5277' '|'') dflt='';;
5278*) dflt="$libs";;
5279esac
5280case "$libswanted" in
5281'') libswanted='c_s';;
5282esac
5283case "$usesocks" in
5284"$define") libswanted="$libswanted socks5 socks5_sh" ;;
5285esac
5286case "$usecbacktrace" in
5287"$define") libswanted="$libswanted bfd" ;;
5288esac
5289case "$usequadmath" in
5290"$define") libswanted="$libswanted quadmath" ;;
5291esac
5292libsfound=''
5293libsfiles=''
5294libsdirs=''
5295libspath=''
5296for thisdir in $libpth $xlibpth; do
5297 test -d $thisdir && libspath="$libspath $thisdir"
5298done
5299for thislib in $libswanted; do
5300 for thisdir in $libspath; do
5301 xxx=''
5302 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5303 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5304 $test -f "$xxx" && eval $libscheck
5305 $test -f "$xxx" && libstyle=shared
5306 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5307 $test -f "$xxx" && eval $libscheck
5308 $test -f "$xxx" && libstyle=shared
5309 fi
5310 if test ! -f "$xxx"; then
5311 xxx=$thisdir/lib$thislib.$so
5312 $test -f "$xxx" && eval $libscheck
5313 $test -f "$xxx" && libstyle=shared
5314 fi
5315 if test ! -f "$xxx"; then
5316 xxx=$thisdir/lib$thislib$_a
5317 $test -f "$xxx" && eval $libscheck
5318 $test -f "$xxx" && libstyle=static
5319 fi
5320 if test ! -f "$xxx"; then
5321 xxx=$thisdir/$thislib$_a
5322 $test -f "$xxx" && eval $libscheck
5323 $test -f "$xxx" && libstyle=static
5324 fi
5325 if test ! -f "$xxx"; then
5326 xxx=$thisdir/lib${thislib}_s$_a
5327 $test -f "$xxx" && eval $libscheck
5328 $test -f "$xxx" && libstyle=static
5329 $test -f "$xxx" && thislib=${thislib}_s
5330 fi
5331 if test ! -f "$xxx"; then
5332 xxx=$thisdir/Slib$thislib$_a
5333 $test -f "$xxx" && eval $libscheck
5334 $test -f "$xxx" && libstyle=static
5335 fi
5336 if $test -f "$xxx"; then
5337 case "$libstyle" in
5338 shared) echo "Found -l$thislib (shared)." ;;
5339 static) echo "Found -l$thislib." ;;
5340 *) echo "Found -l$thislib ($libstyle)." ;;
5341 esac
5342 case " $dflt " in
5343 *"-l$thislib "*);;
5344 *) dflt="$dflt -l$thislib"
5345 libsfound="$libsfound $xxx"
5346 yyy=`basename $xxx`
5347 libsfiles="$libsfiles $yyy"
5348 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5349 case " $libsdirs " in
5350 *" $yyy "*) ;;
5351 *) libsdirs="$libsdirs $yyy" ;;
5352 esac
5353 ;;
5354 esac
5355 break
5356 fi
5357 done
5358 if $test ! -f "$xxx"; then
5359 echo "No -l$thislib."
5360 fi
5361done
5362set X $dflt
5363shift
5364dflt="$*"
5365case "$libs" in
5366'') dflt="$dflt";;
5367*) dflt="$libs";;
5368esac
5369case "$dflt" in
5370' '|'') dflt='none';;
5371esac
5372
5373$cat <<EOM
5374
5375In order to compile $package on your machine, a number of libraries
5376are usually needed. Include any other special libraries here as well.
5377Say "none" for none. The default list is almost always right.
5378EOM
5379
5380echo " "
5381rp="What libraries to use?"
5382. ./myread
5383case "$ans" in
5384none) libs=' ';;
5385*) libs="$ans";;
5386esac
5387
5388: determine optimization, if desired, or use for debug flag also
5389case "$optimize" in
5390' '|$undef) dflt='none';;
5391'') dflt='-O';;
5392*) dflt="$optimize";;
5393esac
5394$cat <<EOH
5395
5396By default, $package compiles with the -O flag to use the optimizer.
5397Alternately, you might want to use the symbolic debugger, which uses
5398the -g flag (on traditional Unix systems). Either flag can be
5399specified here. To use neither flag, specify the word "none".
5400
5401EOH
5402rp="What optimizer/debugger flag should be used?"
5403. ./myread
5404optimize="$ans"
5405case "$optimize" in
5406'none') optimize=" ";;
5407esac
5408
5409: Check what DEBUGGING is required from the command line
5410: -DEBUGGING or -DDEBUGGING or
5411: -DEBUGGING=both = -g + -DDEBUGGING
5412: -DEBUGGING=-g or -Doptimize=-g = -g
5413: -DEBUGGING=none or -UDEBUGGING =
5414: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
5415case "$EBUGGING" in
5416'') ;;
5417*) DEBUGGING=$EBUGGING ;;
5418esac
5419
5420case "$DEBUGGING" in
5421-g|both|$define)
5422 case "$optimize" in
5423 *-g*) ;;
5424 *) optimize="$optimize -g" ;;
5425 esac ;;
5426none|$undef)
5427 case "$optimize" in
5428 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5429 shift
5430 optimize="$*"
5431 ;;
5432 esac ;;
5433esac
5434
5435dflt=''
5436case "$DEBUGGING" in
5437both|$define) dflt='-DDEBUGGING'
5438esac
5439
5440: argument order is deliberate, as the flag will start with - which set could
5441: think is an option
5442checkccflag='check=$1; flag=$2; callback=$3;
5443echo " ";
5444echo "Checking if your compiler accepts $flag" 2>&1;
5445[ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5446echo "int main(void) { return 0; }" > gcctest.c;
5447if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5448 echo "Yes, it does." 2>&1;
5449 if $test -s gcctest.out ; then
5450 echo "But your platform does not like it:";
5451 cat gcctest.out;
5452 else
5453 case "$ccflags" in
5454 *$check*)
5455 echo "Leaving current flags $ccflags alone." 2>&1
5456 ;;
5457 *) dflt="$dflt $flag";
5458 eval $callback
5459 ;;
5460 esac
5461 fi
5462else
5463 echo "Nope, it does not, but that is ok." 2>&1;
5464fi
5465'
5466
5467: We will not override a previous value, but we might want to
5468: augment a hint file
5469case "$hint" in
5470default|recommended)
5471 case "$gccversion" in
5472 1.*) dflt="$dflt -fpcc-struct-return" ;;
5473 esac
5474 case "$optimize:$DEBUGGING" in
5475 *-g*:old) dflt="$dflt -DDEBUGGING";;
5476 esac
5477 case "$gccversion" in
5478 2.*) if $test -d /etc/conf/kconfig.d &&
5479 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5480 then
5481 # Interactive Systems (ISC) POSIX mode.
5482 dflt="$dflt -posix"
5483 fi
5484 ;;
5485 esac
5486 case "$gccversion" in
5487 1.*) ;;
5488 2.[0-8]*) ;;
5489 ?*) set strict-aliasing -fno-strict-aliasing
5490 eval $checkccflag
5491 ;;
5492 esac
5493 # For gcc, adding -pipe speeds up compilations for some, but apparently
5494 # some assemblers can't read from stdin. (It also slows down compilations
5495 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5496 case "$gccversion" in
5497 ?*) set pipe -pipe
5498 eval $checkccflag
5499 ;;
5500 esac
5501
5502 # on x86_64 (at least) we require an extra library (libssp) in the
5503 # link command line. This library is not named, so I infer that it is
5504 # an implementation detail that may change. Hence the safest approach
5505 # is to add the flag to the flags passed to the compiler at link time,
5506 # as that way the compiler can do the right implementation dependant
5507 # thing. (NWC)
5508 case "$osname" in
5509 amigaos) ;; # -fstack-protector builds but doesn't work
5510 *) case "$gccversion" in
5511 ?*) set stack-protector-strong -fstack-protector-strong
5512 eval $checkccflag
5513 case "$dflt" in
5514 *-fstack-protector-strong*) ;; # It got added.
5515 *) # Try the plain/older -fstack-protector.
5516 set stack-protector -fstack-protector
5517 eval $checkccflag
5518 ;;
5519 esac
5520 ;;
5521 esac
5522 ;;
5523 esac
5524 ;;
5525esac
5526
5527case "$mips_type" in
5528*BSD*|'') inclwanted="$locincpth $usrinc";;
5529*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5530esac
5531for thisincl in $inclwanted; do
5532 if $test -d $thisincl; then
5533 if $test x$thisincl != x$usrinc; then
5534 case "$dflt" in
5535 *" -I$thisincl "*);;
5536 *) dflt="$dflt -I$thisincl ";;
5537 esac
5538 fi
5539 fi
5540done
5541
5542inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5543 xxx=true;
5544elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5545 xxx=true;
5546else
5547 xxx=false;
5548fi;
5549if $xxx; then
5550 case "$dflt" in
5551 *$2*);;
5552 *) dflt="$dflt -D$2";;
5553 esac;
5554fi'
5555
5556set signal.h LANGUAGE_C; eval $inctest
5557
5558case "$usesocks" in
5559$define)
5560 ccflags="$ccflags -DSOCKS"
5561 ;;
5562esac
5563
5564case "$hint" in
5565default|recommended) dflt="$ccflags $dflt" ;;
5566*) dflt="$ccflags";;
5567esac
5568
5569case "$dflt" in
5570''|' ') dflt=none;;
5571esac
5572
5573$cat <<EOH
5574
5575Your C compiler may want other flags. For this question you should include
5576-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5577but you should NOT include libraries or ld flags like -lwhatever. If you
5578want $package to honor its debug switch, you should include -DDEBUGGING here.
5579Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5580
5581To use no flags, specify the word "none".
5582
5583EOH
5584set X $dflt
5585shift
5586dflt=${1+"$@"}
5587rp="Any additional cc flags?"
5588. ./myread
5589case "$ans" in
5590none) ccflags='';;
5591*) ccflags="$ans";;
5592esac
5593
5594: the following weeds options from ccflags that are of no interest to cpp
5595case "$cppflags" in
5596'') cppflags="$ccflags" ;;
5597*) set X $ccflags; shift
5598 case " $cppflags " in
5599 *" $1 "*) ;; # Try to avoid doubling the cppflags.
5600 *) cppflags="$cppflags $ccflags" ;;
5601 esac
5602 ;;
5603esac
5604case "$gccversion" in
56051.*) cppflags="$cppflags -D__GNUC__"
5606esac
5607case "$mips_type" in
5608'');;
5609*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5610esac
5611case "$cppflags" in
5612'');;
5613*)
5614 echo " "
5615 echo "Let me guess what the preprocessor flags are..." >&4
5616 set X $cppflags
5617 shift
5618 cppflags=''
5619 $cat >cpp.c <<'EOM'
5620#define BLURFL foo
5621
5622BLURFL xx LFRULB
5623EOM
5624 previous=''
5625 for flag in $*
5626 do
5627 case "$flag" in
5628 -*) ftry="$flag";;
5629 *) ftry="$previous $flag";;
5630 esac
5631 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5632 >cpp1.out 2>/dev/null && \
5633 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5634 >cpp2.out 2>/dev/null && \
5635 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5636 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5637 then
5638 cppflags="$cppflags $ftry"
5639 previous=''
5640 else
5641 previous="$flag"
5642 fi
5643 done
5644 set X $cppflags
5645 shift
5646 cppflags=${1+"$@"}
5647 case "$cppflags" in
5648 *-*) echo "They appear to be: $cppflags";;
5649 esac
5650 $rm -f cpp.c cpp?.out
5651 ;;
5652esac
5653
5654: flags used in final linking phase
5655case "$ldflags" in
5656'') if ./venix; then
5657 dflt='-i -z'
5658 else
5659 dflt=''
5660 fi
5661 case "$ccflags" in
5662 *-posix*) dflt="$dflt -posix" ;;
5663 esac
5664 ;;
5665*) dflt="$ldflags";;
5666esac
5667# See note above about -fstack-protector
5668case "$ccflags" in
5669*-fstack-protector-strong*)
5670 case "$dflt" in
5671 *-fstack-protector-strong*) ;; # Don't add it again
5672 *) dflt="$dflt -fstack-protector-strong" ;;
5673 esac
5674 ;;
5675*-fstack-protector*)
5676 case "$dflt" in
5677 *-fstack-protector*) ;; # Don't add it again
5678 *) dflt="$dflt -fstack-protector" ;;
5679 esac
5680 ;;
5681esac
5682
5683: Try to guess additional flags to pick up local libraries.
5684for thislibdir in $libpth; do
5685 case " $loclibpth " in
5686 *" $thislibdir "*)
5687 case "$dflt " in
5688 *"-L$thislibdir "*) ;;
5689 *) dflt="$dflt -L$thislibdir" ;;
5690 esac
5691 ;;
5692 esac
5693done
5694
5695case "$dflt" in
5696'') dflt='none' ;;
5697esac
5698
5699$cat <<EOH
5700
5701Your C linker may need flags. For this question you should
5702include -L/whatever and any other flags used by the C linker, but you
5703should NOT include libraries like -lwhatever.
5704
5705Make sure you include the appropriate -L/path flags if your C linker
5706does not normally search all of the directories you specified above,
5707namely
5708 $libpth
5709To use no flags, specify the word "none".
5710
5711EOH
5712
5713rp="Any additional ld flags (NOT including libraries)?"
5714. ./myread
5715case "$ans" in
5716none) ldflags='';;
5717*) ldflags="$ans";;
5718esac
5719rmlist="$rmlist pdp11"
5720
5721: coherency check
5722echo " "
5723echo "Checking your choice of C compiler and flags for coherency..." >&4
5724$cat > try.c <<'EOF'
5725#include <stdio.h>
5726int main() { printf("Ok\n"); return(0); }
5727EOF
5728set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5729shift
5730$cat >try.msg <<'EOM'
5731I've tried to compile and run the following simple program:
5732
5733EOM
5734$cat try.c >> try.msg
5735
5736$cat >> try.msg <<EOM
5737
5738I used the command:
5739
5740 $*
5741 $run ./try
5742
5743and I got the following output:
5744
5745EOM
5746dflt=y
5747if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5748 if $sh -c "$run ./try " >>try.msg 2>&1; then
5749 xxx=`$run ./try`
5750 case "$xxx" in
5751 "Ok") dflt=n ;;
5752 *) echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5753 esac
5754 else
5755 echo "The program compiled OK, but exited with status $?." >>try.msg
5756 rp="You have a problem. Shall I abort Configure"
5757 dflt=y
5758 fi
5759else
5760 echo "I can't compile the test program." >>try.msg
5761 rp="You have a BIG problem. Shall I abort Configure"
5762 dflt=y
5763fi
5764case "$dflt" in
5765y)
5766 $cat try.msg >&4
5767 case "$knowitall" in
5768 '')
5769 echo "(The supplied flags or libraries might be incorrect.)"
5770 ;;
5771 *) dflt=n;;
5772 esac
5773 echo " "
5774 . ./myread
5775 case "$ans" in
5776 n*|N*) ;;
5777 *) echo "Ok. Stopping Configure." >&4
5778 exit 1
5779 ;;
5780 esac
5781 ;;
5782n) echo "OK, that should do.";;
5783esac
5784$rm_try gcctest gcctest.out
5785
5786: define a shorthand compile call
5787compile='
5788mc_file=$1;
5789shift;
5790case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5791echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to https://github.com/Perl/perl5/issues" >&4;
5792exit 1;
5793fi;
5794esac;
5795$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5796: define a shorthand compile call for compilations that should be ok.
5797compile_ok='
5798mc_file=$1;
5799shift;
5800$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5801
5802: stub, used only to satisfy other units
5803i_stdlib='define'
5804
5805: check for lengths of integral types
5806echo " "
5807case "$intsize" in
5808'')
5809 echo "Checking to see how big your integers are..." >&4
5810 $cat >try.c <<EOCP
5811#include <stdio.h>
5812#$i_stdlib I_STDLIB
5813#ifdef I_STDLIB
5814#include <stdlib.h>
5815#endif
5816int main()
5817{
5818 printf("intsize=%d;\n", (int)sizeof(int));
5819 printf("longsize=%d;\n", (int)sizeof(long));
5820 printf("shortsize=%d;\n", (int)sizeof(short));
5821 exit(0);
5822}
5823EOCP
5824 set try
5825 if eval $compile_ok && $run ./try > /dev/null; then
5826 eval `$run ./try`
5827 echo "Your integers are $intsize bytes long."
5828 echo "Your long integers are $longsize bytes long."
5829 echo "Your short integers are $shortsize bytes long."
5830 else
5831 $cat >&4 <<EOM
5832!
5833Help! I can't compile and run the intsize test program: please enlighten me!
5834(This is probably a misconfiguration in your system or libraries, and
5835you really ought to fix it. Still, I'll try anyway.)
5836!
5837EOM
5838 dflt=4
5839 rp="What is the size of an integer (in bytes)?"
5840 . ./myread
5841 intsize="$ans"
5842 dflt=$intsize
5843 rp="What is the size of a long integer (in bytes)?"
5844 . ./myread
5845 longsize="$ans"
5846 dflt=2
5847 rp="What is the size of a short integer (in bytes)?"
5848 . ./myread
5849 shortsize="$ans"
5850 fi
5851 ;;
5852esac
5853$rm_try
5854
5855: check for long long
5856echo " "
5857echo "Checking to see if you have long long..." >&4
5858echo 'int main() { long long x = 7; return 0; }' > try.c
5859set try
5860if eval $compile; then
5861 val="$define"
5862 echo "You have long long."
5863else
5864 val="$undef"
5865 echo "You do not have long long."
5866fi
5867$rm_try
5868set d_longlong
5869eval $setvar
5870
5871: check for length of long long
5872case "${d_longlong}${longlongsize}" in
5873$define)
5874 echo " "
5875 echo "Checking to see how big your long longs are..." >&4
5876 $cat >try.c <<'EOCP'
5877#include <stdio.h>
5878int main()
5879{
5880 printf("%d\n", (int)sizeof(long long));
5881 return(0);
5882}
5883EOCP
5884 set try
5885 if eval $compile_ok; then
5886 longlongsize=`$run ./try`
5887 echo "Your long longs are $longlongsize bytes long."
5888 else
5889 dflt='8'
5890 echo " "
5891 echo "(I can't seem to compile the test program. Guessing...)"
5892 rp="What is the size of a long long (in bytes)?"
5893 . ./myread
5894 longlongsize="$ans"
5895 fi
5896 if $test "X$longsize" = "X$longlongsize"; then
5897 echo "(That isn't any different from an ordinary long.)"
5898 fi
5899 ;;
5900esac
5901$rm_try
5902
5903: determine filename position in cpp output
5904echo " "
5905echo "Computing filename position in cpp output for #include directives..." >&4
5906case "$osname" in
5907amigaos) fieldn=3 ;; # Workaround for a bug in abc (pdksh).
5908esac
5909case "$fieldn" in
5910'')
5911case "$osname" in
5912vos) testaccess=-e ;;
5913*) testaccess=-r ;;
5914esac
5915echo '#include <stdio.h>' > foo.c
5916$cat >fieldn <<EOF
5917$startsh
5918$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5919$grep '^[ ]*#.*stdio\.h' | \
5920while read cline; do
5921 pos=1
5922 set \$cline
5923 while $test \$# -gt 0; do
5924 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5925 echo "\$pos"
5926 exit 0
5927 fi
5928 shift
5929 pos=\`expr \$pos + 1\`
5930 done
5931done
5932EOF
5933chmod +x fieldn
5934fieldn=`./fieldn`
5935$rm -f foo.c fieldn
5936;;
5937esac
5938case $fieldn in
5939'') pos='???';;
59401) pos=first;;
59412) pos=second;;
59423) pos=third;;
5943*) pos="${fieldn}th";;
5944esac
5945echo "Your cpp writes the filename in the $pos field of the line."
5946
5947: locate header file
5948$cat >findhdr <<EOF
5949$startsh
5950wanted=\$1
5951name=''
5952for usrincdir in $incpth
5953do
5954 if test -f \$usrincdir/\$wanted; then
5955 echo "\$usrincdir/\$wanted"
5956 exit 0
5957 fi
5958done
5959awkprg='{ print \$$fieldn }'
5960echo "#include <\$wanted>" > foo\$\$.c
5961$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5962$cppfilter $grep "^[ ]*#.*\$wanted" | \
5963while read cline; do
5964 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5965 case "\$name" in
5966 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5967 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5968 *) exit 2;;
5969 esac;
5970done;
5971#
5972# status = 0: grep returned 0 lines, case statement not executed
5973# status = 1: headerfile found
5974# status = 2: while loop executed, no headerfile found
5975#
5976status=\$?
5977$rm -f foo\$\$.c;
5978if test \$status -eq 1; then
5979 exit 0;
5980fi
5981exit 1
5982EOF
5983chmod +x findhdr
5984
5985: define an alternate in-header-list? function
5986inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5987cont=true; xxf="echo \"<\$1> found.\" >&4";
5988case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5989*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5990esac;
5991case $# in 4) instead=instead;; *) instead="at last";; esac;
5992while $test "$cont"; do
5993 xxx=`./findhdr $1`
5994 var=$2; eval "was=\$$2";
5995 if $test "$xxx" && $test -r "$xxx";
5996 then eval $xxf;
5997 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5998 cont="";
5999 else eval $xxnf;
6000 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
6001 set $yyy; shift; shift; yyy=$@;
6002 case $# in 0) cont="";;
6003 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
6004 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
6005 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
6006 xxnf="echo \"there is no <\$1>, ...\" >&4";;
6007 esac;
6008done;
6009while $test "$yyy";
6010do set $yyy; var=$2; eval "was=\$$2";
6011 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
6012 set $yyy; shift; shift; yyy=$@;
6013done'
6014
6015: see if inttypes.h is available
6016: we want a real compile instead of Inhdr because some systems
6017: have an inttypes.h which includes non-existent headers
6018echo " "
6019$cat >try.c <<EOCP
6020#include <inttypes.h>
6021int main() {
6022 static int32_t foo32 = 0x12345678;
6023}
6024EOCP
6025set try
6026if eval $compile; then
6027 echo "<inttypes.h> found." >&4
6028 val="$define"
6029else
6030 echo "<inttypes.h> NOT found." >&4
6031 val="$undef"
6032fi
6033$rm_try
6034set i_inttypes
6035eval $setvar
6036
6037: check for int64_t
6038echo " "
6039echo "Checking to see if you have int64_t..." >&4
6040$cat >try.c <<EOCP
6041#include <sys/types.h>
6042#$i_inttypes I_INTTYPES
6043#ifdef I_INTTYPES
6044#include <inttypes.h>
6045#endif
6046int main() { int64_t x = 7; }
6047EOCP
6048set try
6049if eval $compile; then
6050 val="$define"
6051 echo "You have int64_t."
6052else
6053 val="$undef"
6054 echo "You do not have int64_t."
6055fi
6056$rm_try
6057set d_int64_t
6058eval $setvar
6059
6060: Check if 64bit ints have a quad type
6061echo " "
6062echo "Checking which 64-bit integer type we could use..." >&4
6063
6064case "$intsize" in
60658) val=int
6066 set quadtype
6067 eval $setvar
6068 val='"unsigned int"'
6069 set uquadtype
6070 eval $setvar
6071 quadkind=1
6072 ;;
6073*) case "$longsize" in
6074 8) val=long
6075 set quadtype
6076 eval $setvar
6077 val='"unsigned long"'
6078 set uquadtype
6079 eval $setvar
6080 quadkind=2
6081 ;;
6082 *) case "$d_longlong:$longlongsize" in
6083 define:8)
6084 val='"long long"'
6085 set quadtype
6086 eval $setvar
6087 val='"unsigned long long"'
6088 set uquadtype
6089 eval $setvar
6090 quadkind=3
6091 ;;
6092 *) case "$d_int64_t" in
6093 define)
6094 val=int64_t
6095 set quadtype
6096 eval $setvar
6097 val=uint64_t
6098 set uquadtype
6099 eval $setvar
6100 quadkind=4
6101 ;;
6102 esac
6103 ;;
6104 esac
6105 ;;
6106 esac
6107 ;;
6108esac
6109
6110case "$quadtype" in
6111'') echo "Alas, no 64-bit integer types in sight." >&4
6112 d_quad="$undef"
6113 ;;
6114*) echo "We could use '$quadtype' for 64-bit integers." >&4
6115 d_quad="$define"
6116 ;;
6117esac
6118
6119: Do we want 64bit support
6120case "$uselonglong" in
6121"$define"|true|[yY]*)
6122 cat <<EOM >&4
6123
6124*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6125EOM
6126 use64bitint="$define"
6127 ;;
6128esac
6129case "$use64bits" in
6130"$define"|true|[yY]*)
6131 cat <<EOM >&4
6132
6133*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6134EOM
6135 use64bitint="$define"
6136 ;;
6137esac
6138case "$use64bitints" in
6139"$define"|true|[yY]*)
6140 cat <<EOM >&4
6141
6142*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6143EOM
6144 use64bitint="$define"
6145 ;;
6146esac
6147case "$use64bitsint" in
6148"$define"|true|[yY]*)
6149 cat <<EOM >&4
6150
6151*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6152EOM
6153 use64bitint="$define"
6154 ;;
6155esac
6156case "$uselonglongs" in
6157"$define"|true|[yY]*)
6158 cat <<EOM >&4
6159
6160*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6161EOM
6162 use64bitint="$define"
6163 ;;
6164esac
6165case "$use64bitsall" in
6166"$define"|true|[yY]*)
6167 cat <<EOM >&4
6168
6169*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6170EOM
6171 use64bitall="$define"
6172 ;;
6173esac
6174
6175case "$ccflags" in
6176*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6177esac
6178case "$use64bitall" in
6179"$define"|true|[yY]*) use64bitint="$define" ;;
6180esac
6181
6182case "$longsize" in
61838) cat <<EOM
6184
6185You have natively 64-bit long integers.
6186EOM
6187 val="$define"
6188 ;;
6189*) case "$use64bitint" in
6190 "$define"|true|[yY]*) dflt='y';;
6191 *) dflt='n';;
6192 esac
6193 case "$d_quad" in
6194 "$define") ;;
6195 *) dflt='n' ;;
6196 esac
6197 cat <<EOM
6198
6199Perl can be built to take advantage of 64-bit integer types
6200on some systems. To do so, Configure can be run with -Duse64bitint.
6201Choosing this option will most probably introduce binary incompatibilities.
6202
6203If this doesn't make any sense to you, just accept the default '$dflt'.
6204(The default has been chosen based on your configuration.)
6205EOM
6206 rp='Try to use 64-bit integers, if available?'
6207 . ./myread
6208 case "$ans" in
6209 [yY]*) val="$define" ;;
6210 *) val="$undef" ;;
6211 esac
6212 ;;
6213esac
6214set use64bitint
6215eval $setvar
6216
6217case "$use64bitall" in
6218"$define"|true|[yY]*) dflt='y' ;;
6219*) case "$longsize" in
6220 8) dflt='y' ;;
6221 *) dflt='n' ;;
6222 esac
6223 ;;
6224esac
6225cat <<EOM
6226
6227You may also choose to try maximal 64-bitness. It means using as much
622864-bitness as possible on the platform. This in turn means even more
6229binary incompatibilities. On the other hand, your platform may not
6230have any more 64-bitness available than what you already have chosen.
6231
6232If this doesn't make any sense to you, just accept the default '$dflt'.
6233(The default has been chosen based on your configuration.)
6234EOM
6235rp='Try to use maximal 64-bit support, if available?'
6236. ./myread
6237case "$ans" in
6238[yY]*) val="$define" ;;
6239*) val="$undef" ;;
6240esac
6241set use64bitall
6242eval $setvar
6243case "$use64bitall" in
6244"$define")
6245 case "$use64bitint" in
6246 "$undef")
6247 cat <<EOM
6248
6249Since you have chosen a maximally 64-bit build, I'm also turning on
6250the use of 64-bit integers.
6251EOM
6252 use64bitint="$define" ;;
6253 esac
6254 ;;
6255esac
6256
6257: Look for a hint-file generated 'call-back-unit'. If the
6258: user has specified that a 64-bit perl is to be built,
6259: we may need to set or change some other defaults.
6260if $test -f use64bitint.cbu; then
6261 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6262 . ./use64bitint.cbu
6263fi
6264case "$use64bitint" in
6265"$define"|true|[yY]*)
6266 : This test was common to all the OpenBSD forks, and seems harmless for
6267 : other platforms:
6268 echo " "
6269 echo "Checking if your C library has broken 64-bit functions..." >&4
6270 cat >try.c <<EOCP
6271#include <stdio.h>
6272typedef $uquadtype myULL;
6273int main (void)
6274{
6275 struct {
6276 double d;
6277 myULL u;
6278 } *p, test[] = {
6279 {4294967303.15, 4294967303ULL},
6280 {4294967294.2, 4294967294ULL},
6281 {4294967295.7, 4294967295ULL},
6282 {0.0, 0ULL}
6283 };
6284 for (p = test; p->u; p++) {
6285 myULL x = (myULL)p->d;
6286 if (x != p->u) {
6287 printf("buggy\n");
6288 return 0;
6289 }
6290 }
6291 printf("ok\n");
6292 return 0;
6293}
6294EOCP
6295 set try
6296 if eval $compile_ok; then
6297 libcquad=`$run ./try`
6298 echo "Your C library's 64-bit functions are $libcquad."
6299 else
6300 echo "(I can't seem to compile the test program.)"
6301 echo "Assuming that your C library's 64-bit functions are ok."
6302 libcquad="ok"
6303 fi
6304 $rm_try
6305
6306 case "$libcquad" in
6307 buggy*)
6308 cat >&4 <<EOM
6309
6310*** You have a C library with broken 64-bit functions.
6311*** 64-bit support does not work reliably in this configuration.
6312*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6313*** Cannot continue, aborting.
6314
6315EOM
6316 exit 1
6317 ;;
6318 esac
6319 case "$longsize" in
6320 4) case "$archname64" in
6321 '') archname64=64int ;;
6322 esac
6323 ;;
6324 esac
6325 ;;
6326esac
6327
6328: Look for a hint-file generated 'call-back-unit'. If the
6329: user has specified that a maximally 64-bit perl is to be built,
6330: we may need to set or change some other defaults.
6331if $test -f use64bitall.cbu; then
6332 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6333 . ./use64bitall.cbu
6334fi
6335case "$use64bitall" in
6336"$define"|true|[yY]*)
6337 case "$longsize" in
6338 4) case "$archname64" in
6339 ''|64int) archname64=64all ;;
6340 esac
6341 ;;
6342 esac
6343 ;;
6344esac
6345
6346case "$d_quad:$use64bitint" in
6347$undef:$define)
6348 cat >&4 <<EOF
6349
6350*** You have chosen to use 64-bit integers,
6351*** but none can be found.
6352*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6353*** Cannot continue, aborting.
6354
6355EOF
6356 exit 1
6357 ;;
6358esac
6359
6360: Check if we are using the GNU C library
6361echo " "
6362echo "Checking for GNU C Library..." >&4
6363cat >try.c <<'EOCP'
6364/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
6365 alone are insufficient to distinguish different versions, such as
6366 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
6367 libc version 2.1.0. A. Dougherty, June 3, 2002.
6368*/
6369#include <stdio.h>
6370int main(void)
6371{
6372#ifdef __GLIBC__
6373# ifdef __GLIBC_MINOR__
6374# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6375# include <gnu/libc-version.h>
6376 printf("%s\n", gnu_get_libc_version());
6377# else
6378 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
6379# endif
6380# else
6381 printf("%d\n", __GLIBC__);
6382# endif
6383 return 0;
6384#else
6385 return 1;
6386#endif
6387}
6388EOCP
6389set try
6390if eval $compile_ok && $run ./try > glibc.ver; then
6391 val="$define"
6392 gnulibc_version=`$cat glibc.ver`
6393 echo "You are using the GNU C Library version $gnulibc_version"
6394else
6395 val="$undef"
6396 gnulibc_version=''
6397 echo "You are not using the GNU C Library"
6398fi
6399$rm_try glibc.ver
6400set d_gnulibc
6401eval $setvar
6402
6403: see if nm is to be used to determine whether a symbol is defined or not
6404case "$usenm" in
6405'')
6406 dflt=''
6407 case "$d_gnulibc" in
6408 "$define")
6409 echo " "
6410 echo "nm probably won't work on the GNU C Library." >&4
6411 dflt=n
6412 ;;
6413 esac
6414 case "$dflt" in
6415 '')
6416 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6417 echo " "
6418 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
6419 echo "'nm' won't be sufficient on this system." >&4
6420 dflt=n
6421 fi
6422 ;;
6423 esac
6424 case "$dflt" in
6425 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6426 if $test $dflt -gt 20; then
6427 dflt=y
6428 else
6429 dflt=n
6430 fi
6431 ;;
6432 esac
6433 ;;
6434*)
6435 case "$usenm" in
6436 true|$define) dflt=y;;
6437 *) dflt=n;;
6438 esac
6439 ;;
6440esac
6441$cat <<EOM
6442
6443I can use $nm to extract the symbols from your C libraries. This
6444is a time consuming task which may generate huge output on the disk (up
6445to 3 megabytes) but that should make the symbols extraction faster. The
6446alternative is to skip the 'nm' extraction part and to compile a small
6447test program instead to determine whether each symbol is present. If
6448you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6449this may be the best solution.
6450
6451You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6452
6453EOM
6454rp="Shall I use $nm to extract C symbols from the libraries?"
6455. ./myread
6456case "$ans" in
6457[Nn]*) usenm=false;;
6458*) usenm=true;;
6459esac
6460
6461runnm=$usenm
6462case "$reuseval" in
6463true) runnm=false;;
6464esac
6465
6466: nm options which may be necessary
6467case "$nm_opt" in
6468'') if $test -f /mach_boot; then
6469 nm_opt='' # Mach
6470 elif $test -d /usr/ccs/lib; then
6471 nm_opt='-p' # Solaris (and SunOS?)
6472 elif $test -f /dgux; then
6473 nm_opt='-p' # DG-UX
6474 elif $test -f /lib64/rld; then
6475 nm_opt='-p' # 64-bit Irix
6476 else
6477 nm_opt=''
6478 fi;;
6479esac
6480
6481: nm options which may be necessary for shared libraries but illegal
6482: for archive libraries. Thank you, Linux.
6483case "$nm_so_opt" in
6484'') case "$myuname" in
6485 *linux*|gnu*)
6486 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6487 nm_so_opt='--dynamic'
6488 fi
6489 ;;
6490 esac
6491 ;;
6492esac
6493
6494: Figure out where the libc is located
6495case "$runnm" in
6496true)
6497: get list of predefined functions in a handy place
6498echo " "
6499case "$libc" in
6500'') libc=unknown
6501 case "$libs" in
6502 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6503 esac
6504 ;;
6505esac
6506case "$libs" in
6507'') ;;
6508*) for thislib in $libs; do
6509 case "$thislib" in
6510 -lc|-lc_s)
6511 : Handle C library specially below.
6512 ;;
6513 -l*)
6514 thislib=`echo $thislib | $sed -e 's/^-l//'`
6515 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6516 :
6517 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6518 :
6519 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6520 :
6521 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6522 :
6523 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6524 :
6525 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6526 :
6527 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6528 :
6529 else
6530 try=''
6531 fi
6532 libnames="$libnames $try"
6533 ;;
6534 *) libnames="$libnames $thislib" ;;
6535 esac
6536 done
6537 ;;
6538esac
6539xxx=normal
6540case "$libc" in
6541unknown)
6542 set /lib/libc.$so
6543 for xxx in $libpth; do
6544 $test -r $1 || set $xxx/libc.$so
6545 : The messy sed command sorts on library version numbers.
6546 $test -r $1 || \
6547 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6548 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6549 h
6550 s/[0-9][0-9]*/0000&/g
6551 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6552 G
6553 s/\n/ /' | \
6554 $sort | $sed -e 's/^.* //'`
6555 eval set \$$#
6556 done
6557 $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6558 $test -r $1 || set $sysroot/lib/libsys_s$_a
6559 ;;
6560*)
6561 set blurfl
6562 ;;
6563esac
6564if $test -r "$1"; then
6565 echo "Your (shared) C library seems to be in $1."
6566 libc="$1"
6567elif $test -r /lib/libc && $test -r /lib/clib; then
6568 echo "Your C library seems to be in both /lib/clib and /lib/libc."
6569 xxx=apollo
6570 libc='/lib/clib /lib/libc'
6571 if $test -r /lib/syslib; then
6572 echo "(Your math library is in /lib/syslib.)"
6573 libc="$libc /lib/syslib"
6574 fi
6575elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6576 echo "Your C library seems to be in $libc, as you said before."
6577elif $test -r $incpath/usr/lib/libc$_a; then
6578 libc=$incpath/usr/lib/libc$_a;
6579 echo "Your C library seems to be in $libc. That's fine."
6580elif $test -r /lib/libc$_a; then
6581 libc=/lib/libc$_a;
6582 echo "Your C library seems to be in $libc. You're normal."
6583else
6584 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6585 :
6586 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6587 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6588 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6589 :
6590 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6591 :
6592 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6593 :
6594 else
6595 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6596 fi
6597 if $test -r "$tans"; then
6598 echo "Your C library seems to be in $tans, of all places."
6599 libc=$tans
6600 else
6601 libc='blurfl'
6602 fi
6603fi
6604if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6605 dflt="$libc"
6606 cat <<EOM
6607
6608If the guess above is wrong (which it might be if you're using a strange
6609compiler, or your machine supports multiple models), you can override it here.
6610
6611EOM
6612else
6613 dflt=''
6614 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6615 cat >&4 <<EOM
6616I can't seem to find your C library. I've looked in the following places:
6617
6618EOM
6619 $sed 's/^/ /' libpath
6620 cat <<EOM
6621
6622None of these seems to contain your C library. I need to get its name...
6623
6624EOM
6625fi
6626fn=f
6627rp='Where is your C library?'
6628. ./getfile
6629libc="$ans"
6630
6631echo " "
6632echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6633set X `cat libnames`
6634shift
6635xxx=files
6636case $# in 1) xxx=file; esac
6637echo "Extracting names from the following $xxx for later perusal:" >&4
6638echo " "
6639$sed 's/^/ /' libnames >&4
6640echo " "
6641$echo $n "This may take a while...$c" >&4
6642
6643for file in $*; do
6644 case $file in
6645 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6646 *) $nm $nm_opt $file 2>/dev/null;;
6647 esac
6648done >libc.tmp
6649
6650$echo $n ".$c"
6651$grep fprintf libc.tmp > libc.ptf
6652xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6653xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6654xxx='[ADTSIWi]'
6655if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
6656 eval $xscan;\
6657 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6658 eval $xrun
6659elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6660 eval $xscan;\
6661 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6662 eval $xrun
6663elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6664 eval $xscan;\
6665 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6666 eval $xrun
6667elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6668 eval $xscan;\
6669 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6670 eval $xrun
6671elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6672 eval $xscan;\
6673 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6674 eval $xrun
6675elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6676 eval $xscan;\
6677 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6678 eval $xrun
6679elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6680 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
6681 eval $xscan;\
6682 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6683 eval $xrun
6684elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6685 eval $xscan;\
6686 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6687 eval $xrun
6688elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6689 eval $xscan;\
6690 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6691 eval $xrun
6692elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6693 eval $xscan;\
6694 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6695 eval $xrun
6696elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6697 eval $xscan;\
6698 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6699 eval $xrun
6700elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6701 eval $xscan;\
6702 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6703 eval $xrun
6704elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6705 eval $xscan;\
6706 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6707 eval $xrun
6708elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
6709 eval $xscan;\
6710 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6711 eval $xrun
6712else
6713 $nm -p $* 2>/dev/null >libc.tmp
6714 $grep fprintf libc.tmp > libc.ptf
6715 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6716 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6717 then
6718 nm_opt='-p'
6719 eval $xrun
6720 else
6721 echo " "
6722 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6723 com=''
6724 if $ar t $libc > libc.tmp && \
6725 $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6726 then
6727 for thisname in $libnames $libc; do
6728 $ar t $thisname >>libc.tmp
6729 done
6730 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6731 echo "Ok." >&4
6732 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6733 for thisname in $libnames $libc; do
6734 $ar tv $thisname >>libc.tmp
6735 emximp -o tmp.imp $thisname \
6736 2>/dev/null && \
6737 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6738 < tmp.imp >>libc.tmp
6739 $rm -f tmp.imp
6740 done
6741 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6742 echo "Ok." >&4
6743 else
6744 echo "$ar didn't seem to work right." >&4
6745 echo "Maybe this is a Cray...trying bld instead..." >&4
6746 if bld t $libc | \
6747 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6748 $test -s libc.list
6749 then
6750 for thisname in $libnames; do
6751 bld t $libnames | \
6752 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6753 $ar t $thisname >>libc.tmp
6754 done
6755 echo "Ok." >&4
6756 else
6757 echo "That didn't work either. Giving up." >&4
6758 exit 1
6759 fi
6760 fi
6761 fi
6762fi
6763nm_extract="$com"
6764case "$PASE" in
6765define)
6766 echo " "
6767 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6768 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6769 ;;
6770*) if $test -f /lib/syscalls.exp; then
6771 echo " "
6772 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6773 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \
6774 /lib/syscalls.exp >>libc.list
6775 fi
6776 ;;
6777esac
6778;;
6779esac
6780$rm -f libnames libpath
6781
6782: Check if we are using C++
6783echo " "
6784echo "Checking for C++..." >&4
6785$cat >try.c <<'EOCP'
6786#include <stdio.h>
6787int main(void)
6788{
6789#ifdef __cplusplus
6790 return 0;
6791#else
6792 return 1;
6793#endif
6794}
6795EOCP
6796set try
6797if eval $compile_ok && $run ./try; then
6798 val="$define"
6799 echo "You are using a C++ compiler."
6800else
6801 val="$undef"
6802 echo "You are not using a C++ compiler."
6803fi
6804$rm_try cplusplus$$
6805set d_cplusplus
6806eval $setvar
6807
6808: is a C symbol defined?
6809csym='tlook=$1;
6810case "$3" in
6811-v) tf=libc.tmp; tdc="";;
6812-a) tf=libc.tmp; tdc="[]";;
6813*) tlook="^$1\$"; tf=libc.list; tdc="()";;
6814esac;
6815case "$d_cplusplus" in
6816 $define) extern_C="extern \"C\"" ;;
6817 *) extern_C="extern" ;;
6818esac;
6819tx=yes;
6820case "$reuseval-$4" in
6821true-) ;;
6822true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6823esac;
6824case "$tx" in
6825yes)
6826 tval=false;
6827 if $test "$runnm" = true; then
6828 if $contains $tlook $tf >/dev/null 2>&1; then
6829 tval=true;
6830 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6831 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main(int argc, char **argv) { if(p() && p() != (void *)argv[0]) return(0); else return(1); }"> try.c;
6832 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6833 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6834 $rm_try;
6835 fi;
6836 else
6837 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main(int argc, char **argv) { if(p() && p() != (void *)argv[0]) return(0); else return(1); }"> try.c;
6838 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6839 $rm_try;
6840 fi;
6841 ;;
6842*)
6843 case "$tval" in
6844 $define) tval=true;;
6845 *) tval=false;;
6846 esac;
6847 ;;
6848esac;
6849eval "$2=$tval"'
6850
6851: define an is-in-libc? function
6852inlibc='echo " "; td=$define; tu=$undef;
6853sym=$1; var=$2; eval "was=\$$2";
6854tx=yes;
6855case "$reuseval$was" in
6856true) ;;
6857true*) tx=no;;
6858esac;
6859case "$tx" in
6860yes)
6861 set $sym tres -f;
6862 eval $csym;
6863 case "$tres" in
6864 true)
6865 echo "$sym() found." >&4;
6866 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6867 *)
6868 echo "$sym() NOT found." >&4;
6869 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6870 esac;;
6871*)
6872 case "$was" in
6873 $define) echo "$sym() found." >&4;;
6874 *) echo "$sym() NOT found." >&4;;
6875 esac;;
6876esac'
6877
6878: check for length of double
6879echo " "
6880case "$doublesize" in
6881'')
6882 echo "Checking to see how big your double precision numbers are..." >&4
6883 $cat >try.c <<EOCP
6884#include <stdio.h>
6885#$i_stdlib I_STDLIB
6886#ifdef I_STDLIB
6887#include <stdlib.h>
6888#endif
6889int main()
6890{
6891 printf("%d\n", (int)sizeof(double));
6892 exit(0);
6893}
6894EOCP
6895 set try
6896 if eval $compile_ok; then
6897 doublesize=`$run ./try`
6898 echo "Your double is $doublesize bytes long."
6899 else
6900 dflt='8'
6901 echo "(I can't seem to compile the test program. Guessing...)"
6902 rp="What is the size of a double precision number (in bytes)?"
6903 . ./myread
6904 doublesize="$ans"
6905 fi
6906 ;;
6907esac
6908$rm_try
6909
6910: check for long doubles
6911echo " "
6912echo "Checking to see if you have long double..." >&4
6913echo 'int main() { long double x = 7.0; }' > try.c
6914set try
6915if eval $compile; then
6916 val="$define"
6917 echo "You have long double."
6918else
6919 val="$undef"
6920 echo "You do not have long double."
6921fi
6922$rm_try
6923set d_longdbl
6924eval $setvar
6925
6926: see if ldexpl exists
6927set ldexpl d_ldexpl
6928eval $inlibc
6929
6930: check for length of long double
6931case "${d_longdbl}${longdblsize}" in
6932$define)
6933 echo " "
6934 echo "Checking to see how big your long doubles are..." >&4
6935 $cat >try.c <<'EOCP'
6936#include <stdio.h>
6937int main()
6938{
6939 printf("%d\n", sizeof(long double));
6940}
6941EOCP
6942 set try
6943 set try
6944 if eval $compile; then
6945 longdblsize=`$run ./try`
6946 echo "Your long doubles are $longdblsize bytes long."
6947 else
6948 dflt='8'
6949 echo " "
6950 echo "(I can't seem to compile the test program. Guessing...)" >&4
6951 rp="What is the size of a long double (in bytes)?"
6952 . ./myread
6953 longdblsize="$ans"
6954 fi
6955 if $test "X$doublesize" = "X$longdblsize"; then
6956 echo "That isn't any different from an ordinary double."
6957 echo "I'll keep your setting anyway, but you may see some"
6958 echo "harmless compilation warnings."
6959 fi
6960 ;;
6961esac
6962$rm_try
6963
6964$echo "Checking the kind of long doubles you have..." >&4
6965case "$d_longdbl" in
6966define)
6967$cat <<EOP >try.c
6968#$i_stdlib I_STDLIB
6969#define LONGDBLSIZE $longdblsize
6970#define DOUBLESIZE $doublesize
6971#include <float.h>
6972#ifdef I_STDLIB
6973#include <stdlib.h>
6974#endif
6975#include <stdio.h>
6976static const long double d = -0.1L;
6977int main() {
6978 unsigned const char* b = (unsigned const char*)(&d);
6979#if DOUBLESIZE == LONGDBLSIZE
6980 printf("0\n"); /* if it floats like double */
6981 exit(0);
6982#endif
6983#if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6984 if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6985 /* IEEE 754 128-bit little-endian */
6986 printf("1\n");
6987 exit(0);
6988 }
6989 if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6990 /* IEEE 128-bit big-endian, e.g. solaris sparc */
6991 printf("2\n");
6992 exit(0);
6993 }
6994#endif
6995/* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6996 * while 64-bits platforms have it in 16 bytes. The trailing bytes
6997 * cannot be trusted. */
6998#if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6999 if (b[0] == 0xCD && b[9] == 0xBF) {
7000 /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
7001 * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
7002 * Also known as "extended precision". */
7003 printf("3\n");
7004 exit(0);
7005 }
7006 if (b[0] == 0xBF && b[9] == 0xCD) {
7007 /* Is there ever big-endian 80-bit, really?
7008 *
7009 * The Motorola 68881 had another "extended precision" format:
7010 * sign:1 exp:15 zero:16 integer:1 mantissa:63
7011 * for total of 96 bits of bytes. The zero bits were unused.
7012 * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7013 * If it ever becomes relevant, this format should be allocated
7014 * a new doublekind code since it's quite different from the Intel x87.
7015 */
7016 printf("4\n");
7017 exit(0);
7018 }
7019#endif
7020#if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7021 /* software "double double", the 106 is 53+53.
7022 * but irix thinks it is 107. */
7023 if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7024 /* double double 128-bit fully little-endian,
7025 * little-endian doubles in little-endian order,
7026 * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7027 printf("5\n");
7028 exit(0);
7029 }
7030 if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7031 /* double double 128-bit fully big-endian,
7032 * big-endian doubles in big-endian order,
7033 * e.g. PPC/Power and MIPS:
7034 * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7035 printf("6\n");
7036 exit(0);
7037 }
7038 if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7039 /* double double 128-bit mixed endian.
7040 * little-endian doubles in big-endian order,
7041 * e.g. ppc64el,
7042 * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7043 printf("7\n");
7044 exit(0);
7045 }
7046 if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7047 /* double double 128-bit mixed endian,
7048 * big-endian doubles in little-endian order,
7049 * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7050 printf("8\n");
7051 exit(0);
7052 }
7053#endif
7054/* We are largely making this up because it may well be
7055 * that the VAX format H was never made available to C,
7056 * only to Fortran. */
7057#if LONGDBLSIZE == 16 && defined(__vax__)
7058 if (b[0] == 0xFD && b[15] == 0x99) {
7059 /* VAX format H, PDP-11 mixed endian. */
7060 printf("9\n");
7061 exit(0);
7062 }
7063#endif
7064 printf("-1\n"); /* unknown */
7065 exit(0);
7066}
7067EOP
7068set try
7069if eval $compile; then
7070 longdblkind=`$run ./try`
7071else
7072 longdblkind=-1
7073fi
7074;;
7075*) longdblkind=0 ;;
7076esac
7077case "$longdblkind" in
70780) echo "Your long doubles are doubles." >&4 ;;
70791) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
70802) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
70813) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
70824) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
70835) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
70846) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
70857) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
70868) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
70879) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7088*) echo "Cannot figure out your long double." >&4 ;;
7089esac
7090d_long_double_style_ieee=$undef
7091d_long_double_style_ieee_std=$undef
7092d_long_double_style_ieee_extended=$undef
7093d_long_double_style_ieee_doubledouble=$undef
7094d_long_double_style_vax=$undef
7095case "$longdblkind" in
70961|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7097esac
7098case "$longdblkind" in
70991|2) d_long_double_style_ieee_std=$define ;;
7100esac
7101case "$longdblkind" in
71023|4) d_long_double_style_ieee_extended=$define ;;
7103esac
7104case "$longdblkind" in
71055|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7106esac
7107case "$longdblkind" in
71089) d_long_double_style_vax=$define ;;
7109esac
7110$rm_try
7111
7112: determine the architecture name
7113echo " "
7114if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7115 tarch=`arch`"-$osname"
7116elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7117 if uname -m > tmparch 2>&1 ; then
7118 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7119 -e 's/$/'"-$osname/" tmparch`
7120 else
7121 tarch="$osname"
7122 fi
7123 $rm -f tmparch
7124else
7125 tarch="$osname"
7126fi
7127case "$myarchname" in
7128''|"$tarch") ;;
7129*)
7130 echo "(Your architecture name used to be $myarchname.)"
7131 archname=''
7132 ;;
7133esac
7134case "$targetarch" in
7135'') ;;
7136*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7137esac
7138myarchname="$tarch"
7139case "$archname" in
7140'') dflt="$tarch";;
7141*) dflt="$archname";;
7142esac
7143rp='What is your architecture name'
7144. ./myread
7145archname="$ans"
7146
7147: optionally add API version to the architecture for versioned archlibs
7148case "$useversionedarchname" in
7149$define|true|[yY]*) dflt='y';;
7150*) dflt='n';;
7151esac
7152rp='Add the Perl API version to your archname?'
7153. ./myread
7154case "$ans" in
7155y|Y) useversionedarchname="$define" ;;
7156*) useversionedarchname="$undef" ;;
7157esac
7158case "$useversionedarchname" in
7159$define)
7160 case "$archname" in
7161 *-$api_versionstring)
7162 echo "...and architecture name already has -$api_versionstring" >&4
7163 ;;
7164 *)
7165 archname="$archname-$api_versionstring"
7166 echo "...setting architecture name to $archname." >&4
7167 ;;
7168 esac
7169 ;;
7170esac
7171
7172case "$usethreads" in
7173$define)
7174 echo "Threads selected." >&4
7175 case "$archname" in
7176 *-thread*) echo "...and architecture name already has -thread." >&4
7177 ;;
7178 *) archname="$archname-thread"
7179 echo "...setting architecture name to $archname." >&4
7180 ;;
7181 esac
7182 ;;
7183esac
7184case "$usemultiplicity" in
7185$define)
7186 echo "Multiplicity selected." >&4
7187 case "$archname" in
7188 *-multi*) echo "...and architecture name already has -multi." >&4
7189 ;;
7190 *) archname="$archname-multi"
7191 echo "...setting architecture name to $archname." >&4
7192 ;;
7193 esac
7194 ;;
7195esac
7196case "$use64bitint$use64bitall" in
7197*"$define"*)
7198 case "$archname64" in
7199 '')
7200 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7201 ;;
7202 *)
7203 case "$use64bitint" in
7204 "$define") echo "64 bit integers selected." >&4 ;;
7205 esac
7206 case "$use64bitall" in
7207 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7208 esac
7209 case "$archname" in
7210 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7211 ;;
7212 *) archname="$archname-$archname64"
7213 echo "...setting architecture name to $archname." >&4
7214 ;;
7215 esac
7216 ;;
7217 esac
7218esac
7219case "$uselongdouble" in
7220$define)
7221 echo "Long doubles selected." >&4
7222 case "$longdblsize" in
7223 $doublesize)
7224 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7225 ;;
7226 *)
7227 case "$archname" in
7228 *-ld*) echo "...and architecture name already has -ld." >&4
7229 ;;
7230 *) archname="$archname-ld"
7231 echo "...setting architecture name to $archname." >&4
7232 ;;
7233 esac
7234 ;;
7235 esac
7236 ;;
7237esac
7238case "$usequadmath" in
7239$define)
7240 echo "quadmath selected." >&4
7241 case "$archname" in
7242 *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7243 ;;
7244 *) archname="$archname-quadmath"
7245 echo "...setting architecture name to $archname." >&4
7246 ;;
7247 esac
7248 ;;
7249esac
7250if $test -f archname.cbu; then
7251 echo "Your platform has some specific hints for architecture name, using them..."
7252 . ./archname.cbu
7253fi
7254
7255: set the prefixit variable, to compute a suitable default value
7256prefixit='case "$3" in
7257""|none)
7258 case "$oldprefix" in
7259 "") eval "$1=\"\$$2\"";;
7260 *)
7261 case "$3" in
7262 "") eval "$1=";;
7263 none)
7264 eval "tp=\"\$$2\"";
7265 case "$tp" in
7266 ""|" "|none) eval "$1=\"\$$2\"";;
7267 *) eval "$1=";;
7268 esac;;
7269 esac;;
7270 esac;;
7271*)
7272 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7273 case "$tp" in
7274 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7275 /*-$oldprefix/*|\~*-$oldprefix/*)
7276 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7277 *) eval "$1=\"\$$2\"";;
7278 esac;;
7279esac'
7280
7281: determine installation style
7282: For now, try to deduce it from prefix unless it is already set.
7283: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7284case "$installstyle" in
7285'') case "$prefix" in
7286 *perl*) dflt='lib';;
7287 *) dflt='lib/perl5' ;;
7288 esac
7289 ;;
7290*) dflt="$installstyle" ;;
7291esac
7292: Probably not worth prompting for this since we prompt for all
7293: the directories individually, and the prompt would be too long and
7294: confusing anyway.
7295installstyle=$dflt
7296
7297: determine where public executables go
7298echo " "
7299set dflt bin bin
7300eval $prefixit
7301fn=d~
7302rp='Pathname where the public executables will reside?'
7303. ./getfile
7304if $test "X$ansexp" != "X$binexp"; then
7305 installbin=''
7306fi
7307prefixvar=bin
7308: XXX Bug? -- ignores Configure -Dinstallprefix setting.
7309: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7310: this via initialinstalllocation
7311. ./setprefixvar
7312
7313case "$userelocatableinc" in
7314$define|true|[yY]*) dflt='y' ;;
7315*) dflt='n' ;;
7316esac
7317cat <<EOM
7318
7319Would you like to build Perl so that the installation is relocatable, so that
7320library paths in @INC are determined relative to the path of the perl binary?
7321This is not advised for system Perl installs, or if you need to run setid
7322scripts or scripts under taint mode.
7323
7324If this doesn't make any sense to you, just accept the default '$dflt'.
7325EOM
7326rp='Use relocatable @INC?'
7327. ./myread
7328case "$ans" in
7329y|Y) val="$define" ;;
7330*) val="$undef" ;;
7331esac
7332set userelocatableinc
7333eval $setvar
7334
7335initialinstalllocation="$binexp"
7336: Default prefix is now "up one level from where the binaries are"
7337case "$userelocatableinc" in
7338$define|true|[yY]*)
7339 bin=".../"
7340 binexp=".../"
7341 prefix=".../.."
7342 prefixexp=".../.."
7343 installprefixexp=".../.."
7344 ;;
7345esac
7346
7347: determine where private library files go
7348: Usual default is /usr/local/lib/perl5/$version.
7349: Also allow things like /opt/perl/lib/$version, since
7350: /opt/perl/lib/perl5... would be redundant.
7351: The default "style" setting is made in installstyle.U
7352case "$installstyle" in
7353*lib/perl5*) set dflt privlib lib/$package/$version ;;
7354*) set dflt privlib lib/$version ;;
7355esac
7356eval $prefixit
7357$cat <<EOM
7358
7359There are some auxiliary files for $package that need to be put into a
7360private library directory that is accessible by everyone.
7361
7362EOM
7363fn=$binexp
7364fn=d~+
7365rp='Pathname where the private library files will reside?'
7366. ./getfile
7367prefixvar=privlib
7368. ./setprefixvar
7369
7370: set the prefixup variable, to restore leading tilda escape
7371prefixup='case "$prefixexp" in
7372"$prefix") ;;
7373*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7374esac'
7375
7376: determine where public architecture dependent libraries go
7377set archlib archlib
7378eval $prefixit
7379: privlib default is /usr/local/lib/$package/$version
7380: archlib default is /usr/local/lib/$package/$version/$archname
7381: privlib may have an optional trailing /share.
7382tdflt=`echo $privlib | $sed 's,/share$,,'`
7383tdflt=$tdflt/$archname
7384case "$archlib" in
7385'') dflt=$tdflt
7386 ;;
7387*) dflt="$archlib"
7388 ;;
7389esac
7390$cat <<EOM
7391
7392$spackage contains architecture-dependent library files. If you are
7393sharing libraries in a heterogeneous environment, you might store
7394these files in a separate location. Otherwise, you can just include
7395them with the rest of the public library files.
7396
7397EOM
7398fn=$binexp
7399fn=d+~
7400rp='Where do you want to put the public architecture-dependent libraries?'
7401. ./getfile
7402prefixvar=archlib
7403. ./setprefixvar
7404if $test X"$archlib" = X"$privlib"; then
7405 d_archlib="$undef"
7406else
7407 d_archlib="$define"
7408fi
7409
7410: see if setuid scripts can be secure
7411$cat <<EOM
7412
7413Some kernels have a bug that prevents setuid #! scripts from being
7414secure. Some sites have disabled setuid #! scripts because of this.
7415
7416First let's decide if your kernel supports secure setuid #! scripts.
7417(If setuid #! scripts would be secure but have been disabled anyway,
7418don't say that they are secure if asked.)
7419
7420EOM
7421
7422val="$undef"
7423if $test -d /dev/fd; then
7424 echo "#!$ls" >reflect
7425 chmod +x,u+s reflect
7426 ./reflect >flect 2>&1
7427 if $contains "/dev/fd" flect >/dev/null; then
7428 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7429 val="$define"
7430 else
7431 $cat <<EOM
7432If you are not sure if they are secure, I can check but I'll need a
7433username and password different from the one you are using right now.
7434If you don't have such a username or don't want me to test, simply
7435enter 'none'.
7436
7437EOM
7438 rp='Other username to test security of setuid scripts with?'
7439 dflt='none'
7440 . ./myread
7441 case "$ans" in
7442 n|none)
7443 case "$d_suidsafe" in
7444 '') echo "I'll assume setuid scripts are *not* secure." >&4
7445 dflt=n;;
7446 "$undef")
7447 echo "Well, the $hint value is *not* secure." >&4
7448 dflt=n;;
7449 *) echo "Well, the $hint value *is* secure." >&4
7450 dflt=y;;
7451 esac
7452 ;;
7453 *)
7454 $rm -f reflect flect
7455 echo "#!$ls" >reflect
7456 chmod +x,u+s reflect
7457 echo >flect
7458 chmod a+w flect
7459 echo '"su" will (probably) prompt you for '"$ans's password."
7460 su $ans -c './reflect >flect'
7461 if $contains "/dev/fd" flect >/dev/null; then
7462 echo "Okay, it looks like setuid scripts are secure." >&4
7463 dflt=y
7464 else
7465 echo "I don't think setuid scripts are secure." >&4
7466 dflt=n
7467 fi
7468 ;;
7469 esac
7470 rp='Does your kernel have *secure* setuid scripts?'
7471 . ./myread
7472 case "$ans" in
7473 [yY]*) val="$define";;
7474 *) val="$undef";;
7475 esac
7476 fi
7477else
7478 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7479 echo "(That's for file descriptors, not floppy disks.)"
7480 val="$undef"
7481fi
7482set d_suidsafe
7483eval $setvar
7484
7485$rm -f reflect flect
7486
7487: now see if they want to do setuid emulation
7488if $test $patchlevel -lt 11; then
7489echo " "
7490val="$undef"
7491case "$d_suidsafe" in
7492"$define")
7493 val="$undef"
7494 echo "No need to emulate SUID scripts since they are secure here." >&4
7495 ;;
7496*)
7497 $cat <<EOM
7498Some systems have disabled setuid scripts, especially systems where
7499setuid scripts cannot be secure. On systems where setuid scripts have
7500been disabled, the setuid/setgid bits on scripts are currently
7501useless. It is possible for $package to detect those bits and emulate
7502setuid/setgid in a secure fashion. This emulation will only work if
7503setuid scripts have been disabled in your kernel.
7504
7505EOM
7506 case "$d_dosuid" in
7507 "$define") dflt=y ;;
7508 *) dflt=n ;;
7509 esac
7510 rp="Do you want to do setuid/setgid emulation?"
7511 . ./myread
7512 case "$ans" in
7513 [yY]*) val="$define";;
7514 *) val="$undef";;
7515 esac
7516 ;;
7517esac
7518set d_dosuid
7519eval $setvar
7520else
7521 case "$d_dosuid" in
7522 "$define")
7523 cat >&4 <<EOH
7524
7525SUID emulation has been removed for 5.12
7526Please re-run Configure without -Dd_dosuid
7527
7528EOH
7529 exit 1;
7530 ;;
7531 esac
7532 d_dosuid=undef
7533fi
7534
7535: Find perl5.005 or later.
7536echo "Looking for a previously installed perl5.005 or later... "
7537case "$perl5" in
7538'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7539 : Check if this perl is recent and can load a simple module
7540 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7541 perl5=$tdir/perl
7542 break;
7543 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7544 perl5=$tdir/perl5
7545 break;
7546 fi
7547 done
7548 ;;
7549*) perl5="$perl5"
7550 ;;
7551esac
7552case "$perl5" in
7553'') echo "None found. That's ok.";;
7554*) echo "Using $perl5." ;;
7555esac
7556
7557: Set the siteprefix variables
7558$cat <<EOM
7559
7560After $package is installed, you may wish to install various
7561add-on modules and utilities. Typically, these add-ons will
7562be installed under $prefix with the rest
7563of this package. However, you may wish to install such add-ons
7564elsewhere under a different prefix.
7565
7566If you do not wish to put everything under a single prefix, that's
7567ok. You will be prompted for the individual locations; this siteprefix
7568is only used to suggest the defaults.
7569
7570The default should be fine for most people.
7571
7572EOM
7573fn=d~+
7574rp='Installation prefix to use for add-on modules and utilities?'
7575: XXX Here might be another good place for an installstyle setting.
7576case "$siteprefix" in
7577'') dflt=$prefix ;;
7578*) dflt=$siteprefix ;;
7579esac
7580. ./getfile
7581: XXX Prefixit unit does not yet support siteprefix and vendorprefix
7582oldsiteprefix=''
7583case "$siteprefix" in
7584'') ;;
7585*) case "$ans" in
7586 "$prefix") ;;
7587 *) oldsiteprefix="$prefix";;
7588 esac
7589 ;;
7590esac
7591siteprefix="$ans"
7592siteprefixexp="$ansexp"
7593
7594: determine where site specific libraries go.
7595: Usual default is /usr/local/lib/perl5/site_perl/$version
7596: The default "style" setting is made in installstyle.U
7597: XXX No longer works with Prefixit stuff.
7598prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7599case "$sitelib" in
7600'') case "$installstyle" in
7601 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7602 *) dflt=$siteprefix/lib/site_$prog/$version ;;
7603 esac
7604 ;;
7605*) dflt="$sitelib"
7606 ;;
7607esac
7608$cat <<EOM
7609
7610The installation process will create a directory for
7611site-specific extensions and modules. Most users find it convenient
7612to place all site-specific files in this directory rather than in the
7613main distribution directory.
7614
7615EOM
7616fn=d~+
7617rp='Pathname for the site-specific library files?'
7618. ./getfile
7619prefixvar=sitelib
7620. ./setprefixvar
7621sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7622
7623: Determine list of previous versions to include in @INC
7624$cat > getverlist <<EOPL
7625#!$perl5 -w
7626use File::Basename;
7627\$api_versionstring = "$api_versionstring";
7628\$version = "$version";
7629\$stem = "$sitelib_stem";
7630\$archname = "$archname";
7631EOPL
7632 $cat >> getverlist <<'EOPL'
7633# The list found is store twice for each entry: the original name, and
7634# the binary broken down version as pack "sss", so sorting is easy and
7635# unambiguous. This will work for all versions that have a maximum of
7636# three digit groups, separate by '.'s or '_'s. Names are extended with
7637# ".0.0" to ensure at least three elements for the pack.
7638# -- H.Merijn Brand (m)'06 23-10-2006
7639
7640# Can't have leading @ because metaconfig interprets it as a command!
7641;@inc_version_list=();
7642# XXX Redo to do opendir/readdir?
7643if (-d $stem) {
7644 chdir($stem);
7645 ;@candidates = map {
7646 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7647 ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7648}
7649else {
7650 ;@candidates = ();
7651}
7652
7653($pversion, $aversion, $vsn5005) = map {
7654 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7655foreach $d (@candidates) {
7656 if ($d->[1] lt $pversion) {
7657 if ($d->[1] ge $aversion) {
7658 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7659 }
7660 elsif ($d->[1] ge $vsn5005) {
7661 unshift(@inc_version_list, grep { -d } $d->[0]);
7662 }
7663 }
7664 else {
7665 # Skip newer version. I.e. don't look in
7666 # 5.7.0 if we're installing 5.6.1.
7667 }
7668}
7669
7670if (@inc_version_list) {
7671 print join(' ', @inc_version_list);
7672}
7673else {
7674 # Blank space to preserve value for next Configure run.
7675 print " ";
7676}
7677EOPL
7678chmod +x getverlist
7679case "$inc_version_list" in
7680'') if test -x "$perl5$exe_ext"; then
7681 dflt=`$perl5 getverlist`
7682 else
7683 dflt='none'
7684 fi
7685 ;;
7686$undef) dflt='none' ;;
7687*) eval dflt=\"$inc_version_list\" ;;
7688esac
7689case "$dflt" in
7690''|' ') dflt=none ;;
7691esac
7692case "$dflt" in
76935.005) dflt=none ;;
7694esac
7695$cat <<EOM
7696
7697In order to ease the process of upgrading, this version of perl
7698can be configured to use modules built and installed with earlier
7699versions of perl that were installed under $prefix. Specify here
7700the list of earlier versions that this version of perl should check.
7701If Configure detected no earlier versions of perl installed under
7702$prefix, then the list will be empty. Answer 'none' to tell perl
7703to not search earlier versions.
7704
7705The default should almost always be sensible, so if you're not sure,
7706just accept the default.
7707EOM
7708
7709rp='List of earlier versions to include in @INC?'
7710. ./myread
7711case "$ans" in
7712[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7713*) inc_version_list="$ans" ;;
7714esac
7715case "$inc_version_list" in
7716''|' ')
7717 inc_version_list_init='0'
7718 d_inc_version_list="$undef"
7719 ;;
7720*) inc_version_list_init=`echo $inc_version_list |
7721 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7722 d_inc_version_list="$define"
7723 ;;
7724esac
7725$rm -f getverlist
7726
7727: see if malloc/malloc.h has to be included
7728set malloc/malloc.h i_mallocmalloc
7729eval $inhdr
7730
7731: see if this is a malloc.h system
7732: we want a real compile instead of Inhdr because some systems have a
7733: malloc.h that just gives a compile error saying to use stdlib.h instead
7734echo " "
7735$cat >try.c <<EOCP
7736#include <stdlib.h>
7737#include <malloc.h>
7738#$i_mallocmalloc I_MALLOCMALLOC
7739#ifdef I_MALLOCMALLOC
7740# include <malloc/malloc.h>
7741#endif
7742
7743int main () { return 0; }
7744EOCP
7745set try
7746if eval $compile; then
7747 echo "<malloc.h> found." >&4
7748 val="$define"
7749else
7750 echo "<malloc.h> NOT found." >&4
7751 val="$undef"
7752fi
7753$rm_try
7754set i_malloc
7755eval $setvar
7756
7757: check for length of pointer
7758echo " "
7759case "$ptrsize" in
7760'')
7761 echo "Checking to see how big your pointers are..." >&4
7762 $cat >try.c <<EOCP
7763#include <stdio.h>
7764#$i_stdlib I_STDLIB
7765#ifdef I_STDLIB
7766#include <stdlib.h>
7767#endif
7768int main()
7769{
7770 printf("%d\n", (int)sizeof(void *));
7771 exit(0);
7772}
7773EOCP
7774 set try
7775 if eval $compile_ok; then
7776 ptrsize=`$run ./try`
7777 echo "Your pointers are $ptrsize bytes long."
7778 else
7779 dflt='4'
7780 echo "(I can't seem to compile the test program. Guessing...)" >&4
7781 rp="What is the size of a pointer (in bytes)?"
7782 . ./myread
7783 ptrsize="$ans"
7784 fi
7785 ;;
7786esac
7787$rm_try
7788case "$use64bitall" in
7789"$define"|true|[yY]*)
7790 case "$ptrsize" in
7791 4) cat <<EOM >&4
7792
7793*** You have chosen a maximally 64-bit build,
7794*** but your pointers are only 4 bytes wide.
7795*** Please rerun Configure without -Duse64bitall.
7796EOM
7797 case "$d_quad" in
7798 define)
7799 cat <<EOM >&4
7800*** Since you have quads, you could possibly try with -Duse64bitint.
7801EOM
7802 ;;
7803 esac
7804 cat <<EOM >&4
7805*** Cannot continue, aborting.
7806
7807EOM
7808
7809 exit 1
7810 ;;
7811 esac
7812 ;;
7813esac
7814
7815: determine whether to use malloc wrapping
7816echo " "
7817case "$usemallocwrap" in
7818[yY]*|true|$define) dflt='y' ;;
7819[nN]*|false|$undef) dflt='n' ;;
7820*) case "$usedevel" in
7821 [yY]*|true|$define) dflt='y' ;;
7822 *) dflt='n' ;;
7823 esac
7824 ;;
7825esac
7826rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7827. ./myread
7828usemallocwrap="$ans"
7829case "$ans" in
7830y*|true)
7831 usemallocwrap="$define" ;;
7832*)
7833 usemallocwrap="$undef" ;;
7834esac
7835
7836: determine which malloc to compile in
7837echo " "
7838case "$usemymalloc" in
7839[yY]*|true|$define) dflt='y' ;;
7840[nN]*|false|$undef) dflt='n' ;;
7841*) case "$ptrsize" in
7842 4) dflt='y' ;;
7843 *) dflt='n' ;;
7844 esac
7845 if test "$useithreads" = "$define"; then dflt='n'; fi
7846 ;;
7847esac
7848rp="Do you wish to attempt to use the malloc that comes with $package?"
7849. ./myread
7850usemymalloc="$ans"
7851case "$ans" in
7852y*|true)
7853 usemymalloc='y'
7854 mallocsrc='malloc.c'
7855 mallocobj="malloc$_o"
7856 d_mymalloc="$define"
7857 case "$libs" in
7858 *-lmalloc*)
7859 : Remove malloc from list of libraries to use
7860 echo "Removing unneeded -lmalloc from library list" >&4
7861 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7862 shift
7863 libs="$*"
7864 echo "libs = $libs" >&4
7865 ;;
7866 esac
7867 ;;
7868*)
7869 usemymalloc='n'
7870 mallocsrc=''
7871 mallocobj=''
7872 d_mymalloc="$undef"
7873 ;;
7874esac
7875
7876: compute the return types of malloc and free
7877echo " "
7878$cat >malloc.c <<END
7879#$i_malloc I_MALLOC
7880#$i_stdlib I_STDLIB
7881#include <stdio.h>
7882#include <sys/types.h>
7883#ifdef I_MALLOC
7884#include <malloc.h>
7885#endif
7886#ifdef I_STDLIB
7887#include <stdlib.h>
7888#endif
7889#ifdef TRY_MALLOC
7890void *malloc();
7891#endif
7892#ifdef TRY_FREE
7893void free();
7894#endif
7895END
7896case "$malloctype" in
7897'')
7898 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7899 malloctype='void *'
7900 else
7901 malloctype='char *'
7902 fi
7903 ;;
7904esac
7905echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7906
7907case "$freetype" in
7908'')
7909 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7910 freetype='void'
7911 else
7912 freetype='int'
7913 fi
7914 ;;
7915esac
7916echo "Your system uses $freetype free(), it would seem." >&4
7917$rm -f malloc.[co]
7918: determine where site specific architecture-dependent libraries go.
7919: sitelib default is /usr/local/lib/perl5/site_perl/$version
7920: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7921: sitelib may have an optional trailing /share.
7922case "$sitearch" in
7923'') dflt=`echo $sitelib | $sed 's,/share$,,'`
7924 dflt="$dflt/$archname"
7925 ;;
7926*) dflt="$sitearch"
7927 ;;
7928esac
7929set sitearch sitearch none
7930eval $prefixit
7931$cat <<EOM
7932
7933The installation process will also create a directory for
7934architecture-dependent site-specific extensions and modules.
7935
7936EOM
7937fn=d~+
7938rp='Pathname for the site-specific architecture-dependent library files?'
7939. ./getfile
7940prefixvar=sitearch
7941. ./setprefixvar
7942if $test X"$sitearch" = X"$sitelib"; then
7943 d_sitearch="$undef"
7944else
7945 d_sitearch="$define"
7946fi
7947
7948: Set the vendorprefix variables
7949$cat <<EOM
7950
7951The installation process will also create a directory for
7952vendor-supplied add-ons. Vendors who supply perl with their system
7953may find it convenient to place all vendor-supplied files in this
7954directory rather than in the main distribution directory. This will
7955ease upgrades between binary-compatible maintenance versions of perl.
7956
7957Of course you may also use these directories in whatever way you see
7958fit. For example, you might use them to access modules shared over a
7959company-wide network.
7960
7961The default answer should be fine for most people.
7962This causes further questions about vendor add-ons to be skipped
7963and no vendor-specific directories will be configured for perl.
7964
7965EOM
7966rp='Do you want to configure vendor-specific add-on directories?'
7967case "$usevendorprefix" in
7968define|true|[yY]*) dflt=y ;;
7969*) : User may have set vendorprefix directly on Configure command line.
7970 case "$vendorprefix" in
7971 ''|' ') dflt=n ;;
7972 *) dflt=y ;;
7973 esac
7974 ;;
7975esac
7976. ./myread
7977case "$ans" in
7978[yY]*) fn=d~+
7979 rp='Installation prefix to use for vendor-supplied add-ons?'
7980 case "$vendorprefix" in
7981 '') dflt="$prefix" ;;
7982 *) dflt=$vendorprefix ;;
7983 esac
7984 . ./getfile
7985 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7986 oldvendorprefix=''
7987 case "$vendorprefix" in
7988 '') ;;
7989 *) case "$ans" in
7990 "$prefix") ;;
7991 *) oldvendorprefix="$prefix";;
7992 esac
7993 ;;
7994 esac
7995 usevendorprefix="$define"
7996 vendorprefix="$ans"
7997 vendorprefixexp="$ansexp"
7998 ;;
7999*) usevendorprefix="$undef"
8000 vendorprefix=''
8001 vendorprefixexp=''
8002 ;;
8003esac
8004
8005: Set the vendorlib variables
8006case "$vendorprefix" in
8007'') d_vendorlib="$undef"
8008 vendorlib=''
8009 vendorlibexp=''
8010 ;;
8011*) d_vendorlib="$define"
8012 : determine where vendor-supplied modules go.
8013 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8014 case "$vendorlib" in
8015 '')
8016 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8017 case "$installstyle" in
8018 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8019 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8020 esac
8021 ;;
8022 *) dflt="$vendorlib"
8023 ;;
8024 esac
8025 fn=d~+
8026 rp='Pathname for the vendor-supplied library files?'
8027 . ./getfile
8028 vendorlib="$ans"
8029 vendorlibexp="$ansexp"
8030 ;;
8031esac
8032vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8033prefixvar=vendorlib
8034. ./installprefix
8035
8036: Set the vendorarch variables
8037case "$vendorprefix" in
8038'') d_vendorarch="$undef"
8039 vendorarch=''
8040 vendorarchexp=''
8041 ;;
8042*) d_vendorarch="$define"
8043 : determine where vendor-supplied architecture-dependent libraries go.
8044 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
8045 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8046 : vendorlib may have an optional trailing /share.
8047 case "$vendorarch" in
8048 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
8049 dflt="$dflt/$archname"
8050 ;;
8051 *) dflt="$vendorarch" ;;
8052 esac
8053 fn=d~+
8054 rp='Pathname for vendor-supplied architecture-dependent files?'
8055 . ./getfile
8056 vendorarch="$ans"
8057 vendorarchexp="$ansexp"
8058 ;;
8059esac
8060prefixvar=vendorarch
8061. ./installprefix
8062if $test X"$vendorarch" = X"$vendorlib"; then
8063 d_vendorarch="$undef"
8064else
8065 d_vendorarch="$define"
8066fi
8067
8068: Final catch-all directories to search
8069$cat <<EOM
8070
8071Lastly, you can have perl look in other directories for extensions and
8072modules in addition to those already specified.
8073These directories will be searched after
8074 $sitearch
8075 $sitelib
8076EOM
8077test X"$vendorlib" != "X" && echo ' ' $vendorlib
8078test X"$vendorarch" != "X" && echo ' ' $vendorarch
8079echo ' '
8080case "$otherlibdirs" in
8081''|' ') dflt='none' ;;
8082*) dflt="$otherlibdirs" ;;
8083esac
8084$cat <<EOM
8085Enter a colon-separated set of extra paths to include in perl's @INC
8086search path, or enter 'none' for no extra paths.
8087
8088EOM
8089
8090rp='Colon-separated list of additional directories for perl to search?'
8091. ./myread
8092case "$ans" in
8093' '|''|none) otherlibdirs=' ' ;;
8094*) otherlibdirs="$ans" ;;
8095esac
8096case "$otherlibdirs" in
8097' ') val=$undef ;;
8098*) val=$define ;;
8099esac
8100set d_perl_otherlibdirs
8101eval $setvar
8102
8103: DTrace support
8104dflt_dtrace='/usr/sbin/dtrace'
8105$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8106
8107cat <<EOM
8108
8109Perl can be built to support DTrace on platforms that support it.
8110DTrace is a diagnosis and performance analysis tool from Sun.
8111
8112If this doesn't make any sense to you, just accept the default.
8113EOM
8114
8115while $test 1 ; do
8116 case "$usedtrace" in
8117 $define|true|[yY]*)
8118 dflt='y'
8119 ;;
8120 $undef|false|[nN]*)
8121 dflt='n'
8122 dflt_dtrace=""
8123 ;;
8124 ?*)
8125 dflt='y'
8126 dflt_dtrace=$usedtrace
8127 ;;
8128 *)
8129 dflt='n'
8130 ;;
8131 esac
8132
8133 rp='Support DTrace if available?'
8134 . ./myread
8135 case "$ans" in
8136 y|Y) val="$define" ;;
8137 *) val="$undef" ;;
8138 esac
8139 set usedtrace
8140 eval $setvar
8141
8142 test "X$usedtrace" != "X$define" && break
8143
8144 echo " "
8145 rp='Where is the dtrace executable?'
8146 dflt=$dflt_dtrace
8147 . ./getfile
8148 val="$ans"
8149 set dtrace
8150 eval $setvar
8151
8152 if $test -f $dtrace
8153 then
8154 if $dtrace -h -s ../perldtrace.d \
8155 -o perldtrace.tmp >/dev/null 2>&1 \
8156 && rm -f perldtrace.tmp
8157 then
8158 echo " "
8159 echo "Good: your $dtrace knows about the -h flag."
8160 else
8161 cat >&2 <<EOM
8162
8163*** $me: Fatal Error: $dtrace doesn't support -h flag
8164***
8165*** Your installed dtrace doesn't support the -h switch to compile a D
8166*** program into a C header. Can't continue.
8167
8168EOM
8169 exit 1
8170 fi
8171 break;
8172 fi
8173
8174 case "$fastread" in
8175 yes)
8176 cat >&2 <<EOM
8177
8178*** $me: Fatal Error: $dtrace not found.
8179*** Can't continue.
8180
8181EOM
8182 exit 1
8183 ;;
8184 *)
8185 echo "*** $dtrace was not found."
8186 echo " "
8187 ;;
8188 esac
8189done
8190
8191: See if we want extra modules installed
8192echo " "
8193case "$extras" in
8194'') dflt='n';;
8195*) dflt='y';;
8196esac
8197cat <<EOM
8198Perl can be built with extra modules or bundles of modules which
8199will be fetched from the CPAN and installed alongside Perl.
8200
8201Notice that you will need access to the CPAN; either via the Internet,
8202or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
8203be asked later to configure the CPAN.pm module which will in turn do
8204the installation of the rest of the extra modules or bundles.)
8205
8206Notice also that if the modules require any external software such as
8207libraries and headers (the libz library and the zlib.h header for the
8208Compress::Zlib module, for example) you MUST have any such software
8209already installed, this configuration process will NOT install such
8210things for you.
8211
8212If this doesn't make any sense to you, just accept the default '$dflt'.
8213EOM
8214rp='Install any extra modules (y or n)?'
8215. ./myread
8216case "$ans" in
8217y|Y)
8218 cat <<EOM
8219
8220Please list any extra modules or bundles to be installed from CPAN,
8221with spaces between the names. The names can be in any format the
8222'install' command of CPAN.pm will understand. (Answer 'none',
8223without the quotes, to install no extra modules or bundles.)
8224EOM
8225 rp='Extras?'
8226 dflt="$extras"
8227 . ./myread
8228 extras="$ans"
8229esac
8230case "$extras" in
8231''|'none')
8232 val=''
8233 $rm -f ../extras.lst
8234 ;;
8235*) echo "(Saving the list of extras for later...)"
8236 echo "$extras" > ../extras.lst
8237 val="'$extras'"
8238 ;;
8239esac
8240set extras
8241eval $setvar
8242echo " "
8243
8244: determine where html pages for programs go
8245set html1dir html1dir none
8246eval $prefixit
8247$cat <<EOM
8248
8249If you wish to install html files for programs in $spackage, indicate
8250the appropriate directory here. To skip installing html files,
8251answer "none".
8252EOM
8253case "$html1dir" in
8254''|none|$undef|' ') dflt=none ;;
8255*) dflt=$html1dir ;;
8256esac
8257fn=dn+~
8258rp="Directory for the main $spackage html pages?"
8259. ./getfile
8260prefixvar=html1dir
8261. ./setprefixvar
8262: Use ' ' for none so value is preserved next time through Configure
8263$test X"$html1dir" = "X" && html1dir=' '
8264
8265: determine where html pages for libraries and modules go
8266set html3dir html3dir none
8267eval $prefixit
8268$cat <<EOM
8269
8270If you wish to install html files for modules associated with $spackage,
8271indicate the appropriate directory here. To skip installing html files,
8272answer "none".
8273EOM
8274: There is no obvious default. If they have specified html1dir, then
8275: try to key off that, possibly changing .../html1 into .../html3.
8276case "$html3dir" in
8277'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8278*) dflt=$html3dir ;;
8279esac
8280fn=dn+~
8281rp="Directory for the $spackage module html pages?"
8282. ./getfile
8283prefixvar=html3dir
8284. ./setprefixvar
8285: Use ' ' for none so value is preserved next time through Configure
8286$test X"$html3dir" = "X" && html3dir=' '
8287
8288: determine whether to install perl also as /usr/bin/perl
8289
8290echo " "
8291if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8292 $cat <<EOM
8293Many scripts expect perl to be installed as /usr/bin/perl.
8294
8295If you want to, I can install the perl you are about to compile
8296as /usr/bin/perl (in addition to $bin/perl).
8297EOM
8298 if test -f /usr/bin/perl; then
8299 $cat <<EOM
8300
8301However, please note that because you already have a /usr/bin/perl,
8302overwriting that with a new Perl would very probably cause problems.
8303Therefore I'm assuming you don't want to do that (unless you insist).
8304
8305EOM
8306 case "$installusrbinperl" in
8307 "$define"|[yY]*) dflt='y';;
8308 *) dflt='n';;
8309 esac
8310 else
8311 $cat <<EOM
8312
8313Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8314
8315EOM
8316 case "$installusrbinperl" in
8317 "$undef"|[nN]*) dflt='n';;
8318 *) dflt='y';;
8319 esac
8320 fi
8321 rp="Do you want to install perl as /usr/bin/perl?"
8322 . ./myread
8323 case "$ans" in
8324 [yY]*) val="$define";;
8325 *) val="$undef" ;;
8326 esac
8327else
8328 val="$undef"
8329fi
8330set installusrbinperl
8331eval $setvar
8332
8333: see if dlopen exists
8334xxx_runnm="$runnm"
8335xxx_ccflags="$ccflags"
8336runnm=false
8337: with g++ one needs -shared to get is-in-libc to work for dlopen
8338case "$gccversion" in
8339'') ;;
8340*Clang*) ;;
8341*) case "$d_cplusplus" in
8342 "$define") ccflags="$ccflags -shared" ;;
8343 esac
8344 ;;
8345esac
8346set dlopen d_dlopen
8347eval $inlibc
8348runnm="$xxx_runnm"
8349ccflags="$xxx_ccflags"
8350
8351: see if this is a unistd.h system
8352set unistd.h i_unistd
8353eval $inhdr
8354
8355: determine which dynamic loading, if any, to compile in
8356echo " "
8357dldir="ext/DynaLoader"
8358case "$usedl" in
8359 $define|y|true)
8360 dflt='y'
8361 usedl="$define"
8362 ;;
8363 $undef|n|false)
8364 dflt='n'
8365 usedl="$undef"
8366 ;;
8367 *)
8368 dflt='n'
8369 case "$d_dlopen" in
8370 $define) dflt='y' ;;
8371 esac
8372 : Does a dl_xxx.xs file exist for this operating system
8373 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8374 ;;
8375esac
8376rp="Do you wish to use dynamic loading?"
8377. ./myread
8378usedl="$ans"
8379bin_ELF="$undef"
8380case "$ans" in
8381 y*) usedl="$define"
8382 case "$dlsrc" in
8383 '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8384 dflt="$dldir/dl_${osname}.xs"
8385 elif $test "$d_dlopen" = "$define" ; then
8386 dflt="$dldir/dl_dlopen.xs"
8387 else
8388 dflt=''
8389 fi
8390 ;;
8391 *) dflt="$dldir/$dlsrc"
8392 ;;
8393 esac
8394 echo "The following dynamic loading files are available:"
8395 : Can not go over to $dldir because getfile has path hard-coded in.
8396 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8397 rp="Source file to use for dynamic loading"
8398 fn="fne"
8399 gfpth="$src"
8400 . ./getfile
8401 usedl="$define"
8402 : emulate basename
8403 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8404
8405 $cat << EOM
8406
8407Some systems may require passing special flags to $cc -c to
8408compile modules that will be used to create a shared library.
8409To use no flags, say "none".
8410
8411EOM
8412 case "$cccdlflags" in
8413 '') case "$gccversion" in
8414 '') case "$osname" in
8415 hpux) dflt='+z' ;;
8416 irix*) dflt='-KPIC' ;;
8417 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8418 sunos) dflt='-pic' ;;
8419 *) dflt='none' ;;
8420 esac
8421 ;;
8422 *) case "$osname" in
8423 darwin) dflt='none' ;;
8424 *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8425 *) dflt='-fpic' ;;
8426 esac ;;
8427 esac ;;
8428 ' ') dflt='none' ;;
8429 *) dflt="$cccdlflags" ;;
8430 esac
8431
8432 case "$dflt" in
8433 none) dflt='' ;;
8434 esac
8435
8436 # If -Dsysroot was specified, now's the time to add it
8437 # to cccdlflags
8438 if test "X$sysroot" != X; then
8439 case "$gccversion" in
8440 '') ;;
8441 *) case "$dflt" in
8442 *sysroot*) ;;
8443 'undef'|*)
8444 dflt="$dflt --sysroot=$sysroot" ;;
8445 esac
8446 ;;
8447 esac
8448 fi
8449
8450 case "$dflt" in
8451 '') dflt='none';;
8452 esac
8453
8454 rp="Any special flags to pass to $cc -c to compile shared library modules?"
8455 . ./myread
8456 case "$ans" in
8457 none) cccdlflags=' ' ;;
8458 *) cccdlflags="$ans" ;;
8459 esac
8460
8461 cat << EOM
8462
8463Some systems use ld to create libraries that can be dynamically loaded,
8464while other systems (such as those using ELF) use $cc.
8465
8466EOM
8467
8468: Determine if this is ELF
8469 $cat >try.c <<EOM
8470/* Test for whether ELF binaries are produced */
8471#include <fcntl.h>
8472#$i_stdlib I_STDLIB
8473#ifdef I_STDLIB
8474#include <stdlib.h>
8475#endif
8476#$i_unistd I_UNISTD
8477#ifdef I_UNISTD
8478#include <unistd.h>
8479#endif
8480int main() {
8481 char b[4];
8482 int i = open("a.out",O_RDONLY);
8483 if(i == -1)
8484 exit(1); /* fail */
8485 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8486 exit(0); /* succeed (yes, it is ELF) */
8487 exit(1); /* fail */
8488}
8489EOM
8490 if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8491 bin_ELF="$define"
8492 fi
8493 $rm_try
8494
8495 case "$ld" in
8496 '') if $test $bin_ELF = "$define"; then
8497 cat <<EOM
8498You appear to have ELF support. I'll use $cc to build dynamic libraries.
8499EOM
8500 dflt="$cc"
8501 else
8502 echo "I'll use ld to build dynamic libraries."
8503 dflt='ld'
8504 fi
8505 ;;
8506 *) dflt="$ld"
8507 ;;
8508 esac
8509
8510 rp="What command should be used to create dynamic libraries?"
8511 . ./myread
8512 ld="$ans"
8513
8514 cat << EOM
8515
8516Some systems may require passing special flags to $ld to create a
8517library that can be dynamically loaded. If your ld flags include
8518-L/other/path options to locate libraries outside your loader's normal
8519search path, you may need to specify those -L options here as well. To
8520use no flags, say "none".
8521
8522EOM
8523 case "$lddlflags" in
8524 '') case "$osname" in
8525 haiku) dflt='-shared' ;;
8526 hpux) dflt='-b';
8527 case "$gccversion" in
8528 '') dflt="$dflt +vnocompatwarnings" ;;
8529 esac
8530 ;;
8531 *linux*|irix*|gnu*) dflt="-shared $optimize" ;;
8532 solaris) # See [perl #66604].
8533 # On Solaris 11, gcc -m64 on amd64
8534 # appears not to understand -G. gcc versions at
8535 # least as old as 3.4.3 support -shared, so just
8536 # use that with Solaris 11 and later, but keep
8537 # the old behavior for older Solaris versions.
8538 case "$gccversion" in
8539 '') dflt='-G' ;;
8540 *) case "$osvers" in
8541 2.?|2.10) dflt='-G' ;;
8542 *) dflt='-shared' ;;
8543 esac
8544 ;;
8545 esac
8546 ;;
8547 sunos) dflt='-assert nodefinitions' ;;
8548 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8549 *) dflt='none' ;;
8550 esac
8551 ;;
8552 *) dflt="$lddlflags" ;;
8553 esac
8554
8555 : Only do this for gcc, since, for example, qcc has no concept
8556 : of --sysroot.
8557 if $test "X$sysroot" != X; then
8558 case "$gccversion" in
8559 '') ;;
8560 *) dflt="$dflt --sysroot=$sysroot" ;;
8561 esac
8562 fi
8563
8564 : Try to guess additional flags to pick up local libraries.
8565 : Be careful not to append to a plain 'none'
8566 case "$dflt" in
8567 none) dflt='' ;;
8568 esac
8569 for thisflag in $ldflags; do
8570 case "$thisflag" in
8571 -L*|-R*|-Wl,-R*)
8572 case " $dflt " in
8573 *" $thisflag "*) ;;
8574 *) dflt="$dflt $thisflag" ;;
8575 esac
8576 ;;
8577 esac
8578 done
8579
8580 case "$dflt" in
8581 ''|' ') dflt='none' ;;
8582 esac
8583
8584 case "$ldflags" in
8585 *-fstack-protector-strong*)
8586 case "$dflt" in
8587 *-fstack-protector-strong*) ;; # Don't add it again
8588 *) dflt="$dflt -fstack-protector-strong" ;;
8589 esac
8590 ;;
8591 *-fstack-protector*)
8592 case "$dflt" in
8593 *-fstack-protector*) ;; # Don't add it again
8594 *) dflt="$dflt -fstack-protector" ;;
8595 esac
8596 ;;
8597 esac
8598
8599 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8600 . ./myread
8601 case "$ans" in
8602 none) lddlflags=' ' ;;
8603 *) lddlflags="$ans" ;;
8604 esac
8605
8606 cat <<EOM
8607
8608Some systems may require passing special flags to $cc to indicate that
8609the resulting executable will use dynamic linking. To use no flags,
8610say "none".
8611
8612EOM
8613 case "$ccdlflags" in
8614 '') case "$osname" in
8615 *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8616 sunos) dflt='none' ;;
8617 *) dflt='none' ;;
8618 esac ;;
8619 ' ') dflt='none' ;;
8620 *) dflt="$ccdlflags" ;;
8621 esac
8622 rp="Any special flags to pass to $cc to use dynamic linking?"
8623 . ./myread
8624 case "$ans" in
8625 none) ccdlflags=' ' ;;
8626 *) ccdlflags="$ans" ;;
8627 esac
8628 ;;
8629
8630 *) usedl="$undef"
8631 ld='ld'
8632 dlsrc='dl_none.xs'
8633 lddlflags=''
8634 ccdlflags=''
8635 ;;
8636esac
8637
8638ld_can_script="$undef"
8639case "$bin_ELF$usedl" in
8640 $define$define)
8641 # Abuse try.h and a.out names for neat cleanup
8642 $cat >try.c <<EOM
8643void foo() {}
8644void bar() {}
8645EOM
8646 $cat >try.h <<EOM
8647LIBTEST_42 {
8648 global:
8649 foo;
8650 local: *;
8651 };
8652EOM
8653 if $cc $cccdlflags $ccdlflags $ccflags \
8654 $ldflags $lddlflags -o a.out try.c \
8655 -Wl,--version-script=try.h >/dev/null 2>&1 \
8656 && $test -s a.out ; then
8657 echo "ld supports scripting" >&4
8658 ld_can_script="$define"
8659 else
8660 echo "ld does not support scripting" >&4
8661 fi
8662 $rm_try
8663 ;;
8664esac
8665
8666: Do we want a shared libperl?
8667also=''
8668case "$usedl" in
8669$undef)
8670 # No dynamic loading being used, so don't bother even to prompt.
8671 useshrplib='false'
8672 ;;
8673*) case "$useshrplib" in
8674 '') case "$osname" in
8675 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8676 dflt=y
8677 also='Building a shared libperl is required for dynamic loading to work on your system.'
8678 ;;
8679 *) dflt=n
8680 ;;
8681 esac
8682 ;;
8683 $define|true|[Yy]*)
8684 dflt=y
8685 ;;
8686 *) dflt=n
8687 ;;
8688 esac
8689 $cat << EOM
8690
8691The perl executable is normally obtained by linking perlmain.c with
8692libperl${_a}, any static extensions (usually just DynaLoader), and
8693any other libraries needed on this system (such as -lm, etc.). Since
8694your system supports dynamic loading, it is probably possible to build
8695a shared libperl.$so. If you will have more than one executable linked
8696to libperl.$so, this will significantly reduce the size of each
8697executable, but it may have a noticeable effect on performance. The
8698default is probably sensible for your system.
8699$also
8700
8701EOM
8702 rp="Build a shared libperl.$so (y/n)"
8703 . ./myread
8704 case "$ans" in
8705 true|$define|[Yy]*)
8706 useshrplib='true' ;;
8707 *) useshrplib='false' ;;
8708 esac
8709 ;;
8710esac
8711
8712case "$useshrplib" in
8713true)
8714 case "$userelocatableinc" in
8715 true|define)
8716 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8717 echo "See INSTALL for an explanation why that won't work." >&4
8718 exit 4
8719 ;;
8720 esac
8721 case "$libperl" in
8722 '')
8723 # Figure out a good name for libperl.so. Since it gets stored in
8724 # a version-specific architecture-dependent library, the version
8725 # number isn't really that important, except for making cc/ld happy.
8726 #
8727 # A name such as libperl.so.10.1
8728 majmin="libperl.$so.$patchlevel.$subversion"
8729 # A name such as libperl.so.100
8730 majonly=`echo $patchlevel $subversion |
8731 $awk '{printf "%d%02d", $1, $2}'`
8732 majonly=libperl.$so.$majonly
8733 # I'd prefer to keep the os-specific stuff here to a minimum, and
8734 # rely on figuring it out from the naming of libc.
8735 case "${osname}${osvers}" in
8736 *linux*|gnu*) # ld won't link with a bare -lperl otherwise.
8737 dflt=libperl.$so
8738 ;;
8739 cygwin*) # ld links now against the dll directly
8740 majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8741 majonly=`echo $patchlevel $subversion |
8742 $awk '{printf "%03d%03d", $1, $2}'`
8743 majonly=cygperl5.$majonly.$so
8744 dflt=$majmin
8745 ;;
8746 *) # Try to guess based on whether libc has major.minor.
8747 case "$libc" in
8748 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8749 *libc.$so.[0-9]*) dflt=$majonly ;;
8750 *) dflt=libperl.$so ;;
8751 esac
8752 ;;
8753 esac
8754 ;;
8755 *) dflt=$libperl
8756 ;;
8757 esac
8758 cat << EOM
8759
8760I need to select a good name for the shared libperl. If your system uses
8761library names with major and minor numbers, then you might want something
8762like $majmin. Alternatively, if your system uses a single version
8763number for shared libraries, then you might want to use $majonly.
8764Or, your system might be quite happy with a simple libperl.$so.
8765
8766Since the shared libperl will get installed into a version-specific
8767architecture-dependent directory, the version number of the shared perl
8768library probably isn't important, so the default should be o.k.
8769
8770EOM
8771 rp='What name do you want to give to the shared libperl?'
8772 . ./myread
8773 libperl=$ans
8774 echo "Ok, I'll use $libperl"
8775 ;;
8776*)
8777 libperl="libperl${_a}"
8778 ;;
8779esac
8780
8781# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8782case "$shrpdir" in
8783'') ;;
8784*) $cat >&4 <<EOM
8785WARNING: Use of the shrpdir variable for the installation location of
8786the shared $libperl is not supported. It was never documented and
8787will not work in this version. Let me (https://github.com/Perl/perl5/issues)
8788know of any problems this may cause.
8789
8790EOM
8791 case "$shrpdir" in
8792 "$archlibexp/CORE")
8793 $cat >&4 <<EOM
8794But your current setting of $shrpdir is
8795the default anyway, so it's harmless.
8796EOM
8797 ;;
8798 *)
8799 $cat >&4 <<EOM
8800Further, your current attempted setting of $shrpdir
8801conflicts with the value of $archlibexp/CORE
8802that installperl will use.
8803EOM
8804 ;;
8805 esac
8806 ;;
8807esac
8808
8809# How will the perl executable find the installed shared $libperl?
8810# Add $xxx to ccdlflags.
8811# If we can't figure out a command-line option, use $shrpenv to
8812# set env LD_RUN_PATH. The main perl makefile uses this.
8813shrpdir=$archlibexp/CORE
8814xxx=''
8815tmp_shrpenv=''
8816if "$useshrplib"; then
8817 case "$osname" in
8818 aix)
8819 # We'll set it in Makefile.SH...
8820 ;;
8821 solaris)
8822 xxx="-R $shrpdir"
8823 ;;
8824 freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8825 xxx="-Wl,-R$shrpdir"
8826 ;;
8827 bsdos|linux|irix*|dec_osf|gnu*|haiku)
8828 xxx="-Wl,-rpath,$shrpdir"
8829 ;;
8830 hpux*)
8831 # hpux doesn't like the default, either.
8832 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8833 ;;
8834 cygwin)
8835 # cygwin needs only ldlibpth
8836 ;;
8837 *)
8838 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8839 ;;
8840 esac
8841 case "$xxx" in
8842 '') ;;
8843 *)
8844 # Only add $xxx if it isn't already in ccdlflags.
8845 case " $ccdlflags " in
8846 *" $xxx "*) ;;
8847 *) ccdlflags="$ccdlflags $xxx"
8848 cat <<EOM >&4
8849
8850Adding $xxx to the flags
8851passed to $ld so that the perl executable will find the
8852installed shared $libperl.
8853
8854EOM
8855 ;;
8856 esac
8857 ;;
8858 esac
8859fi
8860# Fix ccdlflags in AIX for building external extensions.
8861# (For building Perl itself bare -bE:perl.exp is needed,
8862# Makefile.SH takes care of this.)
8863case "$osname" in
8864aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8865esac
8866# Respect a hint or command-line value.
8867case "$shrpenv" in
8868'') shrpenv="$tmp_shrpenv" ;;
8869esac
8870case "$ldlibpthname" in
8871'') ldlibpthname=LD_LIBRARY_PATH ;;
8872none) ldlibpthname='' ;;
8873esac
8874
8875: determine where manual pages are on this system
8876echo " "
8877case "$sysman" in
8878'')
8879 syspath='/usr/share/man/man1 /usr/man/man1'
8880 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8881 syspath="$syspath /usr/man/u_man/man1"
8882 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8883 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8884 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8885 sysman=`./loc . /usr/man/man1 $syspath`
8886 ;;
8887esac
8888if $test -d "$sysman"; then
8889 echo "System manual is in $sysman." >&4
8890else
8891 echo "Could not find manual pages in source form." >&4
8892fi
8893
8894: determine where manual pages go
8895set man1dir man1dir none
8896eval $prefixit
8897$cat <<EOM
8898
8899$spackage has manual pages available in source form.
8900EOM
8901case "$nroff" in
8902nroff)
8903 echo "However, you don't have nroff, so they're probably useless to you."
8904 case "$man1dir" in
8905 '') man1dir="none";;
8906 esac;;
8907esac
8908echo "If you don't want the manual sources installed, answer 'none'."
8909case "$man1dir" in
8910' ') dflt=none
8911 ;;
8912'')
8913 lookpath="$prefixexp/share/man/man1"
8914 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8915 lookpath="$lookpath $prefixexp/man/p_man/man1"
8916 lookpath="$lookpath $prefixexp/man/u_man/man1"
8917 lookpath="$lookpath $prefixexp/man/man.1"
8918 case "$sysman" in
8919 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8920 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8921 esac
8922 set dflt
8923 eval $prefixup
8924 ;;
8925*) dflt="$man1dir"
8926 ;;
8927esac
8928echo " "
8929fn=dn+~
8930rp="Where do the main $spackage manual pages (source) go?"
8931. ./getfile
8932if $test "X$man1direxp" != "X$ansexp"; then
8933 installman1dir=''
8934fi
8935prefixvar=man1dir
8936. ./setprefixvar
8937
8938case "$man1dir" in
8939'') man1dir=' '
8940 installman1dir='';;
8941esac
8942
8943: What suffix to use on installed man pages
8944
8945case "$man1dir" in
8946' ')
8947 man1ext='0'
8948 ;;
8949*)
8950 rp="What suffix should be used for the main $spackage man pages?"
8951 case "$man1ext" in
8952 '') case "$man1dir" in
8953 *1) dflt=1 ;;
8954 *1p) dflt=1p ;;
8955 *1pm) dflt=1pm ;;
8956 *l) dflt=l;;
8957 *n) dflt=n;;
8958 *o) dflt=o;;
8959 *p) dflt=p;;
8960 *C) dflt=C;;
8961 *L) dflt=L;;
8962 *L1) dflt=L1;;
8963 *) dflt=1;;
8964 esac
8965 ;;
8966 *) dflt="$man1ext";;
8967 esac
8968 . ./myread
8969 man1ext="$ans"
8970 ;;
8971esac
8972
8973: see if we can have long filenames
8974echo " "
8975first=123456789abcdef
8976$rm -f $first
8977if (echo hi >$first) 2>/dev/null; then
8978 if $test -f 123456789abcde; then
8979 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8980 val="$undef"
8981 else
8982 echo 'You can have filenames longer than 14 characters.'>&4
8983 val="$define"
8984 fi
8985else
8986 $cat <<'EOM'
8987You can't have filenames longer than 14 chars.
8988You can't even think about them!
8989EOM
8990 val="$undef"
8991fi
8992set d_flexfnam
8993eval $setvar
8994$rm -rf 123456789abcde*
8995
8996: determine where library module manual pages go
8997set man3dir man3dir none
8998eval $prefixit
8999$cat <<EOM
9000
9001$spackage has manual pages for many of the library modules.
9002EOM
9003
9004case "$nroff" in
9005nroff)
9006 $cat <<'EOM'
9007However, you don't have nroff, so they're probably useless to you.
9008EOM
9009 case "$man3dir" in
9010 '') man3dir="none";;
9011 esac;;
9012esac
9013
9014case "$d_flexfnam" in
9015undef)
9016 $cat <<'EOM'
9017However, your system can't handle the long file names like File::Basename.3.
9018EOM
9019 case "$man3dir" in
9020 '') man3dir="none";;
9021 esac;;
9022esac
9023
9024echo "If you don't want the manual sources installed, answer 'none'."
9025prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9026case "$man3dir" in
9027'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9028 if $test -d "$privlib/man/man3"; then
9029 cat <<EOM >&4
9030
9031WARNING: Previous versions of perl installed man3 pages into
9032$privlib/man/man3. This version will suggest a
9033new default of $dflt.
9034EOM
9035 tdflt=$dflt
9036 dflt='n'
9037 rp='Do you wish to preserve the old behavior?(y/n)'
9038 . ./myread
9039 case "$ans" in
9040 y*) dflt="$privlib/man/man3" ;;
9041 *) dflt=$tdflt ;;
9042 esac
9043 fi
9044 ;;
9045*) dflt="$man3dir" ;;
9046esac
9047case "$dflt" in
9048' ') dflt=none ;;
9049esac
9050echo " "
9051fn=dn+~
9052rp="Where do the $package library man pages (source) go?"
9053. ./getfile
9054prefixvar=man3dir
9055. ./setprefixvar
9056
9057case "$man3dir" in
9058'') man3dir=' '
9059 installman3dir='';;
9060esac
9061
9062: What suffix to use on installed man pages
9063case "$man3dir" in
9064' ')
9065 man3ext='0'
9066 ;;
9067*)
9068 rp="What suffix should be used for the $package library man pages?"
9069 case "$man3ext" in
9070 '') case "$man3dir" in
9071 *3) dflt=3 ;;
9072 *3p) dflt=3p ;;
9073 *3pm) dflt=3pm ;;
9074 *l) dflt=l;;
9075 *n) dflt=n;;
9076 *o) dflt=o;;
9077 *p) dflt=p;;
9078 *C) dflt=C;;
9079 *L) dflt=L;;
9080 *L3) dflt=L3;;
9081 *) dflt=3;;
9082 esac
9083 ;;
9084 *) dflt="$man3ext";;
9085 esac
9086 . ./myread
9087 man3ext="$ans"
9088 ;;
9089esac
9090
9091: see if we have to deal with yellow pages, now NIS.
9092if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9093 case "$hostcat" in
9094 nidump*) ;;
9095 *)
9096 case "$hostcat" in
9097 *ypcat*) dflt=y;;
9098 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9099 dflt=y
9100 else
9101 dflt=n
9102 fi;;
9103 *) dflt=n;;
9104 esac
9105 echo " "
9106 rp='Are you getting the hosts file via yellow pages?'
9107 . ./myread
9108 case "$ans" in
9109 y*) hostcat='ypcat hosts';;
9110 *) hostcat='cat /etc/hosts';;
9111 esac
9112 ;;
9113 esac
9114fi
9115case "$hostcat" in
9116'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9117esac
9118case "$groupcat" in
9119'') test -f /etc/group && groupcat='cat /etc/group';;
9120esac
9121case "$passcat" in
9122'') test -f /etc/passwd && passcat='cat /etc/passwd';;
9123esac
9124
9125: now get the host name
9126echo " "
9127echo "Figuring out host name..." >&4
9128case "$myhostname" in
9129'') cont=true
9130 echo 'Maybe "hostname" will work...'
9131 if tans=`sh -c hostname 2>&1` ; then
9132 myhostname=$tans
9133 phostname=hostname
9134 cont=''
9135 fi
9136 ;;
9137*) cont='';;
9138esac
9139if $test "$cont"; then
9140 if ./xenix; then
9141 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
9142 if tans=`cat /etc/systemid 2>&1` ; then
9143 myhostname=$tans
9144 phostname='cat /etc/systemid'
9145 echo "Whadyaknow. Xenix always was a bit strange..."
9146 cont=''
9147 fi
9148 elif $test -r /etc/systemid; then
9149 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9150 fi
9151fi
9152if $test "$cont"; then
9153 echo 'No, maybe "uuname -l" will work...'
9154 if tans=`sh -c 'uuname -l' 2>&1` ; then
9155 myhostname=$tans
9156 phostname='uuname -l'
9157 else
9158 echo 'Strange. Maybe "uname -n" will work...'
9159 if tans=`sh -c 'uname -n' 2>&1` ; then
9160 myhostname=$tans
9161 phostname='uname -n'
9162 else
9163 echo 'Oh well, maybe I can mine it out of whoami.h...'
9164 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9165 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9166 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9167 else
9168 case "$myhostname" in
9169 '') echo "Does this machine have an identity crisis or something?"
9170 phostname='';;
9171 *)
9172 echo "Well, you said $myhostname before..."
9173 phostname='echo $myhostname';;
9174 esac
9175 fi
9176 fi
9177 fi
9178fi
9179case "$myhostname" in
9180'') myhostname=noname ;;
9181esac
9182: you do not want to know about this
9183set $myhostname
9184myhostname=$1
9185
9186: verify guess
9187if $test "$myhostname" ; then
9188 dflt=y
9189 rp='Your host name appears to be "'$myhostname'".'" Right?"
9190 . ./myread
9191 case "$ans" in
9192 y*) ;;
9193 *) myhostname='';;
9194 esac
9195fi
9196
9197: bad guess or no guess
9198while $test "X$myhostname" = X ; do
9199 dflt=''
9200 rp="Please type the (one word) name of your host:"
9201 . ./myread
9202 myhostname="$ans"
9203done
9204
9205: translate upper to lower if necessary
9206case "$myhostname" in
9207*[A-Z]*)
9208 echo "(Normalizing case in your host name)"
9209 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9210 ;;
9211esac
9212
9213case "$myhostname" in
9214*.*)
9215 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9216 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9217 echo "(Trimming domain name from host name--host name is now $myhostname)"
9218 ;;
9219*) case "$mydomain" in
9220 '')
9221 {
9222 test "X$hostcat" = "Xypcat hosts" &&
9223 ypmatch "$myhostname" hosts 2>/dev/null |\
9224 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
9225 $test -s hosts
9226 } || {
9227 test "X$hostcat" != "X" &&
9228 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
9229 /[ ]$myhostname[ . ]/p" > hosts
9230 }
9231 tmp_re="[ . ]"
9232 if $test -f hosts; then
9233 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
9234 END { print sum }" hosts` = x1 || tmp_re="[ ]"
9235 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9236 hosts | $sort | $uniq | \
9237 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9238 case `$echo X$dflt` in
9239 X*\ *) echo "(Several hosts in the database matched hostname)"
9240 dflt=.
9241 ;;
9242 X.) echo "(You do not have fully-qualified names in the hosts database)"
9243 ;;
9244 esac
9245 else
9246 echo "(I cannot locate a hosts database anywhere)"
9247 dflt=.
9248 fi
9249 case "$dflt" in
9250 .)
9251 tans=`./loc resolv.conf X /etc /usr/etc`
9252 if $test -f "$tans"; then
9253 echo "(Attempting domain name extraction from $tans)"
9254 dflt=.`$sed -n -e 's/ / /g' \
9255 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
9256 -e 1q 2>/dev/null`
9257 case "$dflt" in
9258 .) dflt=.`$sed -n -e 's/ / /g' \
9259 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
9260 -e 1q 2>/dev/null`
9261 ;;
9262 esac
9263 fi
9264 ;;
9265 esac
9266 case "$dflt" in
9267 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9268 dflt=.`sh -c domainname 2>/dev/null`
9269 case "$dflt" in
9270 '') dflt='.';;
9271 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9272 esac
9273 ;;
9274 esac
9275 case "$dflt$osname" in
9276 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9277 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9278 ;;
9279 esac
9280 case "$dflt" in
9281 .) echo "(Lost all hope -- silly guess then)"
9282 dflt='.nonet'
9283 ;;
9284 esac
9285 $rm -f hosts
9286 ;;
9287 *) dflt="$mydomain";;
9288 esac;;
9289esac
9290echo " "
9291rp="What is your domain name?"
9292. ./myread
9293tans="$ans"
9294case "$ans" in
9295'') ;;
9296.*) ;;
9297*) tans=".$tans";;
9298esac
9299mydomain="$tans"
9300
9301: translate upper to lower if necessary
9302case "$mydomain" in
9303*[A-Z]*)
9304 echo "(Normalizing case in your domain name)"
9305 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9306 ;;
9307esac
9308
9309: a little sanity check here
9310case "$phostname" in
9311'') ;;
9312*)
9313 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9314 $myhostname$mydomain|$myhostname) ;;
9315 *)
9316 case "$phostname" in
9317 sed*)
9318 echo "(That doesn't agree with your whoami.h file, by the way.)"
9319 ;;
9320 *)
9321 echo "(That doesn't agree with your $phostname command, by the way.)"
9322 ;;
9323 esac
9324 ;;
9325 esac
9326 ;;
9327esac
9328
9329: determine the e-mail address of the user who is running us
9330$cat <<EOM
9331
9332I need to get your e-mail address in Internet format if possible, i.e.
9333something like user@host.domain. Please answer accurately since I have
9334no easy means to double check it. The default value provided below
9335is most probably close to reality but may not be valid from outside
9336your organization...
9337
9338EOM
9339cont=x
9340while test "$cont"; do
9341 case "$MAILDOMAIN" in
9342 '')
9343 if $test -s /etc/mailname; then
9344 maildomain=`$cat /etc/mailname`
9345 else
9346 maildomain="$myhostname$mydomain"
9347 fi
9348 ;;
9349 *) maildomain="$MAILDOMAIN";;
9350 esac
9351 case "$cf_email" in
9352 '') dflt="$cf_by@$maildomain";;
9353 *) dflt="$cf_email";;
9354 esac
9355 rp='What is your e-mail address?'
9356 . ./myread
9357 cf_email="$ans"
9358 case "$cf_email" in
9359 *@*.*) cont='' ;;
9360 *)
9361 rp='Address does not look like an Internet one. Use it anyway?'
9362 case "$fastread" in
9363 yes) dflt=y ;;
9364 *) dflt=n ;;
9365 esac
9366 . ./myread
9367 case "$ans" in
9368 y*) cont='' ;;
9369 *) echo " " ;;
9370 esac
9371 ;;
9372 esac
9373done
9374
9375: Ask e-mail of administrator
9376$cat <<EOM
9377
9378If you or somebody else will be maintaining perl at your site, please
9379fill in the correct e-mail address here so that they may be contacted
9380if necessary. Currently, the "perlbug" program included with perl
9381will send mail to this address in addition to perlbug@perl.org. You may
9382enter "none" for no administrator.
9383
9384EOM
9385case "$perladmin" in
9386'') dflt="$cf_email";;
9387*) dflt="$perladmin";;
9388esac
9389rp='Perl administrator e-mail address'
9390. ./myread
9391perladmin="$ans"
9392
9393: determine whether to use a version number suffix for installed binaries
9394echo " "
9395$cat <<EOM
9396Do you want to use a version number suffix for installed binaries? This
9397will install 'perl$version' instead of 'perl', and likewise for other
9398binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9399to be installed side-by-side. Unless you are a developer, you probably
9400do *not* want to do this.
9401EOM
9402case "$versiononly" in
9403"$define"|[Yy]*|true) dflt='y' ;;
9404*) dflt='n';
9405esac
9406rp="Do you want to use a version number suffix for installed binaries?"
9407. ./myread
9408case "$ans" in
9409[yY]*) val="$define";;
9410*) val="$undef" ;;
9411esac
9412set versiononly
9413eval $setvar
9414
9415case "$versiononly" in
9416"$define") inc_version_list=''
9417 inc_version_list_init=0
9418 ;;
9419esac
9420
9421: figure out how to guarantee perl startup
9422: XXX Note that this currently takes advantage of the bug that binexp ignores
9423: the Configure -Dinstallprefix setting, which in turn means that under
9424: relocatable @INC, initialinstalllocation is what binexp started as.
9425case "$startperl" in
9426'')
9427 case "$sharpbang" in
9428 *!)
9429 $cat <<EOH
9430
9431I can use the #! construct to start perl on your system. This will
9432make startup of perl scripts faster, but may cause problems if you
9433want to share those scripts and perl is not in a standard place
9434($initialinstalllocation/perl) on all your platforms. The alternative
9435is to force a shell by starting the script with a single ':' character.
9436
9437EOH
9438 case "$versiononly" in
9439 "$define") dflt="$initialinstalllocation/perl$version";;
9440 *) dflt="$initialinstalllocation/perl";;
9441 esac
9442 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9443 . ./myread
9444 case "$ans" in
9445 none) startperl=": # use perl";;
9446 *) startperl="#!$ans"
9447 if $test 30 -lt `echo "$ans" | wc -c`; then
9448 $cat >&4 <<EOM
9449
9450WARNING: Some systems limit the #! command to 32 characters.
9451If you experience difficulty running Perl scripts with #!, try
9452installing Perl in a directory with a shorter pathname.
9453
9454EOM
9455 fi ;;
9456 esac
9457 ;;
9458 *) startperl=": # use perl"
9459 ;;
9460 esac
9461 ;;
9462esac
9463echo "I'll use $startperl to start perl scripts."
9464
9465: figure best path for perl in scripts
9466case "$perlpath" in
9467'')
9468 case "$versiononly" in
9469 "$define") perlpath="$initialinstalllocation/perl$version";;
9470 *) perlpath="$initialinstalllocation/perl";;
9471 esac
9472 case "$startperl" in
9473 *!*) ;;
9474 *)
9475 $cat <<EOH
9476
9477I will use the "eval 'exec'" idiom to start Perl on your system.
9478I can use the full path of your Perl binary for this purpose, but
9479doing so may cause problems if you want to share those scripts and
9480Perl is not always in a standard place ($initialinstalllocation/perl).
9481
9482EOH
9483 dflt="$initialinstalllocation/perl"
9484 rp="What path shall I use in \"eval 'exec'\"?"
9485 . ./myread
9486 perlpath="$ans"
9487 ;;
9488 esac
9489 ;;
9490esac
9491case "$startperl" in
9492*!*) ;;
9493*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9494esac
9495
9496: determine where public executable scripts go
9497set scriptdir scriptdir
9498eval $prefixit
9499case "$scriptdir" in
9500'')
9501 dflt="$bin"
9502 : guess some guesses
9503 $test -d /usr/share/scripts && dflt=/usr/share/scripts
9504 $test -d /usr/share/bin && dflt=/usr/share/bin
9505 $test -d /usr/local/script && dflt=/usr/local/script
9506 $test -d /usr/local/scripts && dflt=/usr/local/scripts
9507 $test -d $prefixexp/script && dflt=$prefixexp/script
9508 set dflt
9509 eval $prefixup
9510 ;;
9511*) dflt="$scriptdir"
9512 ;;
9513esac
9514$cat <<EOM
9515
9516Some installations have a separate directory just for executable scripts so
9517that they can mount it across multiple architectures but keep the scripts in
9518one spot. You might, for example, have a subdirectory of /usr/share for this.
9519Or you might just lump your scripts in with all your other executables.
9520
9521EOM
9522fn=d~
9523rp='Where do you keep publicly executable scripts?'
9524. ./getfile
9525if $test "X$ansexp" != "X$scriptdirexp"; then
9526 installscript=''
9527fi
9528installscriptdir=''
9529prefixvar=scriptdir
9530. ./setprefixvar
9531: A little fix up for an irregularly named variable.
9532installscript="$installscriptdir"
9533
9534: determine where add-on public executables go
9535case "$sitebin" in
9536'') dflt=$siteprefix/bin ;;
9537*) dflt=$sitebin ;;
9538esac
9539fn=d~
9540rp='Pathname where the add-on public executables should be installed?'
9541. ./getfile
9542prefixvar=sitebin
9543. ./setprefixvar
9544
9545: determine where add-on html pages go
9546: There is no standard location, so try to copy the previously-selected
9547: directory structure for the core html pages.
9548case "$sitehtml1dir" in
9549'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9550*) dflt=$sitehtml1dir ;;
9551esac
9552case "$dflt" in
9553''|' ') dflt=none ;;
9554esac
9555fn=dn+~
9556rp='Pathname where the site-specific html pages should be installed?'
9557. ./getfile
9558prefixvar=sitehtml1dir
9559. ./setprefixvar
9560
9561: determine where add-on library html pages go
9562: There is no standard location, so try to copy the previously-selected
9563: directory structure for the core html pages.
9564case "$sitehtml3dir" in
9565'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9566*) dflt=$sitehtml3dir ;;
9567esac
9568case "$dflt" in
9569''|' ') dflt=none ;;
9570esac
9571fn=dn+~
9572rp='Pathname where the site-specific library html pages should be installed?'
9573. ./getfile
9574prefixvar=sitehtml3dir
9575. ./setprefixvar
9576
9577: determine where add-on manual pages go
9578case "$siteman1dir" in
9579'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9580*) dflt=$siteman1dir ;;
9581esac
9582case "$dflt" in
9583''|' ') dflt=none ;;
9584esac
9585fn=dn+~
9586rp='Pathname where the site-specific manual pages should be installed?'
9587. ./getfile
9588prefixvar=siteman1dir
9589. ./setprefixvar
9590
9591: determine where add-on library man pages go
9592case "$siteman3dir" in
9593'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9594*) dflt=$siteman3dir ;;
9595esac
9596case "$dflt" in
9597''|' ') dflt=none ;;
9598esac
9599fn=dn+~
9600rp='Pathname where the site-specific library manual pages should be installed?'
9601. ./getfile
9602prefixvar=siteman3dir
9603. ./setprefixvar
9604
9605: determine where add-on public executable scripts go
9606case "$sitescript" in
9607'') dflt=$siteprefix/script
9608 $test -d $dflt || dflt=$sitebin ;;
9609*) dflt="$sitescript" ;;
9610esac
9611fn=d~+
9612rp='Pathname where add-on public executable scripts should be installed?'
9613. ./getfile
9614prefixvar=sitescript
9615. ./setprefixvar
9616
9617: see if backtrace exists
9618set backtrace d_backtrace
9619eval $inlibc
9620
9621: Check if C backtrace is actually supported.
9622case "$usecbacktrace" in
9623 "") usecbacktrace=$undef ;;
9624 [yY]*|true|$define)
9625 case "$d_backtrace" in
9626 [yY]*|true|$define)
9627 ;;
9628 *)
9629 echo "This system does not support backtrace" >&4
9630 usecbacktrace=$undef
9631 ;;
9632 esac
9633 ;;
9634 esac
9635
9636: Check if faststdio is requested and available
9637case "$usefaststdio" in
9638$define|true|[yY]*|'')
9639 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9640 case "$xversion" in
9641 [68]) dflt='y' ;;
9642 *) dflt='n' ;;
9643 esac
9644 ;;
9645*) dflt='n';;
9646esac
9647cat <<EOM
9648
9649Perl can be built to use 'fast stdio', which means using the stdio
9650library but also directly manipulating the stdio buffers to enable
9651faster I/O. Using stdio is better for backward compatibility (especially
9652for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9653interface has been preferred instead of stdio.
9654
9655If this doesn't make any sense to you, just accept the default '$dflt'.
9656EOM
9657rp='Use the "fast stdio" if available?'
9658. ./myread
9659case "$ans" in
9660y|Y) val="$define" ;;
9661*) val="$undef" ;;
9662esac
9663set usefaststdio
9664eval $setvar
9665
9666: define an is-a-typedef? function
9667typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9668case "$inclist" in
9669"") inclist="sys/types.h";;
9670esac;
9671eval "varval=\$$var";
9672case "$varval" in
9673"")
9674 $rm -f temp.c;
9675 for inc in $inclist; do
9676 echo "#include <$inc>" >>temp.c;
9677 done;
9678 echo "#ifdef $type" >> temp.c;
9679 echo "printf(\"We have $type\");" >> temp.c;
9680 echo "#endif" >> temp.c;
9681 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9682 if $contains $type temp.E >/dev/null 2>&1; then
9683 eval "$var=\$type";
9684 else
9685 eval "$var=\$def";
9686 fi;
9687 $rm -f temp.?;;
9688*) eval "$var=\$varval";;
9689esac'
9690
9691: define an is-a-typedef? function that prompts if the type is not available.
9692typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9693case "$inclist" in
9694"") inclist="sys/types.h";;
9695esac;
9696eval "varval=\$$var";
9697case "$varval" in
9698"")
9699 $rm -f temp.c;
9700 for inc in $inclist; do
9701 echo "#include <$inc>" >>temp.c;
9702 done;
9703 echo "#ifdef $type" >> temp.c;
9704 echo "printf(\"We have $type\");" >> temp.c;
9705 echo "#endif" >> temp.c;
9706 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9707 echo " " ;
9708 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9709 if $contains $type temp.E >/dev/null 2>&1; then
9710 echo "$type found." >&4;
9711 eval "$var=\$type";
9712 else
9713 echo "$type NOT found." >&4;
9714 dflt="$def";
9715 . ./myread ;
9716 eval "$var=\$ans";
9717 fi;
9718 $rm -f temp.?;;
9719*) eval "$var=\$varval";;
9720esac'
9721
9722: see what type lseek is declared as in the kernel
9723rp="What is the type used for lseek's offset on this system?"
9724set off_t lseektype long stdio.h sys/types.h
9725eval $typedef_ask
9726
9727echo " "
9728echo "Checking to see how big your file offsets are..." >&4
9729$cat >try.c <<EOCP
9730#include <sys/types.h>
9731#include <stdio.h>
9732int main()
9733{
9734 printf("%d\n", (int)sizeof($lseektype));
9735 return(0);
9736}
9737EOCP
9738set try
9739if eval $compile_ok; then
9740 lseeksize=`$run ./try`
9741 echo "Your file offsets are $lseeksize bytes long."
9742else
9743 dflt=$longsize
9744 echo " "
9745 echo "(I can't seem to compile the test program. Guessing...)"
9746 rp="What is the size of your file offsets (in bytes)?"
9747 . ./myread
9748 lseeksize="$ans"
9749fi
9750$rm_try
9751
9752: see what type file positions are declared as in the library
9753rp="What is the type for file position used by fsetpos()?"
9754set fpos_t fpostype long stdio.h sys/types.h
9755eval $typedef_ask
9756
9757: Check size for Fpos_t
9758echo " "
9759case "$fpostype" in
9760*_t) zzz="$fpostype" ;;
9761*) zzz="fpos_t" ;;
9762esac
9763echo "Checking the size of $zzz..." >&4
9764cat > try.c <<EOCP
9765#include <sys/types.h>
9766#include <stdio.h>
9767#$i_stdlib I_STDLIB
9768#ifdef I_STDLIB
9769#include <stdlib.h>
9770#endif
9771int main() {
9772 printf("%d\n", (int)sizeof($fpostype));
9773 exit(0);
9774}
9775EOCP
9776set try
9777if eval $compile_ok; then
9778 yyy=`$run ./try`
9779 case "$yyy" in
9780 '') fpossize=4
9781 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9782 ;;
9783 *) fpossize=$yyy
9784 echo "Your $zzz is $fpossize bytes long."
9785 ;;
9786 esac
9787else
9788 dflt="$longsize"
9789 echo " " >&4
9790 echo "(I can't compile the test program. Guessing...)" >&4
9791 rp="What is the size of your file positions (in bytes)?"
9792 . ./myread
9793 fpossize="$ans"
9794fi
9795
9796: Check for large file support
9797# Backward compatibility (uselfs is deprecated).
9798case "$uselfs" in
9799"$define"|true|[yY]*)
9800 cat <<EOM >&4
9801
9802*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9803EOM
9804 uselargefiles="$define"
9805 ;;
9806esac
9807
9808case "$lseeksize:$fpossize" in
98098:8) cat <<EOM
9810
9811You can have files larger than 2 gigabytes.
9812EOM
9813 val="$define" ;;
9814*) case "$uselargefiles" in
9815 "$undef"|false|[nN]*) dflt='n' ;;
9816 *) dflt='y' ;;
9817 esac
9818 cat <<EOM
9819
9820Perl can be built to understand large files (files larger than 2 gigabytes)
9821on some systems. To do so, Configure can be run with -Duselargefiles.
9822
9823If this doesn't make any sense to you, just accept the default '$dflt'.
9824EOM
9825 rp='Try to understand large files, if available?'
9826 . ./myread
9827 case "$ans" in
9828 y|Y) val="$define" ;;
9829 *) val="$undef" ;;
9830 esac
9831 ;;
9832esac
9833set uselargefiles
9834eval $setvar
9835: Look for a hint-file generated 'call-back-unit'. If the
9836: user has specified that a large files perl is to be built,
9837: we may need to set or change some other defaults.
9838if $test -f uselargefiles.cbu; then
9839 echo "Your platform has some specific hints regarding large file builds, using them..."
9840 . ./uselargefiles.cbu
9841fi
9842case "$uselargefiles" in
9843"$define")
9844 if $test -f uselargefiles.cbu; then
9845 echo " "
9846 echo "Rechecking to see how big your file offsets are..." >&4
9847 $cat >try.c <<EOCP
9848#include <sys/types.h>
9849#include <stdio.h>
9850int main()
9851{
9852 printf("%d\n", (int)sizeof($lseektype));
9853 return(0);
9854}
9855EOCP
9856 set try
9857 if eval $compile_ok; then
9858 lseeksize=`$run ./try`
9859 $echo "Your file offsets are now $lseeksize bytes long."
9860 else
9861 dflt="$lseeksize"
9862 echo " "
9863 echo "(I can't seem to compile the test program. Guessing...)"
9864 rp="What is the size of your file offsets (in bytes)?"
9865 . ./myread
9866 lseeksize="$ans"
9867 fi
9868 case "$fpostype" in
9869 *_t) zzz="$fpostype" ;;
9870 *) zzz="fpos_t" ;;
9871 esac
9872 $echo $n "Rechecking the size of $zzz...$c" >&4
9873 $cat > try.c <<EOCP
9874#include <sys/types.h>
9875#include <stdio.h>
9876#$i_stdlib I_STDLIB
9877#ifdef I_STDLIB
9878#include <stdlib.h>
9879#endif
9880int main() {
9881 printf("%d\n", (int)sizeof($fpostype));
9882 return(0);
9883}
9884EOCP
9885 set try
9886 if eval $compile_ok; then
9887 yyy=`$run ./try`
9888 dflt="$lseeksize"
9889 case "$yyy" in
9890 '') echo " "
9891 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9892 ;;
9893 *) fpossize=$yyy
9894 echo " $fpossize bytes." >&4
9895 ;;
9896 esac
9897 else
9898 dflt="$fpossize"
9899 echo " "
9900 echo "(I can't compile the test program. Guessing...)" >&4
9901 rp="What is the size of your file positions (in bytes)?"
9902 . ./myread
9903 fpossize="$ans"
9904 fi
9905 $rm_try
9906 fi
9907 ;;
9908esac
9909
9910: Check if we want perlio
9911useperlio="$define"
9912
9913: Set the vendorbin variables
9914case "$vendorprefix" in
9915'') d_vendorbin="$undef"
9916 vendorbin=''
9917 vendorbinexp=''
9918 ;;
9919*) d_vendorbin="$define"
9920 : determine where vendor-supplied executables go.
9921 case "$vendorbin" in
9922 '') dflt=$vendorprefix/bin ;;
9923 *) dflt="$vendorbin" ;;
9924 esac
9925 fn=d~+
9926 rp='Pathname for the vendor-supplied executables directory?'
9927 . ./getfile
9928 vendorbin="$ans"
9929 vendorbinexp="$ansexp"
9930 ;;
9931esac
9932prefixvar=vendorbin
9933. ./installprefix
9934
9935: Set the vendorhtml1dir variables
9936case "$vendorprefix" in
9937'') vendorhtml1dir=''
9938 vendorhtml1direxp=''
9939 ;;
9940*) : determine where vendor-supplied html pages go.
9941 : There is no standard location, so try to copy the previously-selected
9942 : directory structure for the core html pages.
9943 : XXX Better default suggestions would be welcome.
9944 case "$vendorhtml1dir" in
9945 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9946 *) dflt=$vendorhtml1dir ;;
9947 esac
9948 case "$dflt" in
9949 ''|' ') dflt=none ;;
9950 esac
9951 fn=dn+~
9952 rp='Pathname for the vendor-supplied html pages?'
9953 . ./getfile
9954 vendorhtml1dir="$ans"
9955 vendorhtml1direxp="$ansexp"
9956 ;;
9957esac
9958: Use ' ' for none so value is preserved next time through Configure
9959$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9960prefixvar=vendorhtml1dir
9961. ./installprefix
9962
9963: Set the vendorhtml3dir variables
9964case "$vendorprefix" in
9965'') vendorhtml3dir=''
9966 vendorhtml3direxp=''
9967 ;;
9968*) : determine where vendor-supplied module html pages go.
9969 : There is no standard location, so try to copy the previously-selected
9970 : directory structure for the core html pages.
9971 : XXX Better default suggestions would be welcome.
9972 case "$vendorhtml3dir" in
9973 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9974 *) dflt=$vendorhtml3dir ;;
9975 esac
9976 case "$dflt" in
9977 ''|' ') dflt=none ;;
9978 esac
9979 fn=dn+~
9980 rp='Pathname for the vendor-supplied html pages?'
9981 . ./getfile
9982 vendorhtml3dir="$ans"
9983 vendorhtml3direxp="$ansexp"
9984 ;;
9985esac
9986: Use ' ' for none so value is preserved next time through Configure
9987$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9988prefixvar=vendorhtml3dir
9989. ./installprefix
9990
9991: Set the vendorman1dir variables
9992case "$vendorprefix" in
9993'') vendorman1dir=''
9994 vendorman1direxp=''
9995 ;;
9996*) : determine where vendor-supplied manual pages go.
9997 case "$vendorman1dir" in
9998 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9999 *) dflt=$vendorman1dir ;;
10000 esac
10001 case "$dflt" in
10002 ''|' ') dflt=none ;;
10003 esac
10004 fn=nd~+
10005 rp='Pathname for the vendor-supplied manual section 1 pages?'
10006 . ./getfile
10007 vendorman1dir="$ans"
10008 vendorman1direxp="$ansexp"
10009 ;;
10010esac
10011: Use ' ' for none so value is preserved next time through Configure
10012$test X"$vendorman1dir" = "X" && vendorman1dir=' '
10013prefixvar=vendorman1dir
10014. ./installprefix
10015
10016: Set the vendorman3dir variables
10017case "$vendorprefix" in
10018'') vendorman3dir=''
10019 vendorman3direxp=''
10020 ;;
10021*) : determine where vendor-supplied module manual pages go.
10022 case "$vendorman3dir" in
10023 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10024 *) dflt=$vendorman3dir ;;
10025 esac
10026 case "$dflt" in
10027 ''|' ') dflt=none ;;
10028 esac
10029 fn=nd~+
10030 rp='Pathname for the vendor-supplied manual section 3 pages?'
10031 . ./getfile
10032 vendorman3dir="$ans"
10033 vendorman3direxp="$ansexp"
10034 ;;
10035esac
10036: Use ' ' for none so value is preserved next time through Configure
10037$test X"$vendorman3dir" = "X" && vendorman3dir=' '
10038prefixvar=vendorman3dir
10039. ./installprefix
10040
10041: Set the vendorscript variables
10042case "$vendorprefix" in
10043'') d_vendorscript="$undef"
10044 vendorscript=''
10045 vendorscriptexp=''
10046 ;;
10047*) d_vendorscript="$define"
10048 : determine where vendor-supplied scripts go.
10049 case "$vendorscript" in
10050 '') dflt=$vendorprefix/script
10051 $test -d $dflt || dflt=$vendorbin ;;
10052 *) dflt="$vendorscript" ;;
10053 esac
10054 $cat <<EOM
10055
10056The installation process will create a directory for
10057vendor-supplied scripts.
10058
10059EOM
10060 fn=d~+
10061 rp='Pathname for the vendor-supplied scripts directory?'
10062 . ./getfile
10063 vendorscript="$ans"
10064 vendorscriptexp="$ansexp"
10065 ;;
10066esac
10067prefixvar=vendorscript
10068. ./installprefix
10069
10070: see if qgcvt exists
10071set qgcvt d_qgcvt
10072eval $inlibc
10073
10074: Check what kind of doubles your system has
10075$echo "Checking the kind of doubles you have..." >&4
10076$cat >try.c <<EOP
10077#$i_stdlib I_STDLIB
10078#define DOUBLESIZE $doublesize
10079#ifdef I_STDLIB
10080#include <stdlib.h>
10081#endif
10082#include <stdio.h>
10083static const double d = -0.1;
10084int main() {
10085 unsigned const char* b = (unsigned const char*)(&d);
10086#if DOUBLESIZE == 4
10087 if (b[0] == 0xCD && b[3] == 0xBD) {
10088 /* IEEE 754 32-bit little-endian */
10089 printf("1\n");
10090 exit(0);
10091 }
10092 if (b[0] == 0xBD && b[3] == 0xCD) {
10093 /* IEEE 754 32-bit big-endian */
10094 printf("2\n");
10095 exit(0);
10096 }
10097 if (b[0] == 0xCC && b[3] == 0xCC) {
10098 /* VAX format F, 32-bit PDP-style mixed endian. */
10099 printf("9\n");
10100 exit(0);
10101 }
10102 if (b[0] == 0xC0 && b[3] == 0x9A) {
10103 /* IBM single 32-bit */
10104 printf("12\n");
10105 exit(0);
10106 }
10107#endif
10108#if DOUBLESIZE == 8
10109 if (b[0] == 0x9A && b[7] == 0xBF) {
10110 /* IEEE 754 64-bit little-endian */
10111 printf("3\n");
10112 exit(0);
10113 }
10114 if (b[0] == 0xBF && b[7] == 0x9A) {
10115 /* IEEE 754 64-bit big-endian */
10116 printf("4\n");
10117 exit(0);
10118 }
10119 if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10120 /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10121 * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10122 * 99 99 b9 bf 9a 99 99 99 */
10123 printf("7\n");
10124 exit(0);
10125 }
10126 if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10127 /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10128 * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10129 * 99 99 99 9a bf b9 99 99 */
10130 printf("8\n");
10131 exit(0);
10132 }
10133 if (b[0] == 0xCC && b[7] == 0xCC) {
10134 /* VAX format D, 64-bit PDP-style mixed endian. */
10135 printf("10\n");
10136 exit(0);
10137 }
10138 if (b[0] == 0xD9 && b[7] == 0x99) {
10139 /* VAX format G, 64-bit PDP-style mixed endian. */
10140 printf("11\n");
10141 exit(0);
10142 }
10143 if (b[0] == 0xC0 && b[7] == 0x9A) {
10144 /* IBM double 64-bit */
10145 printf("13\n");
10146 exit(0);
10147 }
10148 if (b[0] == 0xBF && b[7] == 0xCD) {
10149 /* CRAY single 64-bit */
10150 printf("14\n");
10151 exit(0);
10152 }
10153#endif
10154#if DOUBLESIZE == 16
10155 if (b[0] == 0x9A && b[15] == 0xBF) {
10156 /* IEEE 754 128-bit little-endian */
10157 printf("5\n");
10158 exit(0);
10159 }
10160 if (b[0] == 0xBF && b[15] == 0x9A) {
10161 /* IEEE 754 128-bit big-endian */
10162 printf("6\n");
10163 exit(0);
10164 }
10165#endif
10166 /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10167 * Whether those environments can still build Perl is debatable. */
10168 printf("-1\n"); /* unknown */
10169 exit(0);
10170}
10171EOP
10172set try
10173if eval $compile; then
10174 doublekind=`$run ./try`
10175else
10176 doublekind=-1
10177fi
10178case "$doublekind" in
101791) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
101802) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
101813) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
101824) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
101835) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
101846) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
101857) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
101868) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
101879) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
1018810) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
1018911) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
1019012) echo "You have IBM short 32-bit doubles." >&4 ;;
1019113) echo "You have IBM long 64-bit doubles." >&4 ;;
1019214) echo "You have Cray single 64-bit doubles." >&4 ;;
10193*) echo "Cannot figure out your double. You Cyber, or something?" >&4 ;;
10194esac
10195d_double_style_ieee=$undef
10196d_double_style_vax=$undef
10197d_double_style_ibm=$undef
10198d_double_style_cray=$undef
10199case "$doublekind" in
102001|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
102019|10|11) d_double_style_vax=$define ;;
1020212|13) d_double_style_ibm=$define ;;
1020314) d_double_style_cray=$define ;;
10204esac
10205case "$d_double_style_ieee" in
10206$define)
10207 d_double_has_inf=$define
10208 d_double_has_nan=$define
10209 d_double_has_negative_zero=$define
10210 d_double_has_subnormals=$define
10211 ;;
10212*)
10213 d_double_has_inf=$undef
10214 d_double_has_nan=$undef
10215 d_double_has_negative_zero=$undef
10216 d_double_has_subnormals=$undef
10217 ;;
10218esac
10219$rm_try
10220
10221: Check print/scan long double stuff
10222echo " "
10223
10224if $test X"$d_longdbl" = X"$define"; then
10225
10226echo "Checking how to print long doubles..." >&4
10227
10228if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10229 $cat >try.c <<'EOCP'
10230#include <sys/types.h>
10231#include <stdio.h>
10232int main() {
10233 double d = 123.456;
10234 printf("%.3f\n", d);
10235}
10236EOCP
10237 set try
10238 if eval $compile; then
10239 yyy=`$run ./try`
10240 case "$yyy" in
10241 123.456)
10242 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10243 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10244 echo "We will use %f."
10245 ;;
10246 esac
10247 fi
10248fi
10249
10250if $test X"$sPRIfldbl" = X; then
10251 $cat >try.c <<'EOCP'
10252#include <sys/types.h>
10253#include <stdio.h>
10254int main() {
10255 long double d = 123.456;
10256 printf("%.3Lf\n", d);
10257}
10258EOCP
10259 set try
10260 if eval $compile; then
10261 yyy=`$run ./try`
10262 case "$yyy" in
10263 123.456)
10264 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10265 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10266 echo "We will use %Lf."
10267 ;;
10268 esac
10269 fi
10270fi
10271
10272if $test X"$sPRIfldbl" = X; then
10273 $cat >try.c <<'EOCP'
10274#include <sys/types.h>
10275#include <stdio.h>
10276int main() {
10277 long double d = 123.456;
10278 printf("%.3llf\n", d);
10279}
10280EOCP
10281 set try
10282 if eval $compile; then
10283 yyy=`$run ./try`
10284 case "$yyy" in
10285 123.456)
10286 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10287 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10288 echo "We will use %llf."
10289 ;;
10290 esac
10291 fi
10292fi
10293
10294if $test X"$sPRIfldbl" = X; then
10295 $cat >try.c <<'EOCP'
10296#include <sys/types.h>
10297#include <stdio.h>
10298int main() {
10299 long double d = 123.456;
10300 printf("%.3lf\n", d);
10301}
10302EOCP
10303 set try
10304 if eval $compile; then
10305 yyy=`$run ./try`
10306 case "$yyy" in
10307 123.456)
10308 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10309 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10310 echo "We will use %lf."
10311 ;;
10312 esac
10313 fi
10314fi
10315
10316if $test X"$sPRIfldbl" = X; then
10317 echo "Cannot figure out how to print long doubles." >&4
10318else
10319 sSCNfldbl=$sPRIfldbl # expect consistency
10320fi
10321
10322$rm_try
10323
10324fi # d_longdbl
10325
10326case "$sPRIfldbl" in
10327'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10328 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10329 d_SCNfldbl="$undef";
10330 ;;
10331*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10332 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10333 d_SCNfldbl="$define";
10334 ;;
10335esac
10336
10337: Before committing on uselongdouble, see whether that looks sane.
10338if $test "$uselongdouble" = "$define"; then
10339 message=""
10340 echo " "
10341 echo "Checking if your long double math functions work right..." >&4
10342 $cat > try.c <<EOF
10343#include <math.h>
10344#include <stdio.h>
10345int main() {
10346 printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10347}
10348EOF
10349 case "$osname:$gccversion" in
10350 aix:) saveccflags="$ccflags"
10351 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10352 esac
10353 set try
10354 if eval $compile_ok; then
10355 yyy=`$run ./try`
10356 fi
10357 case "$yyy" in
10358 3) echo "Your long double math functions are working correctly." >&4 ;;
10359 *) echo "Your long double math functions are broken, not using long doubles." >&4
10360 uselongdouble=$undef
10361 ;;
10362 esac
10363 $rm_try
10364 case "$osname:$gccversion" in
10365 aix:) ccflags="$saveccflags" ;; # restore
10366 esac
10367fi
10368
10369: Check how to convert floats to strings.
10370
10371if test "X$d_Gconvert" = X; then
10372
10373echo " "
10374echo "Checking for an efficient way to convert floats to strings."
10375echo " " > try.c
10376case "$uselongdouble" in
10377"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10378esac
10379case "$d_longdbl" in
10380"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10381esac
10382case "$d_PRIgldbl" in
10383"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
10384esac
10385$cat >>try.c <<EOP
10386#ifdef TRY_gconvert
10387#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10388const char *myname = "gconvert";
10389#endif
10390#ifdef TRY_gcvt
10391#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10392const char *myname = "gcvt";
10393#endif
10394#ifdef TRY_qgcvt
10395#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10396const char *myname = "qgcvt";
10397#define DOUBLETYPE long double
10398#endif
10399#ifdef TRY_sprintf
10400#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10401#ifdef HAS_PRIgldbl
10402#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10403#else
10404#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10405#endif
10406#else
10407#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10408#endif
10409const char *myname = "sprintf";
10410#endif
10411
10412#ifndef DOUBLETYPE
10413#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10414#define DOUBLETYPE long double
10415#else
10416#define DOUBLETYPE double
10417#endif
10418#endif
10419
10420#include <stdio.h>
10421
10422#$i_stdlib I_STDLIB
10423#ifdef I_STDLIB
10424#include <stdlib.h>
10425#endif
10426#include <string.h>
10427
10428void checkit(const char *expect, char *got)
10429{
10430 if (strcmp(expect, got)) {
10431 printf("%s oddity: Expected %s, got %s\n",
10432 myname, expect, got);
10433 exit(1);
10434 }
10435}
10436
10437int main()
10438{
10439 char buf[64];
10440 buf[63] = '\0';
10441
10442 /* This must be 1st test on (which?) platform */
10443 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10444 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10445 checkit("0.1", buf);
10446
10447 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10448 checkit("0.01", buf);
10449
10450 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10451 checkit("0.001", buf);
10452
10453 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10454 checkit("0.0001", buf);
10455
10456 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10457 if (strlen(buf) > 5)
10458 checkit("9e-005", buf); /* for Microsoft ?? */
10459 else
10460 checkit("9e-05", buf);
10461
10462 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10463 checkit("1", buf);
10464
10465 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10466 checkit("1.1", buf);
10467
10468 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10469 checkit("1.01", buf);
10470
10471 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10472 checkit("1.001", buf);
10473
10474 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10475 checkit("1.0001", buf);
10476
10477 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10478 checkit("1.00001", buf);
10479
10480 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10481 checkit("1.000001", buf);
10482
10483 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10484 checkit("0", buf);
10485
10486 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10487 checkit("-1", buf);
10488
10489 /* Some Linux gcvt's give 1.e+5 here. */
10490 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10491 checkit("100000", buf);
10492
10493 /* Some Linux gcvt's give -1.e+5 here. */
10494 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10495 checkit("-100000", buf);
10496
10497 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10498 checkit("123.456", buf);
10499
10500 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10501 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10502 /* 34 should be enough to scare even long double
10503 * places into using the e notation. */
10504 if (strlen(buf) > 5)
10505 checkit("1e+034", buf); /* for Microsoft */
10506 else
10507 checkit("1e+34", buf);
10508
10509 /* For Perl, if you add additional tests here, also add them to
10510 * t/base/num.t for benefit of platforms not using Configure or
10511 * overriding d_Gconvert */
10512
10513 exit(0);
10514}
10515EOP
10516: first add preferred functions to our list
10517xxx_list=""
10518for xxx_convert in $gconvert_preference; do
10519 case $xxx_convert in
10520 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10521 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10522 esac
10523done
10524: then add any others
10525for xxx_convert in gconvert gcvt sprintf; do
10526 case "$xxx_list" in
10527 *$xxx_convert*) ;;
10528 *) xxx_list="$xxx_list $xxx_convert" ;;
10529 esac
10530done
10531
10532case "$d_longdbl$uselongdouble" in
10533"$define$define")
10534 : again, add preferred functions to our list first
10535 xxx_ld_list=""
10536 for xxx_convert in $gconvert_ld_preference; do
10537 case $xxx_convert in
10538 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10539 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10540 esac
10541 done
10542 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10543 for xxx_convert in qgcvt sprintf $xxx_list; do
10544 case "$xxx_ld_list" in
10545 $xxx_convert*|*" $xxx_convert"*) ;;
10546 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10547 esac
10548 done
10549 : if sprintf cannot do long doubles, move it to the end
10550 if test "$d_PRIgldbl" != "$define"; then
10551 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10552 fi
10553 : if no qgcvt, remove it
10554 if test "$d_qgcvt" != "$define"; then
10555 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10556 fi
10557 : use the ld_list
10558 xxx_list="$xxx_ld_list"
10559 ;;
10560esac
10561
10562for xxx_convert in $xxx_list; do
10563 echo "Trying $xxx_convert..."
10564 $rm -f try try$_o core
10565 set try -DTRY_$xxx_convert
10566 if eval $compile; then
10567 echo "$xxx_convert() found." >&4
10568 if $run ./try; then
10569 echo "I'll use $xxx_convert to convert floats into a string." >&4
10570 break;
10571 else
10572 echo "...But $xxx_convert didn't work as I expected."
10573 xxx_convert=''
10574 fi
10575 else
10576 echo "$xxx_convert NOT found." >&4
10577 xxx_convert=''
10578 fi
10579done
10580
10581if test X$xxx_convert = X; then
10582 echo "*** WHOA THERE!!! ***" >&4
10583 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
10584 xxx_convert=sprintf
10585fi
10586
10587case "$xxx_convert" in
10588gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10589gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10590qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10591*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10592 "$define$define$define")
10593 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10594 "$define$define$undef")
10595 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10596 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10597 esac
10598 ;;
10599esac
10600
10601fi
10602$rm_try
10603
10604: see if _fwalk exists
10605set fwalk d__fwalk
10606eval $inlibc
10607
10608: see if accept4 exists
10609set accept4 d_accept4
10610eval $inlibc
10611
10612: Initialize h_fcntl
10613h_fcntl=false
10614
10615: Initialize h_sysfile
10616h_sysfile=false
10617
10618: access call always available on UNIX
10619set access d_access
10620eval $inlibc
10621
10622: locate the flags for 'access()'
10623case "$d_access" in
10624"$define")
10625 echo " "
10626 $cat >access.c <<EOCP
10627#include <sys/types.h>
10628#ifdef I_FCNTL
10629#include <fcntl.h>
10630#endif
10631#ifdef I_SYS_FILE
10632#include <sys/file.h>
10633#endif
10634#ifdef I_UNISTD
10635#include <unistd.h>
10636#endif
10637#$i_stdlib I_STDLIB
10638#ifdef I_STDLIB
10639#include <stdlib.h>
10640#endif
10641int main() {
10642 exit(R_OK);
10643}
10644EOCP
10645 : check sys/file.h first, no particular reason here
10646 if $test `./findhdr sys/file.h` && \
10647 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10648 h_sysfile=true;
10649 echo "<sys/file.h> defines the *_OK access constants." >&4
10650 elif $test `./findhdr fcntl.h` && \
10651 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10652 h_fcntl=true;
10653 echo "<fcntl.h> defines the *_OK access constants." >&4
10654 elif $test `./findhdr unistd.h` && \
10655 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10656 echo "<unistd.h> defines the *_OK access constants." >&4
10657 else
10658 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10659 fi
10660 ;;
10661esac
10662$rm -f access*
10663
10664: see if accessx exists
10665set accessx d_accessx
10666eval $inlibc
10667
10668: see if acosh exists
10669set acosh d_acosh
10670eval $inlibc
10671
10672: see if aintl exists
10673set aintl d_aintl
10674eval $inlibc
10675
10676: see if alarm exists
10677set alarm d_alarm
10678eval $inlibc
10679
10680: see if 64bit time functions exists
10681
10682set ctime64 d_ctime64
10683eval $inlibc
10684
10685set localtime64 d_localtime64
10686eval $inlibc
10687
10688set gmtime64 d_gmtime64
10689eval $inlibc
10690
10691set mktime64 d_mktime64
10692eval $inlibc
10693
10694set difftime64 d_difftime64
10695eval $inlibc
10696
10697set asctime64 d_asctime64
10698eval $inlibc
10699
10700: see if POSIX threads are available
10701set pthread.h i_pthread
10702eval $inhdr
10703
10704: define a function to check prototypes
10705$cat > protochk <<EOSH
10706$startsh
10707cc="$cc"
10708optimize="$optimize"
10709ccflags="$ccflags"
10710define="$define"
10711rm_try="$rm_try"
10712usethreads=$usethreads
10713i_pthread=$i_pthread
10714pthread_h_first=$pthread_h_first
10715EOSH
10716
10717$cat >> protochk <<'EOSH'
10718
10719$rm_try
10720foo="$1"
10721shift
10722while test $# -ge 2; do
10723 case "$1" in
10724 $define) echo "#include <$2>" >> try.c ;;
10725 literal) echo "$2" >> try.c ;;
10726 esac
10727 # Extra magic for the benefit of systems that need pthread.h
10728 # to be included early to correctly detect threadsafe functions.
10729 # Such functions must guarantee themselves, though, that the usethreads
10730 # and i_pthread have been defined, before calling protochk.
10731 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10732 echo "#include <pthread.h>" >> try.c
10733 pthread_h_done=yes
10734 fi
10735 shift 2
10736done
10737cat >> try.c <<'EOCP'
10738#define _(args) args
10739EOCP
10740echo "$foo" >> try.c
10741echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10742$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10743status=$?
10744$rm_try
10745exit $status
10746EOSH
10747chmod +x protochk
10748$eunicefix protochk
10749
10750: Define hasproto macro for Configure internal use
10751hasproto='varname=$1; func=$2; shift; shift;
10752while $test $# -ge 2; do
10753 case "$1" in
10754 $define) echo "#include <$2>";;
10755 literal) echo "$2" ;;
10756 esac ;
10757 shift 2;
10758done > try.c;
10759$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10760if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10761 echo "$func() prototype found.";
10762 val="$define";
10763else
10764 echo "$func() prototype NOT found.";
10765 val="$undef";
10766fi;
10767set $varname;
10768eval $setvar;
10769$rm_try tryout.c'
10770
10771: see if sys/types.h has to be included
10772set sys/types.h i_systypes
10773eval $inhdr
10774
10775: see if sys/select.h has to be included
10776set sys/select.h i_sysselct
10777eval $inhdr
10778
10779: Define hasfield macro for Configure internal use
10780hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10781while $test $# -ge 2; do
10782 case "$1" in
10783 $define) echo "#include <$2>";;
10784 esac ;
10785 shift 2;
10786done > try.c;
10787echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10788set try;
10789if eval $compile; then
10790 val="$define";
10791else
10792 val="$undef";
10793fi;
10794set $varname;
10795eval $setvar;
10796$rm_try'
10797
10798: see if we should include sys/time.h
10799echo " "
10800i_time='define'
10801if test "X$timeincl" = X; then
10802 echo "Testing to see if we should include <sys/time.h>." >&4
10803 $echo $n "I'm now running the test program...$c"
10804 $cat >try.c <<EOCP
10805#include <sys/types.h>
10806#include <time.h>
10807#ifdef I_SYSTIME
10808#ifdef SYSTIMEKERNEL
10809#define KERNEL
10810#endif
10811#include <sys/time.h>
10812#endif
10813#ifdef I_SYSSELECT
10814#include <sys/select.h>
10815#endif
10816#$i_stdlib I_STDLIB
10817#ifdef I_STDLIB
10818#include <stdlib.h>
10819#endif
10820int main()
10821{
10822 struct tm foo;
10823#ifdef S_TIMEVAL
10824 struct timeval bar;
10825#endif
10826#ifdef S_TIMEZONE
10827 struct timezone tzp;
10828#endif
10829 if (foo.tm_sec == foo.tm_sec)
10830 exit(0);
10831#ifdef S_TIMEVAL
10832 if (bar.tv_sec == bar.tv_sec)
10833 exit(0);
10834#endif
10835 exit(1);
10836}
10837EOCP
10838 flags=''
10839 for s_timezone in '-DS_TIMEZONE' ''; do
10840 sysselect=''
10841 for s_timeval in '-DS_TIMEVAL' ''; do
10842 for i_systimek in '' '-DSYSTIMEKERNEL'; do
10843 for i_systime in '-DI_SYSTIME' ''; do
10844 case "$flags" in
10845 '') $echo $n ".$c"
10846 set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10847 if eval $compile; then
10848 set X $i_systime $i_systimek $sysselect $s_timeval
10849 shift
10850 flags="$*"
10851 echo " "
10852 $echo $n "Succeeded with $flags$c"
10853 fi
10854 ;;
10855 esac
10856 done
10857 done
10858 done
10859 done
10860 timeincl=''
10861 echo " "
10862 case "$flags" in
10863 *SYSTIMEKERNEL*) i_systimek="$define"
10864 timeincl=`./findhdr sys/time.h`
10865 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10866 *) i_systimek="$undef";;
10867 esac
10868 case "$flags" in
10869 *I_SYSTIME*) i_systime="$define"
10870 timeincl=`./findhdr sys/time.h`" $timeincl"
10871 echo "We'll include <sys/time.h>." >&4;;
10872 *) i_systime="$undef";;
10873 esac
10874 $rm_try
10875fi
10876: see if struct tm knows about tm_zone
10877case "$i_systime$i_time" in
10878*$define*)
10879 echo " "
10880 echo "Checking to see if your struct tm has tm_zone field..." >&4
10881 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10882 eval $hasfield
10883 ;;
10884*) val="$undef"
10885 set d_tm_tm_zone
10886 eval $setvar
10887 ;;
10888esac
10889case "$d_tm_tm_zone" in
10890"$define") echo "Yes, it does." ;;
10891*) echo "No, it doesn't." ;;
10892esac
10893: see if struct tm knows about tm_gmtoff
10894case "$i_systime$i_time" in
10895*$define*)
10896 echo " "
10897 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10898 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10899 eval $hasfield
10900 ;;
10901*) val="$undef"
10902 set d_tm_tm_gmtoff
10903 eval $setvar
10904 ;;
10905esac
10906case "$d_tm_tm_gmtoff" in
10907"$define") echo "Yes, it does." ;;
10908*) echo "No, it doesn't." ;;
10909esac
10910
10911: see if asctime_r exists
10912set asctime_r d_asctime_r
10913eval $inlibc
10914case "$d_asctime_r" in
10915"$define")
10916 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10917 case "$d_asctime_r_proto:$usethreads" in
10918 ":define") d_asctime_r_proto=define
10919 set d_asctime_r_proto asctime_r $hdrs
10920 eval $hasproto ;;
10921 *) ;;
10922 esac
10923 case "$d_asctime_r_proto" in
10924 define)
10925 case "$asctime_r_proto" in
10926 ''|0) try='char* asctime_r(const struct tm*, char*);'
10927 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10928 esac
10929 case "$asctime_r_proto" in
10930 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10931 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10932 esac
10933 case "$asctime_r_proto" in
10934 ''|0) try='int asctime_r(const struct tm*, char*);'
10935 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10936 esac
10937 case "$asctime_r_proto" in
10938 ''|0) try='int asctime_r(const struct tm*, char*, int);'
10939 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10940 esac
10941 case "$asctime_r_proto" in
10942 ''|0) d_asctime_r=undef
10943 asctime_r_proto=0
10944 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10945 * ) case "$asctime_r_proto" in
10946 REENTRANT_PROTO*) ;;
10947 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10948 esac
10949 echo "Prototype: $try" ;;
10950 esac
10951 ;;
10952 *) case "$usethreads" in
10953 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10954 esac
10955 d_asctime_r=undef
10956 asctime_r_proto=0
10957 ;;
10958 esac
10959 ;;
10960*) asctime_r_proto=0
10961 ;;
10962esac
10963
10964: see if asinh exists
10965set asinh d_asinh
10966eval $inlibc
10967
10968: see if atanh exists
10969set atanh d_atanh
10970eval $inlibc
10971
10972: see if atolf exists
10973set atolf d_atolf
10974eval $inlibc
10975
10976: see if atoll exists
10977set atoll d_atoll
10978eval $inlibc
10979
10980: Look for GCC-style attribute format
10981case "$d_attribute_format" in
10982'')
10983echo " "
10984echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10985$cat >attrib.c <<'EOCP'
10986#include <stdio.h>
10987void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10988EOCP
10989if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10990 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10991 echo "Your C compiler doesn't support __attribute__((format))."
10992 val="$undef"
10993 else
10994 echo "Your C compiler supports __attribute__((format))."
10995 val="$define"
10996 fi
10997else
10998 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10999 val="$undef"
11000fi
11001;;
11002*) val="$d_attribute_format" ;;
11003esac
11004set d_attribute_format
11005eval $setvar
11006$rm -f attrib*
11007
11008: Look for GCC-style attribute format with null format allowed
11009case "$d_printf_format_null" in
11010'') case "$d_attribute_format" in
11011 $define)
11012 echo " "
11013 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11014$cat >attrib.c <<EOCP
11015#include <stdio.h>
11016#$i_stdlib I_STDLIB
11017#ifdef I_STDLIB
11018#include <stdlib.h>
11019#endif
11020#$i_inttypes I_INTTYPES
11021#ifdef I_INTTYPES
11022#include <inttypes.h>
11023#endif
11024#ifndef INTPTR_MAX
11025#define intptr_t int
11026#endif
11027int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11028int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
11029int main () { exit(null_printf(NULL)); }
11030EOCP
11031 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11032 : run the executable in case it produces a run-time warning
11033 if $run ./attrib >>attrib.out 2>&1; then
11034 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11035 echo "Your C compiler doesn't allow __printf__ format to be null."
11036 val="$undef"
11037 else
11038 echo "Your C compiler allows __printf__ format to be null."
11039 val="$define"
11040 fi
11041 else
11042 echo "Your C compiler executable failed with __printf__ format null."
11043 val="$undef"
11044 fi
11045 else
11046 echo "Your C compiler fails with __printf__ format null."
11047 val="$undef"
11048 fi
11049 ;;
11050 *) val="$undef" ;;
11051 esac
11052;;
11053*) val="$d_printf_format_null" ;;
11054esac
11055set d_printf_format_null
11056eval $setvar
11057$rm -f attrib*
11058
11059: Look for GCC-style attribute malloc
11060case "$d_attribute_malloc" in
11061'')
11062echo " "
11063echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11064$cat >attrib.c <<'EOCP'
11065#include <stdio.h>
11066char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11067EOCP
11068if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11069 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11070 echo "Your C compiler doesn't support __attribute__((malloc))."
11071 val="$undef"
11072 else
11073 echo "Your C compiler supports __attribute__((malloc))."
11074 val="$define"
11075 fi
11076else
11077 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11078 val="$undef"
11079fi
11080;;
11081*) val="$d_attribute_malloc" ;;
11082esac
11083set d_attribute_malloc
11084eval $setvar
11085$rm -f attrib*
11086
11087: Look for GCC-style attribute nonnull
11088case "$d_attribute_nonnull" in
11089'')
11090echo " "
11091echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11092$cat >attrib.c <<'EOCP'
11093#include <stdio.h>
11094void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11095EOCP
11096if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11097 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11098 echo "Your C compiler doesn't support __attribute__((nonnull))."
11099 val="$undef"
11100 else
11101 echo "Your C compiler supports __attribute__((nonnull))."
11102 val="$define"
11103 fi
11104else
11105 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11106 val="$undef"
11107fi
11108;;
11109*) val="$d_attribute_nonnull" ;;
11110esac
11111set d_attribute_nonnull
11112eval $setvar
11113$rm -f attrib*
11114
11115: Look for GCC-style attribute noreturn
11116case "$d_attribute_noreturn" in
11117'')
11118echo " "
11119echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11120$cat >attrib.c <<'EOCP'
11121#include <stdio.h>
11122void fall_over_dead( void ) __attribute__((noreturn));
11123EOCP
11124if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11125 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11126 echo "Your C compiler doesn't support __attribute__((noreturn))."
11127 val="$undef"
11128 else
11129 echo "Your C compiler supports __attribute__((noreturn))."
11130 val="$define"
11131 fi
11132else
11133 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11134 val="$undef"
11135fi
11136;;
11137*) val="$d_attribute_noreturn" ;;
11138esac
11139set d_attribute_noreturn
11140eval $setvar
11141$rm -f attrib*
11142
11143: Look for GCC-style attribute pure
11144case "$d_attribute_pure" in
11145'')
11146echo " "
11147echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11148$cat >attrib.c <<'EOCP'
11149#include <stdio.h>
11150int square( int n ) __attribute__((pure));
11151EOCP
11152if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11153 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11154 echo "Your C compiler doesn't support __attribute__((pure))."
11155 val="$undef"
11156 else
11157 echo "Your C compiler supports __attribute__((pure))."
11158 val="$define"
11159 fi
11160else
11161 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11162 val="$undef"
11163fi
11164;;
11165*) val="$d_attribute_pure" ;;
11166esac
11167set d_attribute_pure
11168eval $setvar
11169$rm -f attrib*
11170
11171: Look for GCC-style attribute unused
11172case "$d_attribute_unused" in
11173'')
11174echo " "
11175echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11176$cat >attrib.c <<'EOCP'
11177#include <stdio.h>
11178int do_something( int dummy __attribute__((unused)), int n );
11179EOCP
11180if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11181 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11182 echo "Your C compiler doesn't support __attribute__((unused))."
11183 val="$undef"
11184 else
11185 echo "Your C compiler supports __attribute__((unused))."
11186 val="$define"
11187 fi
11188else
11189 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11190 val="$undef"
11191fi
11192;;
11193*) val="$d_attribute_unused" ;;
11194esac
11195set d_attribute_unused
11196eval $setvar
11197$rm -f attrib*
11198
11199: Look for GCC-style attribute deprecated
11200case "$d_attribute_deprecated" in
11201'')
11202echo " "
11203echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11204$cat >attrib.c <<'EOCP'
11205#include <stdio.h>
11206int I_am_deprecated(void) __attribute__((deprecated));
11207EOCP
11208if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11209 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11210 echo "Your C compiler doesn't support __attribute__((deprecated))."
11211 val="$undef"
11212 else
11213 echo "Your C compiler supports __attribute__((deprecated))."
11214 val="$define"
11215 fi
11216else
11217 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11218 val="$undef"
11219fi
11220;;
11221*) val="$d_attribute_deprecated" ;;
11222esac
11223set d_attribute_deprecated
11224eval $setvar
11225$rm -f attrib*
11226
11227: Look for GCC-style attribute warn_unused_result
11228case "$d_attribute_warn_unused_result" in
11229'')
11230echo " "
11231echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11232$cat >attrib.c <<'EOCP'
11233#include <stdio.h>
11234int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11235EOCP
11236if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11237 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11238 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11239 val="$undef"
11240 else
11241 echo "Your C compiler supports __attribute__((warn_unused_result))."
11242 val="$define"
11243 fi
11244else
11245 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11246 val="$undef"
11247fi
11248;;
11249*) val="$d_attribute_warn_unused_result" ;;
11250esac
11251set d_attribute_warn_unused_result
11252eval $setvar
11253$rm -f attrib*
11254
11255: Look for GCC-style attribute always_inline
11256case "$d_attribute_always_inline" in
11257'')
11258echo " "
11259echo "Checking whether your compiler can handle __attribute__((always_inline)) ..." >&4
11260$cat >attrib.c <<'EOCP'
11261#include <stdio.h>
11262static __inline__ __attribute__((always_inline)) int I_will_always_be_inlined(void);
11263EOCP
11264if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11265 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11266 echo "Your C compiler doesn't support __attribute__((always_inline))."
11267 val="$undef"
11268 else
11269 echo "Your C compiler supports __attribute__((always_inline))."
11270 val="$define"
11271 fi
11272else
11273 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11274 val="$undef"
11275fi
11276;;
11277*) val="$d_attribute_always_inline" ;;
11278esac
11279set d_attribute_always_inline
11280eval $setvar
11281$rm -f attrib*
11282
11283: see if getpgrp exists
11284set getpgrp d_getpgrp
11285eval $inlibc
11286
11287case "$d_getpgrp" in
11288"$define")
11289 echo " "
11290 echo "Checking to see which flavor of getpgrp is in use..."
11291 $cat >try.c <<EOP
11292#include <stdio.h>
11293#$i_unistd I_UNISTD
11294#include <sys/types.h>
11295#ifdef I_UNISTD
11296# include <unistd.h>
11297#endif
11298#$i_stdlib I_STDLIB
11299#ifdef I_STDLIB
11300#include <stdlib.h>
11301#endif
11302int main()
11303{
11304 if (getuid() == 0) {
11305 printf("(I see you are running Configure as super-user...)\n");
11306 setuid(1);
11307 }
11308#ifdef TRY_BSD_PGRP
11309 if (getpgrp(1) == 0)
11310 exit(0);
11311#else
11312 if (getpgrp() > 0)
11313 exit(0);
11314#endif
11315 exit(1);
11316}
11317EOP
11318 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11319 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11320 val="$define"
11321 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11322 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11323 val="$undef"
11324 else
11325 echo "I can't seem to compile and run the test program."
11326 if ./usg; then
11327 xxx="a USG one, i.e. you use getpgrp()."
11328 else
11329 # SVR4 systems can appear rather BSD-ish.
11330 case "$i_unistd" in
11331 $undef)
11332 xxx="a BSD one, i.e. you use getpgrp(pid)."
11333 val="$define"
11334 ;;
11335 $define)
11336 xxx="probably a USG one, i.e. you use getpgrp()."
11337 val="$undef"
11338 ;;
11339 esac
11340 fi
11341 echo "Assuming your getpgrp is $xxx" >&4
11342 fi
11343 ;;
11344*) val="$undef";;
11345esac
11346set d_bsdgetpgrp
11347eval $setvar
11348$rm_try
11349
11350: see if setpgrp exists
11351set setpgrp d_setpgrp
11352eval $inlibc
11353
11354case "$d_setpgrp" in
11355"$define")
11356 echo " "
11357 echo "Checking to see which flavor of setpgrp is in use..."
11358 $cat >try.c <<EOP
11359#include <stdio.h>
11360#$i_unistd I_UNISTD
11361#include <sys/types.h>
11362#ifdef I_UNISTD
11363# include <unistd.h>
11364#endif
11365#$i_stdlib I_STDLIB
11366#ifdef I_STDLIB
11367#include <stdlib.h>
11368#endif
11369int main()
11370{
11371 if (getuid() == 0) {
11372 printf("(I see you are running Configure as super-user...)\n");
11373 setuid(1);
11374 }
11375#ifdef TRY_BSD_PGRP
11376 if (-1 == setpgrp(1, 1))
11377 exit(0);
11378#else
11379 if (setpgrp() != -1)
11380 exit(0);
11381#endif
11382 exit(1);
11383}
11384EOP
11385 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11386 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11387 val="$define"
11388 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11389 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11390 val="$undef"
11391 else
11392 echo "(I can't seem to compile and run the test program.)"
11393 if ./usg; then
11394 xxx="a USG one, i.e. you use setpgrp()."
11395 else
11396 # SVR4 systems can appear rather BSD-ish.
11397 case "$i_unistd" in
11398 $undef)
11399 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11400 val="$define"
11401 ;;
11402 $define)
11403 xxx="probably a USG one, i.e. you use setpgrp()."
11404 val="$undef"
11405 ;;
11406 esac
11407 fi
11408 echo "Assuming your setpgrp is $xxx" >&4
11409 fi
11410 ;;
11411*) val="$undef";;
11412esac
11413set d_bsdsetpgrp
11414eval $setvar
11415$rm_try
11416
11417: Look for GCC-style __builtin_add_overflow
11418case "$d_builtin_add_overflow" in
11419'')
11420 echo " "
11421 echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11422 $cat >try.c <<'EOCP'
11423int main(void) {
11424 const unsigned int uint_max = ~0u;
11425 int target_int = 0;
11426 if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11427 return 1;
11428 }
11429 if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11430 return 1;
11431 }
11432 if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11433 return 1;
11434 }
11435 return 0;
11436}
11437EOCP
11438 set try
11439 if eval $compile && $run ./try; then
11440 echo "Your C compiler supports __builtin_add_overflow."
11441 val="$define"
11442 else
11443 echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11444 val="$undef"
11445 fi
11446 ;;
11447*) val="$d_builtin_add_overflow" ;;
11448esac
11449
11450set d_builtin_add_overflow
11451eval $setvar
11452$rm_try
11453
11454: Look for GCC-style __builtin_sub_overflow
11455case "$d_builtin_sub_overflow" in
11456'')
11457 echo " "
11458 echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11459 $cat >try.c <<'EOCP'
11460int main(void) {
11461 const unsigned int uint_max = ~0u;
11462 int target_int = 0;
11463 if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11464 return 1;
11465 }
11466 if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11467 return 1;
11468 }
11469 if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11470 return 1;
11471 }
11472 return 0;
11473}
11474EOCP
11475 set try
11476 if eval $compile && $run ./try; then
11477 echo "Your C compiler supports __builtin_sub_overflow."
11478 val="$define"
11479 else
11480 echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11481 val="$undef"
11482 fi
11483 ;;
11484*) val="$d_builtin_sub_overflow" ;;
11485esac
11486
11487set d_builtin_sub_overflow
11488eval $setvar
11489$rm_try
11490
11491: Look for GCC-style __builtin_mul_overflow
11492case "$d_builtin_mul_overflow" in
11493'')
11494 echo " "
11495 echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11496 $cat >try.c <<'EOCP'
11497int main(void) {
11498 const unsigned int uint_max = ~0u;
11499 int target_int = 0;
11500 if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11501 return 1;
11502 }
11503 if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11504 return 1;
11505 }
11506 if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11507 return 1;
11508 }
11509 return 0;
11510}
11511EOCP
11512 set try
11513 if eval $compile && $run ./try; then
11514 echo "Your C compiler supports __builtin_mul_overflow."
11515 val="$define"
11516 else
11517 echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11518 val="$undef"
11519 fi
11520 ;;
11521*) val="$d_builtin_mul_overflow" ;;
11522esac
11523
11524set d_builtin_mul_overflow
11525eval $setvar
11526$rm_try
11527
11528: Look for GCC-style __builtin_choose_expr
11529case "$d_builtin_choose_expr" in
11530'')
11531 echo " "
11532 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11533 $cat >try.c <<'EOCP'
11534#include <assert.h>
11535#include <stdlib.h>
11536#include <stdio.h>
11537
11538#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11539
11540int main(void) {
11541 assert( SYRINX(1) == 2112 );
11542 assert( SYRINX(1) != 5150 );
11543 assert( SYRINX(0) == 5150 );
11544 assert( SYRINX(0) != 2112 );
11545 puts( "All good!" );
11546 exit(0);
11547}
11548
11549EOCP
11550 set try
11551 if eval $compile && $run ./try; then
11552 echo "Your C compiler supports __builtin_choose_expr."
11553 val="$define"
11554 else
11555 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11556 val="$undef"
11557 fi
11558;;
11559*) val="$d_builtin_choose_expr" ;;
11560esac
11561
11562set d_builtin_choose_expr
11563eval $setvar
11564$rm_try
11565
11566: Look for GCC-style __builtin_expect
11567case "$d_builtin_expect" in
11568'')
11569 echo " "
11570 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11571 $cat >try.c <<'EOCP'
11572int main(void) {
11573 int n = 50;
11574 if ( __builtin_expect(n, 0) ) n = 1;
11575 /* Remember shell exit code truth is 0, C truth is non-zero */
11576 return !(n == 1);
11577}
11578EOCP
11579 set try
11580 if eval $compile && $run ./try; then
11581 echo "Your C compiler supports __builtin_expect."
11582 val="$define"
11583 else
11584 echo "Your C compiler doesn't seem to understand __builtin_expect."
11585 val="$undef"
11586 fi
11587 ;;
11588*) val="$d_builtin_expect" ;;
11589esac
11590
11591set d_builtin_expect
11592eval $setvar
11593$rm_try
11594
11595: see if the Compiler supports C99 variadic macros
11596echo "Checking for C99 variadic macros." >&4
11597$cat >try.c <<EOCP
11598#include <stdio.h>
11599#include <stdarg.h>
11600
11601#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11602
11603int main() {
11604 char buf[20];
11605 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11606 puts(buf);
11607 return 0;
11608}
11609EOCP
11610set try
11611if eval $compile && $run ./try 2>&1 >/dev/null; then
11612 case "`$run ./try`" in
11613 "123 456 789")
11614 echo "You have C99 variadic macros." >&4
11615 d_c99_variadic_macros="$define"
11616 ;;
11617 *)
11618 echo "You don't have functional C99 variadic macros." >&4
11619 d_c99_variadic_macros="$undef"
11620 ;;
11621 esac
11622else
11623 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11624 d_c99_variadic_macros="$undef"
11625fi
11626$rm_try
11627
11628: see if signal is declared as pointer to function returning int or void
11629echo " "
11630xxx=`./findhdr signal.h`
11631$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11632if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
11633 echo "You have int (*signal())() instead of void." >&4
11634 val="$undef"
11635elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
11636 echo "You have void (*signal())()." >&4
11637 val="$define"
11638elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11639 echo "You have int (*signal())() instead of void." >&4
11640 val="$undef"
11641elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11642 echo "You have void (*signal())()." >&4
11643 val="$define"
11644else
11645 case "$d_voidsig" in
11646 '')
11647 echo "I can't determine whether signal handler returns void or int..." >&4
11648 dflt=void
11649 rp="What type does your signal handler return?"
11650 . ./myread
11651 case "$ans" in
11652 v*) val="$define";;
11653 *) val="$undef";;
11654 esac;;
11655 "$define")
11656 echo "As you already told me, signal handler returns void." >&4
11657 val="$define"
11658 ;;
11659 *) echo "As you already told me, signal handler returns int." >&4
11660 val="$undef"
11661 ;;
11662 esac
11663fi
11664set d_voidsig
11665eval $setvar
11666case "$d_voidsig" in
11667"$define") signal_t="void";;
11668*) signal_t="int";;
11669esac
11670$rm -f $$.tmp
11671
11672: check for ability to cast large floats to 32-bit ints.
11673echo " "
11674echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11675if $test "$intsize" -ge 4; then
11676 xxx=int
11677else
11678 xxx=long
11679fi
11680$cat >try.c <<EOCP
11681#include <stdio.h>
11682#$i_stdlib I_STDLIB
11683#ifdef I_STDLIB
11684#include <stdlib.h>
11685#endif
11686#include <sys/types.h>
11687#include <signal.h>
11688$signal_t blech(int s) { exit(3); }
11689int main()
11690{
11691 $xxx i32;
11692 double f, g;
11693 int result = 0;
11694 char str[16];
11695 signal(SIGFPE, blech);
11696
11697 /* Don't let compiler optimize the test away. Store the number
11698 in a writable string for gcc to pass to sscanf under HP-UX.
11699 */
11700 sprintf(str, "2147483647");
11701 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11702 g = 10 * f;
11703 i32 = ($xxx) g;
11704
11705 /* x86 processors will probably give 0x8000 0000, which is a
11706 sign change. We don't want that. We want to mimic SPARC
11707 behavior here, which is to preserve the sign and give
11708 back 0x7fff ffff.
11709 */
11710 if (i32 != ($xxx) f)
11711 result |= 1;
11712 exit(result);
11713}
11714EOCP
11715set try
11716if eval $compile_ok; then
11717 $run ./try 2>/dev/null
11718 yyy=$?
11719else
11720 echo "(I can't seem to compile the test program--assuming it can't)"
11721 yyy=1
11722fi
11723case "$yyy" in
117240) val="$define"
11725 echo "Yup, it can."
11726 ;;
11727*) val="$undef"
11728 echo "Nope, it can't."
11729 ;;
11730esac
11731set d_casti32
11732eval $setvar
11733$rm_try
11734
11735: check for ability to cast negative floats to unsigned
11736echo " "
11737echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11738$cat >try.c <<EOCP
11739#include <stdio.h>
11740#$i_stdlib I_STDLIB
11741#ifdef I_STDLIB
11742#include <stdlib.h>
11743#endif
11744#include <sys/types.h>
11745#include <signal.h>
11746$signal_t blech(int s) { exit(7); }
11747$signal_t blech_in_list(int s) { exit(4); }
11748unsigned long dummy_long(unsigned long p) { return p; }
11749unsigned int dummy_int(unsigned int p) { return p; }
11750unsigned short dummy_short(unsigned short p) { return p; }
11751int main()
11752{
11753 double f;
11754 unsigned long along;
11755 unsigned int aint;
11756 unsigned short ashort;
11757 int result = 0;
11758 char str[16];
11759
11760 /* Frustrate gcc-2.7.2's optimizer which failed this test with
11761 a direct f = -123. assignment. gcc-2.8.0 reportedly
11762 optimized the whole file away
11763 */
11764 /* Store the number in a writable string for gcc to pass to
11765 sscanf under HP-UX.
11766 */
11767 sprintf(str, "-123");
11768 sscanf(str, "%lf", &f); /* f = -123.; */
11769
11770 signal(SIGFPE, blech);
11771 along = (unsigned long)f;
11772 aint = (unsigned int)f;
11773 ashort = (unsigned short)f;
11774 if (along != (unsigned long)-123)
11775 result |= 1;
11776 if (aint != (unsigned int)-123)
11777 result |= 1;
11778 if (ashort != (unsigned short)-123)
11779 result |= 1;
11780 sprintf(str, "1073741824.");
11781 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11782 f = f + f;
11783 along = 0;
11784 along = (unsigned long)f;
11785 if (along != 0x80000000)
11786 result |= 2;
11787 f -= 1.;
11788 along = 0;
11789 along = (unsigned long)f;
11790 if (along != 0x7fffffff)
11791 result |= 1;
11792 f += 2.;
11793 along = 0;
11794 along = (unsigned long)f;
11795 if (along != 0x80000001)
11796 result |= 2;
11797 if (result)
11798 exit(result);
11799 signal(SIGFPE, blech_in_list);
11800 sprintf(str, "123.");
11801 sscanf(str, "%lf", &f); /* f = 123.; */
11802 along = dummy_long((unsigned long)f);
11803 aint = dummy_int((unsigned int)f);
11804 ashort = dummy_short((unsigned short)f);
11805 if (along != (unsigned long)123)
11806 result |= 4;
11807 if (aint != (unsigned int)123)
11808 result |= 4;
11809 if (ashort != (unsigned short)123)
11810 result |= 4;
11811 exit(result);
11812
11813}
11814EOCP
11815set try
11816if eval $compile_ok; then
11817 $run ./try 2>/dev/null
11818 castflags=$?
11819else
11820 echo "(I can't seem to compile the test program--assuming it can't)"
11821 castflags=7
11822fi
11823case "$castflags" in
118240) val="$define"
11825 echo "Yup, it can."
11826 ;;
11827*) val="$undef"
11828 echo "Nope, it can't."
11829 ;;
11830esac
11831set d_castneg
11832eval $setvar
11833$rm_try
11834
11835: see if cbrt exists
11836set cbrt d_cbrt
11837eval $inlibc
11838
11839: see if chown exists
11840set chown d_chown
11841eval $inlibc
11842
11843: see if chroot exists
11844set chroot d_chroot
11845eval $inlibc
11846
11847: see if chsize exists
11848set chsize d_chsize
11849eval $inlibc
11850
11851: see if class exists
11852set class d_class
11853eval $inlibc
11854
11855: see if clearenv exists
11856set clearenv d_clearenv
11857eval $inlibc
11858
11859: Define hasstruct macro for Configure internal use
11860hasstruct='varname=$1; struct=$2; shift; shift;
11861while $test $# -ge 2; do
11862 case "$1" in
11863 $define) echo "#include <$2>";;
11864 esac ;
11865 shift 2;
11866done > try.c;
11867echo "int main () { struct $struct foo; }" >> try.c;
11868set try;
11869if eval $compile; then
11870 val="$define";
11871else
11872 val="$undef";
11873fi;
11874set $varname;
11875eval $setvar;
11876$rm_try'
11877
11878: see whether socket exists
11879socketlib=''
11880sockethdr=''
11881echo " "
11882$echo $n "Hmm... $c" >&4
11883if set socket val -f d_socket; eval $csym; $val; then
11884 echo "Looks like you have Berkeley networking support." >&4
11885 d_socket="$define"
11886 if set setsockopt val -f; eval $csym; $val; then
11887 d_oldsock="$undef"
11888 else
11889 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11890 d_oldsock="$define"
11891 fi
11892else
11893 if $contains socklib libc.list >/dev/null 2>&1; then
11894 echo "Looks like you have Berkeley networking support." >&4
11895 d_socket="$define"
11896 : we will have to assume that it supports the 4.2 BSD interface
11897 d_oldsock="$undef"
11898 else
11899 echo "You don't have Berkeley networking in libc$_a..." >&4
11900 if test "X$d_socket" = "X$define"; then
11901 echo "...but you seem to believe that you have sockets." >&4
11902 else
11903 for net in net socket
11904 do
11905 if test -f $sysroot/usr/lib/lib$net$_a; then
11906 ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) || \
11907 $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11908 if $contains socket libc.list >/dev/null 2>&1; then
11909 d_socket="$define"
11910 socketlib="-l$net"
11911 case "$net" in
11912 net)
11913 echo "...but the Wollongong group seems to have hacked it in." >&4
11914 sockethdr="-I$sysroot/usr/netinclude"
11915 ;;
11916 esac
11917 echo "Found Berkeley sockets interface in lib$net." >&4
11918 if $contains setsockopt libc.list >/dev/null 2>&1; then
11919 d_oldsock="$undef"
11920 else
11921 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11922 d_oldsock="$define"
11923 fi
11924 break
11925 fi
11926 fi
11927 done
11928 if test "X$d_socket" != "X$define"; then
11929 echo "or anywhere else I see." >&4
11930 d_socket="$undef"
11931 d_oldsock="$undef"
11932 fi
11933 fi
11934 fi
11935fi
11936
11937: see if socketpair exists
11938set socketpair d_sockpair
11939eval $inlibc
11940
11941
11942echo " "
11943echo "Checking the availability sa_len in the sock struct ..." >&4
11944$cat >try.c <<EOF
11945#include <sys/types.h>
11946#include <sys/socket.h>
11947int main() {
11948struct sockaddr sa;
11949return (sa.sa_len);
11950}
11951EOF
11952val="$undef"
11953set try; if eval $compile; then
11954 val="$define"
11955fi
11956set d_sockaddr_sa_len; eval $setvar
11957$rm_try
11958
11959echo " "
11960echo "Checking the availability struct sockaddr_in6 ..." >&4
11961$cat >try.c <<EOF
11962#include <sys/types.h>
11963#include <sys/socket.h>
11964#include <netinet/in.h>
11965int main() {
11966struct sockaddr_in6 sin6;
11967return (sin6.sin6_family);
11968}
11969EOF
11970val="$undef"
11971set try; if eval $compile; then
11972 val="$define"
11973fi
11974set d_sockaddr_in6; eval $setvar
11975$rm_try
11976
11977echo " "
11978echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11979$cat >try.c <<EOF
11980#include <sys/types.h>
11981#include <sys/socket.h>
11982#include <netinet/in.h>
11983int main() {
11984struct sockaddr_in6 sin6;
11985return (sin6.sin6_scope_id);
11986}
11987EOF
11988val="$undef"
11989set try; if eval $compile; then
11990 val="$define"
11991fi
11992set d_sin6_scope_id; eval $setvar
11993$rm_try
11994
11995echo " "
11996echo "Checking the availability struct ip_mreq ..." >&4
11997$cat >try.c <<EOF
11998#include <sys/types.h>
11999#include <sys/socket.h>
12000#include <netinet/in.h>
12001int main() {
12002struct ip_mreq mreq;
12003return (mreq.imr_multiaddr.s_addr);
12004}
12005EOF
12006val="$undef"
12007set try; if eval $compile; then
12008 val="$define"
12009fi
12010set d_ip_mreq; eval $setvar
12011$rm_try
12012
12013echo " "
12014echo "Checking the availability struct ip_mreq_source ..." >&4
12015$cat >try.c <<EOF
12016#include <sys/types.h>
12017#include <sys/socket.h>
12018#include <netinet/in.h>
12019int main() {
12020struct ip_mreq_source mreq;
12021return (mreq.imr_multiaddr.s_addr);
12022}
12023EOF
12024val="$undef"
12025set try; if eval $compile; then
12026 val="$define"
12027fi
12028set d_ip_mreq_source; eval $setvar
12029$rm_try
12030
12031echo " "
12032echo "Checking the availability struct ipv6_mreq ..." >&4
12033$cat >try.c <<EOF
12034#include <sys/types.h>
12035#include <sys/socket.h>
12036#include <netinet/in.h>
12037int main() {
12038struct ipv6_mreq mreq;
12039return (mreq.ipv6mr_interface);
12040}
12041EOF
12042val="$undef"
12043set try; if eval $compile; then
12044 val="$define"
12045fi
12046set d_ipv6_mreq; eval $setvar
12047$rm_try
12048
12049echo " "
12050echo "Checking the availability struct ipv6_mreq_source ..." >&4
12051$cat >try.c <<EOF
12052#include <sys/types.h>
12053#include <sys/socket.h>
12054#include <netinet/in.h>
12055int main() {
12056struct ipv6_mreq_source mreq;
12057return (mreq.imr_multiaddr.s_addr);
12058}
12059EOF
12060val="$undef"
12061set try; if eval $compile; then
12062 val="$define"
12063fi
12064set d_ipv6_mreq_source; eval $setvar
12065$rm_try
12066
12067echo " "
12068echo "Checking the availability of certain socket constants..." >&4
12069for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12070 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12071 $cat >try.c <<EOF
12072#include <sys/types.h>
12073#include <sys/socket.h>
12074int main() {
12075 int i = $ENUM;
12076}
12077EOF
12078 val="$undef"
12079 set try; if eval $compile; then
12080 val="$define"
12081 fi
12082 set d_${enum}; eval $setvar
12083 $rm_try
12084done
12085
12086: see if this is a sys/uio.h system
12087set sys/uio.h i_sysuio
12088eval $inhdr
12089
12090: Check for cmsghdr support
12091echo " "
12092echo "Checking to see if your system supports struct cmsghdr..." >&4
12093set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12094eval $hasstruct
12095case "$d_cmsghdr_s" in
12096"$define") echo "Yes, it does." ;;
12097*) echo "No, it doesn't." ;;
12098esac
12099
12100: see if copysign exists
12101set copysign d_copysign
12102eval $inlibc
12103
12104: see if copysignl exists
12105set copysignl d_copysignl
12106eval $inlibc
12107
12108: see if crypt exists
12109echo " "
12110set crypt d_crypt
12111eval $inlibc
12112case "$d_crypt" in
12113$define) cryptlib='' ;;
12114*) if set crypt val -f d_crypt; eval $csym; $val; then
12115 echo 'crypt() found.' >&4
12116 val="$define"
12117 cryptlib=''
12118 else
12119 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12120 if $test -z "$cryptlib"; then
12121 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12122 else
12123 cryptlib=-lcrypt
12124 fi
12125 if $test -z "$cryptlib"; then
12126 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12127 else
12128 cryptlib=-lcrypt
12129 fi
12130 if $test -z "$cryptlib"; then
12131 cryptlib=`./loc libcrypt$_a "" $libpth`
12132 else
12133 cryptlib=-lcrypt
12134 fi
12135 if $test -z "$cryptlib"; then
12136 echo 'crypt() NOT found.' >&4
12137 val="$undef"
12138 else
12139 val="$define"
12140 fi
12141 fi
12142 set d_crypt
12143 eval $setvar
12144 ;;
12145esac
12146
12147: see if this is a crypt.h system
12148set crypt.h i_crypt
12149eval $inhdr
12150
12151: see if crypt_r exists
12152set crypt_r d_crypt_r
12153eval $inlibc
12154case "$d_crypt_r" in
12155"$define")
12156 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12157 case "$d_crypt_r_proto:$usethreads" in
12158 ":define") d_crypt_r_proto=define
12159 set d_crypt_r_proto crypt_r $hdrs
12160 eval $hasproto ;;
12161 *) ;;
12162 esac
12163 case "$d_crypt_r_proto" in
12164 define)
12165 case "$crypt_r_proto" in
12166 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12167 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12168 esac
12169 case "$crypt_r_proto" in
12170 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12171 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12172 esac
12173 case "$crypt_r_proto" in
12174 ''|0) d_crypt_r=undef
12175 crypt_r_proto=0
12176 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12177 * ) case "$crypt_r_proto" in
12178 REENTRANT_PROTO*) ;;
12179 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12180 esac
12181 echo "Prototype: $try" ;;
12182 esac
12183 ;;
12184 *) case "$usethreads" in
12185 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12186 esac
12187 d_crypt_r=undef
12188 crypt_r_proto=0
12189 ;;
12190 esac
12191 ;;
12192*) crypt_r_proto=0
12193 ;;
12194esac
12195
12196: get csh whereabouts
12197case "$csh" in
12198'csh') val="$undef" ;;
12199*) val="$define" ;;
12200esac
12201set d_csh
12202eval $setvar
12203: Respect a hint or command line value for full_csh.
12204case "$full_csh" in
12205'') full_csh=$csh ;;
12206esac
12207
12208: see if ctermid exists
12209set ctermid d_ctermid
12210eval $inlibc
12211
12212: see if ctermid_r exists
12213set ctermid_r d_ctermid_r
12214eval $inlibc
12215case "$d_ctermid_r" in
12216"$define")
12217 hdrs="$i_systypes sys/types.h define stdio.h "
12218 case "$d_ctermid_r_proto:$usethreads" in
12219 ":define") d_ctermid_r_proto=define
12220 set d_ctermid_r_proto ctermid_r $hdrs
12221 eval $hasproto ;;
12222 *) ;;
12223 esac
12224 case "$d_ctermid_r_proto" in
12225 define)
12226 case "$ctermid_r_proto" in
12227 ''|0) try='char* ctermid_r(char*);'
12228 ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12229 esac
12230 case "$ctermid_r_proto" in
12231 ''|0) d_ctermid_r=undef
12232 ctermid_r_proto=0
12233 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12234 * ) case "$ctermid_r_proto" in
12235 REENTRANT_PROTO*) ;;
12236 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12237 esac
12238 echo "Prototype: $try" ;;
12239 esac
12240 ;;
12241 *) case "$usethreads" in
12242 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12243 esac
12244 d_ctermid_r=undef
12245 ctermid_r_proto=0
12246 ;;
12247 esac
12248 ;;
12249*) ctermid_r_proto=0
12250 ;;
12251esac
12252
12253: see if ctime_r exists
12254set ctime_r d_ctime_r
12255eval $inlibc
12256case "$d_ctime_r" in
12257"$define")
12258 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12259 case "$d_ctime_r_proto:$usethreads" in
12260 ":define") d_ctime_r_proto=define
12261 set d_ctime_r_proto ctime_r $hdrs
12262 eval $hasproto ;;
12263 *) ;;
12264 esac
12265 case "$d_ctime_r_proto" in
12266 define)
12267 case "$ctime_r_proto" in
12268 ''|0) try='char* ctime_r(const time_t*, char*);'
12269 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12270 esac
12271 case "$ctime_r_proto" in
12272 ''|0) try='char* ctime_r(const time_t*, char*, int);'
12273 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12274 esac
12275 case "$ctime_r_proto" in
12276 ''|0) try='int ctime_r(const time_t*, char*);'
12277 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12278 esac
12279 case "$ctime_r_proto" in
12280 ''|0) try='int ctime_r(const time_t*, char*, int);'
12281 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12282 esac
12283 case "$ctime_r_proto" in
12284 ''|0) d_ctime_r=undef
12285 ctime_r_proto=0
12286 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12287 * ) case "$ctime_r_proto" in
12288 REENTRANT_PROTO*) ;;
12289 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12290 esac
12291 echo "Prototype: $try" ;;
12292 esac
12293 ;;
12294 *) case "$usethreads" in
12295 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12296 esac
12297 d_ctime_r=undef
12298 ctime_r_proto=0
12299 ;;
12300 esac
12301 ;;
12302*) ctime_r_proto=0
12303 ;;
12304esac
12305
12306: see if cuserid exists
12307set cuserid d_cuserid
12308eval $inlibc
12309
12310: see if dbm.h is available
12311: see if dbmclose exists
12312set dbmclose d_dbmclose
12313eval $inlibc
12314
12315case "$d_dbmclose" in
12316$define)
12317 set dbm.h i_dbm
12318 eval $inhdr
12319 case "$i_dbm" in
12320 $define)
12321 val="$undef"
12322 set i_rpcsvcdbm
12323 eval $setvar
12324 ;;
12325 *) set rpcsvc/dbm.h i_rpcsvcdbm
12326 eval $inhdr
12327 ;;
12328 esac
12329 ;;
12330*) echo "We won't be including <dbm.h>"
12331 val="$undef"
12332 set i_dbm
12333 eval $setvar
12334 val="$undef"
12335 set i_rpcsvcdbm
12336 eval $setvar
12337 ;;
12338esac
12339
12340: see if prototype for dbminit is available
12341echo " "
12342set d_dbminitproto dbminit $i_dbm dbm.h
12343eval $hasproto
12344
12345: see if difftime exists
12346set difftime d_difftime
12347eval $inlibc
12348
12349: see if this is a dirent system
12350echo " "
12351if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12352 val="$define"
12353 echo "<dirent.h> found." >&4
12354else
12355 val="$undef"
12356 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12357 echo "<sys/dir.h> found." >&4
12358 echo " "
12359 else
12360 xinc=`./findhdr sys/ndir.h`
12361 fi
12362 echo "<dirent.h> NOT found." >&4
12363fi
12364set i_dirent
12365eval $setvar
12366
12367: Look for type of directory structure.
12368echo " "
12369$cppstdin $cppflags $cppminus < "$xinc" > try.c
12370
12371case "$direntrytype" in
12372''|' ')
12373 case "$i_dirent" in
12374 $define) guess1='struct dirent' ;;
12375 *) guess1='struct direct' ;;
12376 esac
12377 ;;
12378*) guess1="$direntrytype"
12379 ;;
12380esac
12381
12382case "$guess1" in
12383'struct dirent') guess2='struct direct' ;;
12384*) guess2='struct dirent' ;;
12385esac
12386
12387if $contains "$guess1" try.c >/dev/null 2>&1; then
12388 direntrytype="$guess1"
12389 echo "Your directory entries are $direntrytype." >&4
12390elif $contains "$guess2" try.c >/dev/null 2>&1; then
12391 direntrytype="$guess2"
12392 echo "Your directory entries seem to be $direntrytype." >&4
12393else
12394 echo "I don't recognize your system's directory entries." >&4
12395 rp="What type is used for directory entries on this system?"
12396 dflt="$guess1"
12397 . ./myread
12398 direntrytype="$ans"
12399fi
12400$rm_try
12401
12402: see if the directory entry stores field length
12403echo " "
12404$cppstdin $cppflags $cppminus < "$xinc" > try.c
12405if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12406 echo "Good, your directory entry keeps length information in d_namlen." >&4
12407 val="$define"
12408else
12409 echo "Your directory entry does not know about the d_namlen field." >&4
12410 val="$undef"
12411fi
12412set d_dirnamlen
12413eval $setvar
12414$rm_try
12415
12416: Look for DIR.dd_fd
12417case "$i_dirent" in
12418"$define")
12419 echo "Checking to see if DIR has a dd_fd member variable" >&4
12420 $cat >try.c <<EOCP
12421#$i_stdlib I_STDLIB
12422#ifdef I_STDLIB
12423#include <stdlib.h>
12424#endif
12425#include <dirent.h>
12426
12427int main() {
12428 DIR dir;
12429 dir.dd_fd = 1;
12430 return 0;
12431}
12432EOCP
12433 val=$undef
12434 set try
12435 if eval $compile; then
12436 echo "Yes, it does."
12437 val="$define"
12438 else
12439 echo "No, it does not."
12440 val="$undef"
12441 fi
12442 ;;
12443*)
12444 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12445 val="$undef"
12446 ;;
12447esac
12448set d_dir_dd_fd
12449eval $setvar
12450$rm_try
12451
12452: see if this is an sysdir system
12453set sys/dir.h i_sysdir
12454eval $inhdr
12455
12456: see if this is an sysndir system
12457set sys/ndir.h i_sysndir
12458eval $inhdr
12459
12460: Look for dirfd
12461echo " "
12462$cat >dirfd.c <<EOM
12463#include <stdio.h>
12464#$i_stdlib I_STDLIB
12465#ifdef I_STDLIB
12466#include <stdlib.h>
12467#endif
12468#$i_dirent I_DIRENT /**/
12469#$i_sysdir I_SYS_DIR /**/
12470#$i_sysndir I_SYS_NDIR /**/
12471#$i_systypes I_SYS_TYPES /**/
12472#if defined(I_SYS_TYPES)
12473#include <sys/types.h>
12474#endif
12475#if defined(I_DIRENT)
12476#include <dirent.h>
12477#else
12478#ifdef I_SYS_NDIR
12479#include <sys/ndir.h>
12480#else
12481#ifdef I_SYS_DIR
12482#include <sys/dir.h>
12483#endif
12484#endif
12485#endif
12486int main() {
12487 DIR *dirp = opendir(".");
12488 if (dirfd(dirp) >= 0)
12489 exit(0);
12490 else
12491 exit(1);
12492}
12493EOM
12494val=$undef
12495set dirfd
12496if eval $compile; then
12497 val="$define"
12498fi
12499case "$val" in
12500$define) echo "dirfd() found." >&4 ;;
12501*) echo "dirfd() NOT found." >&4 ;;
12502esac
12503set d_dirfd
12504eval $setvar
12505$rm -f dirfd*
12506
12507: see if dladdr exists
12508set dladdr d_dladdr
12509eval $inlibc
12510
12511: see if dlerror exists
12512xxx_runnm="$runnm"
12513runnm=false
12514set dlerror d_dlerror
12515eval $inlibc
12516runnm="$xxx_runnm"
12517
12518: see if dlfcn is available
12519set dlfcn.h i_dlfcn
12520eval $inhdr
12521
12522: Check what extension to use for shared libs
12523case "$usedl" in
12524$define|y|true)
12525 $cat << EOM
12526
12527On a few systems, the dynamically loaded modules that perl generates and uses
12528will need a different extension than shared libs. The default will probably
12529be appropriate.
12530
12531EOM
12532 case "$dlext" in
12533 '') dflt="$so" ;;
12534 *) dflt="$dlext" ;;
12535 esac
12536 rp='What is the extension of dynamically loaded modules'
12537 . ./myread
12538 dlext="$ans"
12539 ;;
12540*)
12541 dlext="none"
12542 ;;
12543esac
12544
12545: Check if dlsym need a leading underscore
12546echo " "
12547val="$undef"
12548
12549case "$dlsrc" in
12550dl_dlopen.xs)
12551 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12552 $cat >dyna.c <<'EOM'
12553fred () { }
12554EOM
12555
12556$cat >fred.c<<EOM
12557
12558#include <stdio.h>
12559#$i_stdlib I_STDLIB
12560#ifdef I_STDLIB
12561#include <stdlib.h>
12562#endif
12563#$i_dlfcn I_DLFCN
12564#ifdef I_DLFCN
12565#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
12566#else
12567#include <sys/types.h>
12568#include <nlist.h>
12569#include <link.h>
12570#endif
12571
12572extern int fred() ;
12573
12574int main()
12575{
12576 void * handle ;
12577 void * symbol ;
12578#ifndef RTLD_LAZY
12579 int mode = 1 ;
12580#else
12581 int mode = RTLD_LAZY ;
12582#endif
12583 handle = dlopen("./dyna.$dlext", mode) ;
12584 if (handle == NULL) {
12585 printf ("1\n") ;
12586 fflush (stdout) ;
12587 exit(0);
12588 }
12589 symbol = dlsym(handle, "fred") ;
12590 if (symbol == NULL) {
12591 /* try putting a leading underscore */
12592 symbol = dlsym(handle, "_fred") ;
12593 if (symbol == NULL) {
12594 printf ("2\n") ;
12595 fflush (stdout) ;
12596 exit(0);
12597 }
12598 printf ("3\n") ;
12599 }
12600 else
12601 printf ("4\n") ;
12602 fflush (stdout) ;
12603 exit(0);
12604}
12605EOM
12606 : Call the object file tmp-dyna.o in case dlext=o.
12607 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12608 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12609 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12610 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12611 xxx=`$run ./fred`
12612 case $xxx in
12613 1) echo "Test program failed using dlopen." >&4
12614 echo "Perhaps you should not use dynamic loading." >&4;;
12615 2) echo "Test program failed using dlsym." >&4
12616 echo "Perhaps you should not use dynamic loading." >&4;;
12617 3) echo "dlsym needs a leading underscore" >&4
12618 val="$define" ;;
12619 4) echo "dlsym doesn't need a leading underscore." >&4;;
12620 esac
12621 else
12622 echo "I can't compile and run the test program." >&4
12623 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12624 fi
12625 ;;
12626esac
12627
12628$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12629
12630set d_dlsymun
12631eval $setvar
12632
12633: see if drand48_r exists
12634set drand48_r d_drand48_r
12635eval $inlibc
12636case "$d_drand48_r" in
12637"$define")
12638 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12639 case "$d_drand48_r_proto:$usethreads" in
12640 ":define") d_drand48_r_proto=define
12641 set d_drand48_r_proto drand48_r $hdrs
12642 eval $hasproto ;;
12643 *) ;;
12644 esac
12645 case "$d_drand48_r_proto" in
12646 define)
12647 case "$drand48_r_proto" in
12648 ''|0) try='int drand48_r(struct drand48_data*, double*);'
12649 ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12650 esac
12651 case "$drand48_r_proto" in
12652 ''|0) d_drand48_r=undef
12653 drand48_r_proto=0
12654 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12655 * ) case "$drand48_r_proto" in
12656 REENTRANT_PROTO*) ;;
12657 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12658 esac
12659 echo "Prototype: $try" ;;
12660 esac
12661 ;;
12662 *) case "$usethreads" in
12663 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12664 esac
12665 d_drand48_r=undef
12666 drand48_r_proto=0
12667 ;;
12668 esac
12669 ;;
12670*) drand48_r_proto=0
12671 ;;
12672esac
12673
12674: see if prototype for drand48 is available
12675echo " "
12676set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12677eval $hasproto
12678
12679: see if dup2 exists
12680set dup2 d_dup2
12681eval $inlibc
12682
12683: see if dup3 exists
12684set dup3 d_dup3
12685eval $inlibc
12686
12687: see if this is an xlocale.h system
12688set xlocale.h i_xlocale
12689eval $inhdr
12690
12691: see if newlocale exists
12692set newlocale d_newlocale
12693eval $inlibc
12694
12695: see if freelocale exists
12696set freelocale d_freelocale
12697eval $inlibc
12698
12699: see if uselocale exists
12700set uselocale d_uselocale
12701eval $inlibc
12702
12703: see if duplocale exists
12704set duplocale d_duplocale
12705eval $inlibc
12706
12707: see if querylocale exists
12708set querylocale d_querylocale
12709eval $inlibc
12710
12711: see if eaccess exists
12712set eaccess d_eaccess
12713eval $inlibc
12714
12715: see if endgrent exists
12716set endgrent d_endgrent
12717eval $inlibc
12718
12719: see if this is an grp system
12720set grp.h i_grp
12721eval $inhdr
12722
12723case "$i_grp" in
12724$define)
12725 xxx=`./findhdr grp.h`
12726 $cppstdin $cppflags $cppminus < $xxx >$$.h
12727
12728 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12729 val="$define"
12730 else
12731 val="$undef"
12732 fi
12733 set d_grpasswd
12734 eval $setvar
12735
12736 $rm -f $$.h
12737 ;;
12738*)
12739 val="$undef";
12740 set d_grpasswd; eval $setvar
12741 ;;
12742esac
12743
12744: see if endgrent_r exists
12745set endgrent_r d_endgrent_r
12746eval $inlibc
12747case "$d_endgrent_r" in
12748"$define")
12749 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12750 case "$d_endgrent_r_proto:$usethreads" in
12751 ":define") d_endgrent_r_proto=define
12752 set d_endgrent_r_proto endgrent_r $hdrs
12753 eval $hasproto ;;
12754 *) ;;
12755 esac
12756 case "$d_endgrent_r_proto" in
12757 define)
12758 case "$endgrent_r_proto" in
12759 ''|0) try='int endgrent_r(FILE**);'
12760 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12761 esac
12762 case "$endgrent_r_proto" in
12763 ''|0) try='void endgrent_r(FILE**);'
12764 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12765 esac
12766 case "$endgrent_r_proto" in
12767 ''|0) d_endgrent_r=undef
12768 endgrent_r_proto=0
12769 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12770 * ) case "$endgrent_r_proto" in
12771 REENTRANT_PROTO*) ;;
12772 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12773 esac
12774 echo "Prototype: $try" ;;
12775 esac
12776 ;;
12777 *) case "$usethreads" in
12778 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12779 esac
12780 d_endgrent_r=undef
12781 endgrent_r_proto=0
12782 ;;
12783 esac
12784 ;;
12785*) endgrent_r_proto=0
12786 ;;
12787esac
12788
12789: see if endhostent exists
12790set endhostent d_endhent
12791eval $inlibc
12792
12793: see if this is a netdb.h system
12794set netdb.h i_netdb
12795eval $inhdr
12796
12797: see if endhostent_r exists
12798set endhostent_r d_endhostent_r
12799eval $inlibc
12800case "$d_endhostent_r" in
12801"$define")
12802 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12803 case "$d_endhostent_r_proto:$usethreads" in
12804 ":define") d_endhostent_r_proto=define
12805 set d_endhostent_r_proto endhostent_r $hdrs
12806 eval $hasproto ;;
12807 *) ;;
12808 esac
12809 case "$d_endhostent_r_proto" in
12810 define)
12811 case "$endhostent_r_proto" in
12812 ''|0) try='int endhostent_r(struct hostent_data*);'
12813 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12814 esac
12815 case "$endhostent_r_proto" in
12816 ''|0) try='void endhostent_r(struct hostent_data*);'
12817 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12818 esac
12819 case "$endhostent_r_proto" in
12820 ''|0) d_endhostent_r=undef
12821 endhostent_r_proto=0
12822 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12823 * ) case "$endhostent_r_proto" in
12824 REENTRANT_PROTO*) ;;
12825 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12826 esac
12827 echo "Prototype: $try" ;;
12828 esac
12829 ;;
12830 *) case "$usethreads" in
12831 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12832 esac
12833 d_endhostent_r=undef
12834 endhostent_r_proto=0
12835 ;;
12836 esac
12837 ;;
12838*) endhostent_r_proto=0
12839 ;;
12840esac
12841
12842: see if endnetent exists
12843set endnetent d_endnent
12844eval $inlibc
12845
12846: see if endnetent_r exists
12847set endnetent_r d_endnetent_r
12848eval $inlibc
12849case "$d_endnetent_r" in
12850"$define")
12851 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12852 case "$d_endnetent_r_proto:$usethreads" in
12853 ":define") d_endnetent_r_proto=define
12854 set d_endnetent_r_proto endnetent_r $hdrs
12855 eval $hasproto ;;
12856 *) ;;
12857 esac
12858 case "$d_endnetent_r_proto" in
12859 define)
12860 case "$endnetent_r_proto" in
12861 ''|0) try='int endnetent_r(struct netent_data*);'
12862 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12863 esac
12864 case "$endnetent_r_proto" in
12865 ''|0) try='void endnetent_r(struct netent_data*);'
12866 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12867 esac
12868 case "$endnetent_r_proto" in
12869 ''|0) d_endnetent_r=undef
12870 endnetent_r_proto=0
12871 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12872 * ) case "$endnetent_r_proto" in
12873 REENTRANT_PROTO*) ;;
12874 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12875 esac
12876 echo "Prototype: $try" ;;
12877 esac
12878 ;;
12879 *) case "$usethreads" in
12880 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12881 esac
12882 d_endnetent_r=undef
12883 endnetent_r_proto=0
12884 ;;
12885 esac
12886 ;;
12887*) endnetent_r_proto=0
12888 ;;
12889esac
12890
12891: see if endprotoent exists
12892set endprotoent d_endpent
12893eval $inlibc
12894
12895: see if endprotoent_r exists
12896set endprotoent_r d_endprotoent_r
12897eval $inlibc
12898case "$d_endprotoent_r" in
12899"$define")
12900 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12901 case "$d_endprotoent_r_proto:$usethreads" in
12902 ":define") d_endprotoent_r_proto=define
12903 set d_endprotoent_r_proto endprotoent_r $hdrs
12904 eval $hasproto ;;
12905 *) ;;
12906 esac
12907 case "$d_endprotoent_r_proto" in
12908 define)
12909 case "$endprotoent_r_proto" in
12910 ''|0) try='int endprotoent_r(struct protoent_data*);'
12911 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12912 esac
12913 case "$endprotoent_r_proto" in
12914 ''|0) try='void endprotoent_r(struct protoent_data*);'
12915 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12916 esac
12917 case "$endprotoent_r_proto" in
12918 ''|0) d_endprotoent_r=undef
12919 endprotoent_r_proto=0
12920 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12921 * ) case "$endprotoent_r_proto" in
12922 REENTRANT_PROTO*) ;;
12923 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12924 esac
12925 echo "Prototype: $try" ;;
12926 esac
12927 ;;
12928 *) case "$usethreads" in
12929 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12930 esac
12931 d_endprotoent_r=undef
12932 endprotoent_r_proto=0
12933 ;;
12934 esac
12935 ;;
12936*) endprotoent_r_proto=0
12937 ;;
12938esac
12939
12940: see if endpwent exists
12941set endpwent d_endpwent
12942eval $inlibc
12943
12944: see if this is a pwd.h system
12945set pwd.h i_pwd
12946eval $inhdr
12947
12948case "$i_pwd" in
12949$define)
12950 xxx=`./findhdr pwd.h`
12951 $cppstdin $cppflags $cppminus < $xxx >$$.h
12952
12953 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12954 val="$define"
12955 else
12956 val="$undef"
12957 fi
12958 set d_pwquota
12959 eval $setvar
12960
12961 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12962 val="$define"
12963 else
12964 val="$undef"
12965 fi
12966 set d_pwage
12967 eval $setvar
12968
12969 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12970 val="$define"
12971 else
12972 val="$undef"
12973 fi
12974 set d_pwchange
12975 eval $setvar
12976
12977 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12978 val="$define"
12979 else
12980 val="$undef"
12981 fi
12982 set d_pwclass
12983 eval $setvar
12984
12985 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12986 val="$define"
12987 else
12988 val="$undef"
12989 fi
12990 set d_pwexpire
12991 eval $setvar
12992
12993 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12994 val="$define"
12995 else
12996 val="$undef"
12997 fi
12998 set d_pwcomment
12999 eval $setvar
13000
13001 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13002 val="$define"
13003 else
13004 val="$undef"
13005 fi
13006 set d_pwgecos
13007 eval $setvar
13008
13009 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13010 val="$define"
13011 else
13012 val="$undef"
13013 fi
13014 set d_pwpasswd
13015 eval $setvar
13016
13017 $rm -f $$.h
13018 ;;
13019*)
13020 val="$undef";
13021 set d_pwquota; eval $setvar
13022 set d_pwage; eval $setvar
13023 set d_pwchange; eval $setvar
13024 set d_pwclass; eval $setvar
13025 set d_pwexpire; eval $setvar
13026 set d_pwcomment; eval $setvar
13027 set d_pwgecos; eval $setvar
13028 set d_pwpasswd; eval $setvar
13029 ;;
13030esac
13031
13032: see if endpwent_r exists
13033set endpwent_r d_endpwent_r
13034eval $inlibc
13035case "$d_endpwent_r" in
13036"$define")
13037 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13038 case "$d_endpwent_r_proto:$usethreads" in
13039 ":define") d_endpwent_r_proto=define
13040 set d_endpwent_r_proto endpwent_r $hdrs
13041 eval $hasproto ;;
13042 *) ;;
13043 esac
13044 case "$d_endpwent_r_proto" in
13045 define)
13046 case "$endpwent_r_proto" in
13047 ''|0) try='int endpwent_r(FILE**);'
13048 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13049 esac
13050 case "$endpwent_r_proto" in
13051 ''|0) try='void endpwent_r(FILE**);'
13052 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13053 esac
13054 case "$endpwent_r_proto" in
13055 ''|0) d_endpwent_r=undef
13056 endpwent_r_proto=0
13057 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13058 * ) case "$endpwent_r_proto" in
13059 REENTRANT_PROTO*) ;;
13060 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13061 esac
13062 echo "Prototype: $try" ;;
13063 esac
13064 ;;
13065 *) case "$usethreads" in
13066 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13067 esac
13068 d_endpwent_r=undef
13069 endpwent_r_proto=0
13070 ;;
13071 esac
13072 ;;
13073*) endpwent_r_proto=0
13074 ;;
13075esac
13076
13077: see if endservent exists
13078set endservent d_endsent
13079eval $inlibc
13080
13081: see if endservent_r exists
13082set endservent_r d_endservent_r
13083eval $inlibc
13084case "$d_endservent_r" in
13085"$define")
13086 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13087 case "$d_endservent_r_proto:$usethreads" in
13088 ":define") d_endservent_r_proto=define
13089 set d_endservent_r_proto endservent_r $hdrs
13090 eval $hasproto ;;
13091 *) ;;
13092 esac
13093 case "$d_endservent_r_proto" in
13094 define)
13095 case "$endservent_r_proto" in
13096 ''|0) try='int endservent_r(struct servent_data*);'
13097 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13098 esac
13099 case "$endservent_r_proto" in
13100 ''|0) try='void endservent_r(struct servent_data*);'
13101 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13102 esac
13103 case "$endservent_r_proto" in
13104 ''|0) d_endservent_r=undef
13105 endservent_r_proto=0
13106 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13107 * ) case "$endservent_r_proto" in
13108 REENTRANT_PROTO*) ;;
13109 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13110 esac
13111 echo "Prototype: $try" ;;
13112 esac
13113 ;;
13114 *) case "$usethreads" in
13115 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13116 esac
13117 d_endservent_r=undef
13118 endservent_r_proto=0
13119 ;;
13120 esac
13121 ;;
13122*) endservent_r_proto=0
13123 ;;
13124esac
13125
13126: Locate the flags for 'open()'
13127echo " "
13128$cat >try.c <<EOCP
13129#include <sys/types.h>
13130#ifdef I_FCNTL
13131#include <fcntl.h>
13132#endif
13133#ifdef I_SYS_FILE
13134#include <sys/file.h>
13135#endif
13136#$i_stdlib I_STDLIB
13137#ifdef I_STDLIB
13138#include <stdlib.h>
13139#endif
13140int main() {
13141 if(O_RDONLY);
13142#ifdef O_TRUNC
13143 exit(0);
13144#else
13145 exit(1);
13146#endif
13147}
13148EOCP
13149: check sys/file.h first to get FREAD on Sun
13150if $test `./findhdr sys/file.h` && \
13151 set try -DI_SYS_FILE && eval $compile; then
13152 h_sysfile=true;
13153 echo "<sys/file.h> defines the O_* constants..." >&4
13154 if $run ./try; then
13155 echo "and you have the 3 argument form of open()." >&4
13156 val="$define"
13157 else
13158 echo "but not the 3 argument form of open(). Oh, well." >&4
13159 val="$undef"
13160 fi
13161elif $test `./findhdr fcntl.h` && \
13162 set try -DI_FCNTL && eval $compile; then
13163 h_fcntl=true;
13164 echo "<fcntl.h> defines the O_* constants..." >&4
13165 if $run ./try; then
13166 echo "and you have the 3 argument form of open()." >&4
13167 val="$define"
13168 else
13169 echo "but not the 3 argument form of open(). Oh, well." >&4
13170 val="$undef"
13171 fi
13172else
13173 val="$undef"
13174 echo "I can't find the O_* constant definitions! You got problems." >&4
13175fi
13176set d_open3
13177eval $setvar
13178$rm_try
13179
13180: see if this is a sys/file.h system
13181val=''
13182set sys/file.h val
13183eval $inhdr
13184
13185: do we need to include sys/file.h ?
13186case "$val" in
13187"$define")
13188 echo " "
13189 if $h_sysfile; then
13190 val="$define"
13191 echo "We'll be including <sys/file.h>." >&4
13192 else
13193 val="$undef"
13194 echo "We won't be including <sys/file.h>." >&4
13195 fi
13196 ;;
13197*)
13198 h_sysfile=false
13199 ;;
13200esac
13201set i_sysfile
13202eval $setvar
13203
13204: see if fcntl.h is there
13205val=''
13206set fcntl.h val
13207eval $inhdr
13208
13209: see if we can include fcntl.h
13210case "$val" in
13211"$define")
13212 echo " "
13213 if $h_fcntl; then
13214 val="$define"
13215 echo "We'll be including <fcntl.h>." >&4
13216 else
13217 val="$undef"
13218 if $h_sysfile; then
13219 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13220 else
13221 echo "We won't be including <fcntl.h>." >&4
13222 fi
13223 fi
13224 ;;
13225*)
13226 h_fcntl=false
13227 val="$undef"
13228 ;;
13229esac
13230set i_fcntl
13231eval $setvar
13232
13233: see if fork exists
13234set fork d_fork
13235eval $inlibc
13236
13237: see if pipe exists
13238set pipe d_pipe
13239eval $inlibc
13240
13241: check for non-blocking I/O stuff
13242case "$h_sysfile" in
13243true) echo "#include <sys/file.h>" > head.c;;
13244*)
13245 case "$h_fcntl" in
13246 true) echo "#include <fcntl.h>" > head.c;;
13247 *) echo "#include <sys/fcntl.h>" > head.c;;
13248 esac
13249 ;;
13250esac
13251echo " "
13252echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13253case "$o_nonblock" in
13254'')
13255 $cat head.c > try.c
13256 $cat >>try.c <<EOCP
13257#include <stdio.h>
13258#$i_stdlib I_STDLIB
13259#ifdef I_STDLIB
13260#include <stdlib.h>
13261#endif
13262#$i_fcntl I_FCNTL
13263#ifdef I_FCNTL
13264#include <fcntl.h>
13265#endif
13266int main() {
13267#ifdef O_NONBLOCK
13268 printf("O_NONBLOCK\n");
13269 exit(0);
13270#endif
13271#ifdef O_NDELAY
13272 printf("O_NDELAY\n");
13273 exit(0);
13274#endif
13275#ifdef FNDELAY
13276 printf("FNDELAY\n");
13277 exit(0);
13278#endif
13279 exit(0);
13280}
13281EOCP
13282 set try
13283 if eval $compile_ok; then
13284 o_nonblock=`$run ./try`
13285 case "$o_nonblock" in
13286 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13287 *) echo "Seems like we can use $o_nonblock.";;
13288 esac
13289 else
13290 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13291 fi
13292 ;;
13293*) echo "Using $hint value $o_nonblock.";;
13294esac
13295$rm_try
13296
13297echo " "
13298echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13299case "$eagain" in
13300'')
13301 case "$d_fork:$d_pipe:$d_alarm" in
13302 define:define:define)
13303 $cat head.c > try.c
13304 $cat >>try.c <<EOCP
13305#include <errno.h>
13306#include <sys/types.h>
13307#include <signal.h>
13308#include <stdio.h>
13309#$i_stdlib I_STDLIB
13310#ifdef I_STDLIB
13311#include <stdlib.h>
13312#endif
13313#$i_fcntl I_FCNTL
13314#ifdef I_FCNTL
13315#include <fcntl.h>
13316#endif
13317#define MY_O_NONBLOCK $o_nonblock
13318#ifndef errno /* XXX need better Configure test */
13319extern int errno;
13320#endif
13321#$i_unistd I_UNISTD
13322#ifdef I_UNISTD
13323#include <unistd.h>
13324#endif
13325#include <string.h>
13326$signal_t blech(int x) { exit(3); }
13327EOCP
13328 $cat >> try.c <<'EOCP'
13329int main()
13330{
13331 int pd[2];
13332 int pu[2];
13333 char buf[1];
13334 char string[100];
13335 int ret;
13336
13337 ret = pipe(pd); /* Down: child -> parent */
13338 if (ret != 0)
13339 exit(3);
13340 ret = pipe(pu); /* Up: parent -> child */
13341 if (ret != 0)
13342 exit(3);
13343 if (0 != fork()) {
13344 close(pd[1]); /* Parent reads from pd[0] */
13345 close(pu[0]); /* Parent writes (blocking) to pu[1] */
13346#ifdef F_SETFL
13347 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13348 exit(1);
13349#else
13350 exit(4);
13351#endif
13352 signal(SIGALRM, blech);
13353 alarm(5);
13354 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
13355 exit(2);
13356 sprintf(string, "%d\n", ret);
13357 ret = write(2, string, strlen(string));
13358 if (ret != strlen(string))
13359 exit(3);
13360 alarm(0);
13361#ifdef EAGAIN
13362 if (errno == EAGAIN) {
13363 printf("EAGAIN\n");
13364 goto ok;
13365 }
13366#endif
13367#ifdef EWOULDBLOCK
13368 if (errno == EWOULDBLOCK)
13369 printf("EWOULDBLOCK\n");
13370#endif
13371 ok:
13372 ret = write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
13373 if (ret != 1)
13374 exit(3);
13375 sleep(2); /* Give it time to close our pipe */
13376 alarm(5);
13377 ret = read(pd[0], buf, 1); /* Should read EOF */
13378 alarm(0);
13379 sprintf(string, "%d\n", ret);
13380 ret = write(4, string, strlen(string));
13381 if (ret != strlen(string))
13382 exit(3);
13383 exit(0);
13384 }
13385
13386 close(pd[0]); /* We write to pd[1] */
13387 close(pu[1]); /* We read from pu[0] */
13388 ret = read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
13389 if (ret != 1)
13390 exit(3);
13391 close(pd[1]); /* Pipe pd is now fully closed! */
13392 exit(0); /* Bye bye, thank you for playing! */
13393}
13394EOCP
13395 set try
13396 if eval $compile_ok; then
13397 echo "$startsh" >mtry
13398 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13399 chmod +x mtry
13400 $run ./mtry >/dev/null 2>&1
13401 case $? in
13402 0) eagain=`$cat try.out`;;
13403 1) echo "Could not perform non-blocking setting!";;
13404 2) echo "I did a successful read() for something that was not there!";;
13405 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13406 4) echo "Could not find F_SETFL!";;
13407 *) echo "Something terribly wrong happened during testing.";;
13408 esac
13409 rd_nodata=`$cat try.ret`
13410 echo "A read() system call with no data present returns $rd_nodata."
13411 case "$rd_nodata" in
13412 0|-1) ;;
13413 *)
13414 echo "(That's peculiar, fixing that to be -1.)"
13415 rd_nodata=-1
13416 ;;
13417 esac
13418 case "$eagain" in
13419 '')
13420 echo "Forcing errno EAGAIN on read() with no data available."
13421 eagain=EAGAIN
13422 ;;
13423 *)
13424 echo "Your read() sets errno to $eagain when no data is available."
13425 ;;
13426 esac
13427 status=`$cat try.err`
13428 case "$status" in
13429 0) echo "And it correctly returns 0 to signal EOF.";;
13430 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13431 *) echo "However, your read() returns '$status' on EOF??";;
13432 esac
13433 val="$define"
13434 if test "$status" = "$rd_nodata"; then
13435 echo "WARNING: you can't distinguish between EOF and no data!"
13436 val="$undef"
13437 fi
13438 else
13439 echo "I can't compile the test program--assuming errno EAGAIN will do."
13440 eagain=EAGAIN
13441 fi
13442 ;;
13443 *) echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13444 eagain=EAGAIN
13445 val="$define"
13446 ;;
13447 esac
13448 set d_eofnblk
13449 eval $setvar
13450 ;;
13451*)
13452 echo "Using $hint value $eagain."
13453 echo "Your read() returns $rd_nodata when no data is present."
13454 case "$d_eofnblk" in
13455 "$define") echo "And you can see EOF because read() returns 0.";;
13456 "$undef") echo "But you can't see EOF status from read() returned value.";;
13457 *)
13458 echo "(Assuming you can't see EOF status from read anyway.)"
13459 d_eofnblk=$undef
13460 ;;
13461 esac
13462 ;;
13463esac
13464$rm_try head.c mtry
13465
13466: see if erf exists
13467set erf d_erf
13468eval $inlibc
13469
13470: see if erfc exists
13471set erfc d_erfc
13472eval $inlibc
13473
13474: see if exp2 exists
13475set exp2 d_exp2
13476eval $inlibc
13477
13478: see if expm1 exists
13479set expm1 d_expm1
13480eval $inlibc
13481
13482: see if _ptr and _cnt from stdio act std
13483echo " "
13484
13485if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13486 echo "(Looks like you have stdio.h from BSD.)"
13487 case "$stdio_ptr" in
13488 '') stdio_ptr='((fp)->_p)'
13489 ptr_lval=$define
13490 ;;
13491 *) ptr_lval=$d_stdio_ptr_lval;;
13492 esac
13493 case "$stdio_cnt" in
13494 '') stdio_cnt='((fp)->_r)'
13495 cnt_lval=$define
13496 ;;
13497 *) cnt_lval=$d_stdio_cnt_lval;;
13498 esac
13499 case "$stdio_base" in
13500 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13501 esac
13502 case "$stdio_bufsiz" in
13503 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13504 esac
13505elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13506 echo "(Looks like you have stdio.h from Linux.)"
13507 case "$stdio_ptr" in
13508 '') stdio_ptr='((fp)->_IO_read_ptr)'
13509 ptr_lval=$define
13510 ;;
13511 *) ptr_lval=$d_stdio_ptr_lval;;
13512 esac
13513 case "$stdio_cnt" in
13514 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13515 cnt_lval=$undef
13516 ;;
13517 *) cnt_lval=$d_stdio_cnt_lval;;
13518 esac
13519 case "$stdio_base" in
13520 '') stdio_base='((fp)->_IO_read_base)';;
13521 esac
13522 case "$stdio_bufsiz" in
13523 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13524 esac
13525else
13526 case "$stdio_ptr" in
13527 '') stdio_ptr='((fp)->_ptr)'
13528 ptr_lval=$define
13529 ;;
13530 *) ptr_lval=$d_stdio_ptr_lval;;
13531 esac
13532 case "$stdio_cnt" in
13533 '') stdio_cnt='((fp)->_cnt)'
13534 cnt_lval=$define
13535 ;;
13536 *) cnt_lval=$d_stdio_cnt_lval;;
13537 esac
13538 case "$stdio_base" in
13539 '') stdio_base='((fp)->_base)';;
13540 esac
13541 case "$stdio_bufsiz" in
13542 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13543 esac
13544fi
13545
13546: test whether _ptr and _cnt really work
13547echo "Checking how std your stdio is..." >&4
13548$cat >try.c <<EOP
13549#include <stdio.h>
13550#$i_stdlib I_STDLIB
13551#ifdef I_STDLIB
13552#include <stdlib.h>
13553#endif
13554#define FILE_ptr(fp) $stdio_ptr
13555#define FILE_cnt(fp) $stdio_cnt
13556int main() {
13557 FILE *fp = fopen("try.c", "r");
13558 char c = getc(fp);
13559 if (
13560 18 <= FILE_cnt(fp) &&
13561 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13562 )
13563 exit(0);
13564 exit(1);
13565}
13566EOP
13567val="$undef"
13568set try
13569if eval $compile && $to try.c; then
13570 if $run ./try; then
13571 echo "Your stdio acts pretty std."
13572 val="$define"
13573 else
13574 echo "Your stdio isn't very std."
13575 fi
13576else
13577 echo "Your stdio doesn't appear very std."
13578fi
13579$rm_try
13580
13581# glibc 2.2.90 and above apparently change stdio streams so Perl's
13582# direct buffer manipulation no longer works. The Configure tests
13583# should be changed to correctly detect this, but until then,
13584# the following check should at least let perl compile and run.
13585# (This quick fix should be updated before 5.8.1.)
13586# To be defensive, reject all unknown versions, and all versions > 2.2.9.
13587# A. Dougherty, June 3, 2002.
13588case "$d_gnulibc" in
13589$define)
13590 case "$gnulibc_version" in
13591 2.[01]*) ;;
13592 2.2) ;;
13593 2.2.[0-9]) ;;
13594 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13595 val="$undef"
13596 ;;
13597 esac
13598 ;;
13599esac
13600set d_stdstdio
13601eval $setvar
13602
13603: Can _ptr be used as an lvalue?
13604case "$d_stdstdio$ptr_lval" in
13605$define$define) val=$define ;;
13606*) val=$undef ;;
13607esac
13608set d_stdio_ptr_lval
13609eval $setvar
13610
13611: Can _cnt be used as an lvalue?
13612case "$d_stdstdio$cnt_lval" in
13613$define$define) val=$define ;;
13614*) val=$undef ;;
13615esac
13616set d_stdio_cnt_lval
13617eval $setvar
13618
13619
13620: test whether setting _ptr sets _cnt as a side effect
13621d_stdio_ptr_lval_sets_cnt="$undef"
13622d_stdio_ptr_lval_nochange_cnt="$undef"
13623case "$d_stdio_ptr_lval$d_stdstdio" in
13624$define$define)
13625 echo "Checking to see what happens if we set the stdio ptr..." >&4
13626$cat >try.c <<EOP
13627#include <stdio.h>
13628/* Can we scream? */
13629/* Eat dust sed :-) */
13630/* In the buffer space, no one can hear you scream. */
13631#$i_stdlib I_STDLIB
13632#ifdef I_STDLIB
13633#include <stdlib.h>
13634#endif
13635#define FILE_ptr(fp) $stdio_ptr
13636#define FILE_cnt(fp) $stdio_cnt
13637#include <sys/types.h>
13638int main() {
13639 FILE *fp = fopen("try.c", "r");
13640 int c;
13641 char *ptr;
13642 size_t cnt;
13643 if (!fp) {
13644 puts("Fail even to read");
13645 exit(1);
13646 }
13647 c = getc(fp); /* Read away the first # */
13648 if (c == EOF) {
13649 puts("Fail even to read");
13650 exit(1);
13651 }
13652 if (!(
13653 18 <= FILE_cnt(fp) &&
13654 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13655 )) {
13656 puts("Fail even to read");
13657 exit (1);
13658 }
13659 ptr = (char*) FILE_ptr(fp);
13660 cnt = (size_t)FILE_cnt(fp);
13661
13662 FILE_ptr(fp) += 42;
13663
13664 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13665 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13666 exit (1);
13667 }
13668 if (FILE_cnt(fp) <= 20) {
13669 printf ("Fail (<20 chars to test)");
13670 exit (1);
13671 }
13672 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13673 puts("Fail compare");
13674 exit (1);
13675 }
13676 if (cnt == FILE_cnt(fp)) {
13677 puts("Pass_unchanged");
13678 exit (0);
13679 }
13680 if (FILE_cnt(fp) == (cnt - 42)) {
13681 puts("Pass_changed");
13682 exit (0);
13683 }
13684 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13685 return 1;
13686
13687}
13688EOP
13689 set try
13690 if eval $compile && $to try.c; then
13691 case `$run ./try` in
13692 Pass_changed)
13693 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
13694 d_stdio_ptr_lval_sets_cnt="$define" ;;
13695 Pass_unchanged)
13696 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
13697 d_stdio_ptr_lval_nochange_cnt="$define" ;;
13698 Fail*)
13699 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
13700 *)
13701 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13702 esac
13703 else
13704 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
13705 fi
13706 $rm_try
13707 ;;
13708esac
13709
13710: see if _base is also standard
13711val="$undef"
13712case "$d_stdstdio" in
13713$define)
13714 $cat >try.c <<EOP
13715#include <stdio.h>
13716#$i_stdlib I_STDLIB
13717#ifdef I_STDLIB
13718#include <stdlib.h>
13719#endif
13720#define FILE_base(fp) $stdio_base
13721#define FILE_bufsiz(fp) $stdio_bufsiz
13722int main() {
13723 FILE *fp = fopen("try.c", "r");
13724 char c = getc(fp);
13725 if (
13726 19 <= FILE_bufsiz(fp) &&
13727 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13728 )
13729 exit(0);
13730 exit(1);
13731}
13732EOP
13733 set try
13734 if eval $compile && $to try.c; then
13735 if $run ./try; then
13736 echo "And its _base field acts std."
13737 val="$define"
13738 else
13739 echo "But its _base field isn't std."
13740 fi
13741 else
13742 echo "However, it seems to be lacking the _base field."
13743 fi
13744 $rm_try
13745 ;;
13746esac
13747set d_stdiobase
13748eval $setvar
13749
13750: see if fast_stdio exists
13751val="$undef"
13752case "$d_stdstdio:$d_stdio_ptr_lval" in
13753"$define:$define")
13754 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13755 *$define*)
13756 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13757 val="$define"
13758 ;;
13759 esac
13760 ;;
13761esac
13762set d_faststdio
13763eval $setvar
13764
13765: see if fchdir exists
13766set fchdir d_fchdir
13767eval $inlibc
13768
13769: see if fchmod exists
13770set fchmod d_fchmod
13771eval $inlibc
13772
13773: check for openat, unlinkat, renameat, linkat, fchmodat
13774set openat d_openat
13775eval $inlibc
13776
13777set unlinkat d_unlinkat
13778eval $inlibc
13779
13780set renameat d_renameat
13781eval $inlibc
13782
13783set linkat d_linkat
13784eval $inlibc
13785
13786set fchmodat d_fchmodat
13787eval $inlibc
13788
13789: see if fchown exists
13790set fchown d_fchown
13791eval $inlibc
13792
13793: see if this is an fcntl system
13794set fcntl d_fcntl
13795eval $inlibc
13796
13797: See if fcntl-based locking works.
13798echo " "
13799$cat >try.c <<EOCP
13800#$i_stdlib I_STDLIB
13801#ifdef I_STDLIB
13802#include <stdlib.h>
13803#endif
13804#include <unistd.h>
13805#include <fcntl.h>
13806#include <signal.h>
13807$signal_t blech(int x) { exit(3); }
13808int main() {
13809#if defined(F_SETLK) && defined(F_SETLKW)
13810 struct flock flock;
13811 int retval, fd;
13812 fd = open("try.c", O_RDONLY);
13813 flock.l_type = F_RDLCK;
13814 flock.l_whence = SEEK_SET;
13815 flock.l_start = flock.l_len = 0;
13816 signal(SIGALRM, blech);
13817 alarm(10);
13818 retval = fcntl(fd, F_SETLK, &flock);
13819 close(fd);
13820 (retval < 0 ? exit(2) : exit(0));
13821#else
13822 exit(2);
13823#endif
13824}
13825EOCP
13826echo "Checking if fcntl-based file locking works... "
13827case "$d_fcntl" in
13828"$define")
13829 set try
13830 if eval $compile_ok; then
13831 if $run ./try; then
13832 echo "Yes, it seems to work."
13833 val="$define"
13834 else
13835 echo "Nope, it didn't work."
13836 val="$undef"
13837 case "$?" in
13838 3) $cat >&4 <<EOM
13839***
13840*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13841*** This is (almost) impossible.
13842*** If your NFS lock daemons are not feeling well, something like
13843*** this may happen, please investigate. Cannot continue, aborting.
13844***
13845EOM
13846 exit 1
13847 ;;
13848 esac
13849 fi
13850 else
13851 echo "I'm unable to compile the test program, so I'll assume not."
13852 val="$undef"
13853 fi
13854 ;;
13855*) val="$undef";
13856 echo "Nope, since you don't even have fcntl()."
13857 ;;
13858esac
13859set d_fcntl_can_lock
13860eval $setvar
13861$rm_try
13862
13863: check for fd_set items
13864$cat <<EOM
13865
13866Checking to see how well your C compiler handles fd_set and friends ...
13867EOM
13868$cat >try.c <<EOCP
13869#$i_stdlib I_STDLIB
13870#ifdef I_STDLIB
13871#include <stdlib.h>
13872#endif
13873#$i_systime I_SYS_TIME
13874#$i_sysselct I_SYS_SELECT
13875#$d_socket HAS_SOCKET
13876#include <sys/types.h>
13877#ifdef HAS_SOCKET
13878#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13879#endif
13880#ifdef I_SYS_TIME
13881#include <sys/time.h>
13882#endif
13883#ifdef I_SYS_SELECT
13884#include <sys/select.h>
13885#endif
13886int main() {
13887 fd_set fds;
13888
13889#ifdef TRYBITS
13890 if(fds.fds_bits);
13891#endif
13892
13893#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13894 exit(0);
13895#else
13896 exit(1);
13897#endif
13898}
13899EOCP
13900set try -DTRYBITS
13901if eval $compile; then
13902 d_fds_bits="$define"
13903 d_fd_set="$define"
13904 echo "Well, your system knows about the normal fd_set typedef..." >&4
13905 if $run ./try; then
13906 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13907 d_fd_macros="$define"
13908 else
13909 $cat >&4 <<'EOM'
13910but not the normal fd_set macros! Gaaack! I'll have to cover for you.
13911EOM
13912 d_fd_macros="$undef"
13913 fi
13914else
13915 $cat <<'EOM'
13916Hmm, your compiler has some difficulty with fd_set. Checking further...
13917EOM
13918 set try
13919 if eval $compile; then
13920 d_fds_bits="$undef"
13921 d_fd_set="$define"
13922 echo "Well, your system has some sort of fd_set available..." >&4
13923 if $run ./try; then
13924 echo "and you have the normal fd_set macros." >&4
13925 d_fd_macros="$define"
13926 else
13927 $cat <<'EOM'
13928but not the normal fd_set macros! Gross! More work for me...
13929EOM
13930 d_fd_macros="$undef"
13931 fi
13932 else
13933 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
13934 d_fd_set="$undef"
13935 d_fds_bits="$undef"
13936 d_fd_macros="$undef"
13937 fi
13938fi
13939$rm_try
13940
13941: see if fdclose exists
13942set fdclose d_fdclose
13943eval $inlibc
13944
13945: see if fdim exists
13946set fdim d_fdim
13947eval $inlibc
13948
13949: see if fegetround exists
13950set fegetround d_fegetround
13951eval $inlibc
13952
13953: see if fgetpos exists
13954set fgetpos d_fgetpos
13955eval $inlibc
13956
13957: see if finite exists
13958set finite d_finite
13959eval $inlibc
13960
13961: see if finitel exists
13962set finitel d_finitel
13963eval $inlibc
13964
13965: see if flock exists
13966set flock d_flock
13967eval $inlibc
13968
13969: see if prototype for flock is available
13970echo " "
13971set d_flockproto flock $i_sysfile sys/file.h
13972eval $hasproto
13973
13974: see if fma exists
13975set fma d_fma
13976eval $inlibc
13977
13978: see if fmax exists
13979set fmax d_fmax
13980eval $inlibc
13981
13982: see if fmin exists
13983set fmin d_fmin
13984eval $inlibc
13985
13986: see if fp_class exists
13987set fp_class d_fp_class
13988eval $inlibc
13989
13990: check for fpclassify
13991echo "Checking to see if you have fpclassify..." >&4
13992$cat >try.c <<EOCP
13993#include <math.h>
13994int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13995EOCP
13996set try
13997if eval $compile; then
13998 val="$define"
13999 echo "You have fpclassify."
14000else
14001 val="$undef"
14002 echo "You do not have fpclassify."
14003fi
14004$rm_try
14005set d_fpclassify
14006eval $setvar
14007
14008: see if fp_classify exists
14009set fp_classify d_fp_classify
14010eval $inlibc
14011
14012: see if fp_classl exists
14013set fp_classl d_fp_classl
14014eval $inlibc
14015
14016: see if pathconf exists
14017set pathconf d_pathconf
14018eval $inlibc
14019
14020: see if fpathconf exists
14021set fpathconf d_fpathconf
14022eval $inlibc
14023
14024: see if fpclass exists
14025set fpclass d_fpclass
14026eval $inlibc
14027
14028: see if fpclassl exists
14029set fpclassl d_fpclassl
14030eval $inlibc
14031
14032: see if fpgetround exists
14033set fpgetround d_fpgetround
14034eval $inlibc
14035
14036: check for fpos64_t
14037echo " "
14038echo "Checking to see if you have fpos64_t..." >&4
14039$cat >try.c <<EOCP
14040#include <stdio.h>
14041int main() { fpos64_t x = 7; }
14042EOCP
14043set try
14044if eval $compile; then
14045 val="$define"
14046 echo "You have fpos64_t."
14047else
14048 val="$undef"
14049 echo "You do not have fpos64_t."
14050 case "$fpossize" in
14051 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14052 esac
14053fi
14054$rm_try
14055set d_fpos64_t
14056eval $setvar
14057
14058: see if frexpl exists
14059set frexpl d_frexpl
14060eval $inlibc
14061
14062: see if this is a sys/param system
14063set sys/param.h i_sysparam
14064eval $inhdr
14065
14066: see if this is a sys/mount.h system
14067set sys/mount.h i_sysmount
14068eval $inhdr
14069
14070: Check for fs_data_s
14071echo " "
14072echo "Checking to see if your system supports struct fs_data..." >&4
14073set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14074eval $hasstruct
14075case "$d_fs_data_s" in
14076"$define") echo "Yes, it does." ;;
14077*) echo "No, it doesn't." ;;
14078esac
14079
14080: see if fseeko exists
14081set fseeko d_fseeko
14082eval $inlibc
14083case "$longsize" in
140848) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14085esac
14086
14087: see if fsetpos exists
14088set fsetpos d_fsetpos
14089eval $inlibc
14090
14091: see if fstatfs exists
14092set fstatfs d_fstatfs
14093eval $inlibc
14094
14095: see if statvfs exists
14096set statvfs d_statvfs
14097eval $inlibc
14098
14099: see if fstatvfs exists
14100set fstatvfs d_fstatvfs
14101eval $inlibc
14102
14103: see if fsync exists
14104set fsync d_fsync
14105eval $inlibc
14106
14107: see if ftello exists
14108set ftello d_ftello
14109eval $inlibc
14110case "$longsize" in
141118) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14112esac
14113
14114: check for a working futimes
14115d_futimes="$undef"
14116echo " "
14117echo "Checking if you have a working futimes()" >&4
14118$cat >try.c <<EOCP
14119#include <stdio.h>
14120#include <stdlib.h>
14121#include <sys/time.h>
14122#include <errno.h>
14123#include <fcntl.h>
14124#include <stdlib.h>
14125
14126int main ()
14127{
14128 int fd, rv;
14129 fd = open ("try.c", O_RDWR);
14130 if (-1 == fd) exit (1);
14131 rv = futimes (fd, NULL);
14132 exit (rv == -1 ? errno : 0);
14133}
14134EOCP
14135set try
14136if eval $compile; then
14137 `$run ./try`
14138 rc=$?
14139 case "$rc" in
14140 0) echo "Yes, you have" >&4
14141 d_futimes="$define"
14142 ;;
14143 *) echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14144 ;;
14145 esac
14146else
14147 echo "No, it does not (probably harmless)" >&4
14148fi
14149$rm_try
14150
14151: look for gai_strerror
14152echo " "
14153$cat >try.c <<'EOCP'
14154#include <sys/types.h>
14155#include <sys/socket.h>
14156#include <netdb.h>
14157int main ()
14158{
14159 return (gai_strerror (0) ? 0 : 1);
14160 }
14161EOCP
14162set try
14163val="$undef"
14164if eval $compile; then
14165 `$run ./try`
14166 case "$?" in
14167 0) echo "A working gai_strerror() found." >&4
14168 val="$define" ;;
14169 *) echo "gai_strerror() found, but it doesn't work" >&4
14170 ;;
14171 esac
14172else
14173 echo "gai_strerror() NOT found." >&4
14174 fi
14175set d_gai_strerror
14176eval $setvar
14177$rm_try
14178
14179: see if ndbm.h is available
14180set ndbm.h i_ndbm
14181eval $inhdr
14182: Compatibility location for RedHat 7.1
14183set gdbm/ndbm.h i_gdbmndbm
14184eval $inhdr
14185: Compatibility location for Debian 4.0
14186set gdbm-ndbm.h i_gdbm_ndbm
14187eval $inhdr
14188
14189val="$undef"
14190if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14191 : see if dbm_open exists
14192 set dbm_open d_dbm_open
14193 eval $inlibc
14194 case "$d_dbm_open" in
14195 $undef)
14196 i_ndbm="$undef"
14197 i_gdbmndbm="$undef"
14198 i_gdbm_ndbm="$undef"
14199 echo "We won't be including <ndbm.h>"
14200 val="$undef"
14201 ;;
14202 *) val="$define"
14203 ;;
14204 esac
14205fi
14206set d_ndbm
14207eval $setvar
14208
14209ndbm_hdr_protochk='name=$1; hdr=$2;
14210eval "ihdr=\$""i_$name";
14211val="$undef";
14212if $test "$ihdr" = "$define"; then
14213 $echo "Checking if your <$hdr> uses prototypes..." >&4;
14214 case "$d_cplusplus" in
14215 $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14216 *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14217 esac;
14218 case "$val" in
14219 $define) $echo "Your <$hdr> seems to have prototypes";;
14220 *) $echo "Your <$hdr> does not seem to have prototypes";;
14221 esac;
14222fi;
14223set "d_${name}_h_uses_prototypes";
14224eval $setvar'
14225
14226set ndbm ndbm.h
14227eval $ndbm_hdr_protochk
14228set gdbmndbm gdbm/ndbm.h
14229eval $ndbm_hdr_protochk
14230set gdbm_ndbm gdbm-ndbm.h
14231eval $ndbm_hdr_protochk
14232
14233: see if getaddrinfo exists
14234set getaddrinfo d_getaddrinfo
14235eval $inlibc
14236
14237: see if getcwd exists
14238set getcwd d_getcwd
14239eval $inlibc
14240
14241: see if getespwnam exists
14242set getespwnam d_getespwnam
14243eval $inlibc
14244
14245: see if getfsstat exists
14246set getfsstat d_getfsstat
14247eval $inlibc
14248
14249: see if getgrent exists
14250set getgrent d_getgrent
14251eval $inlibc
14252
14253: see if getgrent_r exists
14254set getgrent_r d_getgrent_r
14255eval $inlibc
14256case "$d_getgrent_r" in
14257"$define")
14258 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14259 case "$d_getgrent_r_proto:$usethreads" in
14260 ":define") d_getgrent_r_proto=define
14261 set d_getgrent_r_proto getgrent_r $hdrs
14262 eval $hasproto ;;
14263 *) ;;
14264 esac
14265 case "$d_getgrent_r_proto" in
14266 define)
14267 case "$getgrent_r_proto" in
14268 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14269 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14270 esac
14271 case "$getgrent_r_proto" in
14272 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14273 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14274 esac
14275 case "$getgrent_r_proto" in
14276 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14277 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14278 esac
14279 case "$getgrent_r_proto" in
14280 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14281 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14282 esac
14283 case "$getgrent_r_proto" in
14284 ''|0) try='int getgrent_r(struct group*, char*, int);'
14285 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14286 esac
14287 case "$getgrent_r_proto" in
14288 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14289 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14290 esac
14291 case "$getgrent_r_proto" in
14292 ''|0) d_getgrent_r=undef
14293 getgrent_r_proto=0
14294 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14295 * ) case "$getgrent_r_proto" in
14296 REENTRANT_PROTO*) ;;
14297 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14298 esac
14299 echo "Prototype: $try" ;;
14300 esac
14301 ;;
14302 *) case "$usethreads" in
14303 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14304 esac
14305 d_getgrent_r=undef
14306 getgrent_r_proto=0
14307 ;;
14308 esac
14309 ;;
14310*) getgrent_r_proto=0
14311 ;;
14312esac
14313
14314: see if getgrgid_r exists
14315set getgrgid_r d_getgrgid_r
14316eval $inlibc
14317case "$d_getgrgid_r" in
14318"$define")
14319 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14320 case "$d_getgrgid_r_proto:$usethreads" in
14321 ":define") d_getgrgid_r_proto=define
14322 set d_getgrgid_r_proto getgrgid_r $hdrs
14323 eval $hasproto ;;
14324 *) ;;
14325 esac
14326 case "$d_getgrgid_r_proto" in
14327 define)
14328 case "$getgrgid_r_proto" in
14329 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14330 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14331 esac
14332 case "$getgrgid_r_proto" in
14333 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14334 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14335 esac
14336 case "$getgrgid_r_proto" in
14337 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14338 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14339 esac
14340 case "$getgrgid_r_proto" in
14341 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14342 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14343 esac
14344 case "$getgrgid_r_proto" in
14345 ''|0) d_getgrgid_r=undef
14346 getgrgid_r_proto=0
14347 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14348 * ) case "$getgrgid_r_proto" in
14349 REENTRANT_PROTO*) ;;
14350 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14351 esac
14352 echo "Prototype: $try" ;;
14353 esac
14354 ;;
14355 *) case "$usethreads" in
14356 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14357 esac
14358 d_getgrgid_r=undef
14359 getgrgid_r_proto=0
14360 ;;
14361 esac
14362 ;;
14363*) getgrgid_r_proto=0
14364 ;;
14365esac
14366
14367: see if getgrnam_r exists
14368set getgrnam_r d_getgrnam_r
14369eval $inlibc
14370case "$d_getgrnam_r" in
14371"$define")
14372 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14373 case "$d_getgrnam_r_proto:$usethreads" in
14374 ":define") d_getgrnam_r_proto=define
14375 set d_getgrnam_r_proto getgrnam_r $hdrs
14376 eval $hasproto ;;
14377 *) ;;
14378 esac
14379 case "$d_getgrnam_r_proto" in
14380 define)
14381 case "$getgrnam_r_proto" in
14382 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14383 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14384 esac
14385 case "$getgrnam_r_proto" in
14386 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14387 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14388 esac
14389 case "$getgrnam_r_proto" in
14390 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14391 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14392 esac
14393 case "$getgrnam_r_proto" in
14394 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14395 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14396 esac
14397 case "$getgrnam_r_proto" in
14398 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14399 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14400 esac
14401 case "$getgrnam_r_proto" in
14402 ''|0) d_getgrnam_r=undef
14403 getgrnam_r_proto=0
14404 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14405 * ) case "$getgrnam_r_proto" in
14406 REENTRANT_PROTO*) ;;
14407 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14408 esac
14409 echo "Prototype: $try" ;;
14410 esac
14411 ;;
14412 *) case "$usethreads" in
14413 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14414 esac
14415 d_getgrnam_r=undef
14416 getgrnam_r_proto=0
14417 ;;
14418 esac
14419 ;;
14420*) getgrnam_r_proto=0
14421 ;;
14422esac
14423
14424: see if gethostbyaddr exists
14425set gethostbyaddr d_gethbyaddr
14426eval $inlibc
14427
14428: see if gethostbyname exists
14429set gethostbyname d_gethbyname
14430eval $inlibc
14431
14432: see if gethostent exists
14433set gethostent d_gethent
14434eval $inlibc
14435
14436: see how we will look up host name
14437echo " "
14438call=''
14439if set gethostname val -f d_gethname; eval $csym; $val; then
14440 echo 'gethostname() found.' >&4
14441 d_gethname="$define"
14442 call=gethostname
14443fi
14444if set uname val -f d_uname; eval $csym; $val; then
14445 if ./xenix; then
14446 $cat <<'EOM'
14447uname() was found, but you're running xenix, and older versions of xenix
14448have a broken uname(). If you don't really know whether your xenix is old
14449enough to have a broken system call, use the default answer.
14450
14451EOM
14452 dflt=y
14453 case "$d_uname" in
14454 "$define") dflt=n;;
14455 esac
14456 rp='Is your uname() broken?'
14457 . ./myread
14458 case "$ans" in
14459 n*) d_uname="$define"; call=uname;;
14460 esac
14461 else
14462 echo 'uname() found.' >&4
14463 d_uname="$define"
14464 case "$call" in
14465 '') call=uname ;;
14466 esac
14467 fi
14468fi
14469case "$d_gethname" in
14470'') d_gethname="$undef";;
14471esac
14472case "$d_uname" in
14473'') d_uname="$undef";;
14474esac
14475case "$d_uname$d_gethname" in
14476*define*)
14477 dflt=n
14478 cat <<EOM
14479
14480Every now and then someone has a $call() that lies about the hostname
14481but can't be fixed for political or economic reasons. If you wish, I can
14482pretend $call() isn't there and maybe compute hostname at run-time
14483thanks to the '$phostname' command.
14484
14485EOM
14486 rp="Shall I ignore $call() from now on?"
14487 . ./myread
14488 case "$ans" in
14489 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14490 esac;;
14491esac
14492case "$phostname" in
14493'') aphostname='';;
14494*) case "$aphostname" in
14495 /*) ;;
14496 *) set X $phostname
14497 shift
14498 file=$1
14499 shift
14500 file=`./loc $file $file $pth`
14501 aphostname=`echo $file $*`
14502 ;;
14503 esac
14504 ;;
14505esac
14506case "$d_uname$d_gethname" in
14507*define*) ;;
14508*)
14509 case "$phostname" in
14510 '')
14511 echo "There will be no way for $package to get your hostname." >&4;;
14512 *)
14513 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14514 ;;
14515 esac;;
14516esac
14517case "$d_phostname" in
14518'') d_phostname="$undef";;
14519esac
14520
14521: see if gethostbyaddr_r exists
14522set gethostbyaddr_r d_gethostbyaddr_r
14523eval $inlibc
14524case "$d_gethostbyaddr_r" in
14525"$define")
14526 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14527 case "$d_gethostbyaddr_r_proto:$usethreads" in
14528 ":define") d_gethostbyaddr_r_proto=define
14529 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14530 eval $hasproto ;;
14531 *) ;;
14532 esac
14533 case "$d_gethostbyaddr_r_proto" in
14534 define)
14535 case "$gethostbyaddr_r_proto" in
14536 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14537 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14538 esac
14539 case "$gethostbyaddr_r_proto" in
14540 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14541 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14542 esac
14543 case "$gethostbyaddr_r_proto" in
14544 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14545 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14546 esac
14547 case "$gethostbyaddr_r_proto" in
14548 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14549 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14550 esac
14551 case "$gethostbyaddr_r_proto" in
14552 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14553 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14554 esac
14555 case "$gethostbyaddr_r_proto" in
14556 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14557 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14558 esac
14559 case "$gethostbyaddr_r_proto" in
14560 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14561 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14562 esac
14563 case "$gethostbyaddr_r_proto" in
14564 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14565 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14566 esac
14567 case "$gethostbyaddr_r_proto" in
14568 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14569 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14570 esac
14571 case "$gethostbyaddr_r_proto" in
14572 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14573 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14574 esac
14575 case "$gethostbyaddr_r_proto" in
14576 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14577 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14578 esac
14579 case "$gethostbyaddr_r_proto" in
14580 ''|0) d_gethostbyaddr_r=undef
14581 gethostbyaddr_r_proto=0
14582 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14583 * ) case "$gethostbyaddr_r_proto" in
14584 REENTRANT_PROTO*) ;;
14585 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14586 esac
14587 echo "Prototype: $try" ;;
14588 esac
14589 ;;
14590 *) case "$usethreads" in
14591 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14592 esac
14593 d_gethostbyaddr_r=undef
14594 gethostbyaddr_r_proto=0
14595 ;;
14596 esac
14597 ;;
14598*) gethostbyaddr_r_proto=0
14599 ;;
14600esac
14601
14602: see if gethostbyname_r exists
14603set gethostbyname_r d_gethostbyname_r
14604eval $inlibc
14605case "$d_gethostbyname_r" in
14606"$define")
14607 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14608 case "$d_gethostbyname_r_proto:$usethreads" in
14609 ":define") d_gethostbyname_r_proto=define
14610 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14611 eval $hasproto ;;
14612 *) ;;
14613 esac
14614 case "$d_gethostbyname_r_proto" in
14615 define)
14616 case "$gethostbyname_r_proto" in
14617 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14618 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14619 esac
14620 case "$gethostbyname_r_proto" in
14621 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14622 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14623 esac
14624 case "$gethostbyname_r_proto" in
14625 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14626 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14627 esac
14628 case "$gethostbyname_r_proto" in
14629 ''|0) d_gethostbyname_r=undef
14630 gethostbyname_r_proto=0
14631 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14632 * ) case "$gethostbyname_r_proto" in
14633 REENTRANT_PROTO*) ;;
14634 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14635 esac
14636 echo "Prototype: $try" ;;
14637 esac
14638 ;;
14639 *) case "$usethreads" in
14640 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14641 esac
14642 d_gethostbyname_r=undef
14643 gethostbyname_r_proto=0
14644 ;;
14645 esac
14646 ;;
14647*) gethostbyname_r_proto=0
14648 ;;
14649esac
14650
14651: see if gethostent_r exists
14652set gethostent_r d_gethostent_r
14653eval $inlibc
14654case "$d_gethostent_r" in
14655"$define")
14656 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14657 case "$d_gethostent_r_proto:$usethreads" in
14658 ":define") d_gethostent_r_proto=define
14659 set d_gethostent_r_proto gethostent_r $hdrs
14660 eval $hasproto ;;
14661 *) ;;
14662 esac
14663 case "$d_gethostent_r_proto" in
14664 define)
14665 case "$gethostent_r_proto" in
14666 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14667 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14668 esac
14669 case "$gethostent_r_proto" in
14670 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14671 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14672 esac
14673 case "$gethostent_r_proto" in
14674 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14675 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14676 esac
14677 case "$gethostent_r_proto" in
14678 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14679 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14680 esac
14681 case "$gethostent_r_proto" in
14682 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14683 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14684 esac
14685 case "$gethostent_r_proto" in
14686 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14687 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14688 esac
14689 case "$gethostent_r_proto" in
14690 ''|0) d_gethostent_r=undef
14691 gethostent_r_proto=0
14692 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14693 * ) case "$gethostent_r_proto" in
14694 REENTRANT_PROTO*) ;;
14695 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14696 esac
14697 echo "Prototype: $try" ;;
14698 esac
14699 ;;
14700 *) case "$usethreads" in
14701 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14702 esac
14703 d_gethostent_r=undef
14704 gethostent_r_proto=0
14705 ;;
14706 esac
14707 ;;
14708*) gethostent_r_proto=0
14709 ;;
14710esac
14711
14712: see if prototypes for various gethostxxx netdb.h functions are available
14713echo " "
14714set d_gethostprotos gethostent $i_netdb netdb.h
14715eval $hasproto
14716
14717: see if getitimer exists
14718set getitimer d_getitimer
14719eval $inlibc
14720
14721: see if getlogin exists
14722set getlogin d_getlogin
14723eval $inlibc
14724
14725: see if getlogin_r exists
14726set getlogin_r d_getlogin_r
14727eval $inlibc
14728case "$d_getlogin_r" in
14729"$define")
14730 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14731 case "$d_getlogin_r_proto:$usethreads" in
14732 ":define") d_getlogin_r_proto=define
14733 set d_getlogin_r_proto getlogin_r $hdrs
14734 eval $hasproto ;;
14735 *) ;;
14736 esac
14737 case "$d_getlogin_r_proto" in
14738 define)
14739 case "$getlogin_r_proto" in
14740 ''|0) try='int getlogin_r(char*, size_t);'
14741 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14742 esac
14743 case "$getlogin_r_proto" in
14744 ''|0) try='int getlogin_r(char*, int);'
14745 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14746 esac
14747 case "$getlogin_r_proto" in
14748 ''|0) try='char* getlogin_r(char*, size_t);'
14749 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14750 esac
14751 case "$getlogin_r_proto" in
14752 ''|0) try='char* getlogin_r(char*, int);'
14753 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14754 esac
14755 case "$getlogin_r_proto" in
14756 ''|0) d_getlogin_r=undef
14757 getlogin_r_proto=0
14758 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14759 * ) case "$getlogin_r_proto" in
14760 REENTRANT_PROTO*) ;;
14761 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14762 esac
14763 echo "Prototype: $try" ;;
14764 esac
14765 ;;
14766 *) case "$usethreads" in
14767 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14768 esac
14769 d_getlogin_r=undef
14770 getlogin_r_proto=0
14771 ;;
14772 esac
14773 ;;
14774*) getlogin_r_proto=0
14775 ;;
14776esac
14777
14778: see if getmnt exists
14779set getmnt d_getmnt
14780eval $inlibc
14781
14782: see if getmntent exists
14783set getmntent d_getmntent
14784eval $inlibc
14785
14786: see if getnameinfo exists
14787set getnameinfo d_getnameinfo
14788eval $inlibc
14789
14790: see if getnetbyaddr exists
14791set getnetbyaddr d_getnbyaddr
14792eval $inlibc
14793
14794: see if getnetbyname exists
14795set getnetbyname d_getnbyname
14796eval $inlibc
14797
14798: see if getnetent exists
14799set getnetent d_getnent
14800eval $inlibc
14801
14802: see if getnetbyaddr_r exists
14803set getnetbyaddr_r d_getnetbyaddr_r
14804eval $inlibc
14805case "$d_getnetbyaddr_r" in
14806"$define")
14807 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14808 case "$d_getnetbyaddr_r_proto:$usethreads" in
14809 ":define") d_getnetbyaddr_r_proto=define
14810 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14811 eval $hasproto ;;
14812 *) ;;
14813 esac
14814 case "$d_getnetbyaddr_r_proto" in
14815 define)
14816 case "$getnetbyaddr_r_proto" in
14817 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14818 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14819 esac
14820 case "$getnetbyaddr_r_proto" in
14821 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14822 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14823 esac
14824 case "$getnetbyaddr_r_proto" in
14825 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14826 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14827 esac
14828 case "$getnetbyaddr_r_proto" in
14829 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14830 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14831 esac
14832 case "$getnetbyaddr_r_proto" in
14833 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14834 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14835 esac
14836 case "$getnetbyaddr_r_proto" in
14837 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14838 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14839 esac
14840 case "$getnetbyaddr_r_proto" in
14841 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14842 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14843 esac
14844 case "$getnetbyaddr_r_proto" in
14845 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14846 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14847 esac
14848 case "$getnetbyaddr_r_proto" in
14849 ''|0) d_getnetbyaddr_r=undef
14850 getnetbyaddr_r_proto=0
14851 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14852 * ) case "$getnetbyaddr_r_proto" in
14853 REENTRANT_PROTO*) ;;
14854 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14855 esac
14856 echo "Prototype: $try" ;;
14857 esac
14858 ;;
14859 *) case "$usethreads" in
14860 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14861 esac
14862 d_getnetbyaddr_r=undef
14863 getnetbyaddr_r_proto=0
14864 ;;
14865 esac
14866 ;;
14867*) getnetbyaddr_r_proto=0
14868 ;;
14869esac
14870
14871: see if getnetbyname_r exists
14872set getnetbyname_r d_getnetbyname_r
14873eval $inlibc
14874case "$d_getnetbyname_r" in
14875"$define")
14876 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14877 case "$d_getnetbyname_r_proto:$usethreads" in
14878 ":define") d_getnetbyname_r_proto=define
14879 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14880 eval $hasproto ;;
14881 *) ;;
14882 esac
14883 case "$d_getnetbyname_r_proto" in
14884 define)
14885 case "$getnetbyname_r_proto" in
14886 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14887 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14888 esac
14889 case "$getnetbyname_r_proto" in
14890 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14891 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14892 esac
14893 case "$getnetbyname_r_proto" in
14894 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14895 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14896 esac
14897 case "$getnetbyname_r_proto" in
14898 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14899 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14900 esac
14901 case "$getnetbyname_r_proto" in
14902 ''|0) d_getnetbyname_r=undef
14903 getnetbyname_r_proto=0
14904 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14905 * ) case "$getnetbyname_r_proto" in
14906 REENTRANT_PROTO*) ;;
14907 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14908 esac
14909 echo "Prototype: $try" ;;
14910 esac
14911 ;;
14912 *) case "$usethreads" in
14913 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14914 esac
14915 d_getnetbyname_r=undef
14916 getnetbyname_r_proto=0
14917 ;;
14918 esac
14919 ;;
14920*) getnetbyname_r_proto=0
14921 ;;
14922esac
14923
14924: see if getnetent_r exists
14925set getnetent_r d_getnetent_r
14926eval $inlibc
14927case "$d_getnetent_r" in
14928"$define")
14929 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14930 case "$d_getnetent_r_proto:$usethreads" in
14931 ":define") d_getnetent_r_proto=define
14932 set d_getnetent_r_proto getnetent_r $hdrs
14933 eval $hasproto ;;
14934 *) ;;
14935 esac
14936 case "$d_getnetent_r_proto" in
14937 define)
14938 case "$getnetent_r_proto" in
14939 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14940 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14941 esac
14942 case "$getnetent_r_proto" in
14943 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14944 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14945 esac
14946 case "$getnetent_r_proto" in
14947 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14948 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14949 esac
14950 case "$getnetent_r_proto" in
14951 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14952 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14953 esac
14954 case "$getnetent_r_proto" in
14955 ''|0) try='int getnetent_r(struct netent*, char*, int);'
14956 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14957 esac
14958 case "$getnetent_r_proto" in
14959 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14960 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14961 esac
14962 case "$getnetent_r_proto" in
14963 ''|0) d_getnetent_r=undef
14964 getnetent_r_proto=0
14965 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14966 * ) case "$getnetent_r_proto" in
14967 REENTRANT_PROTO*) ;;
14968 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14969 esac
14970 echo "Prototype: $try" ;;
14971 esac
14972 ;;
14973 *) case "$usethreads" in
14974 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14975 esac
14976 d_getnetent_r=undef
14977 getnetent_r_proto=0
14978 ;;
14979 esac
14980 ;;
14981*) getnetent_r_proto=0
14982 ;;
14983esac
14984
14985: see if prototypes for various getnetxxx netdb.h functions are available
14986echo " "
14987set d_getnetprotos getnetent $i_netdb netdb.h
14988eval $hasproto
14989
14990: see if getpagesize exists
14991set getpagesize d_getpagsz
14992eval $inlibc
14993
14994: Optional checks for getprotobyname and getprotobynumber
14995
14996: see if getprotobyname exists
14997set getprotobyname d_getpbyname
14998eval $inlibc
14999
15000: see if getprotobynumber exists
15001set getprotobynumber d_getpbynumber
15002eval $inlibc
15003
15004: see if getprotoent exists
15005set getprotoent d_getpent
15006eval $inlibc
15007
15008: see if getpgid exists
15009set getpgid d_getpgid
15010eval $inlibc
15011
15012: see if getpgrp2 exists
15013set getpgrp2 d_getpgrp2
15014eval $inlibc
15015
15016: see if getppid exists
15017set getppid d_getppid
15018eval $inlibc
15019
15020: see if getpriority exists
15021set getpriority d_getprior
15022eval $inlibc
15023
15024: see if getprotobyname_r exists
15025set getprotobyname_r d_getprotobyname_r
15026eval $inlibc
15027case "$d_getprotobyname_r" in
15028"$define")
15029 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15030 case "$d_getprotobyname_r_proto:$usethreads" in
15031 ":define") d_getprotobyname_r_proto=define
15032 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15033 eval $hasproto ;;
15034 *) ;;
15035 esac
15036 case "$d_getprotobyname_r_proto" in
15037 define)
15038 case "$getprotobyname_r_proto" in
15039 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15040 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15041 esac
15042 case "$getprotobyname_r_proto" in
15043 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15044 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15045 esac
15046 case "$getprotobyname_r_proto" in
15047 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15048 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15049 esac
15050 case "$getprotobyname_r_proto" in
15051 ''|0) d_getprotobyname_r=undef
15052 getprotobyname_r_proto=0
15053 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15054 * ) case "$getprotobyname_r_proto" in
15055 REENTRANT_PROTO*) ;;
15056 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15057 esac
15058 echo "Prototype: $try" ;;
15059 esac
15060 ;;
15061 *) case "$usethreads" in
15062 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15063 esac
15064 d_getprotobyname_r=undef
15065 getprotobyname_r_proto=0
15066 ;;
15067 esac
15068 ;;
15069*) getprotobyname_r_proto=0
15070 ;;
15071esac
15072
15073: see if getprotobynumber_r exists
15074set getprotobynumber_r d_getprotobynumber_r
15075eval $inlibc
15076case "$d_getprotobynumber_r" in
15077"$define")
15078 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15079 case "$d_getprotobynumber_r_proto:$usethreads" in
15080 ":define") d_getprotobynumber_r_proto=define
15081 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15082 eval $hasproto ;;
15083 *) ;;
15084 esac
15085 case "$d_getprotobynumber_r_proto" in
15086 define)
15087 case "$getprotobynumber_r_proto" in
15088 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15089 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15090 esac
15091 case "$getprotobynumber_r_proto" in
15092 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15093 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15094 esac
15095 case "$getprotobynumber_r_proto" in
15096 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15097 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15098 esac
15099 case "$getprotobynumber_r_proto" in
15100 ''|0) d_getprotobynumber_r=undef
15101 getprotobynumber_r_proto=0
15102 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15103 * ) case "$getprotobynumber_r_proto" in
15104 REENTRANT_PROTO*) ;;
15105 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15106 esac
15107 echo "Prototype: $try" ;;
15108 esac
15109 ;;
15110 *) case "$usethreads" in
15111 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15112 esac
15113 d_getprotobynumber_r=undef
15114 getprotobynumber_r_proto=0
15115 ;;
15116 esac
15117 ;;
15118*) getprotobynumber_r_proto=0
15119 ;;
15120esac
15121
15122: see if getprotoent_r exists
15123set getprotoent_r d_getprotoent_r
15124eval $inlibc
15125case "$d_getprotoent_r" in
15126"$define")
15127 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15128 case "$d_getprotoent_r_proto:$usethreads" in
15129 ":define") d_getprotoent_r_proto=define
15130 set d_getprotoent_r_proto getprotoent_r $hdrs
15131 eval $hasproto ;;
15132 *) ;;
15133 esac
15134 case "$d_getprotoent_r_proto" in
15135 define)
15136 case "$getprotoent_r_proto" in
15137 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15138 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15139 esac
15140 case "$getprotoent_r_proto" in
15141 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15142 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15143 esac
15144 case "$getprotoent_r_proto" in
15145 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15146 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15147 esac
15148 case "$getprotoent_r_proto" in
15149 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15150 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15151 esac
15152 case "$getprotoent_r_proto" in
15153 ''|0) d_getprotoent_r=undef
15154 getprotoent_r_proto=0
15155 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15156 * ) case "$getprotoent_r_proto" in
15157 REENTRANT_PROTO*) ;;
15158 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15159 esac
15160 echo "Prototype: $try" ;;
15161 esac
15162 ;;
15163 *) case "$usethreads" in
15164 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15165 esac
15166 d_getprotoent_r=undef
15167 getprotoent_r_proto=0
15168 ;;
15169 esac
15170 ;;
15171*) getprotoent_r_proto=0
15172 ;;
15173esac
15174
15175: see if prototypes for various getprotoxxx netdb.h functions are available
15176echo " "
15177set d_getprotoprotos getprotoent $i_netdb netdb.h
15178eval $hasproto
15179
15180: see if getprpwnam exists
15181set getprpwnam d_getprpwnam
15182eval $inlibc
15183
15184: see if getpwent exists
15185set getpwent d_getpwent
15186eval $inlibc
15187
15188: see if getpwent_r exists
15189set getpwent_r d_getpwent_r
15190eval $inlibc
15191case "$d_getpwent_r" in
15192"$define")
15193 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15194 case "$d_getpwent_r_proto:$usethreads" in
15195 ":define") d_getpwent_r_proto=define
15196 set d_getpwent_r_proto getpwent_r $hdrs
15197 eval $hasproto ;;
15198 *) ;;
15199 esac
15200 case "$d_getpwent_r_proto" in
15201 define)
15202 case "$getpwent_r_proto" in
15203 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15204 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15205 esac
15206 case "$getpwent_r_proto" in
15207 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15208 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15209 esac
15210 case "$getpwent_r_proto" in
15211 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15212 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15213 esac
15214 case "$getpwent_r_proto" in
15215 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15216 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15217 esac
15218 case "$getpwent_r_proto" in
15219 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15220 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15221 esac
15222 case "$getpwent_r_proto" in
15223 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15224 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15225 esac
15226 case "$getpwent_r_proto" in
15227 ''|0) d_getpwent_r=undef
15228 getpwent_r_proto=0
15229 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15230 * ) case "$getpwent_r_proto" in
15231 REENTRANT_PROTO*) ;;
15232 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15233 esac
15234 echo "Prototype: $try" ;;
15235 esac
15236 ;;
15237 *) case "$usethreads" in
15238 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15239 esac
15240 d_getpwent_r=undef
15241 getpwent_r_proto=0
15242 ;;
15243 esac
15244 ;;
15245*) getpwent_r_proto=0
15246 ;;
15247esac
15248
15249: see if getpwnam_r exists
15250set getpwnam_r d_getpwnam_r
15251eval $inlibc
15252case "$d_getpwnam_r" in
15253"$define")
15254 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15255 case "$d_getpwnam_r_proto:$usethreads" in
15256 ":define") d_getpwnam_r_proto=define
15257 set d_getpwnam_r_proto getpwnam_r $hdrs
15258 eval $hasproto ;;
15259 *) ;;
15260 esac
15261 case "$d_getpwnam_r_proto" in
15262 define)
15263 case "$getpwnam_r_proto" in
15264 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15265 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15266 esac
15267 case "$getpwnam_r_proto" in
15268 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15269 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15270 esac
15271 case "$getpwnam_r_proto" in
15272 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15273 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15274 esac
15275 case "$getpwnam_r_proto" in
15276 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15277 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15278 esac
15279 case "$getpwnam_r_proto" in
15280 ''|0) d_getpwnam_r=undef
15281 getpwnam_r_proto=0
15282 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15283 * ) case "$getpwnam_r_proto" in
15284 REENTRANT_PROTO*) ;;
15285 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15286 esac
15287 echo "Prototype: $try" ;;
15288 esac
15289 ;;
15290 *) case "$usethreads" in
15291 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15292 esac
15293 d_getpwnam_r=undef
15294 getpwnam_r_proto=0
15295 ;;
15296 esac
15297 ;;
15298*) getpwnam_r_proto=0
15299 ;;
15300esac
15301
15302: see if getpwuid_r exists
15303set getpwuid_r d_getpwuid_r
15304eval $inlibc
15305case "$d_getpwuid_r" in
15306"$define")
15307 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15308 case "$d_getpwuid_r_proto:$usethreads" in
15309 ":define") d_getpwuid_r_proto=define
15310 set d_getpwuid_r_proto getpwuid_r $hdrs
15311 eval $hasproto ;;
15312 *) ;;
15313 esac
15314 case "$d_getpwuid_r_proto" in
15315 define)
15316 case "$getpwuid_r_proto" in
15317 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15318 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15319 esac
15320 case "$getpwuid_r_proto" in
15321 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15322 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15323 esac
15324 case "$getpwuid_r_proto" in
15325 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15326 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15327 esac
15328 case "$getpwuid_r_proto" in
15329 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15330 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15331 esac
15332 case "$getpwuid_r_proto" in
15333 ''|0) d_getpwuid_r=undef
15334 getpwuid_r_proto=0
15335 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15336 * ) case "$getpwuid_r_proto" in
15337 REENTRANT_PROTO*) ;;
15338 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15339 esac
15340 echo "Prototype: $try" ;;
15341 esac
15342 ;;
15343 *) case "$usethreads" in
15344 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15345 esac
15346 d_getpwuid_r=undef
15347 getpwuid_r_proto=0
15348 ;;
15349 esac
15350 ;;
15351*) getpwuid_r_proto=0
15352 ;;
15353esac
15354
15355: Optional checks for getsbyname and getsbyport
15356
15357: see if getservbyname exists
15358set getservbyname d_getsbyname
15359eval $inlibc
15360
15361: see if getservbyport exists
15362set getservbyport d_getsbyport
15363eval $inlibc
15364
15365: see if getservent exists
15366set getservent d_getsent
15367eval $inlibc
15368
15369: see if getservbyname_r exists
15370set getservbyname_r d_getservbyname_r
15371eval $inlibc
15372case "$d_getservbyname_r" in
15373"$define")
15374 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15375 case "$d_getservbyname_r_proto:$usethreads" in
15376 ":define") d_getservbyname_r_proto=define
15377 set d_getservbyname_r_proto getservbyname_r $hdrs
15378 eval $hasproto ;;
15379 *) ;;
15380 esac
15381 case "$d_getservbyname_r_proto" in
15382 define)
15383 case "$getservbyname_r_proto" in
15384 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15385 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15386 esac
15387 case "$getservbyname_r_proto" in
15388 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15389 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15390 esac
15391 case "$getservbyname_r_proto" in
15392 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15393 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15394 esac
15395 case "$getservbyname_r_proto" in
15396 ''|0) d_getservbyname_r=undef
15397 getservbyname_r_proto=0
15398 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15399 * ) case "$getservbyname_r_proto" in
15400 REENTRANT_PROTO*) ;;
15401 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15402 esac
15403 echo "Prototype: $try" ;;
15404 esac
15405 ;;
15406 *) case "$usethreads" in
15407 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15408 esac
15409 d_getservbyname_r=undef
15410 getservbyname_r_proto=0
15411 ;;
15412 esac
15413 ;;
15414*) getservbyname_r_proto=0
15415 ;;
15416esac
15417
15418: see if getservbyport_r exists
15419set getservbyport_r d_getservbyport_r
15420eval $inlibc
15421case "$d_getservbyport_r" in
15422"$define")
15423 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15424 case "$d_getservbyport_r_proto:$usethreads" in
15425 ":define") d_getservbyport_r_proto=define
15426 set d_getservbyport_r_proto getservbyport_r $hdrs
15427 eval $hasproto ;;
15428 *) ;;
15429 esac
15430 case "$d_getservbyport_r_proto" in
15431 define)
15432 case "$getservbyport_r_proto" in
15433 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15434 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15435 esac
15436 case "$getservbyport_r_proto" in
15437 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15438 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15439 esac
15440 case "$getservbyport_r_proto" in
15441 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15442 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15443 esac
15444 case "$getservbyport_r_proto" in
15445 ''|0) d_getservbyport_r=undef
15446 getservbyport_r_proto=0
15447 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15448 * ) case "$getservbyport_r_proto" in
15449 REENTRANT_PROTO*) ;;
15450 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15451 esac
15452 echo "Prototype: $try" ;;
15453 esac
15454 ;;
15455 *) case "$usethreads" in
15456 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15457 esac
15458 d_getservbyport_r=undef
15459 getservbyport_r_proto=0
15460 ;;
15461 esac
15462 ;;
15463*) getservbyport_r_proto=0
15464 ;;
15465esac
15466
15467: see if getservent_r exists
15468set getservent_r d_getservent_r
15469eval $inlibc
15470case "$d_getservent_r" in
15471"$define")
15472 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15473 case "$d_getservent_r_proto:$usethreads" in
15474 ":define") d_getservent_r_proto=define
15475 set d_getservent_r_proto getservent_r $hdrs
15476 eval $hasproto ;;
15477 *) ;;
15478 esac
15479 case "$d_getservent_r_proto" in
15480 define)
15481 case "$getservent_r_proto" in
15482 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15483 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15484 esac
15485 case "$getservent_r_proto" in
15486 ''|0) try='int getservent_r(struct servent*, char*, int);'
15487 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15488 esac
15489 case "$getservent_r_proto" in
15490 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15491 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15492 esac
15493 case "$getservent_r_proto" in
15494 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15495 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15496 esac
15497 case "$getservent_r_proto" in
15498 ''|0) d_getservent_r=undef
15499 getservent_r_proto=0
15500 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15501 * ) case "$getservent_r_proto" in
15502 REENTRANT_PROTO*) ;;
15503 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15504 esac
15505 echo "Prototype: $try" ;;
15506 esac
15507 ;;
15508 *) case "$usethreads" in
15509 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15510 esac
15511 d_getservent_r=undef
15512 getservent_r_proto=0
15513 ;;
15514 esac
15515 ;;
15516*) getservent_r_proto=0
15517 ;;
15518esac
15519
15520: see if prototypes for various getservxxx netdb.h functions are available
15521echo " "
15522set d_getservprotos getservent $i_netdb netdb.h
15523eval $hasproto
15524
15525: see if getspnam exists
15526set getspnam d_getspnam
15527eval $inlibc
15528
15529: see if this is a shadow.h system
15530set shadow.h i_shadow
15531eval $inhdr
15532
15533: see if getspnam_r exists
15534set getspnam_r d_getspnam_r
15535eval $inlibc
15536case "$d_getspnam_r" in
15537"$define")
15538 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15539 case "$d_getspnam_r_proto:$usethreads" in
15540 ":define") d_getspnam_r_proto=define
15541 set d_getspnam_r_proto getspnam_r $hdrs
15542 eval $hasproto ;;
15543 *) ;;
15544 esac
15545 case "$d_getspnam_r_proto" in
15546 define)
15547 case "$getspnam_r_proto" in
15548 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15549 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15550 esac
15551 case "$getspnam_r_proto" in
15552 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15553 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15554 esac
15555 case "$getspnam_r_proto" in
15556 ''|0) d_getspnam_r=undef
15557 getspnam_r_proto=0
15558 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15559 * ) case "$getspnam_r_proto" in
15560 REENTRANT_PROTO*) ;;
15561 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15562 esac
15563 echo "Prototype: $try" ;;
15564 esac
15565 ;;
15566 *) case "$usethreads" in
15567 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15568 esac
15569 d_getspnam_r=undef
15570 getspnam_r_proto=0
15571 ;;
15572 esac
15573 ;;
15574*) getspnam_r_proto=0
15575 ;;
15576esac
15577
15578: see if gettimeofday or ftime exists
15579set gettimeofday d_gettimeod
15580eval $inlibc
15581case "$d_gettimeod" in
15582"$undef")
15583 set ftime d_ftime
15584 eval $inlibc
15585 ;;
15586*)
15587 val="$undef"; set d_ftime; eval $setvar
15588 ;;
15589esac
15590case "$d_gettimeod$d_ftime" in
15591"$undef$undef")
15592 echo " "
15593 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15594 ;;
15595esac
15596
15597: see if gmtime_r exists
15598set gmtime_r d_gmtime_r
15599eval $inlibc
15600case "$d_gmtime_r" in
15601"$define")
15602 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15603 case "$d_gmtime_r_proto:$usethreads" in
15604 ":define") d_gmtime_r_proto=define
15605 set d_gmtime_r_proto gmtime_r $hdrs
15606 eval $hasproto ;;
15607 *) ;;
15608 esac
15609 case "$d_gmtime_r_proto" in
15610 define)
15611 case "$gmtime_r_proto" in
15612 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15613 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15614 esac
15615 case "$gmtime_r_proto" in
15616 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15617 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15618 esac
15619 case "$gmtime_r_proto" in
15620 ''|0) d_gmtime_r=undef
15621 gmtime_r_proto=0
15622 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15623 * ) case "$gmtime_r_proto" in
15624 REENTRANT_PROTO*) ;;
15625 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15626 esac
15627 echo "Prototype: $try" ;;
15628 esac
15629 ;;
15630 *) case "$usethreads" in
15631 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15632 esac
15633 d_gmtime_r=undef
15634 gmtime_r_proto=0
15635 ;;
15636 esac
15637 ;;
15638*) gmtime_r_proto=0
15639 ;;
15640esac
15641
15642: see if hasmntopt exists
15643set hasmntopt d_hasmntopt
15644eval $inlibc
15645
15646: see if this is a netinet/in.h or sys/in.h system
15647set netinet/in.h i_niin sys/in.h i_sysin
15648eval $inhdr
15649
15650: see if arpa/inet.h has to be included
15651set arpa/inet.h i_arpainet
15652eval $inhdr
15653
15654: see if htonl --and friends-- exists
15655val=''
15656set htonl val
15657eval $inlibc
15658
15659: Maybe they are macros.
15660case "$val" in
15661$undef)
15662 $cat >htonl.c <<EOM
15663#include <stdio.h>
15664#include <sys/types.h>
15665#$i_niin I_NETINET_IN
15666#$i_sysin I_SYS_IN
15667#$i_arpainet I_ARPA_INET
15668#ifdef I_NETINET_IN
15669#include <netinet/in.h>
15670#endif
15671#ifdef I_SYS_IN
15672#include <sys/in.h>
15673#endif
15674#ifdef I_ARPA_INET
15675#include <arpa/inet.h>
15676#endif
15677#ifdef htonl
15678printf("Defined as a macro.");
15679#endif
15680EOM
15681 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15682 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15683 val="$define"
15684 echo "But it seems to be defined as a macro." >&4
15685 fi
15686 $rm -f htonl.?
15687 ;;
15688esac
15689set d_htonl
15690eval $setvar
15691
15692: see if hypot exists
15693set hypot d_hypot
15694eval $inlibc
15695
15696: see if ilogb exists
15697set ilogb d_ilogb
15698eval $inlibc
15699
15700: see if ilogbl exists
15701set ilogbl d_ilogbl
15702eval $inlibc
15703
15704: check whether inet_aton exists
15705set inet_aton d_inetaton
15706eval $inlibc
15707
15708: see if inet_ntop exists
15709set inet_ntop d_inetntop
15710eval $inlibc
15711
15712: see if inet_pton exists
15713set inet_pton d_inetpton
15714eval $inlibc
15715
15716: Look for isascii
15717echo " "
15718$cat >isascii.c <<EOCP
15719#include <stdio.h>
15720#include <ctype.h>
15721#$i_stdlib I_STDLIB
15722#ifdef I_STDLIB
15723#include <stdlib.h>
15724#endif
15725int main() {
15726 int c = 'A';
15727 if (isascii(c))
15728 exit(0);
15729 else
15730 exit(1);
15731}
15732EOCP
15733set isascii
15734if eval $compile; then
15735 echo "isascii() found." >&4
15736 val="$define"
15737else
15738 echo "isascii() NOT found." >&4
15739 val="$undef"
15740fi
15741set d_isascii
15742eval $setvar
15743$rm -f isascii*
15744
15745: Look for isblank
15746echo " "
15747$cat >isblank.c <<'EOCP'
15748#include <stdio.h>
15749#include <ctype.h>
15750int main() {
15751 int c = ' ';
15752 if (isblank(c))
15753 return 0 ;
15754 else
15755 return 1 ;
15756}
15757EOCP
15758if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15759 echo "isblank() found." >&4
15760 val="$define"
15761else
15762 echo "isblank() NOT found." >&4
15763 val="$undef"
15764fi
15765set d_isblank
15766eval $setvar
15767$rm -f isblank*
15768
15769: check for isfinite
15770echo "Checking to see if you have isfinite..." >&4
15771$cat >try.c <<EOCP
15772#include <math.h>
15773int main() { return isfinite(0.0); }
15774EOCP
15775set try
15776if eval $compile; then
15777 val="$define"
15778 echo "You have isfinite."
15779else
15780 val="$undef"
15781 echo "You do not have isfinite."
15782fi
15783$rm_try
15784set d_isfinite
15785eval $setvar
15786
15787: see if isfinitel exists
15788set isfinitel d_isfinitel
15789eval $inlibc
15790
15791: check for isinf
15792echo "Checking to see if you have isinf..." >&4
15793$cat >try.c <<EOCP
15794#include <math.h>
15795int main() { return isinf(0.0); }
15796EOCP
15797set try
15798if eval $compile; then
15799 val="$define"
15800 echo "You have isinf."
15801else
15802 val="$undef"
15803 echo "You do not have isinf."
15804fi
15805$rm_try
15806set d_isinf
15807eval $setvar
15808
15809: see if isinfl exists
15810set isinfl d_isinfl
15811eval $inlibc
15812
15813: check for isless
15814echo "Checking to see if you have isless..." >&4
15815$cat >try.c <<EOCP
15816#include <math.h>
15817int main() { return isless(2.0, 1.0); }
15818EOCP
15819set try
15820if eval $compile; then
15821 val="$define"
15822 echo "You have isless."
15823else
15824 val="$undef"
15825 echo "You do not have isless."
15826fi
15827$rm_try
15828set d_isless
15829eval $setvar
15830
15831: check for isnan
15832echo "Checking to see if you have isnan..." >&4
15833$cat >try.c <<EOCP
15834#include <math.h>
15835int main() { return isnan(0.0); }
15836EOCP
15837set try
15838if eval $compile; then
15839 val="$define"
15840 echo "You have isnan."
15841else
15842 val="$undef"
15843 echo "You do not have isnan."
15844fi
15845$rm_try
15846set d_isnan
15847eval $setvar
15848
15849: see if isnanl exists
15850set isnanl d_isnanl
15851eval $inlibc
15852
15853: check for isnormal
15854echo "Checking to see if you have isnormal..." >&4
15855$cat >try.c <<EOCP
15856#include <math.h>
15857int main() { return isnormal(0.0); }
15858EOCP
15859set try
15860if eval $compile; then
15861 val="$define"
15862 echo "You have isnormal."
15863else
15864 val="$undef"
15865 echo "You do not have isnormal."
15866fi
15867$rm_try
15868set d_isnormal
15869eval $setvar
15870
15871: see if j0 exists
15872set j0 d_j0
15873eval $inlibc
15874
15875: see if j0l exists
15876set j0l d_j0l
15877eval $inlibc
15878
15879: see if killpg exists
15880set killpg d_killpg
15881eval $inlibc
15882
15883: see if localeconv exists
15884set localeconv d_locconv
15885eval $inlibc
15886
15887: see if libc has the POSIX.1-2008 currency locale rules
15888case "$d_locconv:$d_lc_monetary_2008" in
15889$define:)
15890 $cat >try.c <<EOCP
15891#include <locale.h>
15892int main() {
15893 struct lconv *lc = localeconv();
15894 char int_p_cs_precedes = lc->int_p_cs_precedes;
15895 return 0;
15896}
15897EOCP
15898 set try
15899 if eval $compile; then
15900 d_lc_monetary_2008="$define"
15901 else
15902 d_lc_monetary_2008="$undef"
15903 fi;
15904 $rm_try
15905 ;;
15906esac
15907
15908: see if lchown exists
15909echo " "
15910$cat > try.c <<EOCP
15911#include <pwd.h>
15912#include <stdio.h>
15913#include <stdlib.h>
15914#$i_unistd I_UNISTD
15915#ifdef I_UNISTD
15916# include <unistd.h>
15917#endif
15918int main(int argc, char *argv[])
15919{
15920 if (lchown("./try.c", -1, getgid()) == -1) {
15921 exit(EXIT_FAILURE);
15922 }
15923 exit(EXIT_SUCCESS);
15924}
15925EOCP
15926set try
15927if eval $compile && ./try; then
15928 $echo "lchown() found." >&4
15929 val="$define"
15930else
15931 $echo "lchown() NOT found." >&4
15932 val="$undef"
15933fi
15934set d_lchown
15935eval $setvar
15936$rm_try
15937
15938: See if number of significant digits in a double precision number is known
15939echo " "
15940$cat >ldbl_dig.c <<EOM
15941#include <limits.h>
15942#include <float.h>
15943#ifdef LDBL_DIG
15944printf("Contains LDBL_DIG");
15945#endif
15946EOM
15947$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15948if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15949 echo "LDBL_DIG found." >&4
15950 val="$define"
15951else
15952 echo "LDBL_DIG NOT found." >&4
15953 val="$undef"
15954fi
15955$rm -f ldbl_dig.?
15956set d_ldbl_dig
15957eval $setvar
15958
15959: see if lgamma exists
15960set lgamma d_lgamma
15961eval $inlibc
15962
15963: see if lgamma_r exists
15964set lgamma_r d_lgamma_r
15965eval $inlibc
15966
15967: check to see if math.h defines _LIB_VERSION
15968d_libm_lib_version="$undef"
15969echo " "
15970echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15971$cat >try.c <<EOCP
15972#include <unistd.h>
15973#include <math.h>
15974int main (int argc, char *argv[])
15975{
15976 printf ("%d\n", _LIB_VERSION);
15977 return (0);
15978 } /* main */
15979EOCP
15980set try
15981if eval $compile; then
15982 foo=`$run ./try`
15983 echo "Yes, it does ($foo)" >&4
15984 d_libm_lib_version="$define"
15985else
15986 echo "No, it does not (probably harmless)" >&4
15987 fi
15988$rm_try
15989
15990: see if link exists
15991set link d_link
15992eval $inlibc
15993
15994: see if llrint exists
15995set llrint d_llrint
15996eval $inlibc
15997
15998: see if llrintl exists
15999set llrintl d_llrintl
16000eval $inlibc
16001
16002: see if llround exists
16003set llround d_llround
16004eval $inlibc
16005
16006: see if llroundl exists
16007set llroundl d_llroundl
16008eval $inlibc
16009
16010: see if localeconv_l exists
16011set localeconv_l d_localeconv_l
16012eval $inlibc
16013
16014: see if localtime_r exists
16015set localtime_r d_localtime_r
16016eval $inlibc
16017case "$d_localtime_r" in
16018"$define")
16019 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16020 case "$d_localtime_r_proto:$usethreads" in
16021 ":define") d_localtime_r_proto=define
16022 set d_localtime_r_proto localtime_r $hdrs
16023 eval $hasproto ;;
16024 *) ;;
16025 esac
16026 case "$d_localtime_r_proto" in
16027 define)
16028 case "$localtime_r_proto" in
16029 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16030 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16031 esac
16032 case "$localtime_r_proto" in
16033 ''|0) try='int localtime_r(const time_t*, struct tm*);'
16034 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16035 esac
16036 case "$localtime_r_proto" in
16037 ''|0) d_localtime_r=undef
16038 localtime_r_proto=0
16039 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16040 * ) case "$localtime_r_proto" in
16041 REENTRANT_PROTO*) ;;
16042 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16043 esac
16044 echo "Prototype: $try" ;;
16045 esac
16046 ;;
16047 *) case "$usethreads" in
16048 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16049 esac
16050 d_localtime_r=undef
16051 localtime_r_proto=0
16052 ;;
16053 esac
16054 ;;
16055*) localtime_r_proto=0
16056 ;;
16057esac
16058
16059: see if localtime_r calls tzset
16060case "$localtime_r_proto" in
16061REENTRANT_PROTO*)
16062 $cat >try.c <<EOCP
16063/* Does our libc's localtime_r call tzset ?
16064 * return 0 if so, 1 otherwise.
16065 */
16066#$i_systypes I_SYS_TYPES
16067#$i_unistd I_UNISTD
16068#$i_time I_TIME
16069#$i_stdlib I_STDLIB
16070#$i_malloc I_MALLOC
16071#ifdef I_SYS_TYPES
16072# include <sys/types.h>
16073#endif
16074#ifdef I_UNISTD
16075# include <unistd.h>
16076#endif
16077#ifdef I_TIME
16078# include <time.h>
16079#endif
16080#ifdef I_STDLIB
16081#include <stdlib.h>
16082#endif
16083#include <string.h>
16084#ifdef I_MALLOC
16085# include <malloc.h>
16086#endif
16087int main()
16088{
16089 time_t t = time(0L);
16090 char w_tz[]="TZ" "=GMT+5",
16091 e_tz[]="TZ" "=GMT-5",
16092 *tz_e = (char*)malloc(16),
16093 *tz_w = (char*)malloc(16);
16094 struct tm tm_e, tm_w;
16095 memset(&tm_e,'\0',sizeof(struct tm));
16096 memset(&tm_w,'\0',sizeof(struct tm));
16097 strcpy(tz_e,e_tz);
16098 strcpy(tz_w,w_tz);
16099
16100 putenv(tz_e);
16101 localtime_r(&t, &tm_e);
16102
16103 putenv(tz_w);
16104 localtime_r(&t, &tm_w);
16105
16106 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16107 return 1;
16108 return 0;
16109}
16110EOCP
16111 set try
16112 if eval $compile; then
16113 if $run ./try; then
16114 d_localtime_r_needs_tzset=undef;
16115 else
16116 d_localtime_r_needs_tzset=define;
16117 fi;
16118 else
16119 d_localtime_r_needs_tzset=undef;
16120 fi;
16121 ;;
16122 *)
16123 d_localtime_r_needs_tzset=undef;
16124 ;;
16125esac
16126$rm_try
16127
16128: see if lockf exists
16129set lockf d_lockf
16130eval $inlibc
16131
16132: see if log1p exists
16133set log1p d_log1p
16134eval $inlibc
16135
16136: see if log2 exists
16137set log2 d_log2
16138eval $inlibc
16139
16140: see if logb exists
16141set logb d_logb
16142eval $inlibc
16143
16144: see if lrint exists
16145set lrint d_lrint
16146eval $inlibc
16147
16148: see if lrintl exists
16149set lrintl d_lrintl
16150eval $inlibc
16151
16152: see if lround exists
16153set lround d_lround
16154eval $inlibc
16155
16156: see if lroundl exists
16157set lroundl d_lroundl
16158eval $inlibc
16159
16160: see if prototype for lseek is available
16161echo " "
16162set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16163eval $hasproto
16164
16165: see if lstat exists
16166set lstat d_lstat
16167eval $inlibc
16168
16169: see if madvise exists
16170set madvise d_madvise
16171eval $inlibc
16172
16173: see if malloc_size exists
16174set malloc_size d_malloc_size
16175eval $inlibc
16176
16177: see if malloc_size_good exists
16178set malloc_good_size d_malloc_good_size
16179eval $inlibc
16180
16181: see if malloc_usable_size exists
16182set malloc_usable_size d_malloc_usable_size
16183eval $inlibc
16184
16185: see if mblen exists
16186set mblen d_mblen
16187eval $inlibc
16188
16189: see if mbrlen exists
16190set mbrlen d_mbrlen
16191eval $inlibc
16192
16193: see if mbrtowc exists
16194set mbrtowc d_mbrtowc
16195eval $inlibc
16196
16197: see if mbstowcs exists
16198set mbstowcs d_mbstowcs
16199eval $inlibc
16200
16201: see if mbtowc exists
16202set mbtowc d_mbtowc
16203eval $inlibc
16204
16205: see if memmem exists
16206: We need both a prototype in string.h and the symbol in libc.
16207echo " "
16208d_memmem_proto=''
16209xx1="#$d_gnulibc HAS_GNULIBC"
16210xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16211xx3='# define _GNU_SOURCE'
16212xx4='#endif'
16213set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16214eval $hasproto
16215case "$d_memmem_proto" in
16216 define) # see if memmem exists
16217 set memmem d_memmem
16218 eval $inlibc
16219 ;;
16220 *) val=$undef
16221 set d_memmem
16222 eval $setvar
16223 ;;
16224esac
16225
16226: see if memrchr exists
16227: We need both a prototype in string.h and the symbol in libc.
16228echo " "
16229d_memrchr_proto=''
16230xx1="#$d_gnulibc HAS_GNULIBC"
16231xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16232xx3='# define _GNU_SOURCE'
16233xx4='#endif'
16234set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16235eval $hasproto
16236case "$d_memrchr_proto" in
16237 define) # see if memrchr exists
16238 set memrchr d_memrchr
16239 eval $inlibc
16240 ;;
16241 *) val=$undef
16242 set d_memrchr
16243 eval $setvar
16244 ;;
16245esac
16246
16247: see if mkdir exists
16248set mkdir d_mkdir
16249eval $inlibc
16250
16251: see if mkdtemp exists
16252set mkdtemp d_mkdtemp
16253eval $inlibc
16254
16255: see if mkfifo exists
16256set mkfifo d_mkfifo
16257eval $inlibc
16258
16259: see if mkostemp exists
16260set mkostemp d_mkostemp
16261eval $inlibc
16262
16263: see if mkstemp exists
16264set mkstemp d_mkstemp
16265eval $inlibc
16266
16267: see if mkstemps exists
16268set mkstemps d_mkstemps
16269eval $inlibc
16270
16271: see if mktime exists
16272set mktime d_mktime
16273eval $inlibc
16274
16275: see if sys/mman.h has to be included
16276set sys/mman.h i_sysmman
16277eval $inhdr
16278
16279: see if mmap exists
16280set mmap d_mmap
16281eval $inlibc
16282: see what shmat returns
16283: default to something harmless
16284mmaptype='void *'
16285case "$i_sysmman$d_mmap" in
16286"$define$define")
16287 $cat >mmap.c <<'END'
16288#include <sys/mman.h>
16289void *mmap();
16290END
16291 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16292 mmaptype='void *'
16293 else
16294 mmaptype='caddr_t'
16295 fi
16296 echo "and it returns ($mmaptype)." >&4
16297 ;;
16298esac
16299
16300: see if sqrtl exists
16301set sqrtl d_sqrtl
16302eval $inlibc
16303
16304: see if scalbnl exists
16305set scalbnl d_scalbnl
16306eval $inlibc
16307
16308: see if truncl exists
16309set truncl d_truncl
16310eval $inlibc
16311
16312: see if modfl exists
16313set modfl d_modfl
16314eval $inlibc
16315
16316: see if prototype for modfl is available
16317echo " "
16318set d_modflproto modfl define math.h
16319eval $hasproto
16320
16321if $test "$uselongdouble" = "$define"; then
16322 message=""
16323 if $test "$d_sqrtl" != "$define"; then
16324 message="$message sqrtl"
16325 fi
16326 if $test "$d_modfl" != "$define"; then
16327 if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16328 echo "You have both truncl and copysignl, so I can emulate modfl."
16329 else
16330 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16331 echo "You have both aintl and copysignl, so I can emulate modfl."
16332 else
16333 message="$message modfl"
16334 fi
16335 fi
16336 fi
16337 if $test "$d_frexpl" != "$define"; then
16338 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16339 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16340 else
16341 message="$message frexpl"
16342 fi
16343 fi
16344 if $test "$d_ldexpl" != "$define"; then
16345 message="$message ldexpl"
16346 fi
16347
16348 if $test "$message" != ""; then
16349 $cat <<EOM >&4
16350
16351*** You requested the use of long doubles but you do not seem to have
16352*** the following mathematical functions needed for long double support:
16353*** $message
16354*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16355*** Cannot continue, aborting.
16356
16357EOM
16358
16359 exit 1
16360 fi
16361fi
16362
16363: see if mprotect exists
16364set mprotect d_mprotect
16365eval $inlibc
16366
16367: see if msgctl exists
16368set msgctl d_msgctl
16369eval $inlibc
16370
16371: see if msgget exists
16372set msgget d_msgget
16373eval $inlibc
16374
16375: see if msgsnd exists
16376set msgsnd d_msgsnd
16377eval $inlibc
16378
16379: see if msgrcv exists
16380set msgrcv d_msgrcv
16381eval $inlibc
16382
16383: see how much of the 'msg*(2)' library is present.
16384h_msg=true
16385echo " "
16386case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16387*"$undef"*) h_msg=false;;
16388esac
16389case "$osname" in
16390freebsd)
16391 case "`ipcs 2>&1`" in
16392 "SVID messages"*"not configured"*)
16393 echo "Your $osname does not have the msg*(2) configured." >&4
16394 h_msg=false
16395 val="$undef"
16396 set msgctl d_msgctl
16397 eval $setvar
16398 set msgget d_msgget
16399 eval $setvar
16400 set msgsnd d_msgsnd
16401 eval $setvar
16402 set msgrcv d_msgrcv
16403 eval $setvar
16404 ;;
16405 esac
16406 ;;
16407esac
16408: we could also check for sys/ipc.h ...
16409if $h_msg && $test `./findhdr sys/msg.h`; then
16410 echo "You have the full msg*(2) library." >&4
16411 val="$define"
16412else
16413 echo "You don't have the full msg*(2) library." >&4
16414 val="$undef"
16415fi
16416set d_msg
16417eval $setvar
16418
16419: Check for msghdr_s
16420echo " "
16421echo "Checking to see if your system supports struct msghdr..." >&4
16422set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16423eval $hasstruct
16424case "$d_msghdr_s" in
16425"$define") echo "Yes, it does." ;;
16426*) echo "No, it doesn't." ;;
16427esac
16428
16429: see if msync exists
16430set msync d_msync
16431eval $inlibc
16432
16433: see if munmap exists
16434set munmap d_munmap
16435eval $inlibc
16436
16437: see if nan exists
16438set nan d_nan
16439eval $inlibc
16440
16441: see if nanosleep exists
16442set nanosleep d_nanosleep
16443eval $inlibc
16444
16445: see if nearbyint exists
16446set nearbyint d_nearbyint
16447eval $inlibc
16448
16449: see if nextafter exists
16450set nextafter d_nextafter
16451eval $inlibc
16452
16453: see if nexttoward exists
16454set nexttoward d_nexttoward
16455eval $inlibc
16456
16457: see if nice exists
16458set nice d_nice
16459eval $inlibc
16460
16461: see if this is a langinfo.h system
16462set langinfo.h i_langinfo
16463eval $inhdr
16464
16465: see if nl_langinfo exists
16466set nl_langinfo d_nl_langinfo
16467eval $inlibc
16468
16469: see if this is a quadmath.h system
16470set quadmath.h i_quadmath
16471eval $inhdr
16472
16473: Check basic sizes
16474echo " "
16475$echo "Choosing the C types to be used for Perl's internal types..." >&4
16476
16477case "$use64bitint:$d_quad:$quadtype" in
16478define:define:?*)
16479 ivtype="$quadtype"
16480 uvtype="$uquadtype"
16481 ivsize=8
16482 uvsize=8
16483 ;;
16484*) ivtype="long"
16485 uvtype="unsigned long"
16486 ivsize=$longsize
16487 uvsize=$longsize
16488 ;;
16489esac
16490
16491case "$uselongdouble:$d_longdbl" in
16492define:define)
16493 nvtype="long double"
16494 nvsize=$longdblsize
16495 ;;
16496*) nvtype=double
16497 nvsize=$doublesize
16498 ;;
16499esac
16500
16501case "$usequadmath:$i_quadmath" in
16502define:define)
16503 nvtype="__float128"
16504 nvsize=16
16505 case "$libs" in
16506 *quadmath*) ;;
16507 *) $cat <<EOM >&4
16508
16509*** You requested the use of the quadmath library, but you
16510*** do not seem to have the quadmath library installed.
16511*** Cannot continue, aborting.
16512EOM
16513 exit 1
16514 ;;
16515 esac
16516 ;;
16517define:*) $cat <<EOM >&4
16518
16519*** You requested the use of the quadmath library, but you
16520*** do not seem to have the required header, <quadmath.h>.
16521EOM
16522 case "$gccversion" in
16523 [23].*|4.[0-5]*)
16524 $cat <<EOM >&4
16525*** Your gcc looks a bit old:
16526*** $gccversion
16527EOM
16528 ;;
16529 '')
16530 $cat <<EOM >&4
16531*** You are not running a gcc.
16532EOM
16533 ;;
16534 esac
16535 $cat <<EOM >&4
16536*** For the quadmath library you need at least gcc 4.6.
16537*** Cannot continue, aborting.
16538EOM
16539 exit 1
16540 ;;
16541esac
16542
16543$echo "(IV will be "$ivtype", $ivsize bytes)"
16544$echo "(UV will be "$uvtype", $uvsize bytes)"
16545$echo "(NV will be "$nvtype", $nvsize bytes)"
16546
16547$cat >try.c <<EOCP
16548#$i_inttypes I_INTTYPES
16549#ifdef I_INTTYPES
16550#include <inttypes.h>
16551#endif
16552#include <stdio.h>
16553int main() {
16554#ifdef INT8
16555 int8_t i = INT8_MAX;
16556 uint8_t u = UINT8_MAX;
16557 printf("int8_t\n");
16558#endif
16559#ifdef INT16
16560 int16_t i = INT16_MAX;
16561 uint16_t u = UINT16_MAX;
16562 printf("int16_t\n");
16563#endif
16564#ifdef INT32
16565 int32_t i = INT32_MAX;
16566 uint32_t u = UINT32_MAX;
16567 printf("int32_t\n");
16568#endif
16569}
16570EOCP
16571
16572i8type="signed char"
16573u8type="unsigned char"
16574i8size=1
16575u8size=1
16576
16577case "$i16type" in
16578'') case "$shortsize" in
16579 2) i16type=short
16580 u16type="unsigned short"
16581 i16size=$shortsize
16582 u16size=$shortsize
16583 ;;
16584 esac
16585 ;;
16586esac
16587case "$i16type" in
16588'') set try -DINT16
16589 if eval $compile; then
16590 case "`$run ./try`" in
16591 int16_t)
16592 i16type=int16_t
16593 u16type=uint16_t
16594 i16size=2
16595 u16size=2
16596 ;;
16597 esac
16598 fi
16599 ;;
16600esac
16601case "$i16type" in
16602'') if $test $shortsize -ge 2; then
16603 i16type=short
16604 u16type="unsigned short"
16605 i16size=$shortsize
16606 u16size=$shortsize
16607 fi
16608 ;;
16609esac
16610
16611case "$i32type" in
16612'') case "$longsize" in
16613 4) i32type=long
16614 u32type="unsigned long"
16615 i32size=$longsize
16616 u32size=$longsize
16617 ;;
16618 *) case "$intsize" in
16619 4) i32type=int
16620 u32type="unsigned int"
16621 i32size=$intsize
16622 u32size=$intsize
16623 ;;
16624 esac
16625 ;;
16626 esac
16627 ;;
16628esac
16629case "$i32type" in
16630'') set try -DINT32
16631 if eval $compile; then
16632 case "`$run ./try`" in
16633 int32_t)
16634 i32type=int32_t
16635 u32type=uint32_t
16636 i32size=4
16637 u32size=4
16638 ;;
16639 esac
16640 fi
16641 ;;
16642esac
16643case "$i32type" in
16644'') if $test $intsize -ge 4; then
16645 i32type=int
16646 u32type="unsigned int"
16647 i32size=$intsize
16648 u32size=$intsize
16649 fi
16650 ;;
16651esac
16652
16653case "$i64type" in
16654'') case "$d_quad:$quadtype" in
16655 define:?*)
16656 i64type="$quadtype"
16657 u64type="$uquadtype"
16658 i64size=8
16659 u64size=8
16660 ;;
16661 esac
16662 ;;
16663esac
16664
16665$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16666$cat <<EOP >try.c
16667#include <stdio.h>
16668#$i_stdlib I_STDLIB
16669#ifdef I_STDLIB
16670#include <stdlib.h>
16671#endif
16672#include <sys/types.h>
16673#include <signal.h>
16674#ifdef SIGFPE
16675/* volatile so that the compiler has to store it out to memory */
16676volatile int bletched = 0;
16677$signal_t blech(int s) { bletched = 1; }
16678#endif
16679int main() {
16680 $uvtype u = 0;
16681 $nvtype d;
16682 int n = 8 * $uvsize;
16683 int i;
16684#ifdef SIGFPE
16685 signal(SIGFPE, blech);
16686#endif
16687
16688 for (i = 0; i < n; i++) {
16689 u = u << 1 | ($uvtype)1;
16690 d = ($nvtype)u;
16691 if (($uvtype)d != u)
16692 break;
16693 if (d <= 0)
16694 break;
16695 d = ($nvtype)(u - 1);
16696 if (($uvtype)d != (u - 1))
16697 break;
16698#ifdef SIGFPE
16699 if (bletched)
16700 break;
16701#endif
16702 }
16703 printf("%d\n", ((i == n) ? -n : i));
16704 exit(0);
16705}
16706EOP
16707set try
16708
16709d_nv_preserves_uv="$undef"
16710if eval $compile; then
16711 nv_preserves_uv_bits="`$run ./try`"
16712fi
16713case "$nv_preserves_uv_bits" in
16714\-[1-9]*)
16715 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16716 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
16717 d_nv_preserves_uv="$define"
16718 ;;
16719[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
16720 d_nv_preserves_uv="$undef" ;;
16721*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
16722 nv_preserves_uv_bits="0" ;;
16723esac
16724$rm_try
16725
16726$echo "Checking to find the largest integer value your NVs can hold..." >&4
16727$cat <<EOP >try.c
16728#include <stdio.h>
16729
16730typedef $nvtype NV;
16731
16732int
16733main() {
16734 NV value = 2;
16735 int count = 1;
16736
16737 while(count < 256) {
16738 /* volatile so that the compiler has to store it out to memory */
16739 volatile NV up = value + 1.0;
16740 volatile NV negated = -value;
16741 volatile NV down = negated - 1.0;
16742 volatile NV got_up = up - value;
16743 int up_good = got_up == 1.0;
16744 int got_down = down - negated;
16745 int down_good = got_down == -1.0;
16746
16747 if (down_good != up_good) {
16748 fprintf(stderr,
16749 "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16750 up_good, (double) got_up, down_good, (double) got_down,
16751 count, (double) value);
16752 return 1;
16753 }
16754 if (!up_good) {
16755 while (1) {
16756 if (count > 8) {
16757 count -= 8;
16758 fputs("256.0", stdout);
16759 } else {
16760 count--;
16761 fputs("2.0", stdout);
16762 }
16763 if (!count) {
16764 puts("");
16765 return 0;
16766 }
16767 fputs("*", stdout);
16768 }
16769 }
16770 value *= 2;
16771 ++count;
16772 }
16773 fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16774 count, (double) value);
16775 return 1;
16776}
16777EOP
16778set try
16779
16780nv_overflows_integers_at='0'
16781if eval $compile; then
16782 xxx="`$run ./try`"
16783 case "$?" in
16784 0)
16785 case "$xxx" in
16786 2*) cat >&4 <<EOM
16787The largest integer your NVs can preserve is equal to $xxx
16788EOM
16789 nv_overflows_integers_at="$xxx"
16790 ;;
16791 *) cat >&4 <<EOM
16792Cannot determine the largest integer value your NVs can hold, unexpected output
16793'$xxx'
16794EOM
16795 ;;
16796 esac
16797 ;;
16798 *) cat >&4 <<EOM
16799Cannot determine the largest integer value your NVs can hold
16800EOM
16801 ;;
16802 esac
16803fi
16804$rm_try
16805
16806$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16807$cat <<EOP >try.c
16808#include <stdio.h>
16809#$i_stdlib I_STDLIB
16810#ifdef I_STDLIB
16811#include <stdlib.h>
16812#endif
16813#include <string.h>
16814#include <sys/types.h>
16815#include <signal.h>
16816#ifdef SIGFPE
16817/* volatile so that the compiler has to store it out to memory */
16818volatile int bletched = 0;
16819$signal_t blech(int s) { bletched = 1; }
16820#endif
16821
16822int checkit($nvtype d, const char *where) {
16823 void *v = &d;
16824 unsigned char *p = (unsigned char *)v;
16825 unsigned char *end = p + sizeof(d);
16826 int fail = 0;
16827
16828 while (p < end)
16829 fail += *p++;
16830
16831 if (!fail)
16832 return 0;
16833
16834 p = (unsigned char *)v;
16835 printf("No - %s: 0x", where);
16836 while (p < end)
16837 printf ("%02X", *p++);
16838 printf("\n");
16839 return 1;
16840}
16841
16842int main(int argc, char **argv) {
16843 $nvtype d = 0.0;
16844 int fail = 0;
16845 fail += checkit(d, "0.0");
16846
16847 /* The compiler shouldn't be assuming that bletched is 0 */
16848 d = bletched;
16849
16850 fail += checkit(d, "bleched");
16851
16852#ifdef SIGFPE
16853 signal(SIGFPE, blech);
16854#endif
16855
16856 /* Paranoia - the compiler should have no way of knowing that ANSI says
16857 that argv[argc] will always be NULL. Actually, if it did assume this it
16858 would be buggy, as this is C and main() can be called from elsewhere in
16859 the program. */
16860 d = argv[argc] ? 1 : 0;
16861
16862 if (d) {
16863 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16864 }
16865
16866 fail += checkit(d, "ternary");
16867
16868 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16869
16870 if (d != 0.0) {
16871 printf("No - memset doesn't give 0.0\n");
16872 /* This might just blow up: */
16873 printf("(gives %g)\n", d);
16874 return 1;
16875 }
16876
16877#ifdef SIGFPE
16878 if (bletched) {
16879 printf("No - something bleched\n");
16880 return 1;
16881 }
16882#endif
16883 if (fail) {
16884 printf("No - %d fail(s)\n", fail);
16885 return 1;
16886 }
16887 printf("Yes\n");
16888 return 0;
16889}
16890EOP
16891set try
16892
16893d_nv_zero_is_allbits_zero="$undef"
16894if eval $compile; then
16895 xxx="`$run ./try`"
16896 case "$?" in
16897 0)
16898 case "$xxx" in
16899 Yes) cat >&4 <<EOM
169000.0 is represented as all bits zero in memory
16901EOM
16902 d_nv_zero_is_allbits_zero="$define"
16903 ;;
16904 *) cat >&4 <<EOM
169050.0 is not represented as all bits zero in memory
16906EOM
16907 d_nv_zero_is_allbits_zero="$undef"
16908 ;;
16909 esac
16910 ;;
16911 *) cat >&4 <<EOM
169120.0 is not represented as all bits zero in memory
16913EOM
16914 d_nv_zero_is_allbits_zero="$undef"
16915 ;;
16916 esac
16917fi
16918$rm_try
16919
16920: check for off64_t
16921echo " "
16922echo "Checking to see if you have off64_t..." >&4
16923$cat >try.c <<EOCP
16924#include <sys/types.h>
16925#include <unistd.h>
16926int main() { off64_t x = 7; }
16927EOCP
16928set try
16929if eval $compile; then
16930 val="$define"
16931 echo "You have off64_t."
16932else
16933 val="$undef"
16934 echo "You do not have off64_t."
16935 case "$lseeksize" in
16936 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16937 esac
16938fi
16939$rm_try
16940set d_off64_t
16941eval $setvar
16942
16943: how to create joinable pthreads
16944if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16945 echo " "
16946 echo "Checking what constant to use for creating joinable pthreads..." >&4
16947 $cat >try.c <<'EOCP'
16948#include <pthread.h>
16949int main() {
16950 int detachstate = JOINABLE;
16951}
16952EOCP
16953 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16954 if eval $compile; then
16955 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16956 val="$undef" # Yes, undef.
16957 set d_old_pthread_create_joinable
16958 eval $setvar
16959 val=""
16960 set old_pthread_create_joinable
16961 eval $setvar
16962 else
16963 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16964 if eval $compile; then
16965 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16966 val="$define"
16967 set d_old_pthread_create_joinable
16968 eval $setvar
16969 val=PTHREAD_CREATE_UNDETACHED
16970 set old_pthread_create_joinable
16971 eval $setvar
16972 else
16973 set try -DJOINABLE=__UNDETACHED
16974 if eval $compile; then
16975 echo "You seem to use __UNDETACHED." >&4
16976 val="$define"
16977 set d_old_pthread_create_joinable
16978 eval $setvar
16979 val=__UNDETACHED
16980 set old_pthread_create_joinable
16981 eval $setvar
16982 else
16983 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
16984 val="$define"
16985 set d_old_pthread_create_joinable
16986 eval $setvar
16987 val=0
16988 set old_pthread_create_joinable
16989 eval $setvar
16990 fi
16991 fi
16992 fi
16993 $rm_try
16994else
16995 d_old_pthread_create_joinable="$undef"
16996 old_pthread_create_joinable=""
16997fi
16998
16999: see if pause exists
17000set pause d_pause
17001eval $inlibc
17002
17003: see if pipe2 exists
17004set pipe2 d_pipe2
17005eval $inlibc
17006
17007: see if poll exists
17008set poll d_poll
17009eval $inlibc
17010
17011: see if prctl exists
17012set prctl d_prctl
17013eval $inlibc
17014
17015: see if prctl supports PR_SET_NAME
17016d_prctl_set_name=$undef
17017case $d_prctl in
17018 $define)
17019 $cat >try.c <<EOM
17020#ifdef __ANDROID__
17021#include <unistd.h>
17022#endif
17023#include <sys/prctl.h>
17024
17025int main (int argc, char *argv[])
17026{
17027 return (prctl (PR_SET_NAME, "Test"));
17028 } /* main */
17029EOM
17030 set try
17031 if eval $compile_ok && $run ./try; then
17032 echo "Your prctl (PR_SET_NAME, ...) works"
17033 d_prctl_set_name=$define
17034 fi
17035 $rm_try
17036 ;;
17037 esac
17038
17039: see if readlink exists
17040set readlink d_readlink
17041eval $inlibc
17042
17043: Check if there is a /proc symlink to the abs path of
17044: the executing program. We will honor hints of d_procselfexe=$undef
17045: or procselfexe being non-empty, otherwise will try to determine both
17046: if we have readlink.
17047: AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17048: referenced, and AmigaOS does not have a proc filesystem anyway.
17049echo " "
17050val="$undef"
17051if $test "X$d_procselfexe" = Xundef; then
17052 procselfexe=''
17053elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17054 val="$define"
17055elif $test "X$d_readlink" = Xdefine; then
17056 : NetBSD first as /proc/self is a symlink to /proc/curproc,
17057 : and it feels more tidy to avoid an extra level of symlink
17058 set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17059 while test $# -gt 0; do
17060 type=$1; try=$2
17061 shift; shift
17062 if $issymlink $try; then
17063 $ls -l $try > reflect
17064 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17065 echo "You have $type-like $try."
17066 procselfexe='"'$try'"'
17067 val="$define"
17068 : This will break out of the loop
17069 set X; shift
17070 fi
17071 fi
17072 done
17073fi
17074$rm -f reflect
17075set d_procselfexe
17076eval $setvar
17077
17078: backward compatibility for d_hvfork
17079if test X$d_hvfork != X; then
17080 d_vfork="$d_hvfork"
17081 d_hvfork=''
17082fi
17083: see if there is a vfork
17084val=''
17085set vfork val
17086eval $inlibc
17087
17088d_pseudofork=$undef
17089
17090: Ok, but do we want to use it. vfork is reportedly unreliable in
17091: perl on Solaris 2.x, and probably elsewhere.
17092case "$val" in
17093$define)
17094 echo " "
17095 case "$usevfork" in
17096 false) dflt='n';;
17097 *) dflt='y';;
17098 esac
17099 cat <<'EOM'
17100
17101Perl can only use a vfork() that doesn't suffer from strict
17102restrictions on calling functions or modifying global data in
17103the child. For example, glibc-2.1 contains such a vfork()
17104that is unsuitable. If your system provides a proper fork()
17105call, chances are that you do NOT want perl to use vfork().
17106
17107EOM
17108 rp="Do you still want to use vfork()?"
17109 . ./myread
17110 case "$ans" in
17111 y|Y) ;;
17112 *)
17113 echo "Ok, we won't use vfork()."
17114 val="$undef"
17115 ;;
17116 esac
17117 ;;
17118esac
17119set d_vfork
17120eval $setvar
17121case "$d_vfork" in
17122$define) usevfork='true';;
17123*) usevfork='false';;
17124esac
17125
17126: see whether the pthread_atfork exists
17127$cat >try.c <<EOP
17128#include <pthread.h>
17129#include <stdio.h>
17130int main() {
17131#ifdef PTHREAD_ATFORK
17132 pthread_atfork(NULL,NULL,NULL);
17133#endif
17134}
17135EOP
17136
17137: see if pthread_atfork exists
17138set try -DPTHREAD_ATFORK
17139if eval $compile; then
17140 val="$define"
17141else
17142 val="$undef"
17143fi
17144case "$usethreads" in
17145$define)
17146 case "$val" in
17147 $define) echo 'pthread_atfork found.' >&4 ;;
17148 *) echo 'pthread_atfork NOT found.' >&4 ;;
17149 esac
17150esac
17151set d_pthread_atfork
17152eval $setvar
17153
17154: see if pthread_attr_setscope exists
17155set pthread_attr_setscope d_pthread_attr_setscope
17156eval $inlibc
17157
17158: see whether the various POSIXish _yields exist
17159$cat >try.c <<EOP
17160#include <pthread.h>
17161#include <stdio.h>
17162int main() {
17163#ifdef SCHED_YIELD
17164 sched_yield();
17165#else
17166#ifdef PTHREAD_YIELD
17167 pthread_yield();
17168#else
17169#ifdef PTHREAD_YIELD_NULL
17170 pthread_yield(NULL);
17171#endif
17172#endif
17173#endif
17174}
17175EOP
17176: see if sched_yield exists
17177set try -DSCHED_YIELD
17178if eval $compile; then
17179 val="$define"
17180 sched_yield='sched_yield()'
17181else
17182 val="$undef"
17183fi
17184case "$usethreads" in
17185$define)
17186 case "$val" in
17187 $define) echo 'sched_yield() found.' >&4 ;;
17188 *) echo 'sched_yield() NOT found.' >&4 ;;
17189 esac
17190esac
17191set d_sched_yield
17192eval $setvar
17193
17194: see if pthread_yield exists
17195set try -DPTHREAD_YIELD
17196if eval $compile; then
17197 val="$define"
17198 case "$sched_yield" in
17199 '') sched_yield='pthread_yield()' ;;
17200 esac
17201else
17202 set try -DPTHREAD_YIELD_NULL
17203 if eval $compile; then
17204 val="$define"
17205 case "$sched_yield" in
17206 '') sched_yield='pthread_yield(NULL)' ;;
17207 esac
17208 else
17209 val="$undef"
17210 fi
17211fi
17212case "$usethreads" in
17213$define)
17214 case "$val" in
17215 $define) echo 'pthread_yield() found.' >&4 ;;
17216 *) echo 'pthread_yield() NOT found.' >&4 ;;
17217 esac
17218 ;;
17219esac
17220set d_pthread_yield
17221eval $setvar
17222case "$sched_yield" in
17223'') sched_yield=undef ;;
17224esac
17225$rm_try
17226
17227: check for ptrdiff_t
17228echo " "
17229echo "Checking to see if you have ptrdiff_t..." >&4
17230$cat >try.c <<EOCP
17231#include <stddef.h>
17232int main() { ptrdiff_t x = 7; }
17233EOCP
17234set try
17235if eval $compile; then
17236 val="$define"
17237 echo "You have ptrdiff_t."
17238else
17239 val="$undef"
17240 echo "You do not have ptrdiff_t."
17241fi
17242$rm_try
17243set d_ptrdiff_t
17244eval $setvar
17245
17246: see if random_r exists
17247set random_r d_random_r
17248eval $inlibc
17249case "$d_random_r" in
17250"$define")
17251 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17252 case "$d_random_r_proto:$usethreads" in
17253 ":define") d_random_r_proto=define
17254 set d_random_r_proto random_r $hdrs
17255 eval $hasproto ;;
17256 *) ;;
17257 esac
17258 case "$d_random_r_proto" in
17259 define)
17260 case "$random_r_proto" in
17261 ''|0) try='int random_r(int*, struct random_data*);'
17262 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17263 esac
17264 case "$random_r_proto" in
17265 ''|0) try='int random_r(long*, struct random_data*);'
17266 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17267 esac
17268 case "$random_r_proto" in
17269 ''|0) try='int random_r(struct random_data*, int32_t*);'
17270 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17271 esac
17272 case "$random_r_proto" in
17273 ''|0) d_random_r=undef
17274 random_r_proto=0
17275 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17276 * ) case "$random_r_proto" in
17277 REENTRANT_PROTO*) ;;
17278 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17279 esac
17280 echo "Prototype: $try" ;;
17281 esac
17282 ;;
17283 *) case "$usethreads" in
17284 define) echo "random_r has no prototype, not using it." >&4 ;;
17285 esac
17286 d_random_r=undef
17287 random_r_proto=0
17288 ;;
17289 esac
17290 ;;
17291*) random_r_proto=0
17292 ;;
17293esac
17294
17295: see if readdir and friends exist
17296set readdir d_readdir
17297eval $inlibc
17298set seekdir d_seekdir
17299eval $inlibc
17300set telldir d_telldir
17301eval $inlibc
17302set rewinddir d_rewinddir
17303eval $inlibc
17304
17305: see if readdir64_r exists
17306set readdir64_r d_readdir64_r
17307eval $inlibc
17308case "$d_readdir64_r" in
17309"$define")
17310 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17311 case "$d_readdir64_r_proto:$usethreads" in
17312 ":define") d_readdir64_r_proto=define
17313 set d_readdir64_r_proto readdir64_r $hdrs
17314 eval $hasproto ;;
17315 *) ;;
17316 esac
17317 case "$d_readdir64_r_proto" in
17318 define)
17319 case "$readdir64_r_proto" in
17320 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17321 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17322 esac
17323 case "$readdir64_r_proto" in
17324 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17325 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17326 esac
17327 case "$readdir64_r_proto" in
17328 ''|0) d_readdir64_r=undef
17329 readdir64_r_proto=0
17330 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17331 * ) case "$readdir64_r_proto" in
17332 REENTRANT_PROTO*) ;;
17333 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17334 esac
17335 echo "Prototype: $try" ;;
17336 esac
17337 ;;
17338 *) case "$usethreads" in
17339 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17340 esac
17341 d_readdir64_r=undef
17342 readdir64_r_proto=0
17343 ;;
17344 esac
17345 ;;
17346*) readdir64_r_proto=0
17347 ;;
17348esac
17349
17350: see if readdir_r exists
17351set readdir_r d_readdir_r
17352eval $inlibc
17353case "$d_readdir_r" in
17354"$define")
17355 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17356 case "$d_readdir_r_proto:$usethreads" in
17357 ":define") d_readdir_r_proto=define
17358 set d_readdir_r_proto readdir_r $hdrs
17359 eval $hasproto ;;
17360 *) ;;
17361 esac
17362 case "$d_readdir_r_proto" in
17363 define)
17364 case "$readdir_r_proto" in
17365 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17366 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17367 esac
17368 case "$readdir_r_proto" in
17369 ''|0) try='int readdir_r(DIR*, struct dirent*);'
17370 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17371 esac
17372 case "$readdir_r_proto" in
17373 ''|0) d_readdir_r=undef
17374 readdir_r_proto=0
17375 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17376 * ) case "$readdir_r_proto" in
17377 REENTRANT_PROTO*) ;;
17378 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17379 esac
17380 echo "Prototype: $try" ;;
17381 esac
17382 ;;
17383 *) case "$usethreads" in
17384 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17385 esac
17386 d_readdir_r=undef
17387 readdir_r_proto=0
17388 ;;
17389 esac
17390 ;;
17391*) readdir_r_proto=0
17392 ;;
17393esac
17394
17395: see if readv exists
17396set readv d_readv
17397eval $inlibc
17398
17399: see if recvmsg exists
17400set recvmsg d_recvmsg
17401eval $inlibc
17402
17403: see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17404echo " "
17405if set regcomp val -f d_regcomp; eval $csym; $val; then
17406 echo 'regcomp() found.' >&4
17407 d_regcomp="$define"
17408 d_regcmp="$undef"
17409 d_re_comp="$undef"
17410elif set regcmp val -f d_regcmp; eval $csym; $val; then
17411 echo 'regcmp() found.' >&4
17412 d_regcmp="$define"
17413 d_regcomp="$undef"
17414 d_re_comp="$undef"
17415elif set re_comp val -f d_re_comp; eval $csym; $val; then
17416 echo 're_comp() found, assuming re_exec() also exists.' >&4
17417 d_re_comp="$define"
17418 d_regcomp="$undef"
17419 d_regcmp="$undef"
17420else
17421 $cat >&4 <<EOM
17422No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17423EOM
17424 d_regcmp="$undef"
17425 d_re_comp="$undef"
17426 d_regcomp="$undef"
17427fi
17428
17429: see if remainder exists
17430set remainder d_remainder
17431eval $inlibc
17432
17433: see if remquo exists
17434set remquo d_remquo
17435eval $inlibc
17436
17437: see if rename exists
17438set rename d_rename
17439eval $inlibc
17440
17441: see if rint exists
17442set rint d_rint
17443eval $inlibc
17444
17445: see if rmdir exists
17446set rmdir d_rmdir
17447eval $inlibc
17448
17449: see if round exists
17450set round d_round
17451eval $inlibc
17452
17453: see if prototype for sbrk is available
17454echo " "
17455set d_sbrkproto sbrk $i_unistd unistd.h
17456eval $hasproto
17457
17458: see if scalbn exists
17459set scalbn d_scalbn
17460eval $inlibc
17461
17462: see if select exists
17463set select d_select
17464eval $inlibc
17465
17466: see if semctl exists
17467set semctl d_semctl
17468eval $inlibc
17469
17470: see if semget exists
17471set semget d_semget
17472eval $inlibc
17473
17474: see if semop exists
17475set semop d_semop
17476eval $inlibc
17477
17478: see how much of the 'sem*(2)' library is present.
17479h_sem=true
17480echo " "
17481case "$d_semctl$d_semget$d_semop" in
17482*"$undef"*) h_sem=false;;
17483esac
17484case "$osname" in
17485freebsd)
17486 case "`ipcs 2>&1`" in
17487 "SVID messages"*"not configured"*)
17488 echo "Your $osname does not have the sem*(2) configured." >&4
17489 h_sem=false
17490 val="$undef"
17491 set semctl d_semctl
17492 eval $setvar
17493 set semget d_semget
17494 eval $setvar
17495 set semop d_semop
17496 eval $setvar
17497 ;;
17498 esac
17499 ;;
17500esac
17501: we could also check for sys/ipc.h ...
17502if $h_sem && $test `./findhdr sys/sem.h`; then
17503 echo "You have the full sem*(2) library." >&4
17504 val="$define"
17505else
17506 echo "You don't have the full sem*(2) library." >&4
17507 val="$undef"
17508fi
17509set d_sem
17510eval $setvar
17511
17512: see whether sys/sem.h defines union semun
17513echo " "
17514$cat > try.c <<'END'
17515#include <sys/types.h>
17516#include <sys/ipc.h>
17517#include <sys/sem.h>
17518int main () { union semun semun; semun.buf = 0; }
17519END
17520set try
17521if eval $compile; then
17522 echo "You have union semun in <sys/sem.h>." >&4
17523 val="$define"
17524else
17525 echo "You do not have union semun in <sys/sem.h>." >&4
17526 val="$undef"
17527fi
17528$rm_try
17529set d_union_semun
17530eval $setvar
17531
17532: see how to do semctl IPC_STAT
17533case "$d_sem" in
17534$define)
17535 echo " "
17536 $cat > tryh.h <<END
17537#ifndef S_IRUSR
17538# ifdef S_IREAD
17539# define S_IRUSR S_IREAD
17540# define S_IWUSR S_IWRITE
17541# define S_IXUSR S_IEXEC
17542# else
17543# define S_IRUSR 0400
17544# define S_IWUSR 0200
17545# define S_IXUSR 0100
17546# endif
17547# define S_IRGRP (S_IRUSR>>3)
17548# define S_IWGRP (S_IWUSR>>3)
17549# define S_IXGRP (S_IXUSR>>3)
17550# define S_IROTH (S_IRUSR>>6)
17551# define S_IWOTH (S_IWUSR>>6)
17552# define S_IXOTH (S_IXUSR>>6)
17553#endif
17554#ifndef S_IRWXU
17555# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17556# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17557# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17558#endif
17559END
17560 : see whether semctl IPC_STAT can use union semun
17561 case "$d_semctl_semun" in
17562 '')
17563 val="$undef"
17564 $cat > try.c <<END
17565#include <sys/types.h>
17566#include <sys/ipc.h>
17567#include <sys/sem.h>
17568#include <sys/stat.h>
17569#include <stdio.h>
17570#include <errno.h>
17571#include "tryh.h"
17572#ifndef errno
17573extern int errno;
17574#endif
17575#$d_union_semun HAS_UNION_SEMUN
17576int main() {
17577 union semun
17578#ifndef HAS_UNION_SEMUN
17579 {
17580 int val;
17581 struct semid_ds *buf;
17582 unsigned short *array;
17583 }
17584#endif
17585 arg;
17586 int sem, st;
17587
17588#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17589 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17590 if (sem > -1) {
17591 struct semid_ds argbuf;
17592 arg.buf = &argbuf;
17593# ifdef IPC_STAT
17594 st = semctl(sem, 0, IPC_STAT, arg);
17595 if (st == 0)
17596 printf("semun\n");
17597 else
17598# endif /* IPC_STAT */
17599 printf("semctl IPC_STAT failed: errno = %d\n", errno);
17600# ifdef IPC_RMID
17601 if (semctl(sem, 0, IPC_RMID, arg) != 0)
17602# endif /* IPC_RMID */
17603 printf("semctl IPC_RMID failed: errno = %d\n", errno);
17604 } else
17605#endif /* IPC_PRIVATE && ... */
17606 printf("semget failed: errno = %d\n", errno);
17607 return 0;
17608}
17609END
17610 set try
17611 if eval $compile; then
17612 xxx=`$run ./try`
17613 case "$xxx" in
17614 semun) val="$define" ;;
17615 esac
17616 fi
17617 $rm_try
17618 set d_semctl_semun
17619 eval $setvar
17620 ;;
17621 esac
17622 case "$d_semctl_semun" in
17623 $define)
17624 echo "You can use union semun for semctl IPC_STAT." >&4
17625 also='also'
17626 ;;
17627 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
17628 also=''
17629 ;;
17630 esac
17631
17632 : see whether semctl IPC_STAT can use struct semid_ds pointer
17633 case "$d_semctl_semid_ds" in
17634 '')
17635 val="$undef"
17636 $cat > try.c <<'END'
17637#include <sys/types.h>
17638#include <sys/ipc.h>
17639#include <sys/sem.h>
17640#include <sys/stat.h>
17641#include "tryh.h"
17642#include <stdio.h>
17643#include <errno.h>
17644#ifndef errno
17645extern int errno;
17646#endif
17647int main() {
17648 union semun
17649#ifndef HAS_UNION_SEMUN
17650 {
17651 int val;
17652 struct semid_ds *buf;
17653 unsigned short *array;
17654 }
17655#endif
17656 arg;
17657 struct semid_ds argbuf;
17658 int sem, st;
17659
17660#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17661 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17662 if (sem > -1) {
17663 arg.buf = &argbuf;
17664# ifdef IPC_STAT
17665 st = semctl(sem, 0, IPC_STAT, arg);
17666 if (st == 0)
17667 printf("semid_ds\n");
17668 else
17669# endif /* IPC_STAT */
17670 printf("semctl IPC_STAT failed: errno = %d\n", errno);
17671# ifdef IPC_RMID
17672 if (semctl(sem, 0, IPC_RMID, arg) != 0)
17673# endif /* IPC_RMID */
17674 printf("semctl IPC_RMID failed: errno = %d\n", errno);
17675 } else
17676#endif /* IPC_PRIVATE && ... */
17677 printf("semget failed: errno = %d\n", errno);
17678
17679 return 0;
17680}
17681END
17682 set try
17683 if eval $compile; then
17684 xxx=`$run ./try`
17685 case "$xxx" in
17686 semid_ds) val="$define" ;;
17687 esac
17688 fi
17689 $rm_try
17690 set d_semctl_semid_ds
17691 eval $setvar
17692 ;;
17693 esac
17694 case "$d_semctl_semid_ds" in
17695 $define)
17696 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17697 ;;
17698 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17699 ;;
17700 esac
17701 ;;
17702*) val="$undef"
17703
17704 # We do not have the full sem*(2) library, so assume we can not
17705 # use either.
17706
17707 set d_semctl_semun
17708 eval $setvar
17709
17710 set d_semctl_semid_ds
17711 eval $setvar
17712 ;;
17713esac
17714$rm_try tryh.h
17715
17716: see if sendmsg exists
17717set sendmsg d_sendmsg
17718eval $inlibc
17719
17720: see if setegid exists
17721set setegid d_setegid
17722eval $inlibc
17723
17724: see if seteuid exists
17725set seteuid d_seteuid
17726eval $inlibc
17727
17728: see if setgrent exists
17729set setgrent d_setgrent
17730eval $inlibc
17731
17732: see if setgrent_r exists
17733set setgrent_r d_setgrent_r
17734eval $inlibc
17735case "$d_setgrent_r" in
17736"$define")
17737 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17738 case "$d_setgrent_r_proto:$usethreads" in
17739 ":define") d_setgrent_r_proto=define
17740 set d_setgrent_r_proto setgrent_r $hdrs
17741 eval $hasproto ;;
17742 *) ;;
17743 esac
17744 case "$d_setgrent_r_proto" in
17745 define)
17746 case "$setgrent_r_proto" in
17747 ''|0) try='int setgrent_r(FILE**);'
17748 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17749 esac
17750 case "$setgrent_r_proto" in
17751 ''|0) try='void setgrent_r(FILE**);'
17752 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17753 esac
17754 case "$setgrent_r_proto" in
17755 ''|0) d_setgrent_r=undef
17756 setgrent_r_proto=0
17757 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17758 * ) case "$setgrent_r_proto" in
17759 REENTRANT_PROTO*) ;;
17760 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17761 esac
17762 echo "Prototype: $try" ;;
17763 esac
17764 ;;
17765 *) case "$usethreads" in
17766 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17767 esac
17768 d_setgrent_r=undef
17769 setgrent_r_proto=0
17770 ;;
17771 esac
17772 ;;
17773*) setgrent_r_proto=0
17774 ;;
17775esac
17776
17777: see if sethostent exists
17778set sethostent d_sethent
17779eval $inlibc
17780
17781: see if sethostent_r exists
17782set sethostent_r d_sethostent_r
17783eval $inlibc
17784case "$d_sethostent_r" in
17785"$define")
17786 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17787 case "$d_sethostent_r_proto:$usethreads" in
17788 ":define") d_sethostent_r_proto=define
17789 set d_sethostent_r_proto sethostent_r $hdrs
17790 eval $hasproto ;;
17791 *) ;;
17792 esac
17793 case "$d_sethostent_r_proto" in
17794 define)
17795 case "$sethostent_r_proto" in
17796 ''|0) try='int sethostent_r(int, struct hostent_data*);'
17797 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17798 esac
17799 case "$sethostent_r_proto" in
17800 ''|0) try='void sethostent_r(int, struct hostent_data*);'
17801 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17802 esac
17803 case "$sethostent_r_proto" in
17804 ''|0) d_sethostent_r=undef
17805 sethostent_r_proto=0
17806 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17807 * ) case "$sethostent_r_proto" in
17808 REENTRANT_PROTO*) ;;
17809 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17810 esac
17811 echo "Prototype: $try" ;;
17812 esac
17813 ;;
17814 *) case "$usethreads" in
17815 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17816 esac
17817 d_sethostent_r=undef
17818 sethostent_r_proto=0
17819 ;;
17820 esac
17821 ;;
17822*) sethostent_r_proto=0
17823 ;;
17824esac
17825
17826: see if setitimer exists
17827set setitimer d_setitimer
17828eval $inlibc
17829
17830: see if setlinebuf exists
17831set setlinebuf d_setlinebuf
17832eval $inlibc
17833
17834: see if locale.h is available
17835set locale.h i_locale
17836eval $inhdr
17837
17838: see if this system has wctype.h
17839set wctype.h i_wctype
17840eval $inhdr
17841
17842: see if towupper exists
17843set towupper d_towupper
17844eval $inlibc
17845
17846: check for setlocale function and behavior
17847$cat <<EOM
17848
17849Checking to see if you have setlocale() and its behavior
17850EOM
17851$cat >try.c <<EOCP
17852#include <stdlib.h>
17853#include <string.h>
17854#$i_locale I_LOCALE
17855#ifdef I_LOCALE
17856# include <locale.h>
17857#endif
17858#$i_wctype I_WCTYPE
17859#ifdef I_WCTYPE
17860# include <wctype.h>
17861#endif
17862
17863int main() {
17864 const char * invalid_name = "\a"; /* This is really invalid! */
17865 int accepts_any_locale_name = 0;
17866 int has_C_UTF8 = 0;
17867 unsigned char bad_setlocale = 255;
17868
17869 /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
17870 * disabled. It's hard to imagine an instance where meaningful locale
17871 * handling could be done without LC_CTYPE */
17872 const char * name = setlocale(LC_CTYPE, "C");
17873
17874 if (name == NULL || strcmp(name, "C") != 0) {
17875 exit(bad_setlocale);
17876 }
17877
17878 name = setlocale(LC_CTYPE, invalid_name);
17879 if (name != NULL) {
17880
17881 /* Let it pass if it accepts the name but gives back one of the C
17882 * locales */
17883 if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
17884 accepts_any_locale_name = 1;
17885 }
17886 }
17887
17888 name = setlocale(LC_CTYPE, "C.UTF-8");
17889 if (name != NULL) {
17890 unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
17891
17892#$d_towupper HAS_TOWUPPER
17893#ifdef HAS_TOWUPPER
17894
17895 /* We assume that if the machine doesn't have the C99 towupper, it
17896 * doesn't have C.UTF-8, even if we successfully changed locales to
17897 * include it. This seems safer even on platforms that didn't accept
17898 * the really invalid name */
17899
17900 if (towupper(y_with_diaeresis) == 0x178) {
17901 has_C_UTF8 = 1;
17902 }
17903
17904#endif
17905
17906 }
17907
17908#if 0
17909
17910 /* Currently unused code to determine if LC_ALL with disparate values uses
17911 * category = value pairs or positional, and to determine the separator
17912 * between the categories. We could add code so that if the separator were
17913 * > '9', we subtract 10; similarly for 'Z' and 'z', and then just about
17914 * every possible ASCII separator would fit in the 5 bits available in the
17915 * exit code. This would not be true in EBCDIC. And then if LC_ALL is
17916 * positional, we probably would want to know the order of the categories.
17917 * Using a file between the C program and the shell script would really be
17918 * require to do that */
17919#ifdef LC_ALL
17920
17921 unsigned char min_separator = ' ' - 1;
17922 unsigned char separator = min_separator;
17923 int uses_name_value_pair_names = 0;
17924
17925 name = setlocale(LC_ALL, "C");
17926 if (name == NULL || strcmp(name, "C") != 0) {
17927 exit(bad_setlocale);
17928 }
17929
17930 if (has_C_UTF8) {
17931 char * pos;
17932
17933 name = setlocale(LC_CTYPE, "C.UTF-8");
17934 if (name == NULL) {
17935 exit(bad_setlocale);
17936 }
17937 name = setlocale(LC_ALL, NULL);
17938 if (name == NULL) {
17939 exit(bad_setlocale);
17940 }
17941
17942 pos = strstr(name, "LC_CTYPE" "=C.UTF-8");
17943 if (pos != NULL) {
17944 uses_name_value_pair_names = 1;
17945 if (pos == name) {
17946 separator = name[sizeof("LC_CTYPE=C.UTF-8") - 1];
17947 }
17948 else {
17949 separator = *(pos - 1);
17950 }
17951 }
17952 else {
17953 pos = strstr(name, "C.UTF-8");
17954 if (pos == NULL) {
17955 /* bad */
17956 }
17957 else if (pos == name) {
17958 separator = name[sizeof("C.UTF-8") - 1];
17959 }
17960 else {
17961 separator = *(pos - 1);
17962 }
17963 }
17964 }
17965
17966#endif
17967#endif
17968
17969 exit( 0 /* (separator - min_separator) << 3
17970 | uses_name_value_pair_names << 2
17971 */
17972 | has_C_UTF8 << 1
17973 | accepts_any_locale_name);
17974
17975}
17976EOCP
17977set try
17978if eval $compile; then
17979 echo "Your system has setlocale()..." >&4
17980 $run ./try
17981 case $? in
17982 0) echo "and it seems sane" >&4
17983 d_setlocale="$define"
17984 d_setlocale_accepts_any_locale_name="$undef"
17985 d_has_C_UTF8="false"
17986 ;;
17987 1) echo "and it seems sane, but accepts any locale name as valid" >&4
17988 d_setlocale="$define"
17989 d_setlocale_accepts_any_locale_name="$define"
17990 d_has_C_UTF8="false"
17991 ;;
17992 2) echo "and it seems sane" >&4
17993 d_setlocale="$define"
17994 d_setlocale_accepts_any_locale_name="$undef"
17995 d_has_C_UTF8="true"
17996 ;;
17997 3) echo "and it seems sane, but accepts any locale name as valid" >&4
17998 d_setlocale="$define"
17999 d_setlocale_accepts_any_locale_name="$define"
18000 d_has_C_UTF8="true"
18001 ;;
18002 *) echo "but it doesn't seem to work, so we won't use it." >&4
18003 d_setlocale="$undef"
18004 d_setlocale_accepts_any_locale_name="$undef"
18005 d_has_C_UTF8="false"
18006 ;;
18007 esac
18008else
18009 echo "your system does not have setlocale()" >&4
18010 d_setlocale="$undef"
18011 d_setlocale_accepts_any_locale_name="$undef"
18012 d_has_C_UTF8="false"
18013fi
18014$rm_try
18015
18016: see if setlocale_r exists
18017set setlocale_r d_setlocale_r
18018eval $inlibc
18019case "$d_setlocale_r" in
18020"$define")
18021 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18022 case "$d_setlocale_r_proto:$usethreads" in
18023 ":define") d_setlocale_r_proto=define
18024 set d_setlocale_r_proto setlocale_r $hdrs
18025 eval $hasproto ;;
18026 *) ;;
18027 esac
18028 case "$d_setlocale_r_proto" in
18029 define)
18030 case "$setlocale_r_proto" in
18031 ''|0) try='int setlocale_r(int, const char*, char*, int);'
18032 ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18033 esac
18034 case "$setlocale_r_proto" in
18035 ''|0) d_setlocale_r=undef
18036 setlocale_r_proto=0
18037 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18038 * ) case "$setlocale_r_proto" in
18039 REENTRANT_PROTO*) ;;
18040 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18041 esac
18042 echo "Prototype: $try" ;;
18043 esac
18044 ;;
18045 *) case "$usethreads" in
18046 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18047 esac
18048 d_setlocale_r=undef
18049 setlocale_r_proto=0
18050 ;;
18051 esac
18052 ;;
18053*) setlocale_r_proto=0
18054 ;;
18055esac
18056
18057: see if setnetent exists
18058set setnetent d_setnent
18059eval $inlibc
18060
18061: see if setnetent_r exists
18062set setnetent_r d_setnetent_r
18063eval $inlibc
18064case "$d_setnetent_r" in
18065"$define")
18066 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18067 case "$d_setnetent_r_proto:$usethreads" in
18068 ":define") d_setnetent_r_proto=define
18069 set d_setnetent_r_proto setnetent_r $hdrs
18070 eval $hasproto ;;
18071 *) ;;
18072 esac
18073 case "$d_setnetent_r_proto" in
18074 define)
18075 case "$setnetent_r_proto" in
18076 ''|0) try='int setnetent_r(int, struct netent_data*);'
18077 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18078 esac
18079 case "$setnetent_r_proto" in
18080 ''|0) try='void setnetent_r(int, struct netent_data*);'
18081 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18082 esac
18083 case "$setnetent_r_proto" in
18084 ''|0) d_setnetent_r=undef
18085 setnetent_r_proto=0
18086 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18087 * ) case "$setnetent_r_proto" in
18088 REENTRANT_PROTO*) ;;
18089 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18090 esac
18091 echo "Prototype: $try" ;;
18092 esac
18093 ;;
18094 *) case "$usethreads" in
18095 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18096 esac
18097 d_setnetent_r=undef
18098 setnetent_r_proto=0
18099 ;;
18100 esac
18101 ;;
18102*) setnetent_r_proto=0
18103 ;;
18104esac
18105
18106: see if setprotoent exists
18107set setprotoent d_setpent
18108eval $inlibc
18109
18110: see if setpgid exists
18111set setpgid d_setpgid
18112eval $inlibc
18113
18114: see if setpgrp2 exists
18115set setpgrp2 d_setpgrp2
18116eval $inlibc
18117
18118: see if setpriority exists
18119set setpriority d_setprior
18120eval $inlibc
18121
18122: see if setproctitle exists
18123set setproctitle d_setproctitle
18124eval $inlibc
18125
18126: see if setprotoent_r exists
18127set setprotoent_r d_setprotoent_r
18128eval $inlibc
18129case "$d_setprotoent_r" in
18130"$define")
18131 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18132 case "$d_setprotoent_r_proto:$usethreads" in
18133 ":define") d_setprotoent_r_proto=define
18134 set d_setprotoent_r_proto setprotoent_r $hdrs
18135 eval $hasproto ;;
18136 *) ;;
18137 esac
18138 case "$d_setprotoent_r_proto" in
18139 define)
18140 case "$setprotoent_r_proto" in
18141 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18142 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18143 esac
18144 case "$setprotoent_r_proto" in
18145 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18146 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18147 esac
18148 case "$setprotoent_r_proto" in
18149 ''|0) d_setprotoent_r=undef
18150 setprotoent_r_proto=0
18151 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18152 * ) case "$setprotoent_r_proto" in
18153 REENTRANT_PROTO*) ;;
18154 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18155 esac
18156 echo "Prototype: $try" ;;
18157 esac
18158 ;;
18159 *) case "$usethreads" in
18160 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18161 esac
18162 d_setprotoent_r=undef
18163 setprotoent_r_proto=0
18164 ;;
18165 esac
18166 ;;
18167*) setprotoent_r_proto=0
18168 ;;
18169esac
18170
18171: see if setpwent exists
18172set setpwent d_setpwent
18173eval $inlibc
18174
18175: see if setpwent_r exists
18176set setpwent_r d_setpwent_r
18177eval $inlibc
18178case "$d_setpwent_r" in
18179"$define")
18180 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18181 case "$d_setpwent_r_proto:$usethreads" in
18182 ":define") d_setpwent_r_proto=define
18183 set d_setpwent_r_proto setpwent_r $hdrs
18184 eval $hasproto ;;
18185 *) ;;
18186 esac
18187 case "$d_setpwent_r_proto" in
18188 define)
18189 case "$setpwent_r_proto" in
18190 ''|0) try='int setpwent_r(FILE**);'
18191 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18192 esac
18193 case "$setpwent_r_proto" in
18194 ''|0) try='void setpwent_r(FILE**);'
18195 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18196 esac
18197 case "$setpwent_r_proto" in
18198 ''|0) d_setpwent_r=undef
18199 setpwent_r_proto=0
18200 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18201 * ) case "$setpwent_r_proto" in
18202 REENTRANT_PROTO*) ;;
18203 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18204 esac
18205 echo "Prototype: $try" ;;
18206 esac
18207 ;;
18208 *) case "$usethreads" in
18209 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18210 esac
18211 d_setpwent_r=undef
18212 setpwent_r_proto=0
18213 ;;
18214 esac
18215 ;;
18216*) setpwent_r_proto=0
18217 ;;
18218esac
18219
18220: see if setregid exists
18221set setregid d_setregid
18222eval $inlibc
18223set setresgid d_setresgid
18224eval $inlibc
18225
18226: see if setreuid exists
18227set setreuid d_setreuid
18228eval $inlibc
18229set setresuid d_setresuid
18230eval $inlibc
18231
18232: see if setrgid exists
18233set setrgid d_setrgid
18234eval $inlibc
18235
18236: see if setruid exists
18237set setruid d_setruid
18238eval $inlibc
18239
18240: see if setservent exists
18241set setservent d_setsent
18242eval $inlibc
18243
18244: see if setservent_r exists
18245set setservent_r d_setservent_r
18246eval $inlibc
18247case "$d_setservent_r" in
18248"$define")
18249 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18250 case "$d_setservent_r_proto:$usethreads" in
18251 ":define") d_setservent_r_proto=define
18252 set d_setservent_r_proto setservent_r $hdrs
18253 eval $hasproto ;;
18254 *) ;;
18255 esac
18256 case "$d_setservent_r_proto" in
18257 define)
18258 case "$setservent_r_proto" in
18259 ''|0) try='int setservent_r(int, struct servent_data*);'
18260 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18261 esac
18262 case "$setservent_r_proto" in
18263 ''|0) try='void setservent_r(int, struct servent_data*);'
18264 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18265 esac
18266 case "$setservent_r_proto" in
18267 ''|0) d_setservent_r=undef
18268 setservent_r_proto=0
18269 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18270 * ) case "$setservent_r_proto" in
18271 REENTRANT_PROTO*) ;;
18272 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18273 esac
18274 echo "Prototype: $try" ;;
18275 esac
18276 ;;
18277 *) case "$usethreads" in
18278 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18279 esac
18280 d_setservent_r=undef
18281 setservent_r_proto=0
18282 ;;
18283 esac
18284 ;;
18285*) setservent_r_proto=0
18286 ;;
18287esac
18288
18289: see if setsid exists
18290set setsid d_setsid
18291eval $inlibc
18292
18293: see if setvbuf exists
18294set setvbuf d_setvbuf
18295eval $inlibc
18296
18297: see if shmctl exists
18298set shmctl d_shmctl
18299eval $inlibc
18300
18301: see if shmget exists
18302set shmget d_shmget
18303eval $inlibc
18304
18305: see if shmat exists
18306set shmat d_shmat
18307eval $inlibc
18308: see what shmat returns
18309case "$d_shmat" in
18310"$define")
18311 $cat >shmat.c <<'END'
18312#include <sys/shm.h>
18313void *shmat();
18314END
18315 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18316 shmattype='void *'
18317 else
18318 shmattype='char *'
18319 fi
18320 echo "and it returns ($shmattype)." >&4
18321 : see if a prototype for shmat is available
18322 xxx=`./findhdr sys/shm.h`
18323 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18324 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18325 val="$define"
18326 else
18327 val="$undef"
18328 fi
18329 $rm -f shmat.[co]
18330 ;;
18331*)
18332 val="$undef"
18333 ;;
18334esac
18335set d_shmatprototype
18336eval $setvar
18337
18338: see if shmdt exists
18339set shmdt d_shmdt
18340eval $inlibc
18341
18342: see how much of the 'shm*(2)' library is present.
18343h_shm=true
18344echo " "
18345case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18346*"$undef"*) h_shm=false;;
18347esac
18348case "$osname" in
18349freebsd)
18350 case "`ipcs 2>&1`" in
18351 "SVID shared memory"*"not configured"*)
18352 echo "Your $osname does not have the shm*(2) configured." >&4
18353 h_shm=false
18354 val="$undef"
18355 set shmctl d_shmctl
18356 eval $setvar
18357 set shmget d_shmget
18358 eval $setvar
18359 set shmat d_shmat
18360 eval $setvar
18361 set shmdt d_shmdt
18362 eval $setvar
18363 ;;
18364 esac
18365 ;;
18366esac
18367: we could also check for sys/ipc.h ...
18368if $h_shm && $test `./findhdr sys/shm.h`; then
18369 echo "You have the full shm*(2) library." >&4
18370 val="$define"
18371else
18372 echo "You don't have the full shm*(2) library." >&4
18373 val="$undef"
18374fi
18375set d_shm
18376eval $setvar
18377
18378: see if we have sigaction
18379echo " "
18380if set sigaction val -f d_sigaction; eval $csym; $val; then
18381 echo 'sigaction() found.' >&4
18382 $cat > try.c <<EOP
18383#include <stdio.h>
18384#include <sys/types.h>
18385#include <signal.h>
18386#$i_stdlib I_STDLIB
18387#ifdef I_STDLIB
18388#include <stdlib.h>
18389#endif
18390int main()
18391{
18392 struct sigaction act, oact;
18393 act.sa_flags = 0;
18394 oact.sa_handler = 0;
18395 /* so that act and oact are used */
18396 exit(act.sa_flags == 0 && oact.sa_handler == 0);
18397}
18398EOP
18399 set try
18400 if eval $compile_ok; then
18401 val="$define"
18402 else
18403 echo "But you don't seem to have a usable struct sigaction." >&4
18404 val="$undef"
18405 fi
18406else
18407 echo 'sigaction NOT found.' >&4
18408 val="$undef"
18409fi
18410set d_sigaction; eval $setvar
18411$rm_try
18412
18413: see what type pids are declared as in the kernel
18414rp="What is the type of process ids on this system?"
18415set pid_t pidtype int stdio.h sys/types.h
18416eval $typedef_ask
18417
18418: see what type uids are declared as in the kernel
18419echo " "
18420echo "Looking for the type for user ids returned by getuid()."
18421set uid_t uidtype xxx stdio.h sys/types.h
18422eval $typedef
18423case "$uidtype" in
18424xxx)
18425 xxx=`./findhdr sys/user.h`
18426 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18427 case $1 in
18428 unsigned) dflt="$1 $2" ;;
18429 *) dflt="$1" ;;
18430 esac
18431 ;;
18432*) dflt="$uidtype";;
18433esac
18434case "$uidtype" in
18435uid_t) echo "uid_t found." ;;
18436*) rp="What is the type for user ids returned by getuid()?"
18437 . ./myread
18438 uidtype="$ans"
18439 ;;
18440esac
18441
18442: Define hasfield_t macro for Configure internal use
18443hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18444while $test $# -ge 2; do
18445 case "$1" in
18446 $define) echo "#include <$2>";;
18447 esac ;
18448 shift 2;
18449done > try.c;
18450echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18451set try;
18452if eval $compile; then
18453 val="$define";
18454else
18455 val="$undef";
18456fi;
18457set $varname;
18458eval $setvar;
18459$rm_try'
18460
18461: see what siginfo fields we have
18462case "$d_sigaction" in
18463"$define")
18464 echo "Checking if your siginfo_t has si_errno field...">&4
18465 set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18466 eval $hasfield_t;
18467
18468 echo "Checking if your siginfo_t has si_pid field...">&4
18469 set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18470 eval $hasfield_t;
18471
18472 echo "Checking if your siginfo_t has si_uid field...">&4
18473 set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18474 eval $hasfield_t;
18475
18476 echo "Checking if your siginfo_t has si_addr field...">&4
18477 set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18478 eval $hasfield_t;
18479
18480 echo "Checking if your siginfo_t has si_status field...">&4
18481 set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18482 eval $hasfield_t;
18483
18484 echo "Checking if your siginfo_t has si_band field...">&4
18485 set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18486 eval $hasfield_t;
18487
18488 echo "Checking if your siginfo_t has si_value field...">&4
18489 set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18490 eval $hasfield_t;
18491
18492 echo "Checking if your siginfo_t has si_fd field...">&4
18493 set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18494 eval $hasfield_t;
18495
18496 ;;
18497*)
18498 d_siginfo_si_errno="$undef"
18499 d_siginfo_si_pid="$undef"
18500 d_siginfo_si_uid="$undef"
18501 d_siginfo_si_addr="$undef"
18502 d_siginfo_si_status="$undef"
18503 d_siginfo_si_band="$undef"
18504 d_siginfo_si_value="$undef"
18505 d_siginfo_si_fd="$undef"
18506 ;;
18507esac
18508
18509: see if this is a sunmath.h system
18510set sunmath.h i_sunmath
18511eval $inhdr
18512
18513: see if signbit exists
18514$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18515$cat >try.c <<EOCP
18516#$i_sunmath I_SUNMATH
18517#include <math.h>
18518#ifdef I_SUNMATH /* Solaris special math library */
18519# include <sunmath.h>
18520#endif
18521#define NV $nvtype
18522int main(int argc, char **argv)
18523{
18524 NV x = 0.0;
18525 NV y = -1.0;
18526 if ((signbit(x) == 0) && (signbit(y) != 0))
18527 return 0;
18528 else
18529 return 1;
18530}
18531EOCP
18532val="$undef"
18533set try
18534if eval $compile; then
18535 if $run ./try; then
18536 $echo "Yes." >&4
18537 val="$define"
18538 else
18539 $echo "Signbit seems to be available, but doesn't work as I expected."
18540 $echo "I won't use it." >&4
18541 val="$undef"
18542 fi
18543else
18544 $echo "Nope." >&4
18545 dflt="$undef"
18546fi
18547set d_signbit
18548eval $setvar
18549$rm_try
18550
18551: see if sigprocmask exists
18552set sigprocmask d_sigprocmask
18553eval $inlibc
18554
18555: see if sigsetjmp exists
18556echo " "
18557case "$d_sigsetjmp" in
18558'')
18559 $cat >try.c <<EOP
18560#include <setjmp.h>
18561#$i_stdlib I_STDLIB
18562#ifdef I_STDLIB
18563#include <stdlib.h>
18564#endif
18565sigjmp_buf env;
18566int set = 1;
18567int main()
18568{
18569 if (sigsetjmp(env,1))
18570 exit(set);
18571 set = 0;
18572 siglongjmp(env, 1);
18573 exit(1);
18574}
18575EOP
18576 set try
18577 if eval $compile; then
18578 if $run ./try >/dev/null 2>&1; then
18579 echo "POSIX sigsetjmp found." >&4
18580 val="$define"
18581 else
18582 $cat >&4 <<EOM
18583Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18584I'll ignore them.
18585EOM
18586 val="$undef"
18587 fi
18588 else
18589 echo "sigsetjmp not found." >&4
18590 val="$undef"
18591 fi
18592 ;;
18593*) val="$d_sigsetjmp"
18594 case "$d_sigsetjmp" in
18595 $define) echo "POSIX sigsetjmp found." >&4;;
18596 $undef) echo "sigsetjmp not found." >&4;;
18597 esac
18598 ;;
18599esac
18600set d_sigsetjmp
18601eval $setvar
18602$rm_try
18603
18604: see if snprintf exists
18605set snprintf d_snprintf
18606eval $inlibc
18607
18608: see if vsnprintf exists
18609set vsnprintf d_vsnprintf
18610eval $inlibc
18611
18612case "$d_snprintf-$d_vsnprintf" in
18613"$define-$define")
18614 $cat <<EOM
18615Checking whether your snprintf() and vsnprintf() work okay...
18616EOM
18617 $cat >try.c <<'EOCP'
18618/* v?snprintf testing logic courtesy of Russ Allbery.
18619 * According to C99:
18620 * - if the buffer is too short it still must be \0-terminated
18621 * - if the buffer is too short the potentially required length
18622 * must be returned and not -1
18623 * - if the buffer is NULL the potentially required length
18624 * must be returned and not -1 or core dump
18625 */
18626#include <stdio.h>
18627#include <stdarg.h>
18628
18629char buf[2];
18630
18631int test (char *format, ...)
18632{
18633 va_list args;
18634 int count;
18635
18636 va_start (args, format);
18637 count = vsnprintf (buf, sizeof buf, format, args);
18638 va_end (args);
18639 return count;
18640}
18641
18642int main ()
18643{
18644 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18645 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18646}
18647EOCP
18648 set try
18649 if eval $compile; then
18650 `$run ./try`
18651 case "$?" in
18652 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18653 *) cat <<EOM >&4
18654Your snprintf() and snprintf() don't seem to be working okay.
18655EOM
18656 d_snprintf="$undef"
18657 d_vsnprintf="$undef"
18658 ;;
18659 esac
18660 else
18661 echo "(I can't seem to compile the test program--assuming they don't)"
18662 d_snprintf="$undef"
18663 d_vsnprintf="$undef"
18664 fi
18665 $rm_try
18666 ;;
18667esac
18668
18669: see if sockatmark exists
18670set sockatmark d_sockatmark
18671eval $inlibc
18672
18673: see if prototype for sockatmark is available
18674echo " "
18675set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18676eval $hasproto
18677
18678: see if socks5_init exists
18679set socks5_init d_socks5_init
18680eval $inlibc
18681
18682: see if srand48_r exists
18683set srand48_r d_srand48_r
18684eval $inlibc
18685case "$d_srand48_r" in
18686"$define")
18687 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18688 case "$d_srand48_r_proto:$usethreads" in
18689 ":define") d_srand48_r_proto=define
18690 set d_srand48_r_proto srand48_r $hdrs
18691 eval $hasproto ;;
18692 *) ;;
18693 esac
18694 case "$d_srand48_r_proto" in
18695 define)
18696 case "$srand48_r_proto" in
18697 ''|0) try='int srand48_r(long, struct drand48_data*);'
18698 ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18699 esac
18700 case "$srand48_r_proto" in
18701 ''|0) d_srand48_r=undef
18702 srand48_r_proto=0
18703 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18704 * ) case "$srand48_r_proto" in
18705 REENTRANT_PROTO*) ;;
18706 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18707 esac
18708 echo "Prototype: $try" ;;
18709 esac
18710 ;;
18711 *) case "$usethreads" in
18712 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18713 esac
18714 d_srand48_r=undef
18715 srand48_r_proto=0
18716 ;;
18717 esac
18718 ;;
18719*) srand48_r_proto=0
18720 ;;
18721esac
18722
18723: see if srandom_r exists
18724set srandom_r d_srandom_r
18725eval $inlibc
18726case "$d_srandom_r" in
18727"$define")
18728 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18729 case "$d_srandom_r_proto:$usethreads" in
18730 ":define") d_srandom_r_proto=define
18731 set d_srandom_r_proto srandom_r $hdrs
18732 eval $hasproto ;;
18733 *) ;;
18734 esac
18735 case "$d_srandom_r_proto" in
18736 define)
18737 case "$srandom_r_proto" in
18738 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18739 ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18740 esac
18741 case "$srandom_r_proto" in
18742 ''|0) d_srandom_r=undef
18743 srandom_r_proto=0
18744 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18745 * ) case "$srandom_r_proto" in
18746 REENTRANT_PROTO*) ;;
18747 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18748 esac
18749 echo "Prototype: $try" ;;
18750 esac
18751 ;;
18752 *) case "$usethreads" in
18753 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18754 esac
18755 d_srandom_r=undef
18756 srandom_r_proto=0
18757 ;;
18758 esac
18759 ;;
18760*) srandom_r_proto=0
18761 ;;
18762esac
18763
18764: see if prototype for setresgid is available
18765echo " "
18766set d_sresgproto setresgid $i_unistd unistd.h
18767eval $hasproto
18768
18769: see if prototype for setresuid is available
18770echo " "
18771set d_sresuproto setresuid $i_unistd unistd.h
18772eval $hasproto
18773
18774: see if stat exists
18775set stat d_stat
18776eval $inlibc
18777
18778: see if sys/stat.h is available
18779set sys/stat.h i_sysstat
18780eval $inhdr
18781
18782: see if stat knows about block sizes
18783echo " "
18784echo "Checking to see if your struct stat has st_blocks field..." >&4
18785set d_statblks stat st_blocks $i_sysstat sys/stat.h
18786eval $hasfield
18787
18788: see if this is a sys/vfs.h system
18789set sys/vfs.h i_sysvfs
18790eval $inhdr
18791
18792: see if this is a sys/statfs.h system
18793set sys/statfs.h i_sysstatfs
18794eval $inhdr
18795
18796: Check for statfs_s
18797echo " "
18798echo "Checking to see if your system supports struct statfs..." >&4
18799set 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
18800eval $hasstruct
18801case "$d_statfs_s" in
18802"$define") echo "Yes, it does." ;;
18803*) echo "No, it doesn't." ;;
18804esac
18805
18806: see if struct statfs knows about f_flags
18807case "$d_statfs_s" in
18808define)
18809 echo " "
18810 echo "Checking to see if your struct statfs has f_flags field..." >&4
18811 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
18812 eval $hasfield
18813 ;;
18814*) val="$undef"
18815 set d_statfs_f_flags
18816 eval $setvar
18817 ;;
18818esac
18819case "$d_statfs_f_flags" in
18820"$define") echo "Yes, it does." ;;
18821*) echo "No, it doesn't." ;;
18822esac
18823
18824: see what flavor, if any, of static inline is supported
18825echo " "
18826echo "Checking to see if your system supports static inline..."
18827$cat > try.c <<'EOCP'
18828#include <stdlib.h>
18829extern int f_via_a(int x);
18830extern int f_via_b(int x);
18831int main(int argc, char **argv)
18832{
18833 int y;
18834
18835 y = f_via_a(0);
18836#ifdef USE_B
18837 y = f_via_b(0);
18838#endif
18839 if (y == 42) {
18840 return EXIT_SUCCESS;
18841 }
18842 else {
18843 return EXIT_FAILURE;
18844 }
18845}
18846EOCP
18847$cat > a.c <<'EOCP'
18848static INLINE int f(int x) {
18849 int y;
18850 y = x + 42;
18851 return y;
18852}
18853
18854int f_via_a(int x)
18855{
18856 return f(x);
18857}
18858EOCP
18859$cat > b.c <<'EOCP'
18860extern int f(int x);
18861
18862int f_via_b(int x)
18863{
18864 return f(x);
18865}
18866EOCP
18867
18868# Respect a hint (or previous) value for perl_static_inline, if there is one.
18869case "$perl_static_inline" in
18870'') # Check the various possibilities, and break out on success.
18871 # For gcc, prefer __inline__, which will still permit
18872 # cflags.SH to add in -ansi.
18873 case "$gccversion" in
18874 '') xxx="inline __inline__ __inline _inline";;
18875 *) xxx="__inline__ inline __inline _inline";;
18876 esac
18877 for inline in $xxx; do
18878 set try -DINLINE=$inline a.c
18879 if eval $compile && $run ./try; then
18880 # Now make sure there is no external linkage of static
18881 # functions
18882 set try -DINLINE=$inline -DUSE_B a.c b.c
18883 if eval $compile && $run ./try; then
18884 $echo "Your compiler supports static $inline, " >&4
18885 $echo "but it also creates an external definition," >&4
18886 $echo "so I won't use it." >&4
18887 val=$undef
18888 else
18889 $echo "Your compiler supports static $inline." >&4
18890 val=$define
18891 perl_static_inline="static $inline";
18892 break;
18893 fi
18894 else
18895 $echo "Your compiler does NOT support static $inline." >&4
18896 val="$undef"
18897 fi
18898 done
18899 ;;
18900*inline*) # Some variant of inline exists.
18901 echo "Keeping your $hint value of $perl_static_inline."
18902 val=$define
18903 ;;
18904static) # No inline capabilities
18905 echo "Keeping your $hint value of $perl_static_inline."
18906 val=$undef
18907 ;;
18908*) # Unrecognized previous value -- blindly trust the supplied
18909 # value and hope it makes sense. Use old value for
18910 # d_static_inline, if there is one.
18911 echo "Keeping your $hint value of $perl_static_inline."
18912 case "$d_static_inline" in
18913 '') val=$define ;;
18914 *) val=$d_static_inline ;;
18915 esac
18916 ;;
18917esac
18918# Fallback to plain 'static' if nothing worked.
18919case "$perl_static_inline" in
18920'')
18921 perl_static_inline="static"
18922 val=$undef
18923 ;;
18924esac
18925set d_static_inline
18926eval $setvar
18927$rm -f a.[co] b.[co]
18928$rm_try
18929
18930: Check stream access
18931$cat >&4 <<EOM
18932Checking how to access stdio streams by file descriptor number...
18933EOM
18934case "$stdio_stream_array" in
18935'') $cat >try.c <<EOCP
18936#include <stdio.h>
18937int main() {
18938 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18939 printf("yes\n");
18940}
18941EOCP
18942 for s in _iob __iob __sF
18943 do
18944 set try -DSTDIO_STREAM_ARRAY=$s
18945 if eval $compile; then
18946 case "`$run ./try`" in
18947 yes) stdio_stream_array=$s; break ;;
18948 esac
18949 fi
18950 done
18951 $rm_try
18952esac
18953case "$stdio_stream_array" in
18954'') $cat >&4 <<EOM
18955I can't figure out how to access stdio streams by file descriptor number.
18956EOM
18957 d_stdio_stream_array="$undef"
18958 ;;
18959*) $cat >&4 <<EOM
18960You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18961EOM
18962 d_stdio_stream_array="$define"
18963 ;;
18964esac
18965
18966: see if strcoll exists
18967set strcoll d_strcoll
18968eval $inlibc
18969
18970: see if strerror_l exists
18971set strerror_l d_strerror_l
18972eval $inlibc
18973
18974: see if strerror_r exists
18975set strerror_r d_strerror_r
18976eval $inlibc
18977case "$d_strerror_r" in
18978"$define")
18979 hdrs="$i_systypes sys/types.h define stdio.h define string.h"
18980 case "$d_strerror_r_proto:$usethreads" in
18981 ":define") d_strerror_r_proto=define
18982 set d_strerror_r_proto strerror_r $hdrs
18983 eval $hasproto ;;
18984 *) ;;
18985 esac
18986 case "$d_strerror_r_proto" in
18987 define)
18988 case "$strerror_r_proto" in
18989 ''|0) try='int strerror_r(int, char*, size_t);'
18990 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18991 esac
18992 case "$strerror_r_proto" in
18993 ''|0) try='int strerror_r(int, char*, int);'
18994 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18995 esac
18996 case "$strerror_r_proto" in
18997 ''|0) try='char* strerror_r(int, char*, size_t);'
18998 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18999 esac
19000 case "$strerror_r_proto" in
19001 ''|0) d_strerror_r=undef
19002 strerror_r_proto=0
19003 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19004 * ) case "$strerror_r_proto" in
19005 REENTRANT_PROTO*) ;;
19006 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19007 esac
19008 echo "Prototype: $try" ;;
19009 esac
19010 ;;
19011 *) case "$usethreads" in
19012 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19013 esac
19014 d_strerror_r=undef
19015 strerror_r_proto=0
19016 ;;
19017 esac
19018 ;;
19019*) strerror_r_proto=0
19020 ;;
19021esac
19022
19023: see if strftime exists
19024set strftime d_strftime
19025eval $inlibc
19026
19027: see if strlcat exists
19028: We need both a prototype in string.h and the symbol in libc.
19029echo " "
19030d_strlcat_proto=''
19031xx1="#$d_gnulibc HAS_GNULIBC"
19032xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19033xx3='# define _GNU_SOURCE'
19034xx4='#endif'
19035set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19036eval $hasproto
19037case "$d_strlcat_proto" in
19038 define) # see if strlcat exists
19039 set strlcat d_strlcat
19040 eval $inlibc
19041 ;;
19042 *) val=$undef
19043 set d_strlcat
19044 eval $setvar
19045 ;;
19046esac
19047
19048: see if strlcpy exists
19049: We need both a prototype in string.h and the symbol in libc.
19050echo " "
19051d_strlcpy_proto=''
19052xx1="#$d_gnulibc HAS_GNULIBC"
19053xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19054xx3='# define _GNU_SOURCE'
19055xx4='#endif'
19056set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19057eval $hasproto
19058case "$d_strlcpy_proto" in
19059 define) # see if strlcpy exists
19060 set strlcpy d_strlcpy
19061 eval $inlibc
19062 ;;
19063 *) val=$undef
19064 set d_strlcpy
19065 eval $setvar
19066 ;;
19067esac
19068
19069: see if strnlen exists
19070set strnlen d_strnlen
19071eval $inlibc
19072
19073: see if strtod exists
19074set strtod d_strtod
19075eval $inlibc
19076
19077: see if strtod_l exists
19078set strtod_l d_strtod_l
19079eval $inlibc
19080
19081: see if strtol exists
19082set strtol d_strtol
19083eval $inlibc
19084
19085: see if strtold exists
19086set strtold d_strtold
19087eval $inlibc
19088
19089: see if strtold_l exists
19090set strtold_l d_strtold_l
19091eval $inlibc
19092
19093: see if strtoll exists
19094set strtoll d_strtoll
19095eval $inlibc
19096
19097case "$d_longlong-$d_strtoll" in
19098"$define-$define")
19099 $cat <<EOM
19100Checking whether your strtoll() works okay...
19101EOM
19102 $cat >try.c <<'EOCP'
19103#include <errno.h>
19104#ifdef __hpux
19105#define strtoll __strtoll
19106#endif
19107#ifdef __EMX__
19108#define strtoll _strtoll
19109#endif
19110#include <stdio.h>
19111#include <stdlib.h>
19112static int bad = 0;
19113void check(const char *s, long long ell, int een) {
19114 long long gll;
19115 errno = 0;
19116 gll = strtoll(s, 0, 10);
19117 if (!((gll == ell) && (errno == een)))
19118 bad++;
19119}
19120int main() {
19121 check(" 1", 1LL, 0);
19122 check(" 0", 0LL, 0);
19123 check("-1", -1LL, 0);
19124 check("-9223372036854775808", -9223372036854775808LL, 0);
19125 check("-9223372036854775808", -9223372036854775808LL, 0);
19126 check(" 9223372036854775807", 9223372036854775807LL, 0);
19127 check("-9223372036854775808", -9223372036854775808LL, 0);
19128 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
19129 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19130 if (!bad)
19131 printf("ok\n");
19132}
19133EOCP
19134 set try
19135 if eval $compile; then
19136 yyy=`$run ./try`
19137 case "$yyy" in
19138 ok) echo "Your strtoll() seems to be working okay." ;;
19139 *) cat <<EOM >&4
19140Your strtoll() doesn't seem to be working okay.
19141EOM
19142 d_strtoll="$undef"
19143 ;;
19144 esac
19145 else
19146 echo "(I can't seem to compile the test program--assuming it doesn't)"
19147 d_strtoll="$undef"
19148 fi
19149 ;;
19150esac
19151
19152: see if strtoq exists
19153set strtoq d_strtoq
19154eval $inlibc
19155
19156: see if strtoul exists
19157set strtoul d_strtoul
19158eval $inlibc
19159
19160case "$d_strtoul" in
19161"$define")
19162 $cat <<EOM
19163Checking whether your strtoul() works okay...
19164EOM
19165 $cat >try.c <<'EOCP'
19166#include <stdlib.h>
19167#include <errno.h>
19168#include <stdio.h>
19169static int bad = 0;
19170void check(const char *s, unsigned long eul, int een) {
19171 unsigned long gul;
19172 errno = 0;
19173 gul = strtoul(s, 0, 10);
19174 if (!((gul == eul) && (errno == een)))
19175 bad++;
19176}
19177int main() {
19178 check(" 1", 1L, 0);
19179 check(" 0", 0L, 0);
19180EOCP
19181 case "$longsize" in
19182 8)
19183 $cat >>try.c <<'EOCP'
19184 check("18446744073709551615", 18446744073709551615UL, 0);
19185 check("18446744073709551616", 18446744073709551615UL, ERANGE);
19186#if 0 /* strtoul() for /^-/ strings is undefined. */
19187 check("-1", 18446744073709551615UL, 0);
19188 check("-18446744073709551614", 2, 0);
19189 check("-18446744073709551615", 1, 0);
19190 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19191 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19192#endif
19193EOCP
19194 ;;
19195 4)
19196 $cat >>try.c <<'EOCP'
19197 check("4294967295", 4294967295UL, 0);
19198 check("4294967296", 4294967295UL, ERANGE);
19199#if 0 /* strtoul() for /^-/ strings is undefined. */
19200 check("-1", 4294967295UL, 0);
19201 check("-4294967294", 2, 0);
19202 check("-4294967295", 1, 0);
19203 check("-4294967296", 4294967295UL, ERANGE);
19204 check("-4294967297", 4294967295UL, ERANGE);
19205#endif
19206EOCP
19207 ;;
19208 *)
19209: Should we write these tests to be more portable by sprintf-ing
19210: ~0 and then manipulating that char string as input for strtol?
19211 ;;
19212 esac
19213 $cat >>try.c <<'EOCP'
19214 if (!bad)
19215 printf("ok\n");
19216 return 0;
19217}
19218EOCP
19219 set try
19220 if eval $compile; then
19221 case "`$run ./try`" in
19222 ok) echo "Your strtoul() seems to be working okay." ;;
19223 *) cat <<EOM >&4
19224Your strtoul() doesn't seem to be working okay.
19225EOM
19226 d_strtoul="$undef"
19227 ;;
19228 esac
19229 else
19230 echo "(I can't seem to compile the test program--assuming it doesn't)"
19231 d_strtoul="$undef"
19232 fi
19233 ;;
19234esac
19235
19236: see if strtoull exists
19237set strtoull d_strtoull
19238eval $inlibc
19239
19240case "$d_longlong-$d_strtoull" in
19241"$define-$define")
19242 $cat <<EOM
19243Checking whether your strtoull() works okay...
19244EOM
19245 $cat >try.c <<'EOCP'
19246#include <stdlib.h>
19247#include <errno.h>
19248#ifdef __hpux
19249#define strtoull __strtoull
19250#endif
19251#include <stdio.h>
19252static int bad = 0;
19253void check(const char *s, long long eull, int een) {
19254 long long gull;
19255 errno = 0;
19256 gull = strtoull(s, 0, 10);
19257 if (!((gull == eull) && (errno == een)))
19258 bad++;
19259}
19260int main() {
19261 check(" 1", 1LL, 0);
19262 check(" 0", 0LL, 0);
19263 check("18446744073709551615", 18446744073709551615ULL, 0);
19264 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
19265#if 0 /* strtoull() for /^-/ strings is undefined. */
19266 check("-1", 18446744073709551615ULL, 0);
19267 check("-18446744073709551614", 2LL, 0);
19268 check("-18446744073709551615", 1LL, 0);
19269 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19270 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19271#endif
19272 if (!bad)
19273 printf("ok\n");
19274}
19275EOCP
19276 set try
19277 if eval $compile; then
19278 case "`$run ./try`" in
19279 ok) echo "Your strtoull() seems to be working okay." ;;
19280 *) cat <<EOM >&4
19281Your strtoull() doesn't seem to be working okay.
19282EOM
19283 d_strtoull="$undef"
19284 ;;
19285 esac
19286 else
19287 echo "(I can't seem to compile the test program--assuming it doesn't)"
19288 d_strtoull="$undef"
19289 fi
19290 ;;
19291esac
19292
19293: see if strtouq exists
19294set strtouq d_strtouq
19295eval $inlibc
19296
19297case "$d_strtouq" in
19298"$define")
19299 $cat <<EOM
19300Checking whether your strtouq() works okay...
19301EOM
19302 $cat >try.c <<'EOCP'
19303#include <stdlib.h>
19304#include <errno.h>
19305#include <stdio.h>
19306static int bad = 0;
19307void check(const char *s, unsigned long long eull, int een) {
19308 unsigned long long gull;
19309 errno = 0;
19310 gull = strtouq(s, 0, 10);
19311 if (!((gull == eull) && (errno == een)))
19312 bad++;
19313}
19314int main() {
19315 check(" 1", 1LL, 0);
19316 check(" 0", 0LL, 0);
19317 check("18446744073709551615", 18446744073709551615ULL, 0);
19318 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
19319#if 0 /* strtouq() for /^-/ strings is undefined. */
19320 check("-1", 18446744073709551615ULL, 0);
19321 check("-18446744073709551614", 2LL, 0);
19322 check("-18446744073709551615", 1LL, 0);
19323 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19324 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19325#endif
19326 if (!bad)
19327 printf("ok\n");
19328 return 0;
19329}
19330EOCP
19331 set try
19332 if eval $compile; then
19333 case "`$run ./try`" in
19334 ok) echo "Your strtouq() seems to be working okay." ;;
19335 *) cat <<EOM >&4
19336Your strtouq() doesn't seem to be working okay.
19337EOM
19338 d_strtouq="$undef"
19339 ;;
19340 esac
19341 else
19342 echo "(I can't seem to compile the test program--assuming it doesn't)"
19343 d_strtouq="$undef"
19344 fi
19345 ;;
19346esac
19347
19348: see if strxfrm exists
19349set strxfrm d_strxfrm
19350eval $inlibc
19351
19352: see if symlink exists
19353set symlink d_symlink
19354eval $inlibc
19355
19356: see if syscall exists
19357set syscall d_syscall
19358eval $inlibc
19359
19360: see if prototype for syscall is available
19361echo " "
19362set d_syscallproto syscall $i_unistd unistd.h
19363eval $hasproto
19364
19365: see if sysconf exists
19366set sysconf d_sysconf
19367eval $inlibc
19368
19369: see if sys_errlist[] exists
19370echo " "
19371if test "X$d_syserrlst" = X; then
19372 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19373 echo "You have sys_errlist[], so we could roll our own strerror."
19374 d_syserrlst="$define"
19375 else
19376 echo "You don't have sys_errlist[], so strerror() is welcome."
19377 d_syserrlst="$undef"
19378 fi
19379fi
19380
19381: see if system exists
19382set system d_system
19383eval $inlibc
19384
19385: see if tcgetpgrp exists
19386set tcgetpgrp d_tcgetpgrp
19387eval $inlibc
19388
19389: see if tcsetpgrp exists
19390set tcsetpgrp d_tcsetpgrp
19391eval $inlibc
19392
19393: see if prototype for telldir is available
19394echo " "
19395set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19396eval $hasproto
19397
19398: see if tgamma exists
19399set tgamma d_tgamma
19400eval $inlibc
19401
19402: check for thread_safe_nl_langinfo_l item
19403$cat <<EOM
19404
19405Checking to see if you have nl_langinfo_l() and that it is thread-safe
19406EOM
19407$cat >try.c <<EOCP
19408#$i_stdlib I_STDLIB
19409#ifdef I_STDLIB
19410# include <stdlib.h>
19411#endif
19412#include <string.h>
19413#$i_langinfo I_LANGINFO
19414#ifdef I_LANGINFO
19415# include <langinfo.h>
19416#endif
19417#$i_pthread I_PTHREAD
19418#ifdef I_PTHREAD
19419# include <pthread.h>
19420#endif
19421#$i_locale I_LOCALE
19422#ifdef I_LOCALE
19423# include <locale.h>
19424#endif
19425
19426void *
19427thread_start(void * arg)
19428{
19429 nl_langinfo(RADIXCHAR);
19430}
19431
19432int main() {
19433 char * main_buffer;
19434 char save_main_buffer[1000];
19435 pthread_t subthread;
19436 pthread_attr_t attr;
19437
19438 main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19439
19440 /* If too large for our generous allowance, just assume we don't have
19441 * it. */
19442 if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19443 exit(1);
19444 }
19445
19446 strcpy(save_main_buffer, main_buffer);
19447
19448 if (pthread_attr_init(&attr) != 0) {
19449 exit(1);
19450 }
19451
19452 if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19453 exit(1);
19454 }
19455
19456 if (pthread_join(subthread, NULL) != 0) {
19457 exit(1);
19458 }
19459
19460 exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19461}
19462EOCP
19463case "$usethreads" in
19464 define)
19465 set try
19466 if eval $compile; then
19467 echo "Your system has nl_langinfo_l()..." >&4
19468 if $run ./try; then
19469 echo "and it is thread-safe (just as I'd hoped)." >&4
19470 d_thread_safe_nl_langinfo_l="$define"
19471 echo "$d_thread_safe_nl_langinfo_l" >&4
19472 else
19473 echo "but it isn't thread-safe, so we won't use it." >&4
19474 fi
19475 else
19476 echo "your system does not have nl_langinfo_l()" >&4
19477 fi
19478 ;;
19479 *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19480esac
19481if test X"$d_thread_safe_nl_langinfo_l" = X; then
19482 d_thread_safe_nl_langinfo_l="$undef"
19483fi
19484$rm_try
19485
19486: see if time exists
19487echo " "
19488if test "X$d_time" = X -o X"$timetype" = X; then
19489 if set time val -f d_time; eval $csym; $val; then
19490 echo 'time() found.' >&4
19491 val="$define"
19492 rp="What is the type returned by time() on this system?"
19493 set time_t timetype long stdio.h sys/types.h
19494 eval $typedef_ask
19495 else
19496 echo 'time() not found, hope that will do.' >&4
19497 val="$undef"
19498 timetype='int';
19499 fi
19500 set d_time
19501 eval $setvar
19502fi
19503
19504: see if timegm exists
19505set timegm d_timegm
19506eval $inlibc
19507
19508: see if this is a sys/times.h system
19509set sys/times.h i_systimes
19510eval $inhdr
19511
19512: see if times exists
19513echo " "
19514if set times val -f d_times; eval $csym; $val; then
19515 echo 'times() found.' >&4
19516 d_times="$define"
19517 inc=''
19518 case "$i_systimes" in
19519 "$define") inc='sys/times.h';;
19520 esac
19521 rp="What is the type returned by times() on this system?"
19522 set clock_t clocktype long stdio.h sys/types.h $inc
19523 eval $typedef_ask
19524else
19525 echo 'times() NOT found, hope that will do.' >&4
19526 d_times="$undef"
19527 clocktype='int'
19528fi
19529
19530: see if tmpnam_r exists
19531set tmpnam_r d_tmpnam_r
19532eval $inlibc
19533case "$d_tmpnam_r" in
19534"$define")
19535 hdrs="$i_systypes sys/types.h define stdio.h "
19536 case "$d_tmpnam_r_proto:$usethreads" in
19537 ":define") d_tmpnam_r_proto=define
19538 set d_tmpnam_r_proto tmpnam_r $hdrs
19539 eval $hasproto ;;
19540 *) ;;
19541 esac
19542 case "$d_tmpnam_r_proto" in
19543 define)
19544 case "$tmpnam_r_proto" in
19545 ''|0) try='char* tmpnam_r(char*);'
19546 ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19547 esac
19548 case "$tmpnam_r_proto" in
19549 ''|0) d_tmpnam_r=undef
19550 tmpnam_r_proto=0
19551 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19552 * ) case "$tmpnam_r_proto" in
19553 REENTRANT_PROTO*) ;;
19554 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19555 esac
19556 echo "Prototype: $try" ;;
19557 esac
19558 ;;
19559 *) case "$usethreads" in
19560 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19561 esac
19562 d_tmpnam_r=undef
19563 tmpnam_r_proto=0
19564 ;;
19565 esac
19566 ;;
19567*) tmpnam_r_proto=0
19568 ;;
19569esac
19570
19571: see if towlower exists
19572set towlower d_towlower
19573eval $inlibc
19574
19575: see if trunc exists
19576set trunc d_trunc
19577eval $inlibc
19578
19579: see if truncate exists
19580set truncate d_truncate
19581eval $inlibc
19582
19583: see if ttyname_r exists
19584set ttyname_r d_ttyname_r
19585eval $inlibc
19586case "$d_ttyname_r" in
19587"$define")
19588 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19589 case "$d_ttyname_r_proto:$usethreads" in
19590 ":define") d_ttyname_r_proto=define
19591 set d_ttyname_r_proto ttyname_r $hdrs
19592 eval $hasproto ;;
19593 *) ;;
19594 esac
19595 case "$d_ttyname_r_proto" in
19596 define)
19597 case "$ttyname_r_proto" in
19598 ''|0) try='int ttyname_r(int, char*, size_t);'
19599 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19600 esac
19601 case "$ttyname_r_proto" in
19602 ''|0) try='int ttyname_r(int, char*, int);'
19603 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19604 esac
19605 case "$ttyname_r_proto" in
19606 ''|0) try='char* ttyname_r(int, char*, int);'
19607 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19608 esac
19609 case "$ttyname_r_proto" in
19610 ''|0) d_ttyname_r=undef
19611 ttyname_r_proto=0
19612 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19613 * ) case "$ttyname_r_proto" in
19614 REENTRANT_PROTO*) ;;
19615 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19616 esac
19617 echo "Prototype: $try" ;;
19618 esac
19619 ;;
19620 *) case "$usethreads" in
19621 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19622 esac
19623 d_ttyname_r=undef
19624 ttyname_r_proto=0
19625 ;;
19626 esac
19627 ;;
19628*) ttyname_r_proto=0
19629 ;;
19630esac
19631
19632: see if tzname[] exists
19633echo " "
19634if set tzname val -a d_tzname; eval $csym; $val; then
19635 val="$define"
19636 echo 'tzname[] found.' >&4
19637else
19638 val="$undef"
19639 echo 'tzname[] NOT found.' >&4
19640fi
19641set d_tzname
19642eval $setvar
19643
19644: Check if is a multiplatform env
19645case "$osname" in
19646darwin) multiarch="$define" ;;
19647esac
19648case "$multiarch" in
19649''|[nN]*) multiarch="$undef" ;;
19650esac
19651
19652: check for ordering of bytes in a UV
19653echo " "
19654case "$multiarch" in
19655*$define*)
19656 $cat <<EOM
19657You seem to be doing a multiarchitecture build,
19658skipping the byteorder check.
19659
19660EOM
19661 byteorder='ffff'
19662 ;;
19663*)
19664 case "$byteorder" in
19665 '')
19666 $cat <<'EOM'
19667In the following, larger digits indicate more significance. A big-endian
19668machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19669little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19670machines may have weird orders like 3412. A Cray will report 87654321,
19671an Alpha will report 12345678. If the test program works the default is
19672probably right.
19673I'm now running the test program...
19674EOM
19675 $cat >try.c <<EOCP
19676#include <stdio.h>
19677#$i_stdlib I_STDLIB
19678#ifdef I_STDLIB
19679#include <stdlib.h>
19680#endif
19681#include <sys/types.h>
19682typedef $uvtype UV;
19683int main()
19684{
19685 int i;
19686 union {
19687 UV l;
19688 char c[$uvsize];
19689 } u;
19690
19691 if ($uvsize > 4)
19692 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19693 else
19694 u.l = (UV)0x04030201;
19695 for (i = 0; i < $uvsize; i++)
19696 printf("%c", u.c[i]+'0');
19697 printf("\n");
19698 exit(0);
19699}
19700EOCP
19701 xxx_prompt=y
19702 set try
19703 if eval $compile && $run ./try > /dev/null; then
19704 dflt=`$run ./try`
19705 case "$dflt" in
19706 [1-4][1-4][1-4][1-4]|12345678|87654321)
19707 echo "(The test program ran ok.)"
19708 echo "byteorder=$dflt"
19709 xxx_prompt=n
19710 ;;
19711 ????|????????) echo "(The test program ran ok.)" ;;
19712 *) echo "(The test program didn't run right for some reason.)" ;;
19713 esac
19714 else
19715 dflt='4321'
19716 cat <<'EOM'
19717(I can't seem to compile the test program. Guessing big-endian...)
19718EOM
19719 fi
19720 case "$xxx_prompt" in
19721 y)
19722 rp="What is the order of bytes in $uvtype?"
19723 . ./myread
19724 byteorder="$ans"
19725 ;;
19726 *) byteorder=$dflt
19727 ;;
19728 esac
19729 ;;
19730 esac
19731 $rm_try
19732 ;;
19733esac
19734
19735: Checking 32bit alignedness
19736$cat <<EOM
19737
19738Checking to see whether you can access character data unalignedly...
19739EOM
19740case "$d_u32align" in
19741'') $cat >try.c <<EOCP
19742#include <stdio.h>
19743#$i_stdlib I_STDLIB
19744#ifdef I_STDLIB
19745#include <stdlib.h>
19746#endif
19747#define U32 $u32type
19748#define BYTEORDER 0x$byteorder
19749#define U8 $u8type
19750#include <signal.h>
19751#ifdef SIGBUS
19752$signal_t bletch(int s) { exit(4); }
19753#endif
19754int main() {
19755#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19756 volatile U8 buf[8];
19757 volatile U32 *up;
19758 int i;
19759
19760 if (sizeof(U32) != 4) {
19761 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19762 exit(1);
19763 }
19764
19765 fflush(stdout);
19766
19767#ifdef SIGBUS
19768 signal(SIGBUS, bletch);
19769#endif
19770
19771 buf[0] = 0;
19772 buf[1] = 0;
19773 buf[2] = 0;
19774 buf[3] = 1;
19775 buf[4] = 0;
19776 buf[5] = 0;
19777 buf[6] = 0;
19778 buf[7] = 1;
19779
19780 for (i = 0; i < 4; i++) {
19781 up = (U32*)(buf + i);
19782 if (! ((*up == 1 << (8*i)) || /* big-endian */
19783 (*up == 1 << (8*(3-i))) /* little-endian */
19784 )
19785 )
19786 {
19787 printf("read failed (%x)\n", *up);
19788 exit(2);
19789 }
19790 }
19791
19792 /* write test */
19793 for (i = 0; i < 4; i++) {
19794 up = (U32*)(buf + i);
19795 *up = 0xBeef;
19796 if (*up != 0xBeef) {
19797 printf("write failed (%x)\n", *up);
19798 exit(3);
19799 }
19800 }
19801
19802 exit(0);
19803#else
19804 printf("1\n");
19805 exit(1);
19806#endif
19807 return 0;
19808}
19809EOCP
19810set try
19811if eval $compile_ok; then
19812 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
19813 $run ./try 2>&1 >/dev/null
19814 case "$?" in
19815 0) cat >&4 <<EOM
19816You can access character data pretty unalignedly.
19817EOM
19818 d_u32align="$undef"
19819 ;;
19820 *) cat >&4 <<EOM
19821It seems that you must access character data in an aligned manner.
19822EOM
19823 d_u32align="$define"
19824 ;;
19825 esac
19826else
19827 rp='Can you access character data at unaligned addresses?'
19828 dflt='n'
19829 . ./myread
19830 case "$ans" in
19831 [yY]*) d_u32align="$undef" ;;
19832 *) d_u32align="$define" ;;
19833 esac
19834fi
19835$rm_try
19836;;
19837esac
19838
19839: see if ualarm exists
19840set ualarm d_ualarm
19841eval $inlibc
19842
19843: see if umask exists
19844set umask d_umask
19845eval $inlibc
19846
19847: see if unordered exists
19848set unordered d_unordered
19849eval $inlibc
19850
19851: see if unsetenv exists
19852set unsetenv d_unsetenv
19853eval $inlibc
19854
19855: see if usleep exists
19856set usleep d_usleep
19857eval $inlibc
19858
19859: see if prototype for usleep is available
19860echo " "
19861set d_usleepproto usleep $i_unistd unistd.h
19862eval $hasproto
19863
19864: see if ustat exists
19865set ustat d_ustat
19866eval $inlibc
19867
19868: see if closedir exists
19869set closedir d_closedir
19870eval $inlibc
19871
19872case "$d_closedir" in
19873"$define")
19874 echo " "
19875 echo "Checking whether closedir() returns a status..." >&4
19876 cat > try.c <<EOM
19877#$i_dirent I_DIRENT /**/
19878#$i_sysdir I_SYS_DIR /**/
19879#$i_sysndir I_SYS_NDIR /**/
19880#$i_systypes I_SYS_TYPES /**/
19881
19882#if defined(I_SYS_TYPES)
19883#include <sys/types.h>
19884#endif
19885#if defined(I_DIRENT)
19886#include <dirent.h>
19887#else
19888#ifdef I_SYS_NDIR
19889#include <sys/ndir.h>
19890#else
19891#ifdef I_SYS_DIR
19892#include <sys/dir.h>
19893#endif
19894#endif
19895#endif
19896int main() { return closedir(opendir(".")); }
19897EOM
19898 set try
19899 if eval $compile_ok; then
19900 if $run ./try > /dev/null 2>&1 ; then
19901 echo "Yes, it does."
19902 val="$undef"
19903 else
19904 echo "No, it doesn't."
19905 val="$define"
19906 fi
19907 else
19908 echo "(I can't seem to compile the test program--assuming it doesn't)"
19909 val="$define"
19910 fi
19911 ;;
19912*)
19913 val="$undef";
19914 ;;
19915esac
19916set d_void_closedir
19917eval $setvar
19918$rm_try
19919
19920: see if there is a wait4
19921set wait4 d_wait4
19922eval $inlibc
19923
19924: see if waitpid exists
19925set waitpid d_waitpid
19926eval $inlibc
19927
19928: see if wcrtomb exists
19929set wcrtomb d_wcrtomb
19930eval $inlibc
19931
19932: look for wcscmp
19933echo " "
19934$cat >try.c <<'EOCP'
19935#include <stdio.h>
19936#include <wchar.h>
19937int main ()
19938{
19939 wchar_t *s = L" ";
19940 return (wcscmp (s, s) ? 1 : 0);
19941 }
19942EOCP
19943set try
19944val="$undef"
19945if eval $compile; then
19946 `$run ./try`
19947 case "$?" in
19948 0) echo "A working wcscmp() found." >&4
19949 val="$define" ;;
19950 *) echo "wcscmp() found, but it doesn't work" >&4
19951 ;;
19952 esac
19953else
19954 echo "wcscmp() NOT found." >&4
19955 fi
19956set d_wcscmp
19957eval $setvar
19958$rm_try
19959
19960: see if wcstombs exists
19961set wcstombs d_wcstombs
19962eval $inlibc
19963
19964: look for wcsxfrm
19965echo " "
19966$cat >try.c <<'EOCP'
19967#include <errno.h>
19968#include <wchar.h>
19969int main ()
19970{
19971 wchar_t dst[4], *src = L" ";
19972 errno = 0;
19973 return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19974 }
19975EOCP
19976set try
19977val="$undef"
19978if eval $compile; then
19979 `$run ./try`
19980 case "$?" in
19981 0) echo "A working wcsxfrm() found." >&4
19982 val="$define" ;;
19983 *) echo "wcsxfrm() found, but it doesn't work" >&4
19984 ;;
19985 esac
19986else
19987 echo "wcsxfrm() NOT found." >&4
19988 fi
19989set d_wcsxfrm
19990eval $setvar
19991$rm_try
19992
19993: see if wctomb exists
19994set wctomb d_wctomb
19995eval $inlibc
19996
19997: see if writev exists
19998set writev d_writev
19999eval $inlibc
20000
20001: check for alignment requirements
20002echo " "
20003case "$alignbytes" in
20004 '') echo "Checking alignment constraints..." >&4
20005 $cat >try.c <<EOCP
20006#include <stdio.h>
20007struct foobar {
20008 char foo;
20009 $nvtype bar;
20010} try_algn;
20011int main()
20012{
20013 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20014 return(0);
20015}
20016EOCP
20017 set try
20018 if eval $compile_ok; then
20019 dflt=`$run ./try`
20020 else
20021 dflt='8'
20022 echo "(I can't seem to compile the test program...)"
20023 fi
20024 case "$multiarch" in
20025 *$define*)
20026 : The usual safe value is 8, but Darwin with -Duselongdouble
20027 : needs 16. Hence, we will take 8 as a minimum, but allow
20028 : Configure to pick a larger value if needed.
20029 if $test "$dflt" -lt 8; then
20030 dflt='8'
20031 echo "Setting alignment to 8 for multiarch support.">&4
20032 fi
20033 ;;
20034 esac
20035 ;;
20036 *) dflt="$alignbytes"
20037 ;;
20038esac
20039rp="Doubles must be aligned on a how-many-byte boundary?"
20040. ./myread
20041alignbytes="$ans"
20042$rm_try
20043
20044: set the base revision
20045baserev=5.0
20046
20047: length of character in bytes. Is always 1, otherwise it is not C
20048: This used to be a test using sizeof
20049charsize=1
20050
20051: Check for the number of bits in a character
20052case "$charbits" in
20053'') echo "Checking how long a character is (in bits)..." >&4
20054 $cat >try.c <<EOCP
20055#include <stdio.h>
20056int main ()
20057{
20058 int n;
20059 unsigned char c;
20060 for (c = 1, n = 0; c; c <<= 1, n++) ;
20061 printf ("%d\n", n);
20062 return (0);
20063 }
20064EOCP
20065 set try
20066 if eval $compile_ok; then
20067 dflt=`$run ./try`
20068 else
20069 dflt='8'
20070 echo "(I can't seem to compile the test program. Guessing...)"
20071 fi
20072 ;;
20073*)
20074 dflt="$charbits"
20075 ;;
20076esac
20077rp="What is the length of a character (in bits)?"
20078. ./myread
20079charbits="$ans"
20080$rm_try
20081case "$charbits" in
200828) ;;
20083*) cat >&4 << EOM
20084Your system has an unsigned character size of $charbits bits, which
20085is rather unusual (normally it is 8 bits). Perl likely will not work
20086correctly on your system, with subtle bugs in various places.
20087EOM
20088 rp='Do you really want to continue?'
20089 dflt='n'
20090 . ./myread
20091 case "$ans" in
20092 [yY]) echo >&4 "Okay, continuing." ;;
20093 *) exit 1 ;;
20094 esac
20095esac
20096
20097: how do we concatenate cpp tokens here?
20098echo " "
20099echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20100$cat >cpp_stuff.c <<'EOCP'
20101#define RCAT(a,b)a/**/b
20102#define ACAT(a,b)a ## b
20103RCAT(Rei,ser)
20104ACAT(Cir,cus)
20105EOCP
20106$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20107if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20108 echo "Oh! Smells like ANSI's been here." >&4
20109 echo "We can catify or stringify, separately or together!"
20110 cpp_stuff=42
20111elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20112 echo "Ah, yes! The good old days!" >&4
20113 echo "However, in the good old days we don't know how to stringify and"
20114 echo "catify at the same time."
20115 cpp_stuff=1
20116else
20117 $cat >&4 <<EOM
20118Hmm, I don't seem to be able to concatenate tokens with your cpp.
20119You're going to have to edit the values of CAT[2-5] in config.h...
20120EOM
20121 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20122fi
20123$rm -f cpp_stuff.*
20124
20125: see if this is a db.h system
20126set db.h i_db
20127eval $inhdr
20128
20129case "$i_db" in
20130$define)
20131 : Check db version.
20132 echo " "
20133 echo "Checking Berkeley DB version ..." >&4
20134 $cat >try.c <<EOCP
20135#include <sys/types.h>
20136#include <stdio.h>
20137#$i_stdlib I_STDLIB
20138#ifdef I_STDLIB
20139#include <stdlib.h>
20140#endif
20141#include <db.h>
20142int main(int argc, char *argv[])
20143{
20144#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20145 int Major, Minor, Patch ;
20146 unsigned long Version ;
20147 (void)db_version(&Major, &Minor, &Patch) ;
20148 if (argc == 2) {
20149 printf("%d %d %d %d %d %d\n",
20150 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20151 Major, Minor, Patch);
20152 exit(0);
20153 }
20154 printf("You have Berkeley DB Version 2 or greater.\n");
20155
20156 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20157 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20158 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20159 Major, Minor, Patch) ;
20160
20161 /* check that db.h & libdb are compatible */
20162 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20163 printf("db.h and libdb are incompatible.\n") ;
20164 exit(3);
20165 }
20166
20167 printf("db.h and libdb are compatible.\n") ;
20168
20169 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20170 + DB_VERSION_PATCH ;
20171
20172 /* needs to be >= 2.3.4 */
20173 if (Version < 2003004) {
20174 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20175 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20176 exit(2);
20177 }
20178
20179 exit(0);
20180#else
20181#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20182 if (argc == 2) {
20183 printf("1 0 0\n");
20184 exit(0);
20185 }
20186 printf("You have Berkeley DB Version 1.\n");
20187 exit(0); /* DB version < 2: the coast is clear. */
20188#else
20189 exit(1); /* <db.h> not Berkeley DB? */
20190#endif
20191#endif
20192}
20193EOCP
20194 set try
20195 if eval $compile_ok && $run ./try; then
20196 echo 'Looks OK.' >&4
20197 set `$run ./try 1`
20198 db_version_major=$1
20199 db_version_minor=$2
20200 db_version_patch=$3
20201 else
20202 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
20203 i_db=$undef
20204 case " $libs " in
20205 *"-ldb "*)
20206 : Remove db from list of libraries to use
20207 echo "Removing unusable -ldb from library list" >&4
20208 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20209 shift
20210 libs="$*"
20211 echo "libs = $libs" >&4
20212 ;;
20213 esac
20214 fi
20215 $rm_try
20216 ;;
20217esac
20218
20219case "$i_db" in
20220define)
20221 : Check the return type needed for hash
20222 echo " "
20223 echo "Checking return type needed for hash for Berkeley DB ..." >&4
20224 $cat >try.c <<EOCP
20225#include <sys/types.h>
20226#include <db.h>
20227
20228#ifndef DB_VERSION_MAJOR
20229u_int32_t hash_cb (const void* ptr, size_t size)
20230{
20231 return 0;
20232}
20233HASHINFO info;
20234int main()
20235{
20236 info.hash = hash_cb;
20237}
20238#endif
20239EOCP
20240 if $cc $ccflags -c try.c >try.out 2>&1 ; then
20241 if $contains warning try.out >>/dev/null 2>&1 ; then
20242 db_hashtype='int'
20243 else
20244 db_hashtype='u_int32_t'
20245 fi
20246 else
20247 : XXX Maybe we should just give up here.
20248 db_hashtype=u_int32_t
20249 $cat try.out >&4
20250 echo "Help: I can't seem to compile the db test program." >&4
20251 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20252 fi
20253 $rm_try
20254 echo "Your version of Berkeley DB uses $db_hashtype for hash."
20255 ;;
20256*) db_hashtype=u_int32_t
20257 ;;
20258esac
20259case "$i_db" in
20260define)
20261 : Check the return type needed for prefix
20262 echo " "
20263 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20264 cat >try.c <<EOCP
20265#include <sys/types.h>
20266#include <db.h>
20267
20268#ifndef DB_VERSION_MAJOR
20269size_t prefix_cb (const DBT *key1, const DBT *key2)
20270{
20271 return 0;
20272}
20273BTREEINFO info;
20274int main()
20275{
20276 info.prefix = prefix_cb;
20277}
20278#endif
20279EOCP
20280 if $cc $ccflags -c try.c >try.out 2>&1 ; then
20281 if $contains warning try.out >>/dev/null 2>&1 ; then
20282 db_prefixtype='int'
20283 else
20284 db_prefixtype='size_t'
20285 fi
20286 else
20287 db_prefixtype='size_t'
20288 : XXX Maybe we should just give up here.
20289 $cat try.out >&4
20290 echo "Help: I can't seem to compile the db test program." >&4
20291 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20292 fi
20293 $rm_try
20294 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20295 ;;
20296*) db_prefixtype='size_t'
20297 ;;
20298esac
20299
20300: Include . in @INC
20301$cat <<EOM
20302
20303Historically Perl has provided a final fallback of the current working
20304directory '.' when searching for a library. This, however, can lead to
20305problems when a Perl program which loads optional modules is called from
20306a shared directory. This can lead to executing unexpected code.
20307
20308EOM
20309
20310# When changing to exclude by default:
20311case "$default_inc_excludes_dot" in
20312 $undef|false|[nN]*) dflt="n" ;;
20313 *) dflt="y" ;;
20314esac
20315# To turn exclude off by default:
20316#case "$default_inc_excludes_dot" in
20317# $define|true|[yY]*) dflt="y" ;;
20318# *) dflt="n" ;;
20319#esac
20320
20321rp='Exclude '.' from @INC by default? '
20322. ./myread
20323case "$ans" in
20324 [nN]|undef) default_inc_excludes_dot="$undef" ;;
20325 *) default_inc_excludes_dot="$define" ;;
20326esac
20327
20328: Check what kind of inf/nan your system has
20329$echo "Checking the kind of infinities and nans you have..." >&4
20330$echo "(The following tests may crash. That's okay.)" >&4
20331$cat >try.c <<EOP
20332#define DOUBLESIZE $doublesize
20333#$d_longdbl HAS_LONG_DOUBLE
20334#ifdef HAS_LONG_DOUBLE
20335#define LONG_DOUBLESIZE $longdblsize
20336#define LONG_DOUBLEKIND $longdblkind
20337#endif
20338#include <math.h>
20339#include <string.h>
20340#include <stdio.h>
20341/* Note that whether the sign bit is on or off
20342 * for NaN depends on the CPU/FPU, and possibly
20343 * can be affected by the build toolchain.
20344 *
20345 * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20346 * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20347 * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20348 * (respectively) as opposed to the more usual
20349 * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20350 *
20351 * Pre-IEEE-754 floating point format do not even have inf/nan support
20352 * at all. They might have a "max" value (DBL_MAX), which may be deadly
20353 * to even mention, causing immediate SIGFPE or equivalent: this is
20354 * the case with VAX floating point, for example.
20355 */
20356static void bytes(void *v, unsigned int n) {
20357 unsigned char *p = (unsigned char *)v;
20358 int i;
20359 for (i = 0; i < n; i++) {
20360 printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20361 }
20362}
20363int main(int argc, char *argv[]) {
20364 /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20365 * because some compilers are 'smart' and not only warn but refuse to
20366 * compile such 'illegal' values. */
20367 double dinf = exp(1e9);
20368 double dnan = sqrt(-1.0);
20369#ifdef HAS_LONG_DOUBLE
20370 long double ldinf = (long double)exp(1e9);
20371 long double ldnan = (long double)sqrt(-1.0);
20372# if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20373/* the 80-bit long doubles might have garbage in their excess bytes */
20374 memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20375 memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20376# endif
20377 if (argc == 2) {
20378 switch (argv[1][0]) {
20379 case '1': bytes(&dinf, sizeof(dinf)); break;
20380 case '2': bytes(&dnan, sizeof(dnan)); break;
20381 case '3': bytes(&ldinf, sizeof(ldinf)); break;
20382 case '4': bytes(&ldnan, sizeof(ldnan)); break;
20383#endif
20384 }
20385 }
20386 return 0;
20387}
20388EOP
20389set try
20390if eval $compile; then
20391 doubleinfbytes=`$run ./try 1`
20392 doublenanbytes=`$run ./try 2`
20393 case "$d_longdbl" in
20394 $define)
20395 longdblinfbytes=`$run ./try 3`
20396 longdblnanbytes=`$run ./try 4`
20397 ;;
20398 esac
20399else
20400 # Defaults in case the above test program failed.
20401 case "$doublekind" in
20402 1) # IEEE 754 32-bit LE
20403 doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20404 doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20405 ;;
20406 2) # IEEE 754 32-bit BE
20407 doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20408 doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20409 ;;
20410 3) # IEEE 754 64-bit LE
20411 doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20412 doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20413 ;;
20414 4) # IEEE 754 64-bit BE
20415 doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20416 doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20417 ;;
20418 5) # IEEE 754 128-bit LE
20419 doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20420 doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20421 ;;
20422 6) # IEEE 754 128-bit BE
20423 doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20424 doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20425 ;;
20426 7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20427 doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20428 doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20429 ;;
20430 8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20431 doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20432 doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20433 ;;
20434 9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20435 doubleinfbytes=$undef
20436 doublenanbytes=$undef
20437 ;;
20438 *) # No idea.
20439 doubleinfbytes=$undef
20440 doublenanbytes=$undef
20441 ;;
20442 esac
20443 case "$longdblkind" in
20444 1) # IEEE 754 128-bit LE
20445 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20446 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20447 ;;
20448 2) # IEEE 754 128-bit BE
20449 longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20450 longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20451 ;;
20452 3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20453 case "$longdblsize" in
20454 12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20455 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20456 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20457 ;;
20458 16) # x86_64
20459 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20460 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20461 ;;
20462 *) # No idea.
20463 longdblinfbytes=$undef
20464 longdblnanbytes=$undef
20465 ;;
20466 esac
20467 ;;
20468 4) # IEEE 754 80-bit BE, 12 or 16 bytes
20469 case "$longdblsize" in
20470 12) # 32-bit system
20471 longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20472 longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20473 ;;
20474 16) # 64-bit system
20475 longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20476 longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20477 ;;
20478 *) # No idea.
20479 longdblinfbytes=$undef
20480 longdblnanbytes=$undef
20481 ;;
20482 esac
20483 ;;
20484 5) # 128-bit LE-LE "double double"
20485 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20486 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20487 ;;
20488 6) # 128-bit BE-BE "double double"
20489 longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20490 longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20491 ;;
20492 7) # 128-bit LE-BE "double double"
20493 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20494 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20495 ;;
20496 8) # 128-bit BE-LE "double double"
20497 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20498 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20499 ;;
20500 9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20501 longdblinfbytes=$undef
20502 longdblnanbytes=$undef
20503 ;;
20504 *) # No idea.
20505 longdblinfbytes=$undef
20506 longdblnanbytes=$undef
20507 ;;
20508 esac
20509fi
20510# In case the program crashed the values are empty, turn them undef.
20511case "$doubleinfbytes" in
20512'') doubleinfbytes=$undef ;;
20513esac
20514case "$doublenanbytes" in
20515'') doublenanbytes=$undef ;;
20516esac
20517case "$longdblinfbytes" in
20518'') longdblinfbytes=$undef ;;
20519esac
20520case "$longdblnanbytes" in
20521'') longdblnanbytes=$undef ;;
20522esac
20523$rm_try
20524
20525: Check the length of the double mantissa
20526$echo "Checking how many mantissa bits your doubles have..." >&4
20527$cat >try.c <<EOP
20528#$i_sunmath I_SUNMATH
20529#include <float.h>
20530#ifdef I_SUNMATH
20531# include <sunmath.h>
20532#endif
20533#ifdef DBL_MANT_DIG
20534# define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20535#endif
20536#include <stdio.h>
20537int main(int argc, char *argv[]) {
20538#ifdef BITS
20539 printf("%d\n", BITS);
20540#endif
20541 return 0;
20542}
20543EOP
20544set try
20545if eval $compile; then
20546 doublemantbits=`$run ./try`
20547else
20548 doublemantbits="$undef"
20549fi
20550$rm_try
20551
20552: Check the length of the longdouble mantissa
20553$echo "Checking how many mantissa bits your long doubles have..." >&4
20554$cat >try.c <<EOP
20555#$i_sunmath I_SUNMATH
20556#include <float.h>
20557#ifdef I_SUNMATH
20558# include <sunmath.h>
20559#endif
20560#$d_longdbl HAS_LONG_DOUBLE
20561#if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20562# if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20563/* This format has no implicit bit. Beware, however, that for
20564 * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20565 * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20566 * and the top bit must have been one since 387, zero is plain invalid.
20567 * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20568# define BITS LDBL_MANT_DIG
20569# elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20570/* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20571 * reason e.g. Irix thinks 107. But in any case, we want only
20572 * the number of real bits, the implicit bits are of no interest. */
20573# define BITS 2 * (DBL_MANT_DIG - 1)
20574# else
20575# define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20576# endif
20577#endif
20578#include <stdio.h>
20579int main(int argc, char *argv[]) {
20580#ifdef BITS
20581 printf("%d\n", BITS);
20582#endif
20583 return 0;
20584}
20585EOP
20586set try
20587if eval $compile; then
20588 longdblmantbits=`$run ./try`
20589else
20590 longdblmantbits="$undef"
20591fi
20592$rm_try
20593
20594: Check the length of the NV mantissa
20595$echo "Checking how many mantissa bits your NVs have..." >&4
20596if test "X$usequadmath" = "X$define"; then
20597 nvmantbits=112 # 128-1-15
20598else
20599 if test "X$nvsize" = "X$doublesize"; then
20600 nvmantbits="$doublemantbits"
20601 else
20602 if test "X$nvsize" = "X$longdblsize"; then
20603 nvmantbits="$longdblmantbits"
20604 else
20605 nvmantbits="$undef"
20606 fi
20607 fi
20608fi
20609
20610: How can we generate normalized random numbers ?
20611echo " "
20612echo "Using our internal random number implementation..." >&4
20613
20614case "$ccflags" in
20615*-Dmy_rand=*|*-Dmy_srand=*)
20616 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20617 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20618 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20619 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20620 ;;
20621esac
20622
20623randfunc=Perl_drand48
20624drand01="Perl_drand48()"
20625seedfunc="Perl_drand48_init"
20626randbits=48
20627randseedtype=U32
20628
20629: Probe whether dtrace builds an object, as newer Illumos requires an input
20630: object file that uses at least one of the probes defined in the .d file
20631case "$usedtrace" in
20632$define)
20633 case "$dtracexnolibs" in
20634 $define|true|[yY]*)
20635 dtracexnolibs=$define
20636 $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20637 ;;
20638 ' '|'')
20639 if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20640 dtracexnolibs=$define
20641 echo "Your dtrace accepts -xnolibs"
20642 elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20643 dtracexnolibs=$undef
20644 echo "Your dtrace doesn't accept -xnolibs"
20645 else
20646 echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20647 exit 1
20648 fi
20649 ;;
20650 *)
20651 dtracexnolibs=$undef
20652 $dtrace -h -s ../perldtrace.d -o perldtrace.h
20653 ;;
20654 esac
20655 case $dtracexnolibs in
20656 $define) xnolibs=-xnolibs ;;
20657 *) xnolibs= ;;
20658 esac
20659
20660 case "$dtraceobject" in
20661 $define|true|[yY]*)
20662 dtraceobject=$define
20663 ;;
20664 ' '|'')
20665 $cat >try.c <<EOM
20666#include "perldtrace.h"
20667int main(void) {
20668 PERL_LOADED_FILE("dummy");
20669 return 0;
20670}
20671EOM
20672 dtraceobject=$undef
20673 if $cc -c -o try.o $optimize $ccflags try.c \
20674 && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20675 dtraceobject=$define
20676 echo "Your dtrace builds an object file"
20677 fi
20678 ;;
20679 *) dtraceobject=$undef ;;
20680 esac
20681 $rm_try perldtrace.o perldtrace.h
20682esac
20683
20684: Determine if this is an EBCDIC system
20685echo " "
20686echo "Determining whether or not we are on an EBCDIC system..." >&4
20687$cat >try.c <<'EOM'
20688int main()
20689{
20690 if ('M'==0xd4) return 0;
20691 return 1;
20692}
20693EOM
20694
20695val=$undef
20696set try
20697if eval $compile_ok; then
20698 if $run ./try; then
20699 echo "You seem to speak EBCDIC." >&4
20700 val="$define"
20701 else
20702 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20703 fi
20704else
20705 echo "I'm unable to compile the test program." >&4
20706 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20707fi
20708$rm_try
20709set ebcdic
20710eval $setvar
20711
20712: Check how to flush
20713echo " "
20714$cat >&4 <<EOM
20715Checking how to flush all pending stdio output...
20716EOM
20717# I only know how to find the first 32 possibly open files on SunOS.
20718# See also hints/sunos_4_1.sh and util.c --AD
20719case "$osname" in
20720sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20721esac
20722$cat >>try.c <<EOCP
20723#include <stdio.h>
20724#$i_stdlib I_STDLIB
20725#ifdef I_STDLIB
20726#include <stdlib.h>
20727#endif
20728#$i_unistd I_UNISTD
20729#ifdef I_UNISTD
20730# include <unistd.h>
20731#endif
20732#$d_sysconf HAS_SYSCONF
20733#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20734#ifdef HAS_STDIO_STREAM_ARRAY
20735# define STDIO_STREAM_ARRAY $stdio_stream_array
20736#endif
20737int main() {
20738 FILE* p;
20739 unlink("try.out");
20740 p = fopen("try.out", "w");
20741#ifdef TRY_FPUTC
20742 fputc('x', p);
20743#else
20744# ifdef TRY_FPRINTF
20745 fprintf(p, "x");
20746# endif
20747#endif
20748#ifdef TRY_FFLUSH_NULL
20749 fflush(NULL);
20750#endif
20751#ifdef TRY_FFLUSH_ALL
20752 {
20753 long open_max = -1;
20754# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20755 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20756# else
20757# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20758 open_max = sysconf(_SC_OPEN_MAX);
20759# else
20760# ifdef FOPEN_MAX
20761 open_max = FOPEN_MAX;
20762# else
20763# ifdef OPEN_MAX
20764 open_max = OPEN_MAX;
20765# else
20766# ifdef _NFILE
20767 open_max = _NFILE;
20768# endif
20769# endif
20770# endif
20771# endif
20772# endif
20773# ifdef HAS_STDIO_STREAM_ARRAY
20774 if (open_max > 0) {
20775 long i;
20776 for (i = 0; i < open_max; i++)
20777 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20778 STDIO_STREAM_ARRAY[i]._file < open_max &&
20779 STDIO_STREAM_ARRAY[i]._flag)
20780 fflush(&STDIO_STREAM_ARRAY[i]);
20781 }
20782 }
20783# endif
20784#endif
20785 _exit(42);
20786}
20787EOCP
20788: first we have to find out how _not_ to flush
20789$to try.c
20790if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20791 output=''
20792 set try -DTRY_FPUTC
20793 if eval $compile; then
20794 $run ./try 2>/dev/null
20795 code="$?"
20796 $from try.out
20797 if $test ! -s try.out -a "X$code" = X42; then
20798 output=-DTRY_FPUTC
20799 fi
20800 fi
20801 case "$output" in
20802 '')
20803 set try -DTRY_FPRINTF
20804 if eval $compile; then
20805 $run ./try 2>/dev/null
20806 code="$?"
20807 $from try.out
20808 if $test ! -s try.out -a "X$code" = X42; then
20809 output=-DTRY_FPRINTF
20810 fi
20811 fi
20812 ;;
20813 esac
20814fi
20815: check for fflush NULL behavior
20816case "$fflushNULL" in
20817'') set try -DTRY_FFLUSH_NULL $output
20818 if eval $compile; then
20819 $run ./try 2>/dev/null
20820 code="$?"
20821 $from try.out
20822 if $test -s try.out -a "X$code" = X42; then
20823 fflushNULL="`$cat try.out`"
20824 else
20825 if $test "X$code" != X42; then
20826 $cat >&4 <<EOM
20827(If this test failed, don't worry, we'll try another method shortly.)
20828EOM
20829 fi
20830 fi
20831 fi
20832 $rm -f core try.core core.try.*
20833 case "$fflushNULL" in
20834 x) $cat >&4 <<EOM
20835Your fflush(NULL) works okay for output streams.
20836Let's see if it clobbers input pipes...
20837EOM
20838# As of mid-March 2000 all versions of Solaris appear to have a stdio
20839# bug that improperly flushes the input end of pipes. So we avoid the
20840# autoflush on fork/system/exec support for now. :-(
20841$cat >tryp.c <<EOCP
20842#include <stdio.h>
20843int
20844main(int argc, char **argv)
20845{
20846 char buf[1024];
20847 int i;
20848 char *bp = buf;
20849 while (1) {
20850 while ((i = getc(stdin)) != -1
20851 && (*bp++ = i) != '\n'
20852 && bp < &buf[1024])
20853 /* DO NOTHING */ ;
20854 *bp = '\0';
20855 fprintf(stdout, "%s", buf);
20856 fflush(NULL);
20857 if (i == -1)
20858 return 0;
20859 bp = buf;
20860 }
20861}
20862EOCP
20863 fflushNULL="$define"
20864 set tryp
20865 if eval $compile; then
20866 $rm -f tryp.out
20867 # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20868 if $test "X$targethost" != X; then
20869 $to tryp.c
20870 $to tryp
20871 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20872 else
20873 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
20874 fi
20875 if cmp tryp.c tryp.out >/dev/null 2>&1; then
20876 $cat >&4 <<EOM
20877fflush(NULL) seems to behave okay with input streams.
20878EOM
20879 fflushNULL="$define"
20880 else
20881 $cat >&4 <<EOM
20882Ouch, fflush(NULL) clobbers input pipes! We will not use it.
20883EOM
20884 fflushNULL="$undef"
20885 fi
20886 fi
20887 $rm -f core tryp.c tryp.core core.tryp.*
20888 ;;
20889 '') $cat >&4 <<EOM
20890Your fflush(NULL) isn't working (contrary to ANSI C).
20891EOM
20892 fflushNULL="$undef"
20893 ;;
20894 *) $cat >&4 <<EOM
20895Cannot figure out whether your fflush(NULL) works or not.
20896I'm assuming it doesn't (contrary to ANSI C).
20897EOM
20898 fflushNULL="$undef"
20899 ;;
20900 esac
20901 ;;
20902$define|true|[yY]*)
20903 fflushNULL="$define"
20904 ;;
20905*)
20906 fflushNULL="$undef"
20907 ;;
20908esac
20909: check explicit looping only if NULL did not work, and if the pipe
20910: bug does not show up on an explicit flush too
20911case "$fflushNULL" in
20912"$undef")
20913 $cat >tryp.c <<EOCP
20914#include <stdio.h>
20915int
20916main(int argc, char **argv)
20917{
20918 char buf[1024];
20919 int i;
20920 char *bp = buf;
20921 while (1) {
20922 while ((i = getc(stdin)) != -1
20923 && (*bp++ = i) != '\n'
20924 && bp < &buf[1024])
20925 /* DO NOTHING */ ;
20926 *bp = '\0';
20927 fprintf(stdout, "%s", buf);
20928 fflush(stdin);
20929 if (i == -1)
20930 return 0;
20931 bp = buf;
20932 }
20933}
20934EOCP
20935 set tryp
20936 if eval $compile; then
20937 $rm -f tryp.out
20938 if $test "X$targethost" != X; then
20939 $to tryp.c
20940 $to tryp
20941 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20942 else
20943 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
20944 fi
20945 if cmp tryp.c tryp.out >/dev/null 2>&1; then
20946 $cat >&4 <<EOM
20947Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20948EOM
20949 : now check for fflushall behaviour
20950 case "$fflushall" in
20951 '') set try -DTRY_FFLUSH_ALL $output
20952 if eval $compile; then
20953 $cat >&4 <<EOM
20954(Now testing the other method--but note that this also may fail.)
20955EOM
20956 $run ./try 2>/dev/null
20957 code=$?
20958 $from try.out
20959 if $test -s try.out -a "X$code" = X42; then
20960 fflushall="`$cat try.out`"
20961 fi
20962 fi
20963 $rm_try
20964 case "$fflushall" in
20965 x) $cat >&4 <<EOM
20966Whew. Flushing explicitly all the stdio streams works.
20967EOM
20968 fflushall="$define"
20969 ;;
20970 '') $cat >&4 <<EOM
20971Sigh. Flushing explicitly all the stdio streams doesn't work.
20972EOM
20973 fflushall="$undef"
20974 ;;
20975 *) $cat >&4 <<EOM
20976Cannot figure out whether flushing stdio streams explicitly works or not.
20977I'm assuming it doesn't.
20978EOM
20979 fflushall="$undef"
20980 ;;
20981 esac
20982 ;;
20983 "$define"|true|[yY]*)
20984 fflushall="$define"
20985 ;;
20986 *)
20987 fflushall="$undef"
20988 ;;
20989 esac
20990 else
20991 $cat >&4 <<EOM
20992All is futile. Even fflush(stdin) clobbers input pipes!
20993EOM
20994 fflushall="$undef"
20995 fi
20996 else
20997 fflushall="$undef"
20998 fi
20999 $rm -f core tryp.c tryp.core core.tryp.*
21000 ;;
21001*) fflushall="$undef"
21002 ;;
21003esac
21004
21005case "$fflushNULL$fflushall" in
21006undefundef)
21007 $cat <<EOM
21008OK, I give up. I cannot figure out how to flush pending stdio output.
21009We won't be flushing handles at all before fork/exec/popen.
21010EOM
21011 ;;
21012esac
21013$rm_try tryp
21014
21015: Store the full pathname to the ar program for use in the C program
21016: Respect a hint or command line value for full_ar.
21017case "$full_ar" in
21018'') full_ar=$ar ;;
21019esac
21020
21021: Store the full pathname to the sed program for use in the C program
21022full_sed=$sed
21023
21024: see what type gids are declared as in the kernel
21025echo " "
21026echo "Looking for the type for group ids returned by getgid()."
21027set gid_t gidtype xxx stdio.h sys/types.h
21028eval $typedef
21029case "$gidtype" in
21030xxx)
21031 xxx=`./findhdr sys/user.h`
21032 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21033 case $1 in
21034 unsigned) dflt="$1 $2" ;;
21035 *) dflt="$1" ;;
21036 esac
21037 ;;
21038*) dflt="$gidtype";;
21039esac
21040case "$gidtype" in
21041gid_t) echo "gid_t found." ;;
21042*) rp="What is the type for group ids returned by getgid()?"
21043 . ./myread
21044 gidtype="$ans"
21045 ;;
21046esac
21047
21048: Check the size of GID
21049echo " "
21050case "$gidtype" in
21051*_t) zzz="$gidtype" ;;
21052*) zzz="gid" ;;
21053esac
21054echo "Checking the size of $zzz..." >&4
21055cat > try.c <<EOCP
21056#include <sys/types.h>
21057#include <stdio.h>
21058#$i_stdlib I_STDLIB
21059#ifdef I_STDLIB
21060#include <stdlib.h>
21061#endif
21062int main() {
21063 printf("%d\n", (int)sizeof($gidtype));
21064 exit(0);
21065}
21066EOCP
21067set try
21068if eval $compile_ok; then
21069 yyy=`$run ./try`
21070 case "$yyy" in
21071 '') gidsize=4
21072 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21073 ;;
21074 *) gidsize=$yyy
21075 echo "Your $zzz is $gidsize bytes long."
21076 ;;
21077 esac
21078else
21079 gidsize=4
21080 echo "(I can't compile the test program--guessing $gidsize.)" >&4
21081fi
21082
21083: Check if GID is signed
21084echo " "
21085case "$gidtype" in
21086*_t) zzz="$gidtype" ;;
21087*) zzz="gid" ;;
21088esac
21089echo "Checking the sign of $zzz..." >&4
21090cat > try.c <<EOCP
21091#include <sys/types.h>
21092#include <stdio.h>
21093int main() {
21094 $gidtype foo = -1;
21095 if (foo < 0)
21096 printf("-1\n");
21097 else
21098 printf("1\n");
21099}
21100EOCP
21101set try
21102if eval $compile; then
21103 yyy=`$run ./try`
21104 case "$yyy" in
21105 '') gidsign=1
21106 echo "(I can't execute the test program--guessing unsigned.)" >&4
21107 ;;
21108 *) gidsign=$yyy
21109 case "$gidsign" in
21110 1) echo "Your $zzz is unsigned." ;;
21111 -1) echo "Your $zzz is signed." ;;
21112 esac
21113 ;;
21114 esac
21115else
21116 gidsign=1
21117 echo "(I can't compile the test program--guessing unsigned.)" >&4
21118fi
21119
21120: Check 64bit sizes
21121echo " "
21122
21123if $test X"$quadtype" != X; then
21124
21125echo "Checking how to print 64-bit integers..." >&4
21126
21127if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21128 $cat >try.c <<'EOCP'
21129#include <sys/types.h>
21130#include <stdio.h>
21131int main() {
21132 int q = 12345678901;
21133 printf("%ld\n", q);
21134}
21135EOCP
21136 set try
21137 if eval $compile; then
21138 yyy=`$run ./try`
21139 case "$yyy" in
21140 12345678901)
21141 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21142 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21143 echo "We will use %d."
21144 ;;
21145 esac
21146 fi
21147fi
21148
21149if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21150 $cat >try.c <<'EOCP'
21151#include <sys/types.h>
21152#include <stdio.h>
21153int main() {
21154 long q = 12345678901;
21155 printf("%ld\n", q);
21156}
21157EOCP
21158 set try
21159 if eval $compile; then
21160 yyy=`$run ./try`
21161 case "$yyy" in
21162 12345678901)
21163 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21164 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21165 echo "We will use %ld."
21166 ;;
21167 esac
21168 fi
21169fi
21170
21171if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21172 $cat >try.c <<'EOCP'
21173#include <sys/types.h>
21174#include <inttypes.h>
21175#include <stdio.h>
21176int main() {
21177 int64_t q = 12345678901;
21178 printf("%" PRId64 "\n", q);
21179}
21180EOCP
21181 set try
21182 if eval $compile; then
21183 yyy=`$run ./try`
21184 case "$yyy" in
21185 12345678901)
21186 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21187 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21188 echo "We will use the C9X style."
21189 ;;
21190 esac
21191 fi
21192fi
21193
21194if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21195 $cat >try.c <<EOCP
21196#include <sys/types.h>
21197#include <stdio.h>
21198int main() {
21199 $quadtype q = 12345678901;
21200 printf("%Ld\n", q);
21201}
21202EOCP
21203 set try
21204 if eval $compile; then
21205 yyy=`$run ./try`
21206 case "$yyy" in
21207 12345678901)
21208 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21209 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21210 echo "We will use %Ld."
21211 ;;
21212 esac
21213 fi
21214fi
21215
21216if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21217 $cat >try.c <<'EOCP'
21218#include <sys/types.h>
21219#include <stdio.h>
21220int main() {
21221 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21222 printf("%lld\n", q);
21223}
21224EOCP
21225 set try
21226 if eval $compile; then
21227 yyy=`$run ./try`
21228 case "$yyy" in
21229 12345678901)
21230 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21231 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21232 echo "We will use the %lld style."
21233 ;;
21234 esac
21235 fi
21236fi
21237
21238if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21239 $cat >try.c <<EOCP
21240#include <sys/types.h>
21241#include <stdio.h>
21242int main() {
21243 $quadtype q = 12345678901;
21244 printf("%qd\n", q);
21245}
21246EOCP
21247 set try
21248 if eval $compile; then
21249 yyy=`$run ./try`
21250 case "$yyy" in
21251 12345678901)
21252 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21253 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21254 echo "We will use %qd."
21255 ;;
21256 esac
21257 fi
21258fi
21259
21260if $test X"$sPRId64" = X; then
21261 echo "Cannot figure out how to print 64-bit integers." >&4
21262fi
21263$rm_try
21264
21265fi
21266
21267case "$sPRId64" in
21268'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21269 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21270 ;;
21271*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21272 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21273 ;;
21274esac
21275
21276: Check format strings for internal types
21277echo " "
21278$echo "Checking the format strings to be used for Perl's internal types..." >&4
21279
21280if $test X"$ivsize" = X8; then
21281 ivdformat="$sPRId64"
21282 uvuformat="$sPRIu64"
21283 uvoformat="$sPRIo64"
21284 uvxformat="$sPRIx64"
21285 uvXUformat="$sPRIXU64"
21286else
21287 if $test X"$ivsize" = X"$longsize"; then
21288 ivdformat='"ld"'
21289 uvuformat='"lu"'
21290 uvoformat='"lo"'
21291 uvxformat='"lx"'
21292 uvXUformat='"lX"'
21293 else
21294 if $test X"$ivsize" = X"$intsize"; then
21295 ivdformat='"d"'
21296 uvuformat='"u"'
21297 uvoformat='"o"'
21298 uvxformat='"x"'
21299 uvXUformat='"X"'
21300 else
21301 : far out
21302 if $test X"$ivsize" = X"$shortsize"; then
21303 ivdformat='"hd"'
21304 uvuformat='"hu"'
21305 uvoformat='"ho"'
21306 uvxformat='"hx"'
21307 uvXUformat='"hX"'
21308 fi
21309 fi
21310 fi
21311fi
21312
21313if $test X"$usequadmath" = X"$define"; then
21314 nveformat='"Qe"'
21315 nvfformat='"Qf"'
21316 nvgformat='"Qg"'
21317 nvEUformat='"QE"'
21318 nvFUformat='"QF"'
21319 nvGUformat='"QG"'
21320else
21321 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21322 nveformat="$sPRIeldbl"
21323 nvfformat="$sPRIfldbl"
21324 nvgformat="$sPRIgldbl"
21325 nvEUformat="$sPRIEUldbl"
21326 nvFUformat="$sPRIFUldbl"
21327 nvGUformat="$sPRIGUldbl"
21328 else
21329 nveformat='"e"'
21330 nvfformat='"f"'
21331 nvgformat='"g"'
21332 nvEUformat='"E"'
21333 nvFUformat='"F"'
21334 nvGUformat='"G"'
21335 fi
21336fi
21337
21338case "$ivdformat" in
21339'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21340 exit 1
21341 ;;
21342esac
21343
21344: Check format string for GID
21345
21346echo " "
21347$echo "Checking the format string to be used for gids..." >&4
21348
21349case "$gidsign" in
21350-1) if $test X"$gidsize" = X"$ivsize"; then
21351 gidformat="$ivdformat"
21352 else
21353 if $test X"$gidsize" = X"$longsize"; then
21354 gidformat='"ld"'
21355 else
21356 if $test X"$gidsize" = X"$intsize"; then
21357 gidformat='"d"'
21358 else
21359 if $test X"$gidsize" = X"$shortsize"; then
21360 gidformat='"hd"'
21361 fi
21362 fi
21363 fi
21364 fi
21365 ;;
21366*) if $test X"$gidsize" = X"$uvsize"; then
21367 gidformat="$uvuformat"
21368 else
21369 if $test X"$gidsize" = X"$longsize"; then
21370 gidformat='"lu"'
21371 else
21372 if $test X"$gidsize" = X"$intsize"; then
21373 gidformat='"u"'
21374 else
21375 if $test X"$gidsize" = X"$shortsize"; then
21376 gidformat='"hu"'
21377 fi
21378 fi
21379 fi
21380 fi
21381 ;;
21382esac
21383
21384: see if getgroups exists
21385set getgroups d_getgrps
21386eval $inlibc
21387
21388: see if setgroups exists
21389set setgroups d_setgrps
21390eval $inlibc
21391
21392: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21393echo " "
21394case "$d_getgrps$d_setgrps" in
21395*define*)
21396 case "$groupstype" in
21397 '') dflt="$gidtype" ;;
21398 *) dflt="$groupstype" ;;
21399 esac
21400 $cat <<EOM
21401What type of pointer is the second argument to getgroups() and setgroups()?
21402Usually this is the same as group ids, $gidtype, but not always.
21403
21404EOM
21405 rp='What type pointer is the second argument to getgroups() and setgroups()?'
21406 . ./myread
21407 groupstype="$ans"
21408 ;;
21409*) groupstype="$gidtype";;
21410esac
21411
21412: check whether make sets MAKE
21413echo " "
21414echo "Checking if your $make program sets \$(MAKE)..." >&4
21415case "$make_set_make" in
21416'')
21417 $sed 's/^X //' > testmake.mak << 'EOF'
21418Xall:
21419X @echo 'maketemp="$(MAKE)"'
21420EOF
21421 case "`$make -f testmake.mak 2>/dev/null`" in
21422 *maketemp=*) make_set_make='#' ;;
21423 *) make_set_make="MAKE=$make" ;;
21424 esac
21425 $rm -f testmake.mak
21426 ;;
21427esac
21428case "$make_set_make" in
21429'#') echo "Yup, it does.";;
21430*) echo "Nope, it doesn't.";;
21431esac
21432
21433: see what type is used for mode_t
21434rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21435set mode_t modetype int stdio.h sys/types.h
21436eval $typedef_ask
21437
21438: see if we need va_copy
21439echo " "
21440$cat >try.c <<EOCP
21441#include <stdarg.h>
21442#include <stdio.h>
21443#include <stdlib.h>
21444#include <signal.h>
21445
21446int
21447ivfprintf(FILE *f, const char *fmt, va_list *valp)
21448{
21449 return vfprintf(f, fmt, *valp);
21450}
21451
21452int
21453myvfprintf(FILE *f, const char *fmt, va_list val)
21454{
21455 return ivfprintf(f, fmt, &val);
21456}
21457
21458int
21459myprintf(char *fmt, ...)
21460{
21461 va_list val;
21462 va_start(val, fmt);
21463 return myvfprintf(stdout, fmt, val);
21464}
21465
21466int
21467main(int ac, char **av)
21468{
21469 signal(SIGSEGV, exit);
21470
21471 myprintf("%s%cs all right, then\n", "that", '\'');
21472 exit(0);
21473}
21474EOCP
21475set try
21476if eval $compile && $run ./try 2>&1 >/dev/null; then
21477 case "`$run ./try`" in
21478 "that's all right, then")
21479 okay=yes
21480 ;;
21481 esac
21482fi
21483case "$okay" in
21484yes) echo "It seems that you don't need va_copy()." >&4
21485 need_va_copy="$undef"
21486 ;;
21487*) echo "It seems that va_copy() or similar will be needed." >&4
21488 need_va_copy="$define"
21489 ;;
21490esac
21491$rm_try
21492
21493: see what type is used for size_t
21494rp="What is the type used for the length parameter for string functions?"
21495set size_t sizetype 'unsigned int' stdio.h sys/types.h
21496eval $typedef_ask
21497
21498: check for type of arguments to gethostbyaddr.
21499if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21500 case "$d_gethbyaddr" in
21501 $define)
21502 $cat <<EOM
21503
21504Checking to see what type of arguments are accepted by gethostbyaddr().
21505EOM
21506 hdrs="$define sys/types.h
21507 $d_socket sys/socket.h
21508 $i_niin netinet/in.h
21509 $i_netdb netdb.h
21510 $i_unistd unistd.h"
21511 : The first arg can 'char *' or 'void *'
21512 : The second arg is some of integral type
21513 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21514 for yyy in size_t long int; do
21515 case "$netdb_host_type" in
21516 '') try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21517 if ./protochk "$try" $hdrs; then
21518 echo "Your system accepts $xxx for the first arg."
21519 echo "...and $yyy for the second arg."
21520 netdb_host_type="$xxx"
21521 netdb_hlen_type="$yyy"
21522 fi
21523 ;;
21524 esac
21525 done
21526 done
21527 : In case none of those worked, prompt the user.
21528 case "$netdb_host_type" in
21529 '') rp='What is the type for the 1st argument to gethostbyaddr?'
21530 dflt='char *'
21531 . ./myread
21532 netdb_host_type=$ans
21533 rp='What is the type for the 2nd argument to gethostbyaddr?'
21534 dflt="$sizetype"
21535 . ./myread
21536 netdb_hlen_type=$ans
21537 ;;
21538 esac
21539 ;;
21540 *) : no gethostbyaddr, so pick harmless defaults
21541 netdb_host_type='char *'
21542 netdb_hlen_type="$sizetype"
21543 ;;
21544 esac
21545 # Remove the "const" if needed. -- but then we'll have a
21546 # prototype clash!
21547 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21548fi
21549
21550: check for type of argument to gethostbyname.
21551if test "X$netdb_name_type" = X ; then
21552 case "$d_gethbyname" in
21553 $define)
21554 $cat <<EOM
21555
21556Checking to see what type of argument is accepted by gethostbyname().
21557EOM
21558 hdrs="$define sys/types.h
21559 $d_socket sys/socket.h
21560 $i_niin netinet/in.h
21561 $i_netdb netdb.h
21562 $i_unistd unistd.h"
21563 for xxx in "const char *" "char *"; do
21564 case "$netdb_name_type" in
21565 '') try="$extern_C struct hostent *gethostbyname($xxx);"
21566 if ./protochk "$try" $hdrs; then
21567 echo "Your system accepts $xxx."
21568 netdb_name_type="$xxx"
21569 fi
21570 ;;
21571 esac
21572 done
21573 : In case none of those worked, prompt the user.
21574 case "$netdb_name_type" in
21575 '') rp='What is the type for the 1st argument to gethostbyname?'
21576 dflt='char *'
21577 . ./myread
21578 netdb_name_type=$ans
21579 ;;
21580 esac
21581 ;;
21582 *) : no gethostbyname, so pick harmless default
21583 netdb_name_type='char *'
21584 ;;
21585 esac
21586fi
21587
21588: check for type of 1st argument to getnetbyaddr.
21589if test "X$netdb_net_type" = X ; then
21590 case "$d_getnbyaddr" in
21591 $define)
21592 $cat <<EOM
21593
21594Checking to see what type of 1st argument is accepted by getnetbyaddr().
21595EOM
21596 hdrs="$define sys/types.h
21597 $d_socket sys/socket.h
21598 $i_niin netinet/in.h
21599 $i_netdb netdb.h
21600 $i_unistd unistd.h"
21601 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21602 case "$netdb_net_type" in
21603 '') try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21604 if ./protochk "$try" $hdrs; then
21605 echo "Your system accepts $xxx."
21606 netdb_net_type="$xxx"
21607 fi
21608 ;;
21609 esac
21610 done
21611 : In case none of those worked, prompt the user.
21612 case "$netdb_net_type" in
21613 '') rp='What is the type for the 1st argument to getnetbyaddr?'
21614 dflt='long'
21615 . ./myread
21616 netdb_net_type=$ans
21617 ;;
21618 esac
21619 ;;
21620 *) : no getnetbyaddr, so pick harmless default
21621 netdb_net_type='long'
21622 ;;
21623 esac
21624fi
21625: locate the preferred pager for this system
21626fn=f/
21627case "$pager" in
21628'')
21629 dflt=''
21630 case "$pg" in
21631 /*) dflt=$pg;;
21632 [a-zA-Z]:/*) dflt=$pg;;
21633 esac
21634 case "$more" in
21635 /*) dflt=$more;;
21636 [a-zA-Z]:/*) dflt=$more;;
21637 esac
21638 case "$less" in
21639 /*) dflt=$less;;
21640 [a-zA-Z]:/*) dflt=$less;;
21641 esac
21642 case "$dflt" in
21643 '') dflt=/usr/ucb/more;;
21644 esac
21645 ;;
21646*) dflt="$pager"
21647 ;;
21648esac
21649fn="f/($dflt)"
21650echo " "
21651rp='What pager is used on your system?'
21652. ./getfile
21653pager="$ans"
21654
21655: see if ar generates random libraries by itself
21656echo " "
21657echo "Checking how to generate random libraries on your machine..." >&4
21658echo 'int bar1() { return bar2(); }' > bar1.c
21659echo 'int bar2() { return 2; }' > bar2.c
21660$cat > foo.c <<EOP
21661#$i_stdlib I_STDLIB
21662#ifdef I_STDLIB
21663#include <stdlib.h>
21664#endif
21665int main() { printf("%d\n", bar1()); exit(0); }
21666EOP
21667$cc $ccflags -c bar1.c >/dev/null 2>&1
21668$cc $ccflags -c bar2.c >/dev/null 2>&1
21669$cc $ccflags -c foo.c >/dev/null 2>&1
21670$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21671if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21672 $run ./foobar >/dev/null 2>&1; then
21673 echo "$ar appears to generate random libraries itself."
21674 orderlib=false
21675 if [ "X$ranlib" = "X" ]; then
21676 ranlib=":"
21677 fi
21678elif $ar s bar$_a >/dev/null 2>&1 &&
21679 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21680 $run ./foobar >/dev/null 2>&1; then
21681 echo "a table of contents needs to be added with '$ar s'."
21682 orderlib=false
21683 ranlib="$ar s"
21684elif $ar ts bar$_a >/dev/null 2>&1 &&
21685 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21686 $run ./foobar >/dev/null 2>&1; then
21687 echo "a table of contents needs to be added with '$ar ts'."
21688 orderlib=false
21689 ranlib="$ar ts"
21690else
21691 case "$ranlib" in
21692 :) ranlib='';;
21693 '')
21694 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21695 $test -f $ranlib || ranlib=''
21696 ;;
21697 esac
21698 if $test -n "$ranlib"; then
21699 echo "your system has '$ranlib'; we'll use that."
21700 orderlib=false
21701 else
21702 echo "your system doesn't seem to support random libraries"
21703 echo "so we'll use lorder and tsort to order the libraries."
21704 orderlib=true
21705 ranlib=":"
21706 fi
21707fi
21708$rm -f foo* bar*
21709
21710: Check the max offset that gmtime and localtime accept
21711echo "Checking max offsets that gmtime () accepts"
21712
21713case "$sGMTIME_min/$sGMTIME_max" in
21714 0/0|/)
21715 $cat >try.c <<EOCP
21716#include <sys/types.h>
21717#include <stdio.h>
21718#include <time.h>
21719
21720int i;
21721struct tm *tmp;
21722time_t pt;
21723
21724void gm_check (time_t t, int min_year, int max_year)
21725{
21726 tmp = gmtime (&t);
21727 if ( tmp == NULL ||
21728 /* Check tm_year overflow */
21729 tmp->tm_year < min_year || tmp->tm_year > max_year)
21730 tmp = NULL;
21731 else
21732 pt = t;
21733 } /* gm_check */
21734
21735int check_max ()
21736{
21737 tmp = NULL;
21738 pt = 0;
21739#ifdef MAXLONG
21740 gm_check (MAXLONG, 69, 0x7fffffff);
21741#endif
21742 if (tmp == NULL || tmp->tm_year < 0) {
21743 for (i = 63; i >= 0; i--) {
21744 time_t x = pt | ((time_t)1 << i);
21745 if (x < 0 || x < pt) continue;
21746 gm_check (x, 69, 0x7fffffff);
21747 }
21748 }
21749 printf ("sGMTIME_max=%ld\n", pt);
21750 return (0);
21751 } /* check_max */
21752
21753int check_min ()
21754{
21755 tmp = NULL;
21756 pt = 0;
21757#ifdef MINLONG
21758 gm_check (MINLONG, -1900, 70);
21759#endif
21760 if (tmp == NULL) {
21761 for (i = 36; i >= 0; i--) {
21762 time_t x = pt - ((time_t)1 << i);
21763 if (x > 0) continue;
21764 gm_check (x, -1900, 70);
21765 }
21766 }
21767 printf ("sGMTIME_min=%ld\n", pt);
21768 return (0);
21769 } /* check_min */
21770
21771int main (int argc, char *argv[])
21772{
21773 /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21774 check_max ();
21775 check_min ();
21776 return (0);
21777 } /* main */
21778EOCP
21779 set try
21780 if eval $compile; then
21781 eval `$run ./try 2>/dev/null`
21782 else
21783 echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21784 fi
21785 $rm_try
21786 ;;
21787 esac
21788
21789echo "Checking max offsets that localtime () accepts"
21790
21791case "$sLOCALTIME_min/$sLOCALTIME_max" in
21792 0/0|/)
21793 $cat >try.c <<EOCP
21794#include <sys/types.h>
21795#include <stdio.h>
21796#include <time.h>
21797
21798int i;
21799struct tm *tmp;
21800time_t pt;
21801
21802void local_check (time_t t, int min_year, int max_year)
21803{
21804 if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21805 tmp = NULL;
21806 else
21807 tmp = localtime (&t);
21808 if ( tmp == NULL ||
21809 /* Check tm_year overflow */
21810 tmp->tm_year < min_year || tmp->tm_year > max_year)
21811 tmp = NULL;
21812 else
21813 pt = t;
21814 } /* local_check */
21815
21816int check_max ()
21817{
21818 tmp = NULL;
21819 pt = 0;
21820#ifdef MAXLONG
21821 local_check (MAXLONG, 69, 0x7fffffff);
21822#endif
21823 if (tmp == NULL || tmp->tm_year < 0) {
21824 for (i = 63; i >= 0; i--) {
21825 time_t x = pt | ((time_t)1 << i);
21826 if (x < 0 || x < pt) continue;
21827 local_check (x, 69, 0x7fffffff);
21828 }
21829 }
21830 printf ("sLOCALTIME_max=%ld\n", pt);
21831 return (0);
21832 } /* check_max */
21833
21834int check_min ()
21835{
21836 tmp = NULL;
21837 pt = 0;
21838#ifdef MINLONG
21839 local_check (MINLONG, -1900, 70);
21840#endif
21841 if (tmp == NULL) {
21842 for (i = 36; i >= 0; i--) {
21843 time_t x = pt - ((time_t)1 << i);
21844 if (x > 0) continue;
21845 local_check (x, -1900, 70);
21846 }
21847 }
21848 printf ("sLOCALTIME_min=%ld\n", pt);
21849 return (0);
21850 } /* check_min */
21851
21852int main (int argc, char *argv[])
21853{
21854 check_max ();
21855 check_min ();
21856 return (0);
21857 } /* main */
21858EOCP
21859 set try
21860 if eval $compile; then
21861 eval `$run ./try 2>/dev/null`
21862 else
21863 echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21864 fi
21865 $rm_try
21866 ;;
21867 esac
21868
21869: check for type of arguments to select.
21870case "$selecttype" in
21871'') case "$d_select" in
21872 $define)
21873 echo " "
21874 $cat <<EOM
21875Checking to see what type of arguments are accepted by select().
21876EOM
21877 hdrs="$define sys/types.h
21878 $i_systime sys/time.h
21879 $i_sysselct sys/select.h
21880 $d_socket sys/socket.h"
21881 : The first arg can be int, unsigned, or size_t
21882 : The last arg may or may not be 'const'
21883 val=''
21884 : void pointer has been seen but using that
21885 : breaks the selectminbits test
21886 for xxx in 'fd_set *' 'int *'; do
21887 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21888 for tmo in 'struct timeval *' 'const struct timeval *'; do
21889 case "$val" in
21890 '') try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21891 if ./protochk "$try" $hdrs; then
21892 echo "Your system accepts $xxx."
21893 val="$xxx"
21894 fi
21895 ;;
21896 esac
21897 done
21898 done
21899 done
21900 case "$val" in
21901 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21902 case "$d_fd_set" in
21903 $define) dflt="fd_set *" ;;
21904 *) dflt="int *" ;;
21905 esac
21906 . ./myread
21907 val=$ans
21908 ;;
21909 esac
21910 selecttype="$val"
21911 ;;
21912 *) : no select, so pick a harmless default
21913 selecttype='int *'
21914 ;;
21915 esac
21916 ;;
21917esac
21918
21919: check for the select 'width'
21920case "$selectminbits" in
21921'') safebits=`expr $ptrsize \* 8`
21922 case "$d_select" in
21923 $define)
21924 $cat <<EOM
21925
21926Checking to see on how many bits at a time your select() operates...
21927EOM
21928 $cat >try.c <<EOCP
21929#include <sys/types.h>
21930#$i_time I_TIME
21931#$i_systime I_SYS_TIME
21932#$i_systimek I_SYS_TIME_KERNEL
21933#ifdef I_TIME
21934# include <time.h>
21935#endif
21936#ifdef I_SYS_TIME
21937# ifdef I_SYS_TIME_KERNEL
21938# define KERNEL
21939# endif
21940# include <sys/time.h>
21941# ifdef I_SYS_TIME_KERNEL
21942# undef KERNEL
21943# endif
21944#endif
21945#$i_sysselct I_SYS_SELECT
21946#ifdef I_SYS_SELECT
21947#include <sys/select.h>
21948#endif
21949#$d_socket HAS_SOCKET
21950#ifdef HAS_SOCKET
21951# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21952#endif
21953#include <stdio.h>
21954#$i_stdlib I_STDLIB
21955#ifdef I_STDLIB
21956#include <stdlib.h>
21957#endif
21958$selecttype b;
21959#define S sizeof(*(b))
21960#define MINBITS 64
21961#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21962#define NBITS (NBYTES * 8)
21963int main() {
21964 char *s = (char *)malloc(NBYTES);
21965 struct timeval t;
21966 int i;
21967 FILE* fp;
21968 int fd;
21969
21970 if (!s)
21971 exit(1);
21972 fclose(stdin);
21973 fp = fopen("try.c", "r");
21974 if (fp == 0)
21975 exit(2);
21976 fd = fileno(fp);
21977 if (fd < 0)
21978 exit(3);
21979 b = ($selecttype)s;
21980 for (i = 0; i < NBITS; i++)
21981 FD_SET(i, b);
21982 t.tv_sec = 0;
21983 t.tv_usec = 0;
21984 select(fd + 1, b, 0, 0, &t);
21985 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21986 free(s);
21987 printf("%d\n", i + 1);
21988 return 0;
21989}
21990EOCP
21991 set try
21992 if eval $compile_ok; then
21993 selectminbits=`$run ./try 2>/dev/null`
21994 case "$selectminbits" in
21995 '') cat >&4 <<EOM
21996Cannot figure out on how many bits at a time your select() operates.
21997I'll play safe and guess it is $safebits bits.
21998EOM
21999 selectminbits=$safebits
22000 bits="$safebits bits"
22001 ;;
22002 1) bits="1 bit" ;;
22003 *) bits="$selectminbits bits" ;;
22004 esac
22005 echo "Your select() operates on $bits at a time." >&4
22006 else
22007 rp='What is the minimum number of bits your select() operates on?'
22008 case "$byteorder" in
22009 12345678) dflt=64 ;;
22010 1234) dflt=32 ;;
22011 *) dflt=1 ;;
22012 esac
22013 . ./myread
22014 val=$ans
22015 selectminbits="$val"
22016 fi
22017 $rm_try
22018 ;;
22019 *) : no select, so pick a harmless default
22020 selectminbits=$safebits
22021 ;;
22022 esac
22023 ;;
22024esac
22025
22026: Trace out the files included by signal.h, then look for SIGxxx names.
22027case "$sig_num_init" in
22028'')
22029if [ "X$fieldn" = X ]; then
22030 : Just make some guesses. We check them later.
22031 xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22032else
22033 xxx=`echo '#include <signal.h>' |
22034 $cppstdin $cppminus $cppflags 2>/dev/null |
22035 $grep '^[ ]*#.*include' |
22036 $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22037 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22038fi
22039xxxfiles=''
22040for xx in $xxx /dev/null ; do
22041 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22042done
22043case "$xxxfiles" in
22044'') xxxfiles=`./findhdr signal.h` ;;
22045esac
22046xxx=`awk '
22047$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22048 print substr($2, 4, 20)
22049}
22050$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22051 print substr($3, 4, 20)
22052}' $xxxfiles`
22053: Append some common names just in case the awk scan failed.
22054xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22055xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22056xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22057xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22058xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22059
22060: generate a few handy files for later
22061$cat > signal.c <<EOCP
22062#include <sys/types.h>
22063#include <signal.h>
22064#$i_stdlib I_STDLIB
22065#ifdef I_STDLIB
22066#include <stdlib.h>
22067#endif
22068#include <stdio.h>
22069int main() {
22070
22071/* Strange style to avoid deeply-nested #if/#else/#endif */
22072#ifndef NSIG
22073# ifdef _NSIG
22074# define NSIG (_NSIG)
22075# endif
22076#endif
22077
22078#ifndef NSIG
22079# ifdef SIGMAX
22080# define NSIG (SIGMAX+1)
22081# endif
22082#endif
22083
22084#ifndef NSIG
22085# ifdef SIG_MAX
22086# define NSIG (SIG_MAX+1)
22087# endif
22088#endif
22089
22090#ifndef NSIG
22091# ifdef _SIG_MAX
22092# define NSIG (_SIG_MAX+1)
22093# endif
22094#endif
22095
22096#ifndef NSIG
22097# ifdef MAXSIG
22098# define NSIG (MAXSIG+1)
22099# endif
22100#endif
22101
22102#ifndef NSIG
22103# ifdef MAX_SIG
22104# define NSIG (MAX_SIG+1)
22105# endif
22106#endif
22107
22108#ifndef NSIG
22109# ifdef SIGARRAYSIZE
22110# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22111# endif
22112#endif
22113
22114#ifndef NSIG
22115# ifdef _sys_nsig
22116# define NSIG (_sys_nsig) /* Solaris 2.5 */
22117# endif
22118#endif
22119
22120/* Default to some arbitrary number that's big enough to get most
22121 of the common signals.
22122*/
22123#ifndef NSIG
22124# define NSIG 50
22125#endif
22126
22127printf("NSIG %d\n", NSIG);
22128
22129#ifndef JUST_NSIG
22130
22131EOCP
22132
22133echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22134{
22135 printf "#ifdef SIG"; printf $1; printf "\n"
22136 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22137 printf $1; printf ");\n"
22138 printf "#endif\n"
22139}
22140END {
22141 printf "#endif /* JUST_NSIG */\n";
22142 printf "exit(0);\n}\n";
22143}
22144' >>signal.c
22145$cat >signal.awk <<'EOP'
22146BEGIN { ndups = 0 }
22147$1 ~ /^NSIG$/ { nsig = $2 }
22148($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22149 if ($2 > maxsig) { maxsig = $2 }
22150 if (sig_name[$2]) {
22151 dup_name[ndups] = $1
22152 dup_num[ndups] = $2
22153 ndups++
22154 }
22155 else {
22156 sig_name[$2] = $1
22157 sig_num[$2] = $2
22158 }
22159}
22160END {
22161 if (nsig == 0) {
22162 nsig = maxsig + 1
22163 }
22164 printf("NSIG %d\n", nsig);
22165 for (n = 1; n < nsig; n++) {
22166 if (sig_name[n]) {
22167 printf("%s %d\n", sig_name[n], sig_num[n])
22168 }
22169 else {
22170 printf("NUM%d %d\n", n, n)
22171 }
22172 }
22173 for (n = 0; n < ndups; n++) {
22174 printf("%s %d\n", dup_name[n], dup_num[n])
22175 }
22176}
22177EOP
22178$cat >signal_cmd <<EOS
22179$startsh
22180if $test -s signal.lst; then
22181 echo "Using your existing signal.lst file"
22182 exit 0
22183fi
22184xxx="$xxx"
22185EOS
22186$cat >>signal_cmd <<'EOS'
22187
22188set signal
22189if eval $compile_ok; then
22190 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22191 $uniq | $awk -f signal.awk >signal.lst
22192else
22193 echo "(I can't seem be able to compile the whole test program)" >&4
22194 echo "(I'll try it in little pieces.)" >&4
22195 set signal -DJUST_NSIG
22196 if eval $compile_ok; then
22197 $run ./signal$_exe > signal.nsg
22198 $cat signal.nsg
22199 else
22200 echo "I can't seem to figure out how many signals you have." >&4
22201 echo "Guessing 50." >&4
22202 echo 'NSIG 50' > signal.nsg
22203 fi
22204 : Now look at all the signal names, one at a time.
22205 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22206 $cat > signal.c <<EOCP
22207#include <sys/types.h>
22208#include <signal.h>
22209#include <stdio.h>
22210int main() {
22211printf("$xx %d\n", SIG${xx});
22212return 0;
22213}
22214EOCP
22215 set signal
22216 if eval $compile; then
22217 echo "SIG${xx} found."
22218 $run ./signal$_exe >> signal.ls1
22219 else
22220 echo "SIG${xx} NOT found."
22221 fi
22222 done
22223 if $test -s signal.ls1; then
22224 $cat signal.nsg signal.ls1 |
22225 $sort -n | $uniq | $awk -f signal.awk >signal.lst
22226 fi
22227
22228fi
22229if $test -s signal.lst; then
22230 :
22231else
22232 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22233 echo 'kill -l' >signal
22234 set X `csh -f <signal`
22235 $rm -f signal
22236 shift
22237 case $# in
22238 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22239 esac
22240 echo $@ | $tr ' ' $trnl | \
22241 $awk '{ printf "%s %d\n", $1, ++s; }
22242 END { printf "NSIG %d\n", ++s }' >signal.lst
22243fi
22244$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22245EOS
22246chmod a+x signal_cmd
22247$eunicefix signal_cmd
22248;;
22249esac
22250
22251: generate list of signal names
22252case "$sig_num_init" in
22253'')
22254echo " "
22255case "$sig_name_init" in
22256'') doinit=yes ;;
22257*) case "$sig_num_init" in
22258 ''|*,*) doinit=yes ;;
22259 esac ;;
22260esac
22261case "$doinit" in
22262yes)
22263 echo "Generating a list of signal names and numbers..." >&4
22264 . ./signal_cmd
22265 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22266 sig_name=`$awk 'BEGIN { printf "ZERO " }
22267 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22268 sig_num=`$awk 'BEGIN { printf "0 " }
22269 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22270 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
22271 !/^NSIG/ { printf "\"%s\", ", $1 }
22272 END { printf "0\n" }' signal.lst`
22273 sig_num_init=`$awk 'BEGIN { printf "0, " }
22274 !/^NSIG/ { printf "%d, ", $2}
22275 END { printf "0\n"}' signal.lst`
22276 ;;
22277esac
22278echo "The following $sig_count signals are available:"
22279echo " "
22280echo $sig_name | $awk \
22281'BEGIN { linelen = 0 }
22282{
22283 for (i = 1; i <= NF; i++) {
22284 name = "SIG" $i " "
22285 linelen = linelen + length(name)
22286 if (linelen > 70) {
22287 printf "\n"
22288 linelen = length(name)
22289 }
22290 printf "%s", name
22291 }
22292 printf "\n"
22293}'
22294sig_size=`echo $sig_name | awk '{print NF}'`
22295$rm -f signal signal.c signal.awk signal.lst signal_cmd
22296;;
22297esac
22298
22299: Check size of size
22300echo " "
22301case "$sizetype" in
22302*_t) zzz="$sizetype" ;;
22303*) zzz="filesize" ;;
22304esac
22305echo "Checking the size of $zzz..." >&4
22306cat > try.c <<EOCP
22307#include <sys/types.h>
22308#include <stdio.h>
22309#$i_stdlib I_STDLIB
22310#ifdef I_STDLIB
22311#include <stdlib.h>
22312#endif
22313int main() {
22314 printf("%d\n", (int)sizeof($sizetype));
22315 exit(0);
22316}
22317EOCP
22318set try
22319if eval $compile_ok; then
22320 yyy=`$run ./try`
22321 case "$yyy" in
22322 '') sizesize=4
22323 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22324 ;;
22325 *) sizesize=$yyy
22326 echo "Your $zzz size is $sizesize bytes."
22327 ;;
22328 esac
22329else
22330 sizesize=4
22331 echo "(I can't compile the test program--guessing $sizesize.)" >&4
22332fi
22333
22334: check for socklen_t
22335echo " "
22336echo "Checking to see if you have socklen_t..." >&4
22337$cat >try.c <<EOCP
22338#include <sys/types.h>
22339#$d_socket HAS_SOCKET
22340#ifdef HAS_SOCKET
22341#include <sys/socket.h>
22342#endif
22343int main() { socklen_t x = 16; }
22344EOCP
22345set try
22346if eval $compile; then
22347 val="$define"
22348 echo "You have socklen_t."
22349else
22350 val="$undef"
22351 echo "You do not have socklen_t."
22352 case "$sizetype" in
22353 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22354 esac
22355fi
22356$rm_try
22357set d_socklen_t
22358eval $setvar
22359
22360: see if this is a socks.h system
22361set socks.h i_socks
22362eval $inhdr
22363
22364: check for type of the size argument to socket calls
22365case "$d_socket" in
22366"$define")
22367 $cat <<EOM
22368
22369Checking to see what type is the last argument of accept().
22370EOM
22371 yyy=''
22372 case "$d_socklen_t" in
22373 "$define") yyy="$yyy socklen_t"
22374 esac
22375 yyy="$yyy $sizetype int long unsigned"
22376 for xxx in $yyy; do
22377 case "$socksizetype" in
22378 '') try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22379 case "$usesocks" in
22380 "$define")
22381 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22382 echo "Your system accepts '$xxx *' for the last argument of accept()."
22383 socksizetype="$xxx"
22384 fi
22385 ;;
22386 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
22387 echo "Your system accepts '$xxx *' for the last argument of accept()."
22388 socksizetype="$xxx"
22389 fi
22390 ;;
22391 esac
22392 ;;
22393 esac
22394 done
22395: In case none of those worked, prompt the user.
22396 case "$socksizetype" in
22397 '') rp='What is the type for socket address structure sizes?'
22398 dflt='int'
22399 . ./myread
22400 socksizetype=$ans
22401 ;;
22402 esac
22403 ;;
22404*) : no sockets, so pick relatively harmless default
22405 socksizetype='int'
22406 ;;
22407esac
22408
22409: see what type is used for signed size_t
22410set ssize_t ssizetype int stdio.h sys/types.h
22411eval $typedef
22412dflt="$ssizetype"
22413$cat > try.c <<EOM
22414#include <stdio.h>
22415#$i_stdlib I_STDLIB
22416#ifdef I_STDLIB
22417#include <stdlib.h>
22418#endif
22419#include <sys/types.h>
22420#define Size_t $sizetype
22421#define SSize_t $dflt
22422int main()
22423{
22424 if (sizeof(Size_t) == sizeof(SSize_t))
22425 printf("$dflt\n");
22426 else if (sizeof(Size_t) == sizeof(int))
22427 printf("int\n");
22428 else
22429 printf("long\n");
22430 exit(0);
22431}
22432EOM
22433echo " "
22434set try
22435if eval $compile_ok && $run ./try > /dev/null; then
22436 ssizetype=`$run ./try`
22437 echo "I'll be using $ssizetype for functions returning a byte count." >&4
22438else
22439 $cat >&4 <<EOM
22440Help! I can't compile and run the ssize_t test program: please enlighten me!
22441(This is probably a misconfiguration in your system or libraries, and
22442you really ought to fix it. Still, I'll try anyway.)
22443
22444I need a type that is the same size as $sizetype, but is guaranteed to
22445be signed. Common values are ssize_t, int and long.
22446
22447EOM
22448 rp="What signed type is the same size as $sizetype?"
22449 . ./myread
22450 ssizetype="$ans"
22451fi
22452$rm_try
22453
22454: Check the size of st_ino
22455$echo " "
22456$echo "Checking the size of st_ino..." >&4
22457$cat > try.c <<EOCP
22458#include <sys/stat.h>
22459#include <stdio.h>
22460#$i_stdlib I_STDLIB
22461#ifdef I_STDLIB
22462#include <stdlib.h>
22463#endif
22464int main() {
22465 struct stat st;
22466 printf("%d\n", (int)sizeof(st.st_ino));
22467 exit(0);
22468}
22469EOCP
22470set try
22471if eval $compile_ok; then
22472 val=`$run ./try`
22473 case "$val" in
22474 '') st_ino_size=4
22475 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22476 ;;
22477 *) st_ino_size=$val
22478 $echo "Your st_ino is $st_ino_size bytes long."
22479 ;;
22480 esac
22481else
22482 st_ino_size=4
22483 $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22484fi
22485$rm_try
22486
22487: Check if st_ino is signed
22488$echo " "
22489$echo "Checking the sign of st_ino..." >&4
22490$cat > try.c <<EOCP
22491#include <sys/stat.h>
22492#include <stdio.h>
22493int main() {
22494 struct stat foo;
22495 foo.st_ino = -1;
22496 if (foo.st_ino < 0)
22497 printf("-1\n");
22498 else
22499 printf("1\n");
22500}
22501EOCP
22502set try
22503if eval $compile; then
22504 val=`$run ./try`
22505 case "$val" in
22506 '') st_ino_sign=1
22507 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22508 ;;
22509 *) st_ino_sign=$val
22510 case "$st_ino_sign" in
22511 1) $echo "Your st_ino is unsigned." ;;
22512 -1) $echo "Your st_ino is signed." ;;
22513 esac
22514 ;;
22515 esac
22516else
22517 st_ino_sign=1
22518 $echo "(I can't compile the test program--guessing unsigned.)" >&4
22519fi
22520$rm_try
22521
22522: see what type of char stdio uses.
22523echo " "
22524echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22525if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22526 echo "Your stdio uses unsigned chars." >&4
22527 stdchar="unsigned char"
22528else
22529 echo "Your stdio uses signed chars." >&4
22530 stdchar="char"
22531fi
22532$rm -f stdioh
22533
22534: Check size of UID
22535echo " "
22536case "$uidtype" in
22537*_t) zzz="$uidtype" ;;
22538*) zzz="uid" ;;
22539esac
22540echo "Checking the size of $zzz..." >&4
22541cat > try.c <<EOCP
22542#include <sys/types.h>
22543#include <stdio.h>
22544#$i_stdlib I_STDLIB
22545#ifdef I_STDLIB
22546#include <stdlib.h>
22547#endif
22548int main() {
22549 printf("%d\n", (int)sizeof($uidtype));
22550 exit(0);
22551}
22552EOCP
22553set try
22554if eval $compile_ok; then
22555 yyy=`$run ./try`
22556 case "$yyy" in
22557 '') uidsize=4
22558 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22559 ;;
22560 *) uidsize=$yyy
22561 echo "Your $zzz is $uidsize bytes long."
22562 ;;
22563 esac
22564else
22565 uidsize=4
22566 echo "(I can't compile the test program--guessing $uidsize.)" >&4
22567fi
22568
22569: Check if UID is signed
22570echo " "
22571case "$uidtype" in
22572*_t) zzz="$uidtype" ;;
22573*) zzz="uid" ;;
22574esac
22575echo "Checking the sign of $zzz..." >&4
22576cat > try.c <<EOCP
22577#include <sys/types.h>
22578#include <stdio.h>
22579int main() {
22580 $uidtype foo = -1;
22581 if (foo < 0)
22582 printf("-1\n");
22583 else
22584 printf("1\n");
22585}
22586EOCP
22587set try
22588if eval $compile; then
22589 yyy=`$run ./try`
22590 case "$yyy" in
22591 '') uidsign=1
22592 echo "(I can't execute the test program--guessing unsigned.)" >&4
22593 ;;
22594 *) uidsign=$yyy
22595 case "$uidsign" in
22596 1) echo "Your $zzz is unsigned." ;;
22597 -1) echo "Your $zzz is signed." ;;
22598 esac
22599 ;;
22600 esac
22601else
22602 uidsign=1
22603 echo "(I can't compile the test program--guessing unsigned.)" >&4
22604fi
22605
22606: Check format string for UID
22607echo " "
22608$echo "Checking the format string to be used for uids..." >&4
22609
22610case "$uidsign" in
22611-1) if $test X"$uidsize" = X"$ivsize"; then
22612 uidformat="$ivdformat"
22613 else
22614 if $test X"$uidsize" = X"$longsize"; then
22615 uidformat='"ld"'
22616 else
22617 if $test X"$uidsize" = X"$intsize"; then
22618 uidformat='"d"'
22619 else
22620 if $test X"$uidsize" = X"$shortsize"; then
22621 uidformat='"hd"'
22622 fi
22623 fi
22624 fi
22625 fi
22626 ;;
22627*) if $test X"$uidsize" = X"$uvsize"; then
22628 uidformat="$uvuformat"
22629 else
22630 if $test X"$uidsize" = X"$longsize"; then
22631 uidformat='"lu"'
22632 else
22633 if $test X"$uidsize" = X"$intsize"; then
22634 uidformat='"u"'
22635 else
22636 if $test X"$uidsize" = X"$shortsize"; then
22637 uidformat='"hu"'
22638 fi
22639 fi
22640 fi
22641 fi
22642 ;;
22643esac
22644
22645: Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22646echo " "
22647echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22648$cat >try.c <<'EOM'
22649/* Intentionally a long probe as I'd like to sanity check that the exact
22650 approach is going to work, as thinking it will work, but only having it
22651 part working at runtime is worse than not having it. */
22652
22653#include <sys/types.h>
22654#include <sys/sysctl.h>
22655#include <sys/param.h>
22656#include <stdio.h>
22657#include <string.h>
22658#include <stdlib.h>
22659#include <unistd.h>
22660
22661int
22662main(int argc, char **argv) {
22663 char *buffer;
22664 char *argv_leaf = strrchr(argv[0], '/');
22665 char *buffer_leaf;
22666 size_t size = 0;
22667 int mib[4];
22668
22669 mib[0] = CTL_KERN;
22670 mib[1] = KERN_PROC;
22671 mib[2] = KERN_PROC_PATHNAME;
22672 mib[3] = -1;
22673
22674 if (!argv_leaf) {
22675 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22676 return 1;
22677 }
22678
22679 if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22680 perror("sysctl");
22681 return 2;
22682 }
22683
22684 if (size < strlen(argv_leaf) + 1) {
22685 fprintf(stderr, "size %lu is too short for a path\n",
22686 (unsigned long) size);
22687 return 3;
22688 }
22689
22690 if (size > MAXPATHLEN * MAXPATHLEN) {
22691 fprintf(stderr, "size %lu is too long for a path\n",
22692 (unsigned long) size);
22693 return 4;
22694 }
22695
22696 buffer = (char *)malloc(size);
22697 if (!buffer) {
22698 perror("malloc");
22699 return 5;
22700 }
22701
22702 if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22703 perror("sysctl");
22704 return 6;
22705 }
22706
22707 if (strlen(buffer) + 1 != size) {
22708 fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22709 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22710 return 7;
22711 }
22712
22713
22714 if (*buffer != '/') {
22715 fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22716 return 8;
22717 }
22718
22719 if (strstr(buffer, "/./")) {
22720 fprintf(stderr, "Contains /./: '%s'\n", buffer);
22721 return 9;
22722 }
22723
22724 if (strstr(buffer, "/../")) {
22725 fprintf(stderr, "Contains /../: '%s'\n", buffer);
22726 return 10;
22727 }
22728
22729 buffer_leaf = strrchr(buffer, '/');
22730 if (strcmp(buffer_leaf, argv_leaf) != 0) {
22731 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22732 return 11;
22733 }
22734
22735 free(buffer);
22736
22737 return 0;
22738}
22739EOM
22740
22741val=$undef
22742set try
22743if eval $compile; then
22744 if $run ./try; then
22745 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22746 val="$define"
22747 else
22748 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22749 val="$undef"
22750 fi
22751else
22752 echo "I'm unable to compile the test program." >&4
22753 echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22754 val="$undef"
22755fi
22756$rm_try
22757set usekernprocpathname
22758eval $setvar
22759
22760: Determine if we can use _NSGetExecutablePath to find executing program
22761echo " "
22762echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22763$cat >try.c <<'EOM'
22764/* Intentionally a long probe as I'd like to sanity check that the exact
22765 approach is going to work, as thinking it will work, but only having it
22766 part working at runtime is worse than not having it. */
22767#include <mach-o/dyld.h>
22768#include <stdio.h>
22769#include <stdlib.h>
22770#include <sys/param.h>
22771#include <string.h>
22772
22773int
22774main(int argc, char **argv) {
22775 char buf[1];
22776 uint32_t size = sizeof(buf);
22777 int result;
22778 char *buffer;
22779 char *tidied;
22780 char *argv_leaf = strrchr(argv[0], '/');
22781 char *tidied_leaf;
22782
22783 if (!argv_leaf) {
22784 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22785 return 1;
22786 }
22787
22788 _NSGetExecutablePath(buf, &size);
22789 if (size > MAXPATHLEN * MAXPATHLEN) {
22790 fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22791 (unsigned int) size);
22792 return 2;
22793 }
22794
22795 buffer = (char *)malloc(size);
22796 if (!buffer) {
22797 perror("malloc");
22798 return 3;
22799 }
22800
22801 result = _NSGetExecutablePath(buffer, &size);
22802 if (result != 0) {
22803 fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22804 result, (unsigned int) size);
22805 return 4;
22806 }
22807
22808 tidied = realpath(buffer, NULL);
22809 if (!tidied) {
22810 perror("realpath");
22811 return 5;
22812 }
22813
22814 free(buffer);
22815
22816 if (*tidied != '/') {
22817 fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22818 return 6;
22819 }
22820
22821 if (strstr(tidied, "/./")) {
22822 fprintf(stderr, "Contains /./: '%s'\n", tidied);
22823 return 7;
22824 }
22825
22826 if (strstr(tidied, "/../")) {
22827 fprintf(stderr, "Contains /../: '%s'\n", tidied);
22828 return 8;
22829 }
22830
22831 tidied_leaf = strrchr(tidied, '/');
22832 if (strcmp(tidied_leaf, argv_leaf) != 0) {
22833 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22834 return 9;
22835 }
22836
22837 free(tidied);
22838
22839 return 0;
22840}
22841EOM
22842
22843val=$undef
22844set try
22845if eval $compile; then
22846 if $run ./try; then
22847 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22848 val="$define"
22849 else
22850 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22851 fi
22852else
22853 echo "I'm unable to compile the test program." >&4
22854 echo "I'll assume no _NSGetExecutablePath here." >&4
22855fi
22856$rm_try
22857set usensgetexecutablepath
22858eval $setvar
22859
22860: Check if site customization support was requested
22861case "$usesitecustomize" in
22862 $define|true|[Yy]*)
22863 usesitecustomize="$define"
22864 ;;
22865 *)
22866 usesitecustomize="$undef"
22867 ;;
22868 esac
22869
22870: determine compiler compiler
22871case "$yacc" in
22872'')
22873 dflt=yacc;;
22874*)
22875 dflt="$yacc";;
22876esac
22877echo " "
22878comp='yacc'
22879if $test -f "$byacc$_exe"; then
22880 dflt="$byacc"
22881 comp="byacc or $comp"
22882fi
22883if $test -f "$bison$_exe"; then
22884 comp="$comp or bison -y"
22885fi
22886rp="Which compiler compiler ($comp) shall I use?"
22887. ./myread
22888yacc="$ans"
22889case "$yacc" in
22890*bis*)
22891 case "$yacc" in
22892 *-y*) ;;
22893 *)
22894 yacc="$yacc -y"
22895 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22896 ;;
22897 esac
22898 ;;
22899esac
22900
22901: see if this is a bfd.h system
22902set bfd.h i_bfd
22903eval $inhdr
22904
22905: see if this is an execinfo.h system
22906set execinfo.h i_execinfo
22907eval $inhdr
22908
22909: see if this is a fenv.h system
22910set fenv.h i_fenv
22911eval $inhdr
22912
22913: see if this is a fp.h system
22914set fp.h i_fp
22915eval $inhdr
22916
22917: see if this is a fp_class.h system
22918set fp_class.h i_fp_class
22919eval $inhdr
22920
22921: see if gdbm.h is available
22922set gdbm.h t_gdbm
22923eval $inhdr
22924case "$t_gdbm" in
22925$define)
22926 : see if gdbm_open exists
22927 set gdbm_open d_gdbm_open
22928 eval $inlibc
22929 case "$d_gdbm_open" in
22930 $undef)
22931 t_gdbm="$undef"
22932 echo "We won't be including <gdbm.h>"
22933 ;;
22934 esac
22935 ;;
22936esac
22937val="$t_gdbm"
22938set i_gdbm
22939eval $setvar
22940
22941: see if this is a ieeefp.h system
22942case "$i_ieeefp" in
22943'' ) set ieeefp.h i_ieeefp
22944 eval $inhdr
22945 ;;
22946esac
22947
22948: see if this is a libutil.h system
22949set libutil.h i_libutil
22950eval $inhdr
22951
22952: see if mach cthreads are available
22953if test "X$usethreads" = "X$define"; then
22954 set mach/cthreads.h i_machcthr
22955 eval $inhdr
22956else
22957 i_machcthr="$undef"
22958fi
22959
22960: see if this is a mntent.h system
22961set mntent.h i_mntent
22962eval $inhdr
22963
22964: see if net/errno.h is available
22965val=''
22966set net/errno.h val
22967eval $inhdr
22968
22969: Unfortunately, it causes problems on some systems. Arrgh.
22970case "$val" in
22971$define)
22972 cat > try.c <<'EOM'
22973#include <stdio.h>
22974#include <errno.h>
22975#include <net/errno.h>
22976int func()
22977{
22978 return ENOTSOCK;
22979}
22980EOM
22981 if $cc $ccflags -c try.c >/dev/null 2>&1; then
22982 echo "We'll be including <net/errno.h>." >&4
22983 else
22984 echo "We won't be including <net/errno.h>." >&4
22985 val="$undef"
22986 fi
22987 $rm_try
22988 ;;
22989esac
22990set i_neterrno
22991eval $setvar
22992
22993: see if netinet/tcp.h is available
22994set netinet/tcp.h i_netinettcp
22995eval $inhdr
22996
22997: see if this is a poll.h system
22998set poll.h i_poll
22999eval $inhdr
23000
23001: see if this is a prot.h system
23002set prot.h i_prot
23003eval $inhdr
23004
23005: Preprocessor symbols
23006echo " "
23007$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23008$cat <<'EOSH' > Cppsym.know
23009a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23010AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23011AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23012arch_pwr ardent ARM ARM32 atarist att386 att3b
23013BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23014BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23015byteorder byte_order
23016c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23017convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23018DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23019ELF encore EPI EXTENSIONS
23020FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23021GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23022GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23023H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23024hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
23025hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23026i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23027iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23028INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23029ksr1
23030LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23031LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23032LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23033luna88k Lynx
23034M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23035MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23036mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23037merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23038MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
23039MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23040M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23041M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23042n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23043news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23044ns32000 ns32016 ns32332 ns32k nsc32000
23045OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23046PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23047plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23048POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23049QK_USER QNX
23050R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23051S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23052SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23053sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23054stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23055SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23056SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23057SYSV4 SYSV5 sysV68 sysV88
23058Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23059TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23060tower32_800 tower32_850 tss
23061u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23062UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23063USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23064USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23065USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23066USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23067uxpm uxps
23068vax venix VMESA vms
23069x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23070XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23071z8000 zarch
23072EOSH
23073# Maybe put other stuff here too.
23074./tr '-' '_' <<EOSH >>Cppsym.know
23075$osname
23076EOSH
23077./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23078./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23079$cat Cppsym.know > Cppsym.c
23080$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23081$rm -f Cppsym.a Cppsym.b Cppsym.c
23082cat <<EOSH > Cppsym
23083$startsh
23084if $test \$# -gt 0; then
23085 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23086 if $test -s Cppsym.got; then
23087 $rm -f Cppsym.got
23088 exit 0
23089 fi
23090 $rm -f Cppsym.got
23091 exit 1
23092else
23093 $tr " " "$trnl" | ./Cppsym.try
23094 exit 0
23095fi
23096EOSH
23097chmod +x Cppsym
23098$eunicefix Cppsym
23099cat <<EOSH > Cppsym.try
23100$startsh
23101cat <<'EOCP' > try.c
23102#include <stdio.h>
23103#if cpp_stuff == 1
23104#define STRINGIFY(a) "a"
23105#endif
23106#if cpp_stuff == 42
23107#define StGiFy(a) #a
23108#define STRINGIFY(a) StGiFy(a)
23109#endif
23110#if $cpp_stuff != 1 && $cpp_stuff != 42
23111# include "Bletch: How does this C preprocessor stringify macros?"
23112#endif
23113int main() {
23114EOCP
23115$awk \\
23116EOSH
23117cat <<'EOSH' >> Cppsym.try
23118'length($1) > 0 {
23119 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23120 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23121 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23122 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23123}' >> try.c
23124echo 'return 0;}' >> try.c
23125EOSH
23126cat <<EOSH >> Cppsym.try
23127ccflags="$ccflags"
23128case "$osname-$gccversion" in
23129irix-) ccflags="\$ccflags -woff 1178" ;;
23130os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23131esac
23132$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23133EOSH
23134chmod +x Cppsym.try
23135$eunicefix Cppsym.try
23136./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23137: Add in any Linux cpp "predefined macros":
23138case "$osname::$gccversion" in
23139 *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23140 tHdrH=_tmpHdr
23141 rm -f $tHdrH'.h' $tHdrH
23142 touch $tHdrH'.h'
23143 # Filter out macro arguments, such as Linux's __INT8_C(c)
23144 if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23145 sed -e 's/#define[\ \ ]*//;s/[\ \ ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23146 if [ -s $tHdrH'_cppsym.real' ]; then
23147 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23148 fi
23149 fi
23150 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23151 ;;
23152esac
23153: now check the C compiler for additional symbols
23154postprocess_cc_v=''
23155case "$osname" in
23156aix) postprocess_cc_v="|$tr , ' '" ;;
23157esac
23158$cat >ccsym <<EOS
23159$startsh
23160$cat >tmp.c <<EOF
23161extern int foo;
23162EOF
23163for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23164do
23165 case "\$i" in
23166 -D*) echo "\$i" | $sed 's/^-D//';;
23167 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23168 esac
23169done
23170$rm_try
23171EOS
23172postprocess_cc_v=''
23173chmod +x ccsym
23174$eunicefix ccsym
23175./ccsym > ccsym1.raw
23176if $test -s ccsym1.raw; then
23177 $sort ccsym1.raw | $uniq >ccsym.raw
23178else
23179 mv ccsym1.raw ccsym.raw
23180fi
23181
23182$awk '/\=/ { print $0; next }
23183 { print $0"=1" }' ccsym.raw >ccsym.list
23184$comm -13 Cppsym.true ccsym.list >ccsym.own
23185$comm -12 Cppsym.true ccsym.list >ccsym.com
23186$comm -23 Cppsym.true ccsym.list >ccsym.cpp
23187also=''
23188if $test -z ccsym.raw; then
23189 echo "Your C compiler doesn't seem to define any symbols!" >&4
23190 echo " "
23191 echo "However, your C preprocessor defines the following symbols:"
23192 $cat Cppsym.true
23193 ccsymbols=''
23194 cppsymbols=`$cat Cppsym.true`
23195 cppsymbols=`echo $cppsymbols`
23196 cppccsymbols="$cppsymbols"
23197else
23198 if $test -s ccsym.com; then
23199 echo "Your C compiler and pre-processor define these symbols:"
23200 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23201 also='also '
23202 symbols='ones'
23203 cppccsymbols=`$cat ccsym.com`
23204 cppccsymbols=`echo $cppccsymbols`
23205 $test "$silent" || sleep 1
23206 fi
23207 if $test -s ccsym.cpp; then
23208 $test "$also" && echo " "
23209 echo "Your C pre-processor ${also}defines the following symbols:"
23210 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23211 also='further '
23212 cppsymbols=`$cat ccsym.cpp`
23213 cppsymbols=`echo $cppsymbols`
23214 $test "$silent" || sleep 1
23215 fi
23216 if $test -s ccsym.own; then
23217 $test "$also" && echo " "
23218 echo "Your C compiler ${also}defines the following cpp symbols:"
23219 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23220 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23221 ccsymbols=`$cat ccsym.own`
23222 ccsymbols=`echo $ccsymbols`
23223 $test "$silent" || sleep 1
23224 fi
23225fi
23226
23227: add -D_FORTIFY_SOURCE if feasible and not already there
23228case "$gccversion" in
23229[456789].*|[1-9][0-9]*) case "$optimize$ccflags" in
23230 *-O*) case "$ccflags$cppsymbols" in
23231 *_FORTIFY_SOURCE=*) # Don't add it again.
23232 echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23233 ;;
23234 *) echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23235 ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23236 ;;
23237 esac
23238 ;;
23239 *) echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23240 ;;
23241 esac
23242 ;;
23243*) echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23244 ;;
23245esac
23246
23247: script used to emit important warnings
23248cat >warn <<EOS
23249$startsh
23250if test \$# -gt 0; then
23251 echo "\$@" >msg
23252else
23253 cat >msg
23254fi
23255echo "*** WARNING:" >&4
23256sed -e 's/^/*** /' <msg >&4
23257echo "*** " >&4
23258cat msg >>config.msg
23259echo " " >>config.msg
23260rm -f msg
23261EOS
23262chmod +x warn
23263$eunicefix warn
23264
23265: see if this is a termio system
23266val="$undef"
23267val2="$undef"
23268val3="$undef"
23269if $test `./findhdr termios.h`; then
23270 set tcsetattr i_termios
23271 eval $inlibc
23272 val3="$i_termios"
23273fi
23274echo " "
23275case "$val3" in
23276 "$define") echo "You have POSIX termios.h... good!" >&4;;
23277 *) if ./Cppsym pyr; then
23278 case "`$run /bin/universe`" in
23279 ucb) if $test `./findhdr sgtty.h`; then
23280 val2="$define"
23281 echo "<sgtty.h> found." >&4
23282 else
23283 echo "System is pyramid with BSD universe."
23284 ./warn "<sgtty.h> not found--you could have problems."
23285 fi;;
23286 *) if $test `./findhdr termio.h`; then
23287 val="$define"
23288 echo "<termio.h> found." >&4
23289 else
23290 echo "System is pyramid with USG universe."
23291 ./warn "<termio.h> not found--you could have problems."
23292 fi;;
23293 esac
23294 elif ./usg; then
23295 if $test `./findhdr termio.h`; then
23296 echo "<termio.h> found." >&4
23297 val="$define"
23298 elif $test `./findhdr sgtty.h`; then
23299 echo "<sgtty.h> found." >&4
23300 val2="$define"
23301 else
23302 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23303 fi
23304 else
23305 if $test `./findhdr sgtty.h`; then
23306 echo "<sgtty.h> found." >&4
23307 val2="$define"
23308 elif $test `./findhdr termio.h`; then
23309 echo "<termio.h> found." >&4
23310 val="$define"
23311 else
23312 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23313 fi
23314 fi;;
23315esac
23316set i_termio; eval $setvar
23317val=$val2; set i_sgtty; eval $setvar
23318val=$val3; set i_termios; eval $setvar
23319
23320: see if stdbool is available
23321: we want a real compile instead of Inhdr because some Solaris systems
23322: have stdbool.h, but it can only be used if the compiler indicates it
23323: is sufficiently c99-compliant.
23324echo " "
23325$cat >try.c <<EOCP
23326#include <stdio.h>
23327#include <stdbool.h>
23328int func(bool x)
23329{
23330 return x ? 1 : 0;
23331}
23332int main(int argc, char **argv)
23333{
23334 return func(0);
23335}
23336EOCP
23337set try
23338if eval $compile; then
23339 echo "<stdbool.h> found." >&4
23340 val="$define"
23341else
23342 echo "<stdbool.h> NOT found." >&4
23343 val="$undef"
23344fi
23345$rm_try
23346set i_stdbool
23347eval $setvar
23348
23349: see if stdint is available
23350set stdint.h i_stdint
23351eval $inhdr
23352
23353: see if sys/access.h is available
23354set sys/access.h i_sysaccess
23355eval $inhdr
23356
23357: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23358set sys/filio.h i_sysfilio
23359eval $inhdr
23360echo " "
23361if $test `./findhdr sys/ioctl.h`; then
23362 val="$define"
23363 echo '<sys/ioctl.h> found.' >&4
23364else
23365 val="$undef"
23366 if $test $i_sysfilio = "$define"; then
23367 echo '<sys/ioctl.h> NOT found.' >&4
23368 else
23369 $test $i_sgtty = "$define" && xxx="sgtty.h"
23370 $test $i_termio = "$define" && xxx="termio.h"
23371 $test $i_termios = "$define" && xxx="termios.h"
23372echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23373 fi
23374fi
23375set i_sysioctl
23376eval $setvar
23377
23378: see if socket ioctl defs are in sys/sockio.h
23379echo " "
23380xxx=`./findhdr sys/sockio.h`
23381if $test "$xxx"; then
23382 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23383 val="$define"
23384 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23385 else
23386 val="$undef"
23387 echo "No socket ioctls found in <sys/sockio.h>." >&4
23388 fi
23389else
23390 val="$undef"
23391 $cat <<EOM
23392<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23393EOM
23394fi
23395set i_syssockio
23396eval $setvar
23397
23398: see if this is a syslog.h system
23399set syslog.h i_syslog
23400eval $inhdr
23401
23402: see if this is a sys/mode.h system
23403set sys/mode.h i_sysmode
23404eval $inhdr
23405
23406: see if there is a sys/poll.h file
23407set sys/poll.h i_syspoll
23408eval $inhdr
23409
23410: see if sys/resource.h has to be included
23411set sys/resource.h i_sysresrc
23412eval $inhdr
23413
23414: see if sys/security.h is available
23415set sys/security.h i_syssecrt
23416eval $inhdr
23417
23418: see if this is a sys/statvfs.h system
23419set sys/statvfs.h i_sysstatvfs
23420eval $inhdr
23421
23422: see if this is a sys/un.h system
23423set sys/un.h i_sysun
23424eval $inhdr
23425
23426: see if this is a sys/utsname.h system
23427set sys/utsname.h i_sysutsname
23428eval $inhdr
23429
23430: see if this is a syswait system
23431set sys/wait.h i_syswait
23432eval $inhdr
23433
23434: see if this is a ustat.h system
23435set ustat.h i_ustat
23436eval $inhdr
23437
23438: see if this is an utime system
23439set utime.h i_utime
23440eval $inhdr
23441
23442: see if this is a vfork system
23443case "$d_vfork" in
23444"$define")
23445 set vfork.h i_vfork
23446 eval $inhdr
23447 ;;
23448*)
23449 i_vfork="$undef"
23450 ;;
23451esac
23452
23453: see if wchar.h is present
23454set wchar.h i_wchar
23455eval $inhdr
23456
23457: Check extensions
23458echo " "
23459echo "Looking for extensions..." >&4
23460: If we are using the old config.sh, nonxs_extensions and xs_extensions may
23461: contain old or inaccurate or duplicate values.
23462nonxs_extensions=''
23463xs_extensions=''
23464: We do not use find because it might not be available.
23465: We do not just use MANIFEST because the user may have dropped
23466: some additional extensions into the source tree and expect them
23467: to be built.
23468
23469: Function to recursively find available extensions, ignoring DynaLoader
23470: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23471: In 5.10.1 and later, extensions are stored in directories
23472: like File-Glob instead of the older File/Glob/.
23473find_extensions='
23474 for xxx in *; do
23475 case "$xxx" in
23476 DynaLoader|dynaload) ;;
23477 *)
23478 this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23479 case "$this_ext" in
23480 Scalar/List/Utils) this_ext="List/Util" ;;
23481 PathTools) this_ext="Cwd" ;;
23482 esac;
23483 echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23484 if $contains " $this_ext " "$tdir/$$.tmp"; then
23485 echo >&4;
23486 echo "Duplicate directories detected for extension $xxx" >&4;
23487 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23488 case "$knowitall" in
23489 "") dflt=y;;
23490 *) dflt=n;;
23491 esac;
23492 . ../UU/myread;
23493 case "$ans" in
23494 n*|N*) ;;
23495 *) echo >&4;
23496 echo "Ok. Stopping Configure." >&4;
23497 echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23498 exit 1;;
23499 esac;
23500 echo "Ok. You will need to correct config.sh before running make." >&4;
23501 fi;
23502 $ls -1 "$xxx" > "$tdir/$$.tmp";
23503 if $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23504 xs_extensions="$xs_extensions $this_ext";
23505 elif $contains "\.c$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23506 xs_extensions="$xs_extensions $this_ext";
23507 elif $test -d "$xxx"; then
23508 nonxs_extensions="$nonxs_extensions $this_ext";
23509 fi;
23510 $rm -f "$tdir/$$.tmp";
23511 ;;
23512 esac;
23513 done'
23514tdir=`pwd`
23515cd "$rsrc/cpan"
23516set X
23517shift
23518eval $find_extensions
23519cd "$rsrc/dist"
23520set X
23521shift
23522eval $find_extensions
23523cd "$rsrc/ext"
23524set X
23525shift
23526eval $find_extensions
23527set X $xs_extensions
23528shift
23529xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23530set X $nonxs_extensions
23531shift
23532nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23533cd "$tdir"
23534known_extensions=`echo $nonxs_extensions $xs_extensions | tr ' ' $trnl | $sort | tr $trnl ' '`
23535
23536: Now see which are supported on this system.
23537avail_ext=''
23538for xxx in $xs_extensions ; do
23539 case "$xxx" in
23540 Amiga*)
23541 case "$osname" in
23542 amigaos) avail_ext="$avail_ext $xxx" ;;
23543 esac
23544 ;;
23545 DB_File|db_file)
23546 case "$i_db" in
23547 $define) avail_ext="$avail_ext $xxx" ;;
23548 esac
23549 ;;
23550 GDBM_File|gdbm_fil)
23551 case "$i_gdbm" in
23552 $define) avail_ext="$avail_ext $xxx" ;;
23553 esac
23554 ;;
23555 IPC/SysV|ipc/sysv)
23556 : XXX Do we need a useipcsysv variable here
23557 case "${d_msg}${d_sem}${d_shm}" in
23558 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23559 esac
23560 ;;
23561 NDBM_File|ndbm_fil)
23562 case "$d_ndbm" in
23563 $define)
23564 case "$osname-$use64bitint" in
23565 hpux-define)
23566 case "$libs" in
23567 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23568 esac
23569 ;;
23570 *) avail_ext="$avail_ext $xxx" ;;
23571 esac
23572 ;;
23573 esac
23574 ;;
23575 ODBM_File|odbm_fil)
23576 case "${i_dbm}${i_rpcsvcdbm}" in
23577 *"${define}"*)
23578 case "$d_cplusplus" in
23579 define) ;; # delete as a function name will not work
23580 *) case "$osname-$use64bitint" in
23581 hpux-define)
23582 case "$libs" in
23583 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23584 esac
23585 ;;
23586 *) avail_ext="$avail_ext $xxx" ;;
23587 esac
23588 ;;
23589 esac
23590 ;;
23591 esac
23592 ;;
23593 Opcode|opcode)
23594 case "$useopcode" in
23595 true|define|y) avail_ext="$avail_ext $xxx" ;;
23596 esac
23597 ;;
23598 POSIX|posix)
23599 case "$useposix" in
23600 true|define|y) avail_ext="$avail_ext $xxx" ;;
23601 esac
23602 ;;
23603 Socket|socket)
23604 case "$d_socket" in
23605 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23606 esac
23607 ;;
23608 I18N/Langinfo|langinfo)
23609 case "$uselanginfo" in
23610 true|define|y) avail_ext="$avail_ext $xxx" ;;
23611 esac
23612 ;;
23613 Sys/Syslog|sys/syslog)
23614 case $osname in
23615 amigaos) ;; # not really very useful on AmigaOS
23616 *)
23617 : XXX syslog requires socket
23618 case "$d_socket" in
23619 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23620 esac
23621 ;;
23622 esac
23623 ;;
23624 Thread|thread)
23625 case "$usethreads" in
23626 true|$define|y)
23627 case "$use5005threads" in
23628 $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23629 esac
23630 esac
23631 ;;
23632 threads|threads/shared)
23633 # threads and threads::shared are special cases.
23634 # To stop people from asking "Perl 5.8.0 was supposed
23635 # to have this new fancy threads implementation but my
23636 # perl doesn't have it" and from people trying to
23637 # (re)install the threads module using CPAN.pm and
23638 # CPAN.pm then offering to reinstall Perl 5.8.0,
23639 # the threads.pm and threads/shared.pm will always be
23640 # there, croaking informatively ("you need to rebuild
23641 # all of Perl with threads, sorry") when threads haven't
23642 # been compiled in.
23643 # --jhi
23644 avail_ext="$avail_ext $xxx"
23645 ;;
23646 VMS*)
23647 ;;
23648 Win32*)
23649 case "$osname" in
23650 cygwin) avail_ext="$avail_ext $xxx" ;;
23651 esac
23652 ;;
23653 XS/APItest|xs/apitest)
23654 # This is just for testing. Skip it unless we have dynamic loading.
23655
23656 case "$usedl" in
23657 $define) avail_ext="$avail_ext $xxx" ;;
23658 esac
23659 ;;
23660 XS/Typemap|xs/typemap)
23661 # This is just for testing. Skip it unless we have dynamic loading.
23662 case "$usedl" in
23663 $define) avail_ext="$avail_ext $xxx" ;;
23664 esac
23665 ;;
23666 *) avail_ext="$avail_ext $xxx"
23667 ;;
23668 esac
23669done
23670
23671set X $avail_ext
23672shift
23673avail_ext="$*"
23674
23675case "$onlyextensions" in
23676'') ;;
23677*) keepextensions=''
23678 echo "You have requested that only certain extensions be included..." >&4
23679 for i in $onlyextensions; do
23680 case " $avail_ext " in
23681 *" $i "*)
23682 echo "Keeping extension $i."
23683 keepextensions="$keepextensions $i"
23684 ;;
23685 *) echo "Ignoring extension $i." ;;
23686 esac
23687 done
23688 avail_ext="$keepextensions"
23689 ;;
23690esac
23691
23692case "$noextensions" in
23693'') ;;
23694*) keepextensions=''
23695 echo "You have requested that certain extensions be ignored..." >&4
23696 for i in $avail_ext; do
23697 case " $noextensions " in
23698 *" $i "*) echo "Ignoring extension $i." ;;
23699 *) echo "Keeping extension $i.";
23700 keepextensions="$keepextensions $i"
23701 ;;
23702 esac
23703 done
23704 avail_ext="$keepextensions"
23705 ;;
23706esac
23707
23708: Now see which nonxs extensions are supported on this system.
23709: For now assume all are.
23710nonxs_ext=''
23711for xxx in $nonxs_extensions ; do
23712 case "$xxx" in
23713 VMS*)
23714 ;;
23715 *) nonxs_ext="$nonxs_ext $xxx"
23716 ;;
23717 esac
23718done
23719
23720set X $nonxs_ext
23721shift
23722nonxs_ext="$*"
23723
23724case $usedl in
23725$define)
23726 $cat <<EOM
23727A number of extensions are supplied with $package. You may choose to
23728compile these extensions for dynamic loading (the default), compile
23729them into the $package executable (static loading), or not include
23730them at all. Answer "none" to include no extensions.
23731Note that DynaLoader is always built and need not be mentioned here.
23732
23733EOM
23734 case "$dynamic_ext" in
23735 '')
23736 : Exclude those listed in static_ext
23737 dflt=''
23738 for xxx in $avail_ext; do
23739 case " $static_ext " in
23740 *" $xxx "*) ;;
23741 *) dflt="$dflt $xxx" ;;
23742 esac
23743 done
23744 set X $dflt
23745 shift
23746 dflt="$*"
23747 ;;
23748 *) dflt="$dynamic_ext"
23749 # Perhaps we are reusing an old out-of-date config.sh.
23750 case "$hint" in
23751 previous)
23752 if test X"$dynamic_ext" != X"$avail_ext"; then
23753 $cat <<EOM
23754NOTICE: Your previous config.sh list may be incorrect.
23755The extensions now available to you are
23756 ${avail_ext}
23757but the default list from your previous config.sh is
23758 ${dynamic_ext}
23759
23760EOM
23761 fi
23762 ;;
23763 esac
23764 ;;
23765 esac
23766 case "$dflt" in
23767 '') dflt=none;;
23768 esac
23769 rp="What extensions do you wish to load dynamically?"
23770 . ./myread
23771 case "$ans" in
23772 none) dynamic_ext=' ' ;;
23773 *) dynamic_ext="$ans" ;;
23774 esac
23775
23776 case "$static_ext" in
23777 '')
23778 : Exclude those already listed in dynamic linking
23779 dflt=''
23780 for xxx in $avail_ext; do
23781 case " $dynamic_ext " in
23782 *" $xxx "*) ;;
23783 *) dflt="$dflt $xxx" ;;
23784 esac
23785 done
23786 set X $dflt
23787 shift
23788 dflt="$*"
23789 ;;
23790 *) dflt="$static_ext"
23791 ;;
23792 esac
23793
23794 case "$dflt" in
23795 '') dflt=none;;
23796 esac
23797 rp="What extensions do you wish to load statically?"
23798 . ./myread
23799 case "$ans" in
23800 none) static_ext=' ' ;;
23801 *) static_ext="$ans" ;;
23802 esac
23803 ;;
23804*)
23805 $cat <<EOM
23806A number of extensions are supplied with $package. Answer "none"
23807to include no extensions.
23808Note that DynaLoader is always built and need not be mentioned here.
23809
23810EOM
23811 case "$static_ext" in
23812 '') dflt="$avail_ext" ;;
23813 *) dflt="$static_ext"
23814 # Perhaps we are reusing an old out-of-date config.sh.
23815 case "$hint" in
23816 previous)
23817 if test X"$static_ext" != X"$avail_ext"; then
23818 $cat <<EOM
23819NOTICE: Your previous config.sh list may be incorrect.
23820The extensions now available to you are
23821 ${avail_ext}
23822but the default list from your previous config.sh is
23823 ${static_ext}
23824
23825EOM
23826 fi
23827 ;;
23828 esac
23829 ;;
23830 esac
23831 : Exclude those that are not xs extensions
23832 case "$dflt" in
23833 '') dflt=none;;
23834 esac
23835 rp="What extensions do you wish to include?"
23836 . ./myread
23837 case "$ans" in
23838 none) static_ext=' ' ;;
23839 *) static_ext="$ans" ;;
23840 esac
23841 ;;
23842esac
23843#
23844# Encode is a special case. If we are building Encode as a static
23845# extension, we need to explicitly list its subextensions as well.
23846# For other nested extensions, this is handled automatically by
23847# the appropriate Makefile.PL.
23848case " $static_ext " in
23849 *" Encode "*) # Add the subextensions of Encode
23850 cd "$rsrc/cpan"
23851 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23852 static_ext="$static_ext Encode/$xxx"
23853 known_extensions="$known_extensions Encode/$xxx"
23854 done
23855 cd "$tdir"
23856 ;;
23857esac
23858
23859set X $dynamic_ext $static_ext $nonxs_ext
23860shift
23861extensions="$*"
23862
23863# Sanity check: We require an extension suitable for use with
23864# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
23865# should show up as failures in the test suite, but it's helpful to
23866# catch them now.) The 'extensions' list is normally sorted
23867# alphabetically, so we need to accept either
23868# DB_File ... Fcntl ... IO ....
23869# or something like
23870# Fcntl ... NDBM_File ... IO ....
23871case " $extensions" in
23872*"_File "*" Fcntl "*" IO "*) ;; # DB_File
23873*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23874*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23875*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23876 echo "WARNING: The Perl you are building will be quite crippled." >& 4
23877 ;;
23878esac
23879
23880: Remove libraries needed only for extensions
23881: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23882: The exception is SunOS 4.x, which needs them.
23883case "${osname}X${osvers}" in
23884sunos*X4*)
23885 perllibs="$libs"
23886 ;;
23887*) case "$usedl" in
23888 $define|true|[yY]*)
23889 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23890 shift
23891 perllibs="$*"
23892 ;;
23893 *) perllibs="$libs"
23894 ;;
23895 esac
23896 ;;
23897esac
23898
23899: Remove build directory name from cppstdin so it can be used from
23900: either the present location or the final installed location.
23901echo " "
23902: Get out of the UU directory to get correct path name.
23903cd ..
23904case "$cppstdin" in
23905`pwd`/cppstdin)
23906 echo "Stripping down cppstdin path name"
23907 cppstdin=cppstdin
23908 ;;
23909esac
23910cd UU
23911
23912: end of configuration questions
23913echo " "
23914echo "End of configuration questions."
23915echo " "
23916
23917: back to where it started
23918if test -d ../UU; then
23919 cd ..
23920fi
23921
23922: configuration may be unconditionally patched via a 'config.arch' file
23923if $test -f config.arch; then
23924 echo "I see a config.arch file, loading it." >&4
23925 . ./config.arch
23926fi
23927
23928: configuration may be patched via a 'config.over' file
23929if $test -f config.over; then
23930 echo " "
23931 dflt=y
23932 rp='I see a config.over file. Do you wish to load it?'
23933 . UU/myread
23934 case "$ans" in
23935 n*) echo "OK, I'll ignore it.";;
23936 *) . ./config.over
23937 echo "Configuration override changes have been loaded."
23938 ;;
23939 esac
23940fi
23941
23942: in case they want portability, strip down executable paths
23943case "$d_portable" in
23944"$define")
23945 echo " "
23946 echo "Stripping down executable paths..." >&4
23947 for file in $loclist $trylist; do
23948 eval temp=\$$file
23949 eval $file=`basename $temp`
23950 done
23951 ;;
23952esac
23953
23954: create config.sh file
23955echo " "
23956echo "Creating config.sh..." >&4
23957$spitshell <<EOT >config.sh
23958$startsh
23959#
23960# This file was produced by running the Configure script. It holds all the
23961# definitions figured out by Configure. Should you modify one of these values,
23962# do not forget to propagate your changes by running "Configure -der". You may
23963# instead choose to run each of the .SH files by yourself, or "Configure -S".
23964#
23965
23966# Package name : $package
23967# Source directory : $src
23968# Configuration time: $cf_time
23969# Configured by : $cf_by
23970# Target system : $myuname
23971
23972EOT
23973: Add in command line options if available
23974$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23975
23976$spitshell <<EOT >>config.sh
23977
23978Author='$Author'
23979Date='$Date'
23980Header='$Header'
23981Id='$Id'
23982Locker='$Locker'
23983Log='$Log'
23984RCSfile='$RCSfile'
23985Revision='$Revision'
23986Source='$Source'
23987State='$State'
23988_a='$_a'
23989_exe='$_exe'
23990_o='$_o'
23991afs='$afs'
23992afsroot='$afsroot'
23993alignbytes='$alignbytes'
23994aphostname='$aphostname'
23995api_revision='$api_revision'
23996api_subversion='$api_subversion'
23997api_version='$api_version'
23998api_versionstring='$api_versionstring'
23999ar='$ar'
24000archlib='$archlib'
24001archlibexp='$archlibexp'
24002archname64='$archname64'
24003archname='$archname'
24004archobjs='$archobjs'
24005asctime_r_proto='$asctime_r_proto'
24006awk='$awk'
24007baserev='$baserev'
24008bash='$bash'
24009bin='$bin'
24010bin_ELF='$bin_ELF'
24011binexp='$binexp'
24012bison='$bison'
24013byacc='$byacc'
24014byteorder='$byteorder'
24015c='$c'
24016castflags='$castflags'
24017cat='$cat'
24018cc='$cc'
24019cccdlflags='$cccdlflags'
24020ccdlflags='$ccdlflags'
24021ccflags='$ccflags'
24022ccflags_uselargefiles='$ccflags_uselargefiles'
24023ccname='$ccname'
24024ccsymbols='$ccsymbols'
24025ccversion='$ccversion'
24026cf_by='$cf_by'
24027cf_email='$cf_email'
24028cf_time='$cf_time'
24029charbits='$charbits'
24030charsize='$charsize'
24031chgrp='$chgrp'
24032chmod='$chmod'
24033chown='$chown'
24034clocktype='$clocktype'
24035comm='$comm'
24036compress='$compress'
24037contains='$contains'
24038cp='$cp'
24039cpio='$cpio'
24040cpp='$cpp'
24041cpp_stuff='$cpp_stuff'
24042cppccsymbols='$cppccsymbols'
24043cppflags='$cppflags'
24044cpplast='$cpplast'
24045cppminus='$cppminus'
24046cpprun='$cpprun'
24047cppstdin='$cppstdin'
24048cppsymbols='$cppsymbols'
24049crypt_r_proto='$crypt_r_proto'
24050cryptlib='$cryptlib'
24051csh='$csh'
24052ctermid_r_proto='$ctermid_r_proto'
24053ctime_r_proto='$ctime_r_proto'
24054d_Gconvert='$d_Gconvert'
24055d_PRIEUldbl='$d_PRIEUldbl'
24056d_PRIFUldbl='$d_PRIFUldbl'
24057d_PRIGUldbl='$d_PRIGUldbl'
24058d_PRIXU64='$d_PRIXU64'
24059d_PRId64='$d_PRId64'
24060d_PRIeldbl='$d_PRIeldbl'
24061d_PRIfldbl='$d_PRIfldbl'
24062d_PRIgldbl='$d_PRIgldbl'
24063d_PRIi64='$d_PRIi64'
24064d_PRIo64='$d_PRIo64'
24065d_PRIu64='$d_PRIu64'
24066d_PRIx64='$d_PRIx64'
24067d_SCNfldbl='$d_SCNfldbl'
24068d__fwalk='$d__fwalk'
24069d_accept4='$d_accept4'
24070d_access='$d_access'
24071d_accessx='$d_accessx'
24072d_acosh='$d_acosh'
24073d_aintl='$d_aintl'
24074d_alarm='$d_alarm'
24075d_archlib='$d_archlib'
24076d_asctime64='$d_asctime64'
24077d_asctime_r='$d_asctime_r'
24078d_asinh='$d_asinh'
24079d_atanh='$d_atanh'
24080d_atolf='$d_atolf'
24081d_atoll='$d_atoll'
24082d_attribute_always_inline='$d_attribute_always_inline'
24083d_attribute_deprecated='$d_attribute_deprecated'
24084d_attribute_format='$d_attribute_format'
24085d_attribute_malloc='$d_attribute_malloc'
24086d_attribute_nonnull='$d_attribute_nonnull'
24087d_attribute_noreturn='$d_attribute_noreturn'
24088d_attribute_pure='$d_attribute_pure'
24089d_attribute_unused='$d_attribute_unused'
24090d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24091d_backtrace='$d_backtrace'
24092d_bsd='$d_bsd'
24093d_bsdgetpgrp='$d_bsdgetpgrp'
24094d_bsdsetpgrp='$d_bsdsetpgrp'
24095d_builtin_add_overflow='$d_builtin_add_overflow'
24096d_builtin_choose_expr='$d_builtin_choose_expr'
24097d_builtin_expect='$d_builtin_expect'
24098d_builtin_mul_overflow='$d_builtin_mul_overflow'
24099d_builtin_sub_overflow='$d_builtin_sub_overflow'
24100d_c99_variadic_macros='$d_c99_variadic_macros'
24101d_casti32='$d_casti32'
24102d_castneg='$d_castneg'
24103d_cbrt='$d_cbrt'
24104d_chown='$d_chown'
24105d_chroot='$d_chroot'
24106d_chsize='$d_chsize'
24107d_class='$d_class'
24108d_clearenv='$d_clearenv'
24109d_closedir='$d_closedir'
24110d_cmsghdr_s='$d_cmsghdr_s'
24111d_copysign='$d_copysign'
24112d_copysignl='$d_copysignl'
24113d_cplusplus='$d_cplusplus'
24114d_crypt='$d_crypt'
24115d_crypt_r='$d_crypt_r'
24116d_csh='$d_csh'
24117d_ctermid='$d_ctermid'
24118d_ctermid_r='$d_ctermid_r'
24119d_ctime64='$d_ctime64'
24120d_ctime_r='$d_ctime_r'
24121d_cuserid='$d_cuserid'
24122d_dbminitproto='$d_dbminitproto'
24123d_difftime64='$d_difftime64'
24124d_difftime='$d_difftime'
24125d_dir_dd_fd='$d_dir_dd_fd'
24126d_dirfd='$d_dirfd'
24127d_dirnamlen='$d_dirnamlen'
24128d_dladdr='$d_dladdr'
24129d_dlerror='$d_dlerror'
24130d_dlopen='$d_dlopen'
24131d_dlsymun='$d_dlsymun'
24132d_dosuid='$d_dosuid'
24133d_double_has_inf='$d_double_has_inf'
24134d_double_has_nan='$d_double_has_nan'
24135d_double_has_negative_zero='$d_double_has_negative_zero'
24136d_double_has_subnormals='$d_double_has_subnormals'
24137d_double_style_cray='$d_double_style_cray'
24138d_double_style_ibm='$d_double_style_ibm'
24139d_double_style_ieee='$d_double_style_ieee'
24140d_double_style_vax='$d_double_style_vax'
24141d_drand48_r='$d_drand48_r'
24142d_drand48proto='$d_drand48proto'
24143d_dup2='$d_dup2'
24144d_dup3='$d_dup3'
24145d_duplocale='$d_duplocale'
24146d_eaccess='$d_eaccess'
24147d_endgrent='$d_endgrent'
24148d_endgrent_r='$d_endgrent_r'
24149d_endhent='$d_endhent'
24150d_endhostent_r='$d_endhostent_r'
24151d_endnent='$d_endnent'
24152d_endnetent_r='$d_endnetent_r'
24153d_endpent='$d_endpent'
24154d_endprotoent_r='$d_endprotoent_r'
24155d_endpwent='$d_endpwent'
24156d_endpwent_r='$d_endpwent_r'
24157d_endsent='$d_endsent'
24158d_endservent_r='$d_endservent_r'
24159d_eofnblk='$d_eofnblk'
24160d_erf='$d_erf'
24161d_erfc='$d_erfc'
24162d_eunice='$d_eunice'
24163d_exp2='$d_exp2'
24164d_expm1='$d_expm1'
24165d_faststdio='$d_faststdio'
24166d_fchdir='$d_fchdir'
24167d_fchmod='$d_fchmod'
24168d_fchmodat='$d_fchmodat'
24169d_fchown='$d_fchown'
24170d_fcntl='$d_fcntl'
24171d_fcntl_can_lock='$d_fcntl_can_lock'
24172d_fd_macros='$d_fd_macros'
24173d_fd_set='$d_fd_set'
24174d_fdclose='$d_fdclose'
24175d_fdim='$d_fdim'
24176d_fds_bits='$d_fds_bits'
24177d_fegetround='$d_fegetround'
24178d_fgetpos='$d_fgetpos'
24179d_finite='$d_finite'
24180d_finitel='$d_finitel'
24181d_flexfnam='$d_flexfnam'
24182d_flock='$d_flock'
24183d_flockproto='$d_flockproto'
24184d_fma='$d_fma'
24185d_fmax='$d_fmax'
24186d_fmin='$d_fmin'
24187d_fork='$d_fork'
24188d_fp_class='$d_fp_class'
24189d_fp_classify='$d_fp_classify'
24190d_fp_classl='$d_fp_classl'
24191d_fpathconf='$d_fpathconf'
24192d_fpclass='$d_fpclass'
24193d_fpclassify='$d_fpclassify'
24194d_fpclassl='$d_fpclassl'
24195d_fpgetround='$d_fpgetround'
24196d_fpos64_t='$d_fpos64_t'
24197d_freelocale='$d_freelocale'
24198d_frexpl='$d_frexpl'
24199d_fs_data_s='$d_fs_data_s'
24200d_fseeko='$d_fseeko'
24201d_fsetpos='$d_fsetpos'
24202d_fstatfs='$d_fstatfs'
24203d_fstatvfs='$d_fstatvfs'
24204d_fsync='$d_fsync'
24205d_ftello='$d_ftello'
24206d_ftime='$d_ftime'
24207d_futimes='$d_futimes'
24208d_gai_strerror='$d_gai_strerror'
24209d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24210d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24211d_getaddrinfo='$d_getaddrinfo'
24212d_getcwd='$d_getcwd'
24213d_getespwnam='$d_getespwnam'
24214d_getfsstat='$d_getfsstat'
24215d_getgrent='$d_getgrent'
24216d_getgrent_r='$d_getgrent_r'
24217d_getgrgid_r='$d_getgrgid_r'
24218d_getgrnam_r='$d_getgrnam_r'
24219d_getgrps='$d_getgrps'
24220d_gethbyaddr='$d_gethbyaddr'
24221d_gethbyname='$d_gethbyname'
24222d_gethent='$d_gethent'
24223d_gethname='$d_gethname'
24224d_gethostbyaddr_r='$d_gethostbyaddr_r'
24225d_gethostbyname_r='$d_gethostbyname_r'
24226d_gethostent_r='$d_gethostent_r'
24227d_gethostprotos='$d_gethostprotos'
24228d_getitimer='$d_getitimer'
24229d_getlogin='$d_getlogin'
24230d_getlogin_r='$d_getlogin_r'
24231d_getmnt='$d_getmnt'
24232d_getmntent='$d_getmntent'
24233d_getnameinfo='$d_getnameinfo'
24234d_getnbyaddr='$d_getnbyaddr'
24235d_getnbyname='$d_getnbyname'
24236d_getnent='$d_getnent'
24237d_getnetbyaddr_r='$d_getnetbyaddr_r'
24238d_getnetbyname_r='$d_getnetbyname_r'
24239d_getnetent_r='$d_getnetent_r'
24240d_getnetprotos='$d_getnetprotos'
24241d_getpagsz='$d_getpagsz'
24242d_getpbyname='$d_getpbyname'
24243d_getpbynumber='$d_getpbynumber'
24244d_getpent='$d_getpent'
24245d_getpgid='$d_getpgid'
24246d_getpgrp2='$d_getpgrp2'
24247d_getpgrp='$d_getpgrp'
24248d_getppid='$d_getppid'
24249d_getprior='$d_getprior'
24250d_getprotobyname_r='$d_getprotobyname_r'
24251d_getprotobynumber_r='$d_getprotobynumber_r'
24252d_getprotoent_r='$d_getprotoent_r'
24253d_getprotoprotos='$d_getprotoprotos'
24254d_getprpwnam='$d_getprpwnam'
24255d_getpwent='$d_getpwent'
24256d_getpwent_r='$d_getpwent_r'
24257d_getpwnam_r='$d_getpwnam_r'
24258d_getpwuid_r='$d_getpwuid_r'
24259d_getsbyname='$d_getsbyname'
24260d_getsbyport='$d_getsbyport'
24261d_getsent='$d_getsent'
24262d_getservbyname_r='$d_getservbyname_r'
24263d_getservbyport_r='$d_getservbyport_r'
24264d_getservent_r='$d_getservent_r'
24265d_getservprotos='$d_getservprotos'
24266d_getspnam='$d_getspnam'
24267d_getspnam_r='$d_getspnam_r'
24268d_gettimeod='$d_gettimeod'
24269d_gmtime64='$d_gmtime64'
24270d_gmtime_r='$d_gmtime_r'
24271d_gnulibc='$d_gnulibc'
24272d_grpasswd='$d_grpasswd'
24273d_has_C_UTF8='$d_has_C_UTF8'
24274d_hasmntopt='$d_hasmntopt'
24275d_htonl='$d_htonl'
24276d_hypot='$d_hypot'
24277d_ilogb='$d_ilogb'
24278d_ilogbl='$d_ilogbl'
24279d_inc_version_list='$d_inc_version_list'
24280d_inetaton='$d_inetaton'
24281d_inetntop='$d_inetntop'
24282d_inetpton='$d_inetpton'
24283d_int64_t='$d_int64_t'
24284d_ip_mreq='$d_ip_mreq'
24285d_ip_mreq_source='$d_ip_mreq_source'
24286d_ipv6_mreq='$d_ipv6_mreq'
24287d_ipv6_mreq_source='$d_ipv6_mreq_source'
24288d_isascii='$d_isascii'
24289d_isblank='$d_isblank'
24290d_isfinite='$d_isfinite'
24291d_isfinitel='$d_isfinitel'
24292d_isinf='$d_isinf'
24293d_isinfl='$d_isinfl'
24294d_isless='$d_isless'
24295d_isnan='$d_isnan'
24296d_isnanl='$d_isnanl'
24297d_isnormal='$d_isnormal'
24298d_j0='$d_j0'
24299d_j0l='$d_j0l'
24300d_killpg='$d_killpg'
24301d_lc_monetary_2008='$d_lc_monetary_2008'
24302d_lchown='$d_lchown'
24303d_ldbl_dig='$d_ldbl_dig'
24304d_ldexpl='$d_ldexpl'
24305d_lgamma='$d_lgamma'
24306d_lgamma_r='$d_lgamma_r'
24307d_libm_lib_version='$d_libm_lib_version'
24308d_libname_unique='$d_libname_unique'
24309d_link='$d_link'
24310d_linkat='$d_linkat'
24311d_llrint='$d_llrint'
24312d_llrintl='$d_llrintl'
24313d_llround='$d_llround'
24314d_llroundl='$d_llroundl'
24315d_localeconv_l='$d_localeconv_l'
24316d_localtime64='$d_localtime64'
24317d_localtime_r='$d_localtime_r'
24318d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24319d_locconv='$d_locconv'
24320d_lockf='$d_lockf'
24321d_log1p='$d_log1p'
24322d_log2='$d_log2'
24323d_logb='$d_logb'
24324d_long_double_style_ieee='$d_long_double_style_ieee'
24325d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24326d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24327d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24328d_long_double_style_vax='$d_long_double_style_vax'
24329d_longdbl='$d_longdbl'
24330d_longlong='$d_longlong'
24331d_lrint='$d_lrint'
24332d_lrintl='$d_lrintl'
24333d_lround='$d_lround'
24334d_lroundl='$d_lroundl'
24335d_lseekproto='$d_lseekproto'
24336d_lstat='$d_lstat'
24337d_madvise='$d_madvise'
24338d_malloc_good_size='$d_malloc_good_size'
24339d_malloc_size='$d_malloc_size'
24340d_malloc_usable_size='$d_malloc_usable_size'
24341d_mblen='$d_mblen'
24342d_mbrlen='$d_mbrlen'
24343d_mbrtowc='$d_mbrtowc'
24344d_mbstowcs='$d_mbstowcs'
24345d_mbtowc='$d_mbtowc'
24346d_memmem='$d_memmem'
24347d_memrchr='$d_memrchr'
24348d_mkdir='$d_mkdir'
24349d_mkdtemp='$d_mkdtemp'
24350d_mkfifo='$d_mkfifo'
24351d_mkostemp='$d_mkostemp'
24352d_mkstemp='$d_mkstemp'
24353d_mkstemps='$d_mkstemps'
24354d_mktime64='$d_mktime64'
24355d_mktime='$d_mktime'
24356d_mmap='$d_mmap'
24357d_modfl='$d_modfl'
24358d_modflproto='$d_modflproto'
24359d_mprotect='$d_mprotect'
24360d_msg='$d_msg'
24361d_msg_ctrunc='$d_msg_ctrunc'
24362d_msg_dontroute='$d_msg_dontroute'
24363d_msg_oob='$d_msg_oob'
24364d_msg_peek='$d_msg_peek'
24365d_msg_proxy='$d_msg_proxy'
24366d_msgctl='$d_msgctl'
24367d_msgget='$d_msgget'
24368d_msghdr_s='$d_msghdr_s'
24369d_msgrcv='$d_msgrcv'
24370d_msgsnd='$d_msgsnd'
24371d_msync='$d_msync'
24372d_munmap='$d_munmap'
24373d_mymalloc='$d_mymalloc'
24374d_nan='$d_nan'
24375d_nanosleep='$d_nanosleep'
24376d_ndbm='$d_ndbm'
24377d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24378d_nearbyint='$d_nearbyint'
24379d_newlocale='$d_newlocale'
24380d_nextafter='$d_nextafter'
24381d_nexttoward='$d_nexttoward'
24382d_nice='$d_nice'
24383d_nl_langinfo='$d_nl_langinfo'
24384d_nv_preserves_uv='$d_nv_preserves_uv'
24385d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24386d_off64_t='$d_off64_t'
24387d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24388d_oldpthreads='$d_oldpthreads'
24389d_oldsock='$d_oldsock'
24390d_open3='$d_open3'
24391d_openat='$d_openat'
24392d_pathconf='$d_pathconf'
24393d_pause='$d_pause'
24394d_perl_otherlibdirs='$d_perl_otherlibdirs'
24395d_phostname='$d_phostname'
24396d_pipe2='$d_pipe2'
24397d_pipe='$d_pipe'
24398d_poll='$d_poll'
24399d_portable='$d_portable'
24400d_prctl='$d_prctl'
24401d_prctl_set_name='$d_prctl_set_name'
24402d_printf_format_null='$d_printf_format_null'
24403d_procselfexe='$d_procselfexe'
24404d_pseudofork='$d_pseudofork'
24405d_pthread_atfork='$d_pthread_atfork'
24406d_pthread_attr_setscope='$d_pthread_attr_setscope'
24407d_pthread_yield='$d_pthread_yield'
24408d_ptrdiff_t='$d_ptrdiff_t'
24409d_pwage='$d_pwage'
24410d_pwchange='$d_pwchange'
24411d_pwclass='$d_pwclass'
24412d_pwcomment='$d_pwcomment'
24413d_pwexpire='$d_pwexpire'
24414d_pwgecos='$d_pwgecos'
24415d_pwpasswd='$d_pwpasswd'
24416d_pwquota='$d_pwquota'
24417d_qgcvt='$d_qgcvt'
24418d_quad='$d_quad'
24419d_querylocale='$d_querylocale'
24420d_random_r='$d_random_r'
24421d_re_comp='$d_re_comp'
24422d_readdir64_r='$d_readdir64_r'
24423d_readdir='$d_readdir'
24424d_readdir_r='$d_readdir_r'
24425d_readlink='$d_readlink'
24426d_readv='$d_readv'
24427d_recvmsg='$d_recvmsg'
24428d_regcmp='$d_regcmp'
24429d_regcomp='$d_regcomp'
24430d_remainder='$d_remainder'
24431d_remquo='$d_remquo'
24432d_rename='$d_rename'
24433d_renameat='$d_renameat'
24434d_rewinddir='$d_rewinddir'
24435d_rint='$d_rint'
24436d_rmdir='$d_rmdir'
24437d_round='$d_round'
24438d_sbrkproto='$d_sbrkproto'
24439d_scalbn='$d_scalbn'
24440d_scalbnl='$d_scalbnl'
24441d_sched_yield='$d_sched_yield'
24442d_scm_rights='$d_scm_rights'
24443d_seekdir='$d_seekdir'
24444d_select='$d_select'
24445d_sem='$d_sem'
24446d_semctl='$d_semctl'
24447d_semctl_semid_ds='$d_semctl_semid_ds'
24448d_semctl_semun='$d_semctl_semun'
24449d_semget='$d_semget'
24450d_semop='$d_semop'
24451d_sendmsg='$d_sendmsg'
24452d_setegid='$d_setegid'
24453d_seteuid='$d_seteuid'
24454d_setgrent='$d_setgrent'
24455d_setgrent_r='$d_setgrent_r'
24456d_setgrps='$d_setgrps'
24457d_sethent='$d_sethent'
24458d_sethostent_r='$d_sethostent_r'
24459d_setitimer='$d_setitimer'
24460d_setlinebuf='$d_setlinebuf'
24461d_setlocale='$d_setlocale'
24462d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
24463d_setlocale_r='$d_setlocale_r'
24464d_setnent='$d_setnent'
24465d_setnetent_r='$d_setnetent_r'
24466d_setpent='$d_setpent'
24467d_setpgid='$d_setpgid'
24468d_setpgrp2='$d_setpgrp2'
24469d_setpgrp='$d_setpgrp'
24470d_setprior='$d_setprior'
24471d_setproctitle='$d_setproctitle'
24472d_setprotoent_r='$d_setprotoent_r'
24473d_setpwent='$d_setpwent'
24474d_setpwent_r='$d_setpwent_r'
24475d_setregid='$d_setregid'
24476d_setresgid='$d_setresgid'
24477d_setresuid='$d_setresuid'
24478d_setreuid='$d_setreuid'
24479d_setrgid='$d_setrgid'
24480d_setruid='$d_setruid'
24481d_setsent='$d_setsent'
24482d_setservent_r='$d_setservent_r'
24483d_setsid='$d_setsid'
24484d_setvbuf='$d_setvbuf'
24485d_shm='$d_shm'
24486d_shmat='$d_shmat'
24487d_shmatprototype='$d_shmatprototype'
24488d_shmctl='$d_shmctl'
24489d_shmdt='$d_shmdt'
24490d_shmget='$d_shmget'
24491d_sigaction='$d_sigaction'
24492d_siginfo_si_addr='$d_siginfo_si_addr'
24493d_siginfo_si_band='$d_siginfo_si_band'
24494d_siginfo_si_errno='$d_siginfo_si_errno'
24495d_siginfo_si_fd='$d_siginfo_si_fd'
24496d_siginfo_si_pid='$d_siginfo_si_pid'
24497d_siginfo_si_status='$d_siginfo_si_status'
24498d_siginfo_si_uid='$d_siginfo_si_uid'
24499d_siginfo_si_value='$d_siginfo_si_value'
24500d_signbit='$d_signbit'
24501d_sigprocmask='$d_sigprocmask'
24502d_sigsetjmp='$d_sigsetjmp'
24503d_sin6_scope_id='$d_sin6_scope_id'
24504d_sitearch='$d_sitearch'
24505d_snprintf='$d_snprintf'
24506d_sockaddr_in6='$d_sockaddr_in6'
24507d_sockaddr_sa_len='$d_sockaddr_sa_len'
24508d_sockatmark='$d_sockatmark'
24509d_sockatmarkproto='$d_sockatmarkproto'
24510d_socket='$d_socket'
24511d_socklen_t='$d_socklen_t'
24512d_sockpair='$d_sockpair'
24513d_socks5_init='$d_socks5_init'
24514d_sqrtl='$d_sqrtl'
24515d_srand48_r='$d_srand48_r'
24516d_srandom_r='$d_srandom_r'
24517d_sresgproto='$d_sresgproto'
24518d_sresuproto='$d_sresuproto'
24519d_stat='$d_stat'
24520d_statblks='$d_statblks'
24521d_statfs_f_flags='$d_statfs_f_flags'
24522d_statfs_s='$d_statfs_s'
24523d_static_inline='$d_static_inline'
24524d_statvfs='$d_statvfs'
24525d_stdio_cnt_lval='$d_stdio_cnt_lval'
24526d_stdio_ptr_lval='$d_stdio_ptr_lval'
24527d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24528d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24529d_stdio_stream_array='$d_stdio_stream_array'
24530d_stdiobase='$d_stdiobase'
24531d_stdstdio='$d_stdstdio'
24532d_strcoll='$d_strcoll'
24533d_strerror_l='$d_strerror_l'
24534d_strerror_r='$d_strerror_r'
24535d_strftime='$d_strftime'
24536d_strlcat='$d_strlcat'
24537d_strlcpy='$d_strlcpy'
24538d_strnlen='$d_strnlen'
24539d_strtod='$d_strtod'
24540d_strtod_l='$d_strtod_l'
24541d_strtol='$d_strtol'
24542d_strtold='$d_strtold'
24543d_strtold_l='$d_strtold_l'
24544d_strtoll='$d_strtoll'
24545d_strtoq='$d_strtoq'
24546d_strtoul='$d_strtoul'
24547d_strtoull='$d_strtoull'
24548d_strtouq='$d_strtouq'
24549d_strxfrm='$d_strxfrm'
24550d_suidsafe='$d_suidsafe'
24551d_symlink='$d_symlink'
24552d_syscall='$d_syscall'
24553d_syscallproto='$d_syscallproto'
24554d_sysconf='$d_sysconf'
24555d_sysernlst='$d_sysernlst'
24556d_syserrlst='$d_syserrlst'
24557d_system='$d_system'
24558d_tcgetpgrp='$d_tcgetpgrp'
24559d_tcsetpgrp='$d_tcsetpgrp'
24560d_telldir='$d_telldir'
24561d_telldirproto='$d_telldirproto'
24562d_tgamma='$d_tgamma'
24563d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24564d_time='$d_time'
24565d_timegm='$d_timegm'
24566d_times='$d_times'
24567d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24568d_tm_tm_zone='$d_tm_tm_zone'
24569d_tmpnam_r='$d_tmpnam_r'
24570d_towlower='$d_towlower'
24571d_towupper='$d_towupper'
24572d_trunc='$d_trunc'
24573d_truncate='$d_truncate'
24574d_truncl='$d_truncl'
24575d_ttyname_r='$d_ttyname_r'
24576d_tzname='$d_tzname'
24577d_u32align='$d_u32align'
24578d_ualarm='$d_ualarm'
24579d_umask='$d_umask'
24580d_uname='$d_uname'
24581d_union_semun='$d_union_semun'
24582d_unlinkat='$d_unlinkat'
24583d_unordered='$d_unordered'
24584d_unsetenv='$d_unsetenv'
24585d_uselocale='$d_uselocale'
24586d_usleep='$d_usleep'
24587d_usleepproto='$d_usleepproto'
24588d_ustat='$d_ustat'
24589d_vendorarch='$d_vendorarch'
24590d_vendorbin='$d_vendorbin'
24591d_vendorlib='$d_vendorlib'
24592d_vendorscript='$d_vendorscript'
24593d_vfork='$d_vfork'
24594d_void_closedir='$d_void_closedir'
24595d_voidsig='$d_voidsig'
24596d_voidtty='$d_voidtty'
24597d_vsnprintf='$d_vsnprintf'
24598d_wait4='$d_wait4'
24599d_waitpid='$d_waitpid'
24600d_wcrtomb='$d_wcrtomb'
24601d_wcscmp='$d_wcscmp'
24602d_wcstombs='$d_wcstombs'
24603d_wcsxfrm='$d_wcsxfrm'
24604d_wctomb='$d_wctomb'
24605d_writev='$d_writev'
24606d_xenix='$d_xenix'
24607date='$date'
24608db_hashtype='$db_hashtype'
24609db_prefixtype='$db_prefixtype'
24610db_version_major='$db_version_major'
24611db_version_minor='$db_version_minor'
24612db_version_patch='$db_version_patch'
24613default_inc_excludes_dot='$default_inc_excludes_dot'
24614direntrytype='$direntrytype'
24615dlext='$dlext'
24616dlsrc='$dlsrc'
24617doubleinfbytes='$doubleinfbytes'
24618doublekind='$doublekind'
24619doublemantbits='$doublemantbits'
24620doublenanbytes='$doublenanbytes'
24621doublesize='$doublesize'
24622drand01='$drand01'
24623drand48_r_proto='$drand48_r_proto'
24624dtrace='$dtrace'
24625dtraceobject='$dtraceobject'
24626dtracexnolibs='$dtracexnolibs'
24627dynamic_ext='$dynamic_ext'
24628eagain='$eagain'
24629ebcdic='$ebcdic'
24630echo='$echo'
24631egrep='$egrep'
24632emacs='$emacs'
24633endgrent_r_proto='$endgrent_r_proto'
24634endhostent_r_proto='$endhostent_r_proto'
24635endnetent_r_proto='$endnetent_r_proto'
24636endprotoent_r_proto='$endprotoent_r_proto'
24637endpwent_r_proto='$endpwent_r_proto'
24638endservent_r_proto='$endservent_r_proto'
24639eunicefix='$eunicefix'
24640exe_ext='$exe_ext'
24641expr='$expr'
24642extensions='$extensions'
24643extern_C='$extern_C'
24644extras='$extras'
24645fflushNULL='$fflushNULL'
24646fflushall='$fflushall'
24647find='$find'
24648firstmakefile='$firstmakefile'
24649flex='$flex'
24650fpossize='$fpossize'
24651fpostype='$fpostype'
24652freetype='$freetype'
24653from='$from'
24654full_ar='$full_ar'
24655full_csh='$full_csh'
24656full_sed='$full_sed'
24657gccansipedantic='$gccansipedantic'
24658gccosandvers='$gccosandvers'
24659gccversion='$gccversion'
24660getgrent_r_proto='$getgrent_r_proto'
24661getgrgid_r_proto='$getgrgid_r_proto'
24662getgrnam_r_proto='$getgrnam_r_proto'
24663gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24664gethostbyname_r_proto='$gethostbyname_r_proto'
24665gethostent_r_proto='$gethostent_r_proto'
24666getlogin_r_proto='$getlogin_r_proto'
24667getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24668getnetbyname_r_proto='$getnetbyname_r_proto'
24669getnetent_r_proto='$getnetent_r_proto'
24670getprotobyname_r_proto='$getprotobyname_r_proto'
24671getprotobynumber_r_proto='$getprotobynumber_r_proto'
24672getprotoent_r_proto='$getprotoent_r_proto'
24673getpwent_r_proto='$getpwent_r_proto'
24674getpwnam_r_proto='$getpwnam_r_proto'
24675getpwuid_r_proto='$getpwuid_r_proto'
24676getservbyname_r_proto='$getservbyname_r_proto'
24677getservbyport_r_proto='$getservbyport_r_proto'
24678getservent_r_proto='$getservent_r_proto'
24679getspnam_r_proto='$getspnam_r_proto'
24680gidformat='$gidformat'
24681gidsign='$gidsign'
24682gidsize='$gidsize'
24683gidtype='$gidtype'
24684glibpth='$glibpth'
24685gmake='$gmake'
24686gmtime_r_proto='$gmtime_r_proto'
24687gnulibc_version='$gnulibc_version'
24688grep='$grep'
24689groupcat='$groupcat'
24690groupstype='$groupstype'
24691gzip='$gzip'
24692h_fcntl='$h_fcntl'
24693h_sysfile='$h_sysfile'
24694hint='$hint'
24695hostcat='$hostcat'
24696hostgenerate='$hostgenerate'
24697hostosname='$hostosname'
24698hostperl='$hostperl'
24699html1dir='$html1dir'
24700html1direxp='$html1direxp'
24701html3dir='$html3dir'
24702html3direxp='$html3direxp'
24703i16size='$i16size'
24704i16type='$i16type'
24705i32size='$i32size'
24706i32type='$i32type'
24707i64size='$i64size'
24708i64type='$i64type'
24709i8size='$i8size'
24710i8type='$i8type'
24711i_arpainet='$i_arpainet'
24712i_bfd='$i_bfd'
24713i_bsdioctl='$i_bsdioctl'
24714i_crypt='$i_crypt'
24715i_db='$i_db'
24716i_dbm='$i_dbm'
24717i_dirent='$i_dirent'
24718i_dlfcn='$i_dlfcn'
24719i_execinfo='$i_execinfo'
24720i_fcntl='$i_fcntl'
24721i_fenv='$i_fenv'
24722i_fp='$i_fp'
24723i_fp_class='$i_fp_class'
24724i_gdbm='$i_gdbm'
24725i_gdbm_ndbm='$i_gdbm_ndbm'
24726i_gdbmndbm='$i_gdbmndbm'
24727i_grp='$i_grp'
24728i_ieeefp='$i_ieeefp'
24729i_inttypes='$i_inttypes'
24730i_langinfo='$i_langinfo'
24731i_libutil='$i_libutil'
24732i_locale='$i_locale'
24733i_machcthr='$i_machcthr'
24734i_malloc='$i_malloc'
24735i_mallocmalloc='$i_mallocmalloc'
24736i_mntent='$i_mntent'
24737i_ndbm='$i_ndbm'
24738i_netdb='$i_netdb'
24739i_neterrno='$i_neterrno'
24740i_netinettcp='$i_netinettcp'
24741i_niin='$i_niin'
24742i_poll='$i_poll'
24743i_prot='$i_prot'
24744i_pthread='$i_pthread'
24745i_pwd='$i_pwd'
24746i_quadmath='$i_quadmath'
24747i_rpcsvcdbm='$i_rpcsvcdbm'
24748i_sgtty='$i_sgtty'
24749i_shadow='$i_shadow'
24750i_socks='$i_socks'
24751i_stdbool='$i_stdbool'
24752i_stdint='$i_stdint'
24753i_stdlib='$i_stdlib'
24754i_sunmath='$i_sunmath'
24755i_sysaccess='$i_sysaccess'
24756i_sysdir='$i_sysdir'
24757i_sysfile='$i_sysfile'
24758i_sysfilio='$i_sysfilio'
24759i_sysin='$i_sysin'
24760i_sysioctl='$i_sysioctl'
24761i_syslog='$i_syslog'
24762i_sysmman='$i_sysmman'
24763i_sysmode='$i_sysmode'
24764i_sysmount='$i_sysmount'
24765i_sysndir='$i_sysndir'
24766i_sysparam='$i_sysparam'
24767i_syspoll='$i_syspoll'
24768i_sysresrc='$i_sysresrc'
24769i_syssecrt='$i_syssecrt'
24770i_sysselct='$i_sysselct'
24771i_syssockio='$i_syssockio'
24772i_sysstat='$i_sysstat'
24773i_sysstatfs='$i_sysstatfs'
24774i_sysstatvfs='$i_sysstatvfs'
24775i_systime='$i_systime'
24776i_systimek='$i_systimek'
24777i_systimes='$i_systimes'
24778i_systypes='$i_systypes'
24779i_sysuio='$i_sysuio'
24780i_sysun='$i_sysun'
24781i_sysutsname='$i_sysutsname'
24782i_sysvfs='$i_sysvfs'
24783i_syswait='$i_syswait'
24784i_termio='$i_termio'
24785i_termios='$i_termios'
24786i_time='$i_time'
24787i_unistd='$i_unistd'
24788i_ustat='$i_ustat'
24789i_utime='$i_utime'
24790i_vfork='$i_vfork'
24791i_wchar='$i_wchar'
24792i_wctype='$i_wctype'
24793i_xlocale='$i_xlocale'
24794ignore_versioned_solibs='$ignore_versioned_solibs'
24795inc_version_list='$inc_version_list'
24796inc_version_list_init='$inc_version_list_init'
24797incpath='$incpath'
24798incpth='$incpth'
24799inews='$inews'
24800initialinstalllocation='$initialinstalllocation'
24801installarchlib='$installarchlib'
24802installbin='$installbin'
24803installhtml1dir='$installhtml1dir'
24804installhtml3dir='$installhtml3dir'
24805installman1dir='$installman1dir'
24806installman3dir='$installman3dir'
24807installprefix='$installprefix'
24808installprefixexp='$installprefixexp'
24809installprivlib='$installprivlib'
24810installscript='$installscript'
24811installsitearch='$installsitearch'
24812installsitebin='$installsitebin'
24813installsitehtml1dir='$installsitehtml1dir'
24814installsitehtml3dir='$installsitehtml3dir'
24815installsitelib='$installsitelib'
24816installsiteman1dir='$installsiteman1dir'
24817installsiteman3dir='$installsiteman3dir'
24818installsitescript='$installsitescript'
24819installstyle='$installstyle'
24820installusrbinperl='$installusrbinperl'
24821installvendorarch='$installvendorarch'
24822installvendorbin='$installvendorbin'
24823installvendorhtml1dir='$installvendorhtml1dir'
24824installvendorhtml3dir='$installvendorhtml3dir'
24825installvendorlib='$installvendorlib'
24826installvendorman1dir='$installvendorman1dir'
24827installvendorman3dir='$installvendorman3dir'
24828installvendorscript='$installvendorscript'
24829intsize='$intsize'
24830issymlink='$issymlink'
24831ivdformat='$ivdformat'
24832ivsize='$ivsize'
24833ivtype='$ivtype'
24834known_extensions='$known_extensions'
24835ksh='$ksh'
24836ld='$ld'
24837ld_can_script='$ld_can_script'
24838lddlflags='$lddlflags'
24839ldflags='$ldflags'
24840ldflags_uselargefiles='$ldflags_uselargefiles'
24841ldlibpthname='$ldlibpthname'
24842less='$less'
24843lib_ext='$lib_ext'
24844libc='$libc'
24845libperl='$libperl'
24846libpth='$libpth'
24847libs='$libs'
24848libsdirs='$libsdirs'
24849libsfiles='$libsfiles'
24850libsfound='$libsfound'
24851libspath='$libspath'
24852libswanted='$libswanted'
24853libswanted_uselargefiles='$libswanted_uselargefiles'
24854line='$line'
24855lint='$lint'
24856lkflags='$lkflags'
24857ln='$ln'
24858lns='$lns'
24859localtime_r_proto='$localtime_r_proto'
24860locincpth='$locincpth'
24861loclibpth='$loclibpth'
24862longdblinfbytes='$longdblinfbytes'
24863longdblkind='$longdblkind'
24864longdblmantbits='$longdblmantbits'
24865longdblnanbytes='$longdblnanbytes'
24866longdblsize='$longdblsize'
24867longlongsize='$longlongsize'
24868longsize='$longsize'
24869lp='$lp'
24870lpr='$lpr'
24871ls='$ls'
24872lseeksize='$lseeksize'
24873lseektype='$lseektype'
24874mail='$mail'
24875mailx='$mailx'
24876make='$make'
24877make_set_make='$make_set_make'
24878mallocobj='$mallocobj'
24879mallocsrc='$mallocsrc'
24880malloctype='$malloctype'
24881man1dir='$man1dir'
24882man1direxp='$man1direxp'
24883man1ext='$man1ext'
24884man3dir='$man3dir'
24885man3direxp='$man3direxp'
24886man3ext='$man3ext'
24887mips_type='$mips_type'
24888mistrustnm='$mistrustnm'
24889mkdir='$mkdir'
24890mmaptype='$mmaptype'
24891modetype='$modetype'
24892more='$more'
24893multiarch='$multiarch'
24894mv='$mv'
24895myarchname='$myarchname'
24896mydomain='$mydomain'
24897myhostname='$myhostname'
24898myuname='$myuname'
24899n='$n'
24900need_va_copy='$need_va_copy'
24901netdb_hlen_type='$netdb_hlen_type'
24902netdb_host_type='$netdb_host_type'
24903netdb_name_type='$netdb_name_type'
24904netdb_net_type='$netdb_net_type'
24905nm='$nm'
24906nm_opt='$nm_opt'
24907nm_so_opt='$nm_so_opt'
24908nonxs_ext='$nonxs_ext'
24909nroff='$nroff'
24910nvEUformat='$nvEUformat'
24911nvFUformat='$nvFUformat'
24912nvGUformat='$nvGUformat'
24913nv_overflows_integers_at='$nv_overflows_integers_at'
24914nv_preserves_uv_bits='$nv_preserves_uv_bits'
24915nveformat='$nveformat'
24916nvfformat='$nvfformat'
24917nvgformat='$nvgformat'
24918nvmantbits='$nvmantbits'
24919nvsize='$nvsize'
24920nvtype='$nvtype'
24921o_nonblock='$o_nonblock'
24922obj_ext='$obj_ext'
24923old_pthread_create_joinable='$old_pthread_create_joinable'
24924optimize='$optimize'
24925orderlib='$orderlib'
24926osname='$osname'
24927osvers='$osvers'
24928otherlibdirs='$otherlibdirs'
24929package='$package'
24930pager='$pager'
24931passcat='$passcat'
24932patchlevel='$patchlevel'
24933path_sep='$path_sep'
24934perl5='$perl5'
24935perl='$perl'
24936perl_patchlevel='$perl_patchlevel'
24937perl_static_inline='$perl_static_inline'
24938perladmin='$perladmin'
24939perllibs='$perllibs'
24940perlpath='$perlpath'
24941pg='$pg'
24942phostname='$phostname'
24943pidtype='$pidtype'
24944plibpth='$plibpth'
24945pmake='$pmake'
24946pr='$pr'
24947prefix='$prefix'
24948prefixexp='$prefixexp'
24949privlib='$privlib'
24950privlibexp='$privlibexp'
24951procselfexe='$procselfexe'
24952ptrsize='$ptrsize'
24953quadkind='$quadkind'
24954quadtype='$quadtype'
24955randbits='$randbits'
24956randfunc='$randfunc'
24957random_r_proto='$random_r_proto'
24958randseedtype='$randseedtype'
24959ranlib='$ranlib'
24960rd_nodata='$rd_nodata'
24961readdir64_r_proto='$readdir64_r_proto'
24962readdir_r_proto='$readdir_r_proto'
24963revision='$revision'
24964rm='$rm'
24965rm_try='$rm_try'
24966rmail='$rmail'
24967run='$run'
24968runnm='$runnm'
24969sGMTIME_max='$sGMTIME_max'
24970sGMTIME_min='$sGMTIME_min'
24971sLOCALTIME_max='$sLOCALTIME_max'
24972sLOCALTIME_min='$sLOCALTIME_min'
24973sPRIEUldbl='$sPRIEUldbl'
24974sPRIFUldbl='$sPRIFUldbl'
24975sPRIGUldbl='$sPRIGUldbl'
24976sPRIXU64='$sPRIXU64'
24977sPRId64='$sPRId64'
24978sPRIeldbl='$sPRIeldbl'
24979sPRIfldbl='$sPRIfldbl'
24980sPRIgldbl='$sPRIgldbl'
24981sPRIi64='$sPRIi64'
24982sPRIo64='$sPRIo64'
24983sPRIu64='$sPRIu64'
24984sPRIx64='$sPRIx64'
24985sSCNfldbl='$sSCNfldbl'
24986sched_yield='$sched_yield'
24987scriptdir='$scriptdir'
24988scriptdirexp='$scriptdirexp'
24989sed='$sed'
24990seedfunc='$seedfunc'
24991selectminbits='$selectminbits'
24992selecttype='$selecttype'
24993sendmail='$sendmail'
24994setgrent_r_proto='$setgrent_r_proto'
24995sethostent_r_proto='$sethostent_r_proto'
24996setlocale_r_proto='$setlocale_r_proto'
24997setnetent_r_proto='$setnetent_r_proto'
24998setprotoent_r_proto='$setprotoent_r_proto'
24999setpwent_r_proto='$setpwent_r_proto'
25000setservent_r_proto='$setservent_r_proto'
25001sh='$sh'
25002shar='$shar'
25003sharpbang='$sharpbang'
25004shmattype='$shmattype'
25005shortsize='$shortsize'
25006shrpenv='$shrpenv'
25007shsharp='$shsharp'
25008sig_count='$sig_count'
25009sig_name='$sig_name'
25010sig_name_init='$sig_name_init'
25011sig_num='$sig_num'
25012sig_num_init='$sig_num_init'
25013sig_size='$sig_size'
25014signal_t='$signal_t'
25015sitearch='$sitearch'
25016sitearchexp='$sitearchexp'
25017sitebin='$sitebin'
25018sitebinexp='$sitebinexp'
25019sitehtml1dir='$sitehtml1dir'
25020sitehtml1direxp='$sitehtml1direxp'
25021sitehtml3dir='$sitehtml3dir'
25022sitehtml3direxp='$sitehtml3direxp'
25023sitelib='$sitelib'
25024sitelib_stem='$sitelib_stem'
25025sitelibexp='$sitelibexp'
25026siteman1dir='$siteman1dir'
25027siteman1direxp='$siteman1direxp'
25028siteman3dir='$siteman3dir'
25029siteman3direxp='$siteman3direxp'
25030siteprefix='$siteprefix'
25031siteprefixexp='$siteprefixexp'
25032sitescript='$sitescript'
25033sitescriptexp='$sitescriptexp'
25034sizesize='$sizesize'
25035sizetype='$sizetype'
25036sleep='$sleep'
25037smail='$smail'
25038so='$so'
25039sockethdr='$sockethdr'
25040socketlib='$socketlib'
25041socksizetype='$socksizetype'
25042sort='$sort'
25043spackage='$spackage'
25044spitshell='$spitshell'
25045srand48_r_proto='$srand48_r_proto'
25046srandom_r_proto='$srandom_r_proto'
25047src='$src'
25048ssizetype='$ssizetype'
25049st_ino_sign='$st_ino_sign'
25050st_ino_size='$st_ino_size'
25051startperl='$startperl'
25052startsh='$startsh'
25053static_ext='$static_ext'
25054stdchar='$stdchar'
25055stdio_base='$stdio_base'
25056stdio_bufsiz='$stdio_bufsiz'
25057stdio_cnt='$stdio_cnt'
25058stdio_filbuf='$stdio_filbuf'
25059stdio_ptr='$stdio_ptr'
25060stdio_stream_array='$stdio_stream_array'
25061strerror_r_proto='$strerror_r_proto'
25062submit='$submit'
25063subversion='$subversion'
25064sysman='$sysman'
25065sysroot='$sysroot'
25066tail='$tail'
25067tar='$tar'
25068targetarch='$targetarch'
25069targetdir='$targetdir'
25070targetenv='$targetenv'
25071targethost='$targethost'
25072targetmkdir='$targetmkdir'
25073targetport='$targetport'
25074targetsh='$targetsh'
25075tbl='$tbl'
25076tee='$tee'
25077test='$test'
25078timeincl='$timeincl'
25079timetype='$timetype'
25080tmpnam_r_proto='$tmpnam_r_proto'
25081to='$to'
25082touch='$touch'
25083tr='$tr'
25084trnl='$trnl'
25085troff='$troff'
25086ttyname_r_proto='$ttyname_r_proto'
25087u16size='$u16size'
25088u16type='$u16type'
25089u32size='$u32size'
25090u32type='$u32type'
25091u64size='$u64size'
25092u64type='$u64type'
25093u8size='$u8size'
25094u8type='$u8type'
25095uidformat='$uidformat'
25096uidsign='$uidsign'
25097uidsize='$uidsize'
25098uidtype='$uidtype'
25099uname='$uname'
25100uniq='$uniq'
25101uquadtype='$uquadtype'
25102use5005threads='$use5005threads'
25103use64bitall='$use64bitall'
25104use64bitint='$use64bitint'
25105usecbacktrace='$usecbacktrace'
25106usecrosscompile='$usecrosscompile'
25107usedevel='$usedevel'
25108usedl='$usedl'
25109usedtrace='$usedtrace'
25110usefaststdio='$usefaststdio'
25111useithreads='$useithreads'
25112usekernprocpathname='$usekernprocpathname'
25113uselanginfo='$uselanginfo'
25114uselargefiles='$uselargefiles'
25115uselongdouble='$uselongdouble'
25116usemallocwrap='$usemallocwrap'
25117usemorebits='$usemorebits'
25118usemultiplicity='$usemultiplicity'
25119usemymalloc='$usemymalloc'
25120usenm='$usenm'
25121usensgetexecutablepath='$usensgetexecutablepath'
25122useopcode='$useopcode'
25123useperlio='$useperlio'
25124useposix='$useposix'
25125usequadmath='$usequadmath'
25126usereentrant='$usereentrant'
25127userelocatableinc='$userelocatableinc'
25128useshrplib='$useshrplib'
25129usesitecustomize='$usesitecustomize'
25130usesocks='$usesocks'
25131usethreads='$usethreads'
25132usevendorprefix='$usevendorprefix'
25133useversionedarchname='$useversionedarchname'
25134usevfork='$usevfork'
25135usrinc='$usrinc'
25136uuname='$uuname'
25137uvXUformat='$uvXUformat'
25138uvoformat='$uvoformat'
25139uvsize='$uvsize'
25140uvtype='$uvtype'
25141uvuformat='$uvuformat'
25142uvxformat='$uvxformat'
25143vendorarch='$vendorarch'
25144vendorarchexp='$vendorarchexp'
25145vendorbin='$vendorbin'
25146vendorbinexp='$vendorbinexp'
25147vendorhtml1dir='$vendorhtml1dir'
25148vendorhtml1direxp='$vendorhtml1direxp'
25149vendorhtml3dir='$vendorhtml3dir'
25150vendorhtml3direxp='$vendorhtml3direxp'
25151vendorlib='$vendorlib'
25152vendorlib_stem='$vendorlib_stem'
25153vendorlibexp='$vendorlibexp'
25154vendorman1dir='$vendorman1dir'
25155vendorman1direxp='$vendorman1direxp'
25156vendorman3dir='$vendorman3dir'
25157vendorman3direxp='$vendorman3direxp'
25158vendorprefix='$vendorprefix'
25159vendorprefixexp='$vendorprefixexp'
25160vendorscript='$vendorscript'
25161vendorscriptexp='$vendorscriptexp'
25162version='$version'
25163version_patchlevel_string='$version_patchlevel_string'
25164versiononly='$versiononly'
25165vi='$vi'
25166xlibpth='$xlibpth'
25167yacc='$yacc'
25168yaccflags='$yaccflags'
25169zcat='$zcat'
25170zip='$zip'
25171EOT
25172
25173: add special variables
25174$test -f $src/patchlevel.h && \
25175awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25176echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25177echo "PERL_CONFIG_SH=true" >>config.sh
25178
25179: propagate old symbols
25180if $test -f UU/config.sh; then
25181 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25182 $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25183 config.sh config.sh UU/oldconfig.sh |\
25184 $sort | $uniq -u >UU/oldsyms
25185 set X `$cat UU/oldsyms`
25186 shift
25187 case $# in
25188 0) ;;
25189 *)
25190 $cat <<EOM
25191Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25192EOM
25193 echo ": Variables propagated from previous config.sh file." >>config.sh
25194 for sym in `$cat UU/oldsyms`; do
25195 echo " Propagating $hint variable "'$'"$sym..."
25196 eval 'tmp="$'"${sym}"'"'
25197 echo "$tmp" | \
25198 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25199 done
25200 ;;
25201 esac
25202fi
25203
25204: preserve RCS keywords in files with variable substitution, grrr
25205Id='$Id'
25206
25207: Finish up by extracting the .SH files
25208case "$alldone" in
25209exit)
25210 echo "Stopping at your request, leaving temporary files around."
25211 exit 0
25212 ;;
25213cont)
25214 ;;
25215'')
25216 dflt=''
25217 nostick=true
25218 $cat <<EOM
25219
25220If you'd like to make any changes to the config.sh file before I begin
25221to configure things, do it as a shell escape now (e.g. !vi config.sh).
25222
25223EOM
25224 rp="Press return or use a shell escape to edit config.sh:"
25225 . UU/myread
25226 nostick=''
25227 case "$ans" in
25228 '') ;;
25229 *) : in case they cannot read
25230 sh 1>&4 -c "$ans";;
25231 esac
25232 ;;
25233esac
25234
25235: if this fails, just run all the .SH files by hand
25236. ./config.sh
25237
25238echo " "
25239exec 1>&4
25240pwd=`pwd`
25241. ./UU/extract
25242cd "$pwd"
25243
25244if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25245 dflt=y
25246 case "$silent" in
25247 true) ;;
25248 *)
25249 $cat <<EOM
25250
25251Now you need to generate make dependencies by running "$make depend".
25252You might prefer to run it in background: "$make depend > makedepend.out &"
25253It can take a while, so you might not want to run it right now.
25254
25255EOM
25256 ;;
25257 esac
25258 rp="Run $make depend now?"
25259 . UU/myread
25260 case "$ans" in
25261 y*)
25262 $make depend && echo "Now you must run '$make'."
25263 ;;
25264 *)
25265 echo "You must run '$make depend' then '$make'."
25266 ;;
25267 esac
25268elif test -f [Mm]akefile; then
25269 echo " "
25270 echo "Now you must run a $make."
25271else
25272 echo "Configure done."
25273fi
25274
25275if $test -f Policy.sh; then
25276 $cat <<EOM
25277
25278If you compile $package on a different machine or from a different object
25279directory, copy the Policy.sh file from this object directory to the
25280new one before you run Configure -- this will help you with most of
25281the policy defaults.
25282
25283EOM
25284fi
25285if $test -f UU/config.msg; then
25286 echo "Hmm. I also noted the following information while running:"
25287 echo " "
25288 $cat UU/config.msg >&4
25289fi
25290$rm -f kit*isdone ark*isdone
25291$rm -rf UU
25292
25293: End of Configure
25294