This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Adapt Configure to GCC version 10
[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
5791cat >&4 <<EOM
5792Internal Configure script bug - compiler test file ${mc_file}.c is missing.
5793Please report this to https://github.com/Perl/perl5/issues
5794EOM
5795exit 1;
5796fi;
5797esac;
5798$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5799: define a shorthand compile call for compilations that should be ok.
5800compile_ok='
5801mc_file=$1;
5802shift;
5803$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5804
5805: stub, used only to satisfy other units
5806i_stdlib='define'
5807
5808: check for lengths of integral types
5809echo " "
5810case "$intsize" in
5811'')
5812 echo "Checking to see how big your integers are..." >&4
5813 $cat >try.c <<EOCP
5814#include <stdio.h>
5815#$i_stdlib I_STDLIB
5816#ifdef I_STDLIB
5817#include <stdlib.h>
5818#endif
5819int main()
5820{
5821 printf("intsize=%d;\n", (int)sizeof(int));
5822 printf("longsize=%d;\n", (int)sizeof(long));
5823 printf("shortsize=%d;\n", (int)sizeof(short));
5824 exit(0);
5825}
5826EOCP
5827 set try
5828 if eval $compile_ok && $run ./try > /dev/null; then
5829 eval `$run ./try`
5830 echo "Your integers are $intsize bytes long."
5831 echo "Your long integers are $longsize bytes long."
5832 echo "Your short integers are $shortsize bytes long."
5833 else
5834 $cat >&4 <<EOM
5835!
5836Help! I can't compile and run the intsize test program: please enlighten me!
5837(This is probably a misconfiguration in your system or libraries, and
5838you really ought to fix it. Still, I'll try anyway.)
5839!
5840EOM
5841 dflt=4
5842 rp="What is the size of an integer (in bytes)?"
5843 . ./myread
5844 intsize="$ans"
5845 dflt=$intsize
5846 rp="What is the size of a long integer (in bytes)?"
5847 . ./myread
5848 longsize="$ans"
5849 dflt=2
5850 rp="What is the size of a short integer (in bytes)?"
5851 . ./myread
5852 shortsize="$ans"
5853 fi
5854 ;;
5855esac
5856$rm_try
5857
5858: check for long long
5859echo " "
5860echo "Checking to see if you have long long..." >&4
5861echo 'int main() { long long x = 7; return 0; }' > try.c
5862set try
5863if eval $compile; then
5864 val="$define"
5865 echo "You have long long."
5866else
5867 val="$undef"
5868 echo "You do not have long long."
5869fi
5870$rm_try
5871set d_longlong
5872eval $setvar
5873
5874: check for length of long long
5875case "${d_longlong}${longlongsize}" in
5876$define)
5877 echo " "
5878 echo "Checking to see how big your long longs are..." >&4
5879 $cat >try.c <<'EOCP'
5880#include <stdio.h>
5881int main()
5882{
5883 printf("%d\n", (int)sizeof(long long));
5884 return(0);
5885}
5886EOCP
5887 set try
5888 if eval $compile_ok; then
5889 longlongsize=`$run ./try`
5890 echo "Your long longs are $longlongsize bytes long."
5891 else
5892 dflt='8'
5893 echo " "
5894 echo "(I can't seem to compile the test program. Guessing...)"
5895 rp="What is the size of a long long (in bytes)?"
5896 . ./myread
5897 longlongsize="$ans"
5898 fi
5899 if $test "X$longsize" = "X$longlongsize"; then
5900 echo "(That isn't any different from an ordinary long.)"
5901 fi
5902 ;;
5903esac
5904$rm_try
5905
5906: determine filename position in cpp output
5907echo " "
5908echo "Computing filename position in cpp output for #include directives..." >&4
5909case "$osname" in
5910amigaos) fieldn=3 ;; # Workaround for a bug in abc (pdksh).
5911esac
5912case "$fieldn" in
5913'')
5914case "$osname" in
5915vos) testaccess=-e ;;
5916*) testaccess=-r ;;
5917esac
5918echo '#include <stdio.h>' > foo.c
5919$cat >fieldn <<EOF
5920$startsh
5921$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5922$grep '^[ ]*#.*stdio\.h' | \
5923while read cline; do
5924 pos=1
5925 set \$cline
5926 while $test \$# -gt 0; do
5927 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5928 echo "\$pos"
5929 exit 0
5930 fi
5931 shift
5932 pos=\`expr \$pos + 1\`
5933 done
5934done
5935EOF
5936chmod +x fieldn
5937fieldn=`./fieldn`
5938$rm -f foo.c fieldn
5939;;
5940esac
5941case $fieldn in
5942'') pos='???';;
59431) pos=first;;
59442) pos=second;;
59453) pos=third;;
5946*) pos="${fieldn}th";;
5947esac
5948echo "Your cpp writes the filename in the $pos field of the line."
5949
5950: locate header file
5951$cat >findhdr <<EOF
5952$startsh
5953wanted=\$1
5954name=''
5955for usrincdir in $incpth
5956do
5957 if test -f \$usrincdir/\$wanted; then
5958 echo "\$usrincdir/\$wanted"
5959 exit 0
5960 fi
5961done
5962awkprg='{ print \$$fieldn }'
5963echo "#include <\$wanted>" > foo\$\$.c
5964$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5965$cppfilter $grep "^[ ]*#.*\$wanted" | \
5966while read cline; do
5967 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5968 case "\$name" in
5969 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5970 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5971 *) exit 2;;
5972 esac;
5973done;
5974#
5975# status = 0: grep returned 0 lines, case statement not executed
5976# status = 1: headerfile found
5977# status = 2: while loop executed, no headerfile found
5978#
5979status=\$?
5980$rm -f foo\$\$.c;
5981if test \$status -eq 1; then
5982 exit 0;
5983fi
5984exit 1
5985EOF
5986chmod +x findhdr
5987
5988: define an alternate in-header-list? function
5989inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5990cont=true; xxf="echo \"<\$1> found.\" >&4";
5991case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5992*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5993esac;
5994case $# in 4) instead=instead;; *) instead="at last";; esac;
5995while $test "$cont"; do
5996 xxx=`./findhdr $1`
5997 var=$2; eval "was=\$$2";
5998 if $test "$xxx" && $test -r "$xxx";
5999 then eval $xxf;
6000 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
6001 cont="";
6002 else eval $xxnf;
6003 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
6004 set $yyy; shift; shift; yyy=$@;
6005 case $# in 0) cont="";;
6006 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
6007 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
6008 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
6009 xxnf="echo \"there is no <\$1>, ...\" >&4";;
6010 esac;
6011done;
6012while $test "$yyy";
6013do set $yyy; var=$2; eval "was=\$$2";
6014 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
6015 set $yyy; shift; shift; yyy=$@;
6016done'
6017
6018: see if inttypes.h is available
6019: we want a real compile instead of Inhdr because some systems
6020: have an inttypes.h which includes non-existent headers
6021echo " "
6022$cat >try.c <<EOCP
6023#include <inttypes.h>
6024int main() {
6025 static int32_t foo32 = 0x12345678;
6026}
6027EOCP
6028set try
6029if eval $compile; then
6030 echo "<inttypes.h> found." >&4
6031 val="$define"
6032else
6033 echo "<inttypes.h> NOT found." >&4
6034 val="$undef"
6035fi
6036$rm_try
6037set i_inttypes
6038eval $setvar
6039
6040: check for int64_t
6041echo " "
6042echo "Checking to see if you have int64_t..." >&4
6043$cat >try.c <<EOCP
6044#include <sys/types.h>
6045#$i_inttypes I_INTTYPES
6046#ifdef I_INTTYPES
6047#include <inttypes.h>
6048#endif
6049int main() { int64_t x = 7; }
6050EOCP
6051set try
6052if eval $compile; then
6053 val="$define"
6054 echo "You have int64_t."
6055else
6056 val="$undef"
6057 echo "You do not have int64_t."
6058fi
6059$rm_try
6060set d_int64_t
6061eval $setvar
6062
6063: Check if 64bit ints have a quad type
6064echo " "
6065echo "Checking which 64-bit integer type we could use..." >&4
6066
6067case "$intsize" in
60688) val=int
6069 set quadtype
6070 eval $setvar
6071 val='"unsigned int"'
6072 set uquadtype
6073 eval $setvar
6074 quadkind=1
6075 ;;
6076*) case "$longsize" in
6077 8) val=long
6078 set quadtype
6079 eval $setvar
6080 val='"unsigned long"'
6081 set uquadtype
6082 eval $setvar
6083 quadkind=2
6084 ;;
6085 *) case "$d_longlong:$longlongsize" in
6086 define:8)
6087 val='"long long"'
6088 set quadtype
6089 eval $setvar
6090 val='"unsigned long long"'
6091 set uquadtype
6092 eval $setvar
6093 quadkind=3
6094 ;;
6095 *) case "$d_int64_t" in
6096 define)
6097 val=int64_t
6098 set quadtype
6099 eval $setvar
6100 val=uint64_t
6101 set uquadtype
6102 eval $setvar
6103 quadkind=4
6104 ;;
6105 esac
6106 ;;
6107 esac
6108 ;;
6109 esac
6110 ;;
6111esac
6112
6113case "$quadtype" in
6114'') echo "Alas, no 64-bit integer types in sight." >&4
6115 d_quad="$undef"
6116 ;;
6117*) echo "We could use '$quadtype' for 64-bit integers." >&4
6118 d_quad="$define"
6119 ;;
6120esac
6121
6122: Do we want 64bit support
6123case "$uselonglong" in
6124"$define"|true|[yY]*)
6125 cat <<EOM >&4
6126
6127*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6128EOM
6129 use64bitint="$define"
6130 ;;
6131esac
6132case "$use64bits" in
6133"$define"|true|[yY]*)
6134 cat <<EOM >&4
6135
6136*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6137EOM
6138 use64bitint="$define"
6139 ;;
6140esac
6141case "$use64bitints" in
6142"$define"|true|[yY]*)
6143 cat <<EOM >&4
6144
6145*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6146EOM
6147 use64bitint="$define"
6148 ;;
6149esac
6150case "$use64bitsint" in
6151"$define"|true|[yY]*)
6152 cat <<EOM >&4
6153
6154*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6155EOM
6156 use64bitint="$define"
6157 ;;
6158esac
6159case "$uselonglongs" in
6160"$define"|true|[yY]*)
6161 cat <<EOM >&4
6162
6163*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6164EOM
6165 use64bitint="$define"
6166 ;;
6167esac
6168case "$use64bitsall" in
6169"$define"|true|[yY]*)
6170 cat <<EOM >&4
6171
6172*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6173EOM
6174 use64bitall="$define"
6175 ;;
6176esac
6177
6178case "$ccflags" in
6179*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6180esac
6181case "$use64bitall" in
6182"$define"|true|[yY]*) use64bitint="$define" ;;
6183esac
6184
6185case "$longsize" in
61868) cat <<EOM
6187
6188You have natively 64-bit long integers.
6189EOM
6190 val="$define"
6191 ;;
6192*) case "$use64bitint" in
6193 "$define"|true|[yY]*) dflt='y';;
6194 *) dflt='n';;
6195 esac
6196 case "$d_quad" in
6197 "$define") ;;
6198 *) dflt='n' ;;
6199 esac
6200 cat <<EOM
6201
6202Perl can be built to take advantage of 64-bit integer types
6203on some systems. To do so, Configure can be run with -Duse64bitint.
6204Choosing this option will most probably introduce binary incompatibilities.
6205
6206If this doesn't make any sense to you, just accept the default '$dflt'.
6207(The default has been chosen based on your configuration.)
6208EOM
6209 rp='Try to use 64-bit integers, if available?'
6210 . ./myread
6211 case "$ans" in
6212 [yY]*) val="$define" ;;
6213 *) val="$undef" ;;
6214 esac
6215 ;;
6216esac
6217set use64bitint
6218eval $setvar
6219
6220case "$use64bitall" in
6221"$define"|true|[yY]*) dflt='y' ;;
6222*) case "$longsize" in
6223 8) dflt='y' ;;
6224 *) dflt='n' ;;
6225 esac
6226 ;;
6227esac
6228cat <<EOM
6229
6230You may also choose to try maximal 64-bitness. It means using as much
623164-bitness as possible on the platform. This in turn means even more
6232binary incompatibilities. On the other hand, your platform may not
6233have any more 64-bitness available than what you already have chosen.
6234
6235If this doesn't make any sense to you, just accept the default '$dflt'.
6236(The default has been chosen based on your configuration.)
6237EOM
6238rp='Try to use maximal 64-bit support, if available?'
6239. ./myread
6240case "$ans" in
6241[yY]*) val="$define" ;;
6242*) val="$undef" ;;
6243esac
6244set use64bitall
6245eval $setvar
6246case "$use64bitall" in
6247"$define")
6248 case "$use64bitint" in
6249 "$undef")
6250 cat <<EOM
6251
6252Since you have chosen a maximally 64-bit build, I'm also turning on
6253the use of 64-bit integers.
6254EOM
6255 use64bitint="$define" ;;
6256 esac
6257 ;;
6258esac
6259
6260: Look for a hint-file generated 'call-back-unit'. If the
6261: user has specified that a 64-bit perl is to be built,
6262: we may need to set or change some other defaults.
6263if $test -f use64bitint.cbu; then
6264 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6265 . ./use64bitint.cbu
6266fi
6267case "$use64bitint" in
6268"$define"|true|[yY]*)
6269 : This test was common to all the OpenBSD forks, and seems harmless for
6270 : other platforms:
6271 echo " "
6272 echo "Checking if your C library has broken 64-bit functions..." >&4
6273 cat >try.c <<EOCP
6274#include <stdio.h>
6275typedef $uquadtype myULL;
6276int main (void)
6277{
6278 struct {
6279 double d;
6280 myULL u;
6281 } *p, test[] = {
6282 {4294967303.15, 4294967303ULL},
6283 {4294967294.2, 4294967294ULL},
6284 {4294967295.7, 4294967295ULL},
6285 {0.0, 0ULL}
6286 };
6287 for (p = test; p->u; p++) {
6288 myULL x = (myULL)p->d;
6289 if (x != p->u) {
6290 printf("buggy\n");
6291 return 0;
6292 }
6293 }
6294 printf("ok\n");
6295 return 0;
6296}
6297EOCP
6298 set try
6299 if eval $compile_ok; then
6300 libcquad=`$run ./try`
6301 echo "Your C library's 64-bit functions are $libcquad."
6302 else
6303 echo "(I can't seem to compile the test program.)"
6304 echo "Assuming that your C library's 64-bit functions are ok."
6305 libcquad="ok"
6306 fi
6307 $rm_try
6308
6309 case "$libcquad" in
6310 buggy*)
6311 cat >&4 <<EOM
6312
6313*** You have a C library with broken 64-bit functions.
6314*** 64-bit support does not work reliably in this configuration.
6315*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6316*** Cannot continue, aborting.
6317
6318EOM
6319 exit 1
6320 ;;
6321 esac
6322 case "$longsize" in
6323 4) case "$archname64" in
6324 '') archname64=64int ;;
6325 esac
6326 ;;
6327 esac
6328 ;;
6329esac
6330
6331: Look for a hint-file generated 'call-back-unit'. If the
6332: user has specified that a maximally 64-bit perl is to be built,
6333: we may need to set or change some other defaults.
6334if $test -f use64bitall.cbu; then
6335 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6336 . ./use64bitall.cbu
6337fi
6338case "$use64bitall" in
6339"$define"|true|[yY]*)
6340 case "$longsize" in
6341 4) case "$archname64" in
6342 ''|64int) archname64=64all ;;
6343 esac
6344 ;;
6345 esac
6346 ;;
6347esac
6348
6349case "$d_quad:$use64bitint" in
6350$undef:$define)
6351 cat >&4 <<EOF
6352
6353*** You have chosen to use 64-bit integers,
6354*** but none can be found.
6355*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6356*** Cannot continue, aborting.
6357
6358EOF
6359 exit 1
6360 ;;
6361esac
6362
6363: Check if we are using the GNU C library
6364echo " "
6365echo "Checking for GNU C Library..." >&4
6366cat >try.c <<'EOCP'
6367/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
6368 alone are insufficient to distinguish different versions, such as
6369 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
6370 libc version 2.1.0. A. Dougherty, June 3, 2002.
6371*/
6372#include <stdio.h>
6373int main(void)
6374{
6375#ifdef __GLIBC__
6376# ifdef __GLIBC_MINOR__
6377# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6378# include <gnu/libc-version.h>
6379 printf("%s\n", gnu_get_libc_version());
6380# else
6381 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
6382# endif
6383# else
6384 printf("%d\n", __GLIBC__);
6385# endif
6386 return 0;
6387#else
6388 return 1;
6389#endif
6390}
6391EOCP
6392set try
6393if eval $compile_ok && $run ./try > glibc.ver; then
6394 val="$define"
6395 gnulibc_version=`$cat glibc.ver`
6396 echo "You are using the GNU C Library version $gnulibc_version"
6397else
6398 val="$undef"
6399 gnulibc_version=''
6400 echo "You are not using the GNU C Library"
6401fi
6402$rm_try glibc.ver
6403set d_gnulibc
6404eval $setvar
6405
6406: see if nm is to be used to determine whether a symbol is defined or not
6407case "$usenm" in
6408'')
6409 dflt=''
6410 case "$d_gnulibc" in
6411 "$define")
6412 echo " "
6413 echo "nm probably won't work on the GNU C Library." >&4
6414 dflt=n
6415 ;;
6416 esac
6417 case "$dflt" in
6418 '')
6419 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6420 echo " "
6421 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
6422 echo "'nm' won't be sufficient on this system." >&4
6423 dflt=n
6424 fi
6425 ;;
6426 esac
6427 case "$dflt" in
6428 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6429 if $test $dflt -gt 20; then
6430 dflt=y
6431 else
6432 dflt=n
6433 fi
6434 ;;
6435 esac
6436 ;;
6437*)
6438 case "$usenm" in
6439 true|$define) dflt=y;;
6440 *) dflt=n;;
6441 esac
6442 ;;
6443esac
6444$cat <<EOM
6445
6446I can use $nm to extract the symbols from your C libraries. This
6447is a time consuming task which may generate huge output on the disk (up
6448to 3 megabytes) but that should make the symbols extraction faster. The
6449alternative is to skip the 'nm' extraction part and to compile a small
6450test program instead to determine whether each symbol is present. If
6451you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6452this may be the best solution.
6453
6454You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6455
6456EOM
6457rp="Shall I use $nm to extract C symbols from the libraries?"
6458. ./myread
6459case "$ans" in
6460[Nn]*) usenm=false;;
6461*) usenm=true;;
6462esac
6463
6464runnm=$usenm
6465case "$reuseval" in
6466true) runnm=false;;
6467esac
6468
6469: nm options which may be necessary
6470case "$nm_opt" in
6471'') if $test -f /mach_boot; then
6472 nm_opt='' # Mach
6473 elif $test -d /usr/ccs/lib; then
6474 nm_opt='-p' # Solaris (and SunOS?)
6475 elif $test -f /dgux; then
6476 nm_opt='-p' # DG-UX
6477 elif $test -f /lib64/rld; then
6478 nm_opt='-p' # 64-bit Irix
6479 else
6480 nm_opt=''
6481 fi;;
6482esac
6483
6484: nm options which may be necessary for shared libraries but illegal
6485: for archive libraries. Thank you, Linux.
6486case "$nm_so_opt" in
6487'') case "$myuname" in
6488 *linux*|gnu*)
6489 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6490 nm_so_opt='--dynamic'
6491 fi
6492 ;;
6493 esac
6494 ;;
6495esac
6496
6497: Figure out where the libc is located
6498case "$runnm" in
6499true)
6500: get list of predefined functions in a handy place
6501echo " "
6502case "$libc" in
6503'') libc=unknown
6504 case "$libs" in
6505 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6506 esac
6507 ;;
6508esac
6509case "$libs" in
6510'') ;;
6511*) for thislib in $libs; do
6512 case "$thislib" in
6513 -lc|-lc_s)
6514 : Handle C library specially below.
6515 ;;
6516 -l*)
6517 thislib=`echo $thislib | $sed -e 's/^-l//'`
6518 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6519 :
6520 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6521 :
6522 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6523 :
6524 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6525 :
6526 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6527 :
6528 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6529 :
6530 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6531 :
6532 else
6533 try=''
6534 fi
6535 libnames="$libnames $try"
6536 ;;
6537 *) libnames="$libnames $thislib" ;;
6538 esac
6539 done
6540 ;;
6541esac
6542xxx=normal
6543case "$libc" in
6544unknown)
6545 set /lib/libc.$so
6546 for xxx in $libpth; do
6547 $test -r $1 || set $xxx/libc.$so
6548 : The messy sed command sorts on library version numbers.
6549 $test -r $1 || \
6550 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6551 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6552 h
6553 s/[0-9][0-9]*/0000&/g
6554 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6555 G
6556 s/\n/ /' | \
6557 $sort | $sed -e 's/^.* //'`
6558 eval set \$$#
6559 done
6560 $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6561 $test -r $1 || set $sysroot/lib/libsys_s$_a
6562 ;;
6563*)
6564 set blurfl
6565 ;;
6566esac
6567if $test -r "$1"; then
6568 echo "Your (shared) C library seems to be in $1."
6569 libc="$1"
6570elif $test -r /lib/libc && $test -r /lib/clib; then
6571 echo "Your C library seems to be in both /lib/clib and /lib/libc."
6572 xxx=apollo
6573 libc='/lib/clib /lib/libc'
6574 if $test -r /lib/syslib; then
6575 echo "(Your math library is in /lib/syslib.)"
6576 libc="$libc /lib/syslib"
6577 fi
6578elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6579 echo "Your C library seems to be in $libc, as you said before."
6580elif $test -r $incpath/usr/lib/libc$_a; then
6581 libc=$incpath/usr/lib/libc$_a;
6582 echo "Your C library seems to be in $libc. That's fine."
6583elif $test -r /lib/libc$_a; then
6584 libc=/lib/libc$_a;
6585 echo "Your C library seems to be in $libc. You're normal."
6586else
6587 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6588 :
6589 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6590 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6591 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6592 :
6593 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6594 :
6595 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6596 :
6597 else
6598 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6599 fi
6600 if $test -r "$tans"; then
6601 echo "Your C library seems to be in $tans, of all places."
6602 libc=$tans
6603 else
6604 libc='blurfl'
6605 fi
6606fi
6607if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6608 dflt="$libc"
6609 cat <<EOM
6610
6611If the guess above is wrong (which it might be if you're using a strange
6612compiler, or your machine supports multiple models), you can override it here.
6613
6614EOM
6615else
6616 dflt=''
6617 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6618 cat >&4 <<EOM
6619I can't seem to find your C library. I've looked in the following places:
6620
6621EOM
6622 $sed 's/^/ /' libpath
6623 cat <<EOM
6624
6625None of these seems to contain your C library. I need to get its name...
6626
6627EOM
6628fi
6629fn=f
6630rp='Where is your C library?'
6631. ./getfile
6632libc="$ans"
6633
6634echo " "
6635echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6636set X `cat libnames`
6637shift
6638xxx=files
6639case $# in 1) xxx=file; esac
6640echo "Extracting names from the following $xxx for later perusal:" >&4
6641echo " "
6642$sed 's/^/ /' libnames >&4
6643echo " "
6644$echo $n "This may take a while...$c" >&4
6645
6646for file in $*; do
6647 case $file in
6648 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6649 *) $nm $nm_opt $file 2>/dev/null;;
6650 esac
6651done >libc.tmp
6652
6653$echo $n ".$c"
6654$grep fprintf libc.tmp > libc.ptf
6655xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6656xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6657xxx='[ADTSIWi]'
6658if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
6659 eval $xscan;\
6660 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6661 eval $xrun
6662elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6663 eval $xscan;\
6664 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6665 eval $xrun
6666elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6667 eval $xscan;\
6668 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6669 eval $xrun
6670elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6671 eval $xscan;\
6672 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6673 eval $xrun
6674elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6675 eval $xscan;\
6676 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6677 eval $xrun
6678elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6679 eval $xscan;\
6680 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6681 eval $xrun
6682elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6683 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
6684 eval $xscan;\
6685 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6686 eval $xrun
6687elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6688 eval $xscan;\
6689 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6690 eval $xrun
6691elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6692 eval $xscan;\
6693 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6694 eval $xrun
6695elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6696 eval $xscan;\
6697 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6698 eval $xrun
6699elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6700 eval $xscan;\
6701 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6702 eval $xrun
6703elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6704 eval $xscan;\
6705 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6706 eval $xrun
6707elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6708 eval $xscan;\
6709 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6710 eval $xrun
6711elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
6712 eval $xscan;\
6713 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6714 eval $xrun
6715else
6716 $nm -p $* 2>/dev/null >libc.tmp
6717 $grep fprintf libc.tmp > libc.ptf
6718 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6719 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6720 then
6721 nm_opt='-p'
6722 eval $xrun
6723 else
6724 echo " "
6725 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6726 com=''
6727 if $ar t $libc > libc.tmp && \
6728 $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6729 then
6730 for thisname in $libnames $libc; do
6731 $ar t $thisname >>libc.tmp
6732 done
6733 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6734 echo "Ok." >&4
6735 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6736 for thisname in $libnames $libc; do
6737 $ar tv $thisname >>libc.tmp
6738 emximp -o tmp.imp $thisname \
6739 2>/dev/null && \
6740 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6741 < tmp.imp >>libc.tmp
6742 $rm -f tmp.imp
6743 done
6744 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6745 echo "Ok." >&4
6746 else
6747 echo "$ar didn't seem to work right." >&4
6748 echo "Maybe this is a Cray...trying bld instead..." >&4
6749 if bld t $libc | \
6750 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6751 $test -s libc.list
6752 then
6753 for thisname in $libnames; do
6754 bld t $libnames | \
6755 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6756 $ar t $thisname >>libc.tmp
6757 done
6758 echo "Ok." >&4
6759 else
6760 echo "That didn't work either. Giving up." >&4
6761 exit 1
6762 fi
6763 fi
6764 fi
6765fi
6766nm_extract="$com"
6767case "$PASE" in
6768define)
6769 echo " "
6770 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6771 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6772 ;;
6773*) if $test -f /lib/syscalls.exp; then
6774 echo " "
6775 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6776 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \
6777 /lib/syscalls.exp >>libc.list
6778 fi
6779 ;;
6780esac
6781;;
6782esac
6783$rm -f libnames libpath
6784
6785: Check if we are using C++
6786echo " "
6787echo "Checking for C++..." >&4
6788$cat >try.c <<'EOCP'
6789#include <stdio.h>
6790int main(void)
6791{
6792#ifdef __cplusplus
6793 return 0;
6794#else
6795 return 1;
6796#endif
6797}
6798EOCP
6799set try
6800if eval $compile_ok && $run ./try; then
6801 val="$define"
6802 echo "You are using a C++ compiler."
6803else
6804 val="$undef"
6805 echo "You are not using a C++ compiler."
6806fi
6807$rm_try cplusplus$$
6808set d_cplusplus
6809eval $setvar
6810
6811: is a C symbol defined?
6812csym='tlook=$1;
6813case "$3" in
6814-v) tf=libc.tmp; tdc="";;
6815-a) tf=libc.tmp; tdc="[]";;
6816*) tlook="^$1\$"; tf=libc.list; tdc="()";;
6817esac;
6818case "$d_cplusplus" in
6819 $define) extern_C="extern \"C\"" ;;
6820 *) extern_C="extern" ;;
6821esac;
6822tx=yes;
6823case "$reuseval-$4" in
6824true-) ;;
6825true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6826esac;
6827case "$tx" in
6828yes)
6829 tval=false;
6830 if $test "$runnm" = true; then
6831 if $contains $tlook $tf >/dev/null 2>&1; then
6832 tval=true;
6833 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6834 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;
6835 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6836 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6837 $rm_try;
6838 fi;
6839 else
6840 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;
6841 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6842 $rm_try;
6843 fi;
6844 ;;
6845*)
6846 case "$tval" in
6847 $define) tval=true;;
6848 *) tval=false;;
6849 esac;
6850 ;;
6851esac;
6852eval "$2=$tval"'
6853
6854: define an is-in-libc? function
6855inlibc='echo " "; td=$define; tu=$undef;
6856sym=$1; var=$2; eval "was=\$$2";
6857tx=yes;
6858case "$reuseval$was" in
6859true) ;;
6860true*) tx=no;;
6861esac;
6862case "$tx" in
6863yes)
6864 set $sym tres -f;
6865 eval $csym;
6866 case "$tres" in
6867 true)
6868 echo "$sym() found." >&4;
6869 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6870 *)
6871 echo "$sym() NOT found." >&4;
6872 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6873 esac;;
6874*)
6875 case "$was" in
6876 $define) echo "$sym() found." >&4;;
6877 *) echo "$sym() NOT found." >&4;;
6878 esac;;
6879esac'
6880
6881: check for length of double
6882echo " "
6883case "$doublesize" in
6884'')
6885 echo "Checking to see how big your double precision numbers are..." >&4
6886 $cat >try.c <<EOCP
6887#include <stdio.h>
6888#$i_stdlib I_STDLIB
6889#ifdef I_STDLIB
6890#include <stdlib.h>
6891#endif
6892int main()
6893{
6894 printf("%d\n", (int)sizeof(double));
6895 exit(0);
6896}
6897EOCP
6898 set try
6899 if eval $compile_ok; then
6900 doublesize=`$run ./try`
6901 echo "Your double is $doublesize bytes long."
6902 else
6903 dflt='8'
6904 echo "(I can't seem to compile the test program. Guessing...)"
6905 rp="What is the size of a double precision number (in bytes)?"
6906 . ./myread
6907 doublesize="$ans"
6908 fi
6909 ;;
6910esac
6911$rm_try
6912
6913: check for long doubles
6914echo " "
6915echo "Checking to see if you have long double..." >&4
6916echo 'int main() { long double x = 7.0; }' > try.c
6917set try
6918if eval $compile; then
6919 val="$define"
6920 echo "You have long double."
6921else
6922 val="$undef"
6923 echo "You do not have long double."
6924fi
6925$rm_try
6926set d_longdbl
6927eval $setvar
6928
6929: see if ldexpl exists
6930set ldexpl d_ldexpl
6931eval $inlibc
6932
6933: check for length of long double
6934case "${d_longdbl}${longdblsize}" in
6935$define)
6936 echo " "
6937 echo "Checking to see how big your long doubles are..." >&4
6938 $cat >try.c <<'EOCP'
6939#include <stdio.h>
6940int main()
6941{
6942 printf("%d\n", sizeof(long double));
6943}
6944EOCP
6945 set try
6946 set try
6947 if eval $compile; then
6948 longdblsize=`$run ./try`
6949 echo "Your long doubles are $longdblsize bytes long."
6950 else
6951 dflt='8'
6952 echo " "
6953 echo "(I can't seem to compile the test program. Guessing...)" >&4
6954 rp="What is the size of a long double (in bytes)?"
6955 . ./myread
6956 longdblsize="$ans"
6957 fi
6958 if $test "X$doublesize" = "X$longdblsize"; then
6959 echo "That isn't any different from an ordinary double."
6960 echo "I'll keep your setting anyway, but you may see some"
6961 echo "harmless compilation warnings."
6962 fi
6963 ;;
6964esac
6965$rm_try
6966
6967$echo "Checking the kind of long doubles you have..." >&4
6968case "$d_longdbl" in
6969define)
6970$cat <<EOP >try.c
6971#$i_stdlib I_STDLIB
6972#define LONGDBLSIZE $longdblsize
6973#define DOUBLESIZE $doublesize
6974#include <float.h>
6975#ifdef I_STDLIB
6976#include <stdlib.h>
6977#endif
6978#include <stdio.h>
6979static const long double d = -0.1L;
6980int main() {
6981 unsigned const char* b = (unsigned const char*)(&d);
6982#if DOUBLESIZE == LONGDBLSIZE
6983 printf("0\n"); /* if it floats like double */
6984 exit(0);
6985#endif
6986#if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6987 if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6988 /* IEEE 754 128-bit little-endian */
6989 printf("1\n");
6990 exit(0);
6991 }
6992 if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6993 /* IEEE 128-bit big-endian, e.g. solaris sparc */
6994 printf("2\n");
6995 exit(0);
6996 }
6997#endif
6998/* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6999 * while 64-bits platforms have it in 16 bytes. The trailing bytes
7000 * cannot be trusted. */
7001#if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
7002 if (b[0] == 0xCD && b[9] == 0xBF) {
7003 /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
7004 * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
7005 * Also known as "extended precision". */
7006 printf("3\n");
7007 exit(0);
7008 }
7009 if (b[0] == 0xBF && b[9] == 0xCD) {
7010 /* Is there ever big-endian 80-bit, really?
7011 *
7012 * The Motorola 68881 had another "extended precision" format:
7013 * sign:1 exp:15 zero:16 integer:1 mantissa:63
7014 * for total of 96 bits of bytes. The zero bits were unused.
7015 * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7016 * If it ever becomes relevant, this format should be allocated
7017 * a new doublekind code since it's quite different from the Intel x87.
7018 */
7019 printf("4\n");
7020 exit(0);
7021 }
7022#endif
7023#if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7024 /* software "double double", the 106 is 53+53.
7025 * but irix thinks it is 107. */
7026 if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7027 /* double double 128-bit fully little-endian,
7028 * little-endian doubles in little-endian order,
7029 * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7030 printf("5\n");
7031 exit(0);
7032 }
7033 if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7034 /* double double 128-bit fully big-endian,
7035 * big-endian doubles in big-endian order,
7036 * e.g. PPC/Power and MIPS:
7037 * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7038 printf("6\n");
7039 exit(0);
7040 }
7041 if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7042 /* double double 128-bit mixed endian.
7043 * little-endian doubles in big-endian order,
7044 * e.g. ppc64el,
7045 * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7046 printf("7\n");
7047 exit(0);
7048 }
7049 if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7050 /* double double 128-bit mixed endian,
7051 * big-endian doubles in little-endian order,
7052 * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7053 printf("8\n");
7054 exit(0);
7055 }
7056#endif
7057/* We are largely making this up because it may well be
7058 * that the VAX format H was never made available to C,
7059 * only to Fortran. */
7060#if LONGDBLSIZE == 16 && defined(__vax__)
7061 if (b[0] == 0xFD && b[15] == 0x99) {
7062 /* VAX format H, PDP-11 mixed endian. */
7063 printf("9\n");
7064 exit(0);
7065 }
7066#endif
7067 printf("-1\n"); /* unknown */
7068 exit(0);
7069}
7070EOP
7071set try
7072if eval $compile; then
7073 longdblkind=`$run ./try`
7074else
7075 longdblkind=-1
7076fi
7077;;
7078*) longdblkind=0 ;;
7079esac
7080case "$longdblkind" in
70810) echo "Your long doubles are doubles." >&4 ;;
70821) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
70832) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
70843) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
70854) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
70865) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
70876) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
70887) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
70898) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
70909) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7091*) echo "Cannot figure out your long double." >&4 ;;
7092esac
7093d_long_double_style_ieee=$undef
7094d_long_double_style_ieee_std=$undef
7095d_long_double_style_ieee_extended=$undef
7096d_long_double_style_ieee_doubledouble=$undef
7097d_long_double_style_vax=$undef
7098case "$longdblkind" in
70991|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7100esac
7101case "$longdblkind" in
71021|2) d_long_double_style_ieee_std=$define ;;
7103esac
7104case "$longdblkind" in
71053|4) d_long_double_style_ieee_extended=$define ;;
7106esac
7107case "$longdblkind" in
71085|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7109esac
7110case "$longdblkind" in
71119) d_long_double_style_vax=$define ;;
7112esac
7113$rm_try
7114
7115: determine the architecture name
7116echo " "
7117if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7118 tarch=`arch`"-$osname"
7119elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7120 if uname -m > tmparch 2>&1 ; then
7121 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7122 -e 's/$/'"-$osname/" tmparch`
7123 else
7124 tarch="$osname"
7125 fi
7126 $rm -f tmparch
7127else
7128 tarch="$osname"
7129fi
7130case "$myarchname" in
7131''|"$tarch") ;;
7132*)
7133 echo "(Your architecture name used to be $myarchname.)"
7134 archname=''
7135 ;;
7136esac
7137case "$targetarch" in
7138'') ;;
7139*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7140esac
7141myarchname="$tarch"
7142case "$archname" in
7143'') dflt="$tarch";;
7144*) dflt="$archname";;
7145esac
7146rp='What is your architecture name'
7147. ./myread
7148archname="$ans"
7149
7150: optionally add API version to the architecture for versioned archlibs
7151case "$useversionedarchname" in
7152$define|true|[yY]*) dflt='y';;
7153*) dflt='n';;
7154esac
7155rp='Add the Perl API version to your archname?'
7156. ./myread
7157case "$ans" in
7158y|Y) useversionedarchname="$define" ;;
7159*) useversionedarchname="$undef" ;;
7160esac
7161case "$useversionedarchname" in
7162$define)
7163 case "$archname" in
7164 *-$api_versionstring)
7165 echo "...and architecture name already has -$api_versionstring" >&4
7166 ;;
7167 *)
7168 archname="$archname-$api_versionstring"
7169 echo "...setting architecture name to $archname." >&4
7170 ;;
7171 esac
7172 ;;
7173esac
7174
7175case "$usethreads" in
7176$define)
7177 echo "Threads selected." >&4
7178 case "$archname" in
7179 *-thread*) echo "...and architecture name already has -thread." >&4
7180 ;;
7181 *) archname="$archname-thread"
7182 echo "...setting architecture name to $archname." >&4
7183 ;;
7184 esac
7185 ;;
7186esac
7187case "$usemultiplicity" in
7188$define)
7189 echo "Multiplicity selected." >&4
7190 case "$archname" in
7191 *-multi*) echo "...and architecture name already has -multi." >&4
7192 ;;
7193 *) archname="$archname-multi"
7194 echo "...setting architecture name to $archname." >&4
7195 ;;
7196 esac
7197 ;;
7198esac
7199case "$use64bitint$use64bitall" in
7200*"$define"*)
7201 case "$archname64" in
7202 '')
7203 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7204 ;;
7205 *)
7206 case "$use64bitint" in
7207 "$define") echo "64 bit integers selected." >&4 ;;
7208 esac
7209 case "$use64bitall" in
7210 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7211 esac
7212 case "$archname" in
7213 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7214 ;;
7215 *) archname="$archname-$archname64"
7216 echo "...setting architecture name to $archname." >&4
7217 ;;
7218 esac
7219 ;;
7220 esac
7221esac
7222case "$uselongdouble" in
7223$define)
7224 echo "Long doubles selected." >&4
7225 case "$longdblsize" in
7226 $doublesize)
7227 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7228 ;;
7229 *)
7230 case "$archname" in
7231 *-ld*) echo "...and architecture name already has -ld." >&4
7232 ;;
7233 *) archname="$archname-ld"
7234 echo "...setting architecture name to $archname." >&4
7235 ;;
7236 esac
7237 ;;
7238 esac
7239 ;;
7240esac
7241case "$usequadmath" in
7242$define)
7243 echo "quadmath selected." >&4
7244 case "$archname" in
7245 *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7246 ;;
7247 *) archname="$archname-quadmath"
7248 echo "...setting architecture name to $archname." >&4
7249 ;;
7250 esac
7251 ;;
7252esac
7253if $test -f archname.cbu; then
7254 echo "Your platform has some specific hints for architecture name, using them..."
7255 . ./archname.cbu
7256fi
7257
7258: set the prefixit variable, to compute a suitable default value
7259prefixit='case "$3" in
7260""|none)
7261 case "$oldprefix" in
7262 "") eval "$1=\"\$$2\"";;
7263 *)
7264 case "$3" in
7265 "") eval "$1=";;
7266 none)
7267 eval "tp=\"\$$2\"";
7268 case "$tp" in
7269 ""|" "|none) eval "$1=\"\$$2\"";;
7270 *) eval "$1=";;
7271 esac;;
7272 esac;;
7273 esac;;
7274*)
7275 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7276 case "$tp" in
7277 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7278 /*-$oldprefix/*|\~*-$oldprefix/*)
7279 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7280 *) eval "$1=\"\$$2\"";;
7281 esac;;
7282esac'
7283
7284: determine installation style
7285: For now, try to deduce it from prefix unless it is already set.
7286: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7287case "$installstyle" in
7288'') case "$prefix" in
7289 *perl*) dflt='lib';;
7290 *) dflt='lib/perl5' ;;
7291 esac
7292 ;;
7293*) dflt="$installstyle" ;;
7294esac
7295: Probably not worth prompting for this since we prompt for all
7296: the directories individually, and the prompt would be too long and
7297: confusing anyway.
7298installstyle=$dflt
7299
7300: determine where public executables go
7301echo " "
7302set dflt bin bin
7303eval $prefixit
7304fn=d~
7305rp='Pathname where the public executables will reside?'
7306. ./getfile
7307if $test "X$ansexp" != "X$binexp"; then
7308 installbin=''
7309fi
7310prefixvar=bin
7311: XXX Bug? -- ignores Configure -Dinstallprefix setting.
7312: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7313: this via initialinstalllocation
7314. ./setprefixvar
7315
7316case "$userelocatableinc" in
7317$define|true|[yY]*) dflt='y' ;;
7318*) dflt='n' ;;
7319esac
7320cat <<EOM
7321
7322Would you like to build Perl so that the installation is relocatable, so that
7323library paths in @INC are determined relative to the path of the perl binary?
7324This is not advised for system Perl installs, or if you need to run setid
7325scripts or scripts under taint mode.
7326
7327If this doesn't make any sense to you, just accept the default '$dflt'.
7328EOM
7329rp='Use relocatable @INC?'
7330. ./myread
7331case "$ans" in
7332y|Y) val="$define" ;;
7333*) val="$undef" ;;
7334esac
7335set userelocatableinc
7336eval $setvar
7337
7338initialinstalllocation="$binexp"
7339: Default prefix is now "up one level from where the binaries are"
7340case "$userelocatableinc" in
7341$define|true|[yY]*)
7342 bin=".../"
7343 binexp=".../"
7344 prefix=".../.."
7345 prefixexp=".../.."
7346 installprefixexp=".../.."
7347 ;;
7348esac
7349
7350: determine where private library files go
7351: Usual default is /usr/local/lib/perl5/$version.
7352: Also allow things like /opt/perl/lib/$version, since
7353: /opt/perl/lib/perl5... would be redundant.
7354: The default "style" setting is made in installstyle.U
7355case "$installstyle" in
7356*lib/perl5*) set dflt privlib lib/$package/$version ;;
7357*) set dflt privlib lib/$version ;;
7358esac
7359eval $prefixit
7360$cat <<EOM
7361
7362There are some auxiliary files for $package that need to be put into a
7363private library directory that is accessible by everyone.
7364
7365EOM
7366fn=$binexp
7367fn=d~+
7368rp='Pathname where the private library files will reside?'
7369. ./getfile
7370prefixvar=privlib
7371. ./setprefixvar
7372
7373: set the prefixup variable, to restore leading tilda escape
7374prefixup='case "$prefixexp" in
7375"$prefix") ;;
7376*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7377esac'
7378
7379: determine where public architecture dependent libraries go
7380set archlib archlib
7381eval $prefixit
7382: privlib default is /usr/local/lib/$package/$version
7383: archlib default is /usr/local/lib/$package/$version/$archname
7384: privlib may have an optional trailing /share.
7385tdflt=`echo $privlib | $sed 's,/share$,,'`
7386tdflt=$tdflt/$archname
7387case "$archlib" in
7388'') dflt=$tdflt
7389 ;;
7390*) dflt="$archlib"
7391 ;;
7392esac
7393$cat <<EOM
7394
7395$spackage contains architecture-dependent library files. If you are
7396sharing libraries in a heterogeneous environment, you might store
7397these files in a separate location. Otherwise, you can just include
7398them with the rest of the public library files.
7399
7400EOM
7401fn=$binexp
7402fn=d+~
7403rp='Where do you want to put the public architecture-dependent libraries?'
7404. ./getfile
7405prefixvar=archlib
7406. ./setprefixvar
7407if $test X"$archlib" = X"$privlib"; then
7408 d_archlib="$undef"
7409else
7410 d_archlib="$define"
7411fi
7412
7413: see if setuid scripts can be secure
7414$cat <<EOM
7415
7416Some kernels have a bug that prevents setuid #! scripts from being
7417secure. Some sites have disabled setuid #! scripts because of this.
7418
7419First let's decide if your kernel supports secure setuid #! scripts.
7420(If setuid #! scripts would be secure but have been disabled anyway,
7421don't say that they are secure if asked.)
7422
7423EOM
7424
7425val="$undef"
7426if $test -d /dev/fd; then
7427 echo "#!$ls" >reflect
7428 chmod +x,u+s reflect
7429 ./reflect >flect 2>&1
7430 if $contains "/dev/fd" flect >/dev/null; then
7431 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7432 val="$define"
7433 else
7434 $cat <<EOM
7435If you are not sure if they are secure, I can check but I'll need a
7436username and password different from the one you are using right now.
7437If you don't have such a username or don't want me to test, simply
7438enter 'none'.
7439
7440EOM
7441 rp='Other username to test security of setuid scripts with?'
7442 dflt='none'
7443 . ./myread
7444 case "$ans" in
7445 n|none)
7446 case "$d_suidsafe" in
7447 '') echo "I'll assume setuid scripts are *not* secure." >&4
7448 dflt=n;;
7449 "$undef")
7450 echo "Well, the $hint value is *not* secure." >&4
7451 dflt=n;;
7452 *) echo "Well, the $hint value *is* secure." >&4
7453 dflt=y;;
7454 esac
7455 ;;
7456 *)
7457 $rm -f reflect flect
7458 echo "#!$ls" >reflect
7459 chmod +x,u+s reflect
7460 echo >flect
7461 chmod a+w flect
7462 echo '"su" will (probably) prompt you for '"$ans's password."
7463 su $ans -c './reflect >flect'
7464 if $contains "/dev/fd" flect >/dev/null; then
7465 echo "Okay, it looks like setuid scripts are secure." >&4
7466 dflt=y
7467 else
7468 echo "I don't think setuid scripts are secure." >&4
7469 dflt=n
7470 fi
7471 ;;
7472 esac
7473 rp='Does your kernel have *secure* setuid scripts?'
7474 . ./myread
7475 case "$ans" in
7476 [yY]*) val="$define";;
7477 *) val="$undef";;
7478 esac
7479 fi
7480else
7481 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7482 echo "(That's for file descriptors, not floppy disks.)"
7483 val="$undef"
7484fi
7485set d_suidsafe
7486eval $setvar
7487
7488$rm -f reflect flect
7489
7490: now see if they want to do setuid emulation
7491if $test $patchlevel -lt 11; then
7492echo " "
7493val="$undef"
7494case "$d_suidsafe" in
7495"$define")
7496 val="$undef"
7497 echo "No need to emulate SUID scripts since they are secure here." >&4
7498 ;;
7499*)
7500 $cat <<EOM
7501Some systems have disabled setuid scripts, especially systems where
7502setuid scripts cannot be secure. On systems where setuid scripts have
7503been disabled, the setuid/setgid bits on scripts are currently
7504useless. It is possible for $package to detect those bits and emulate
7505setuid/setgid in a secure fashion. This emulation will only work if
7506setuid scripts have been disabled in your kernel.
7507
7508EOM
7509 case "$d_dosuid" in
7510 "$define") dflt=y ;;
7511 *) dflt=n ;;
7512 esac
7513 rp="Do you want to do setuid/setgid emulation?"
7514 . ./myread
7515 case "$ans" in
7516 [yY]*) val="$define";;
7517 *) val="$undef";;
7518 esac
7519 ;;
7520esac
7521set d_dosuid
7522eval $setvar
7523else
7524 case "$d_dosuid" in
7525 "$define")
7526 cat >&4 <<EOH
7527
7528SUID emulation has been removed for 5.12
7529Please re-run Configure without -Dd_dosuid
7530
7531EOH
7532 exit 1;
7533 ;;
7534 esac
7535 d_dosuid=undef
7536fi
7537
7538: Find perl5.005 or later.
7539echo "Looking for a previously installed perl5.005 or later... "
7540case "$perl5" in
7541'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7542 : Check if this perl is recent and can load a simple module
7543 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7544 perl5=$tdir/perl
7545 break;
7546 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7547 perl5=$tdir/perl5
7548 break;
7549 fi
7550 done
7551 ;;
7552*) perl5="$perl5"
7553 ;;
7554esac
7555case "$perl5" in
7556'') echo "None found. That's ok.";;
7557*) echo "Using $perl5." ;;
7558esac
7559
7560: Set the siteprefix variables
7561$cat <<EOM
7562
7563After $package is installed, you may wish to install various
7564add-on modules and utilities. Typically, these add-ons will
7565be installed under $prefix with the rest
7566of this package. However, you may wish to install such add-ons
7567elsewhere under a different prefix.
7568
7569If you do not wish to put everything under a single prefix, that's
7570ok. You will be prompted for the individual locations; this siteprefix
7571is only used to suggest the defaults.
7572
7573The default should be fine for most people.
7574
7575EOM
7576fn=d~+
7577rp='Installation prefix to use for add-on modules and utilities?'
7578: XXX Here might be another good place for an installstyle setting.
7579case "$siteprefix" in
7580'') dflt=$prefix ;;
7581*) dflt=$siteprefix ;;
7582esac
7583. ./getfile
7584: XXX Prefixit unit does not yet support siteprefix and vendorprefix
7585oldsiteprefix=''
7586case "$siteprefix" in
7587'') ;;
7588*) case "$ans" in
7589 "$prefix") ;;
7590 *) oldsiteprefix="$prefix";;
7591 esac
7592 ;;
7593esac
7594siteprefix="$ans"
7595siteprefixexp="$ansexp"
7596
7597: determine where site specific libraries go.
7598: Usual default is /usr/local/lib/perl5/site_perl/$version
7599: The default "style" setting is made in installstyle.U
7600: XXX No longer works with Prefixit stuff.
7601prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7602case "$sitelib" in
7603'') case "$installstyle" in
7604 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7605 *) dflt=$siteprefix/lib/site_$prog/$version ;;
7606 esac
7607 ;;
7608*) dflt="$sitelib"
7609 ;;
7610esac
7611$cat <<EOM
7612
7613The installation process will create a directory for
7614site-specific extensions and modules. Most users find it convenient
7615to place all site-specific files in this directory rather than in the
7616main distribution directory.
7617
7618EOM
7619fn=d~+
7620rp='Pathname for the site-specific library files?'
7621. ./getfile
7622prefixvar=sitelib
7623. ./setprefixvar
7624sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7625
7626: Determine list of previous versions to include in @INC
7627$cat > getverlist <<EOPL
7628#!$perl5 -w
7629use File::Basename;
7630\$api_versionstring = "$api_versionstring";
7631\$version = "$version";
7632\$stem = "$sitelib_stem";
7633\$archname = "$archname";
7634EOPL
7635 $cat >> getverlist <<'EOPL'
7636# The list found is store twice for each entry: the original name, and
7637# the binary broken down version as pack "sss", so sorting is easy and
7638# unambiguous. This will work for all versions that have a maximum of
7639# three digit groups, separate by '.'s or '_'s. Names are extended with
7640# ".0.0" to ensure at least three elements for the pack.
7641# -- H.Merijn Brand (m)'06 23-10-2006
7642
7643# Can't have leading @ because metaconfig interprets it as a command!
7644;@inc_version_list=();
7645# XXX Redo to do opendir/readdir?
7646if (-d $stem) {
7647 chdir($stem);
7648 ;@candidates = map {
7649 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7650 ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7651}
7652else {
7653 ;@candidates = ();
7654}
7655
7656($pversion, $aversion, $vsn5005) = map {
7657 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7658foreach $d (@candidates) {
7659 if ($d->[1] lt $pversion) {
7660 if ($d->[1] ge $aversion) {
7661 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7662 }
7663 elsif ($d->[1] ge $vsn5005) {
7664 unshift(@inc_version_list, grep { -d } $d->[0]);
7665 }
7666 }
7667 else {
7668 # Skip newer version. I.e. don't look in
7669 # 5.7.0 if we're installing 5.6.1.
7670 }
7671}
7672
7673if (@inc_version_list) {
7674 print join(' ', @inc_version_list);
7675}
7676else {
7677 # Blank space to preserve value for next Configure run.
7678 print " ";
7679}
7680EOPL
7681chmod +x getverlist
7682case "$inc_version_list" in
7683'') if test -x "$perl5$exe_ext"; then
7684 dflt=`$perl5 getverlist`
7685 else
7686 dflt='none'
7687 fi
7688 ;;
7689$undef) dflt='none' ;;
7690*) eval dflt=\"$inc_version_list\" ;;
7691esac
7692case "$dflt" in
7693''|' ') dflt=none ;;
7694esac
7695case "$dflt" in
76965.005) dflt=none ;;
7697esac
7698$cat <<EOM
7699
7700In order to ease the process of upgrading, this version of perl
7701can be configured to use modules built and installed with earlier
7702versions of perl that were installed under $prefix. Specify here
7703the list of earlier versions that this version of perl should check.
7704If Configure detected no earlier versions of perl installed under
7705$prefix, then the list will be empty. Answer 'none' to tell perl
7706to not search earlier versions.
7707
7708The default should almost always be sensible, so if you're not sure,
7709just accept the default.
7710EOM
7711
7712rp='List of earlier versions to include in @INC?'
7713. ./myread
7714case "$ans" in
7715[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7716*) inc_version_list="$ans" ;;
7717esac
7718case "$inc_version_list" in
7719''|' ')
7720 inc_version_list_init='0'
7721 d_inc_version_list="$undef"
7722 ;;
7723*) inc_version_list_init=`echo $inc_version_list |
7724 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7725 d_inc_version_list="$define"
7726 ;;
7727esac
7728$rm -f getverlist
7729
7730: see if malloc/malloc.h has to be included
7731set malloc/malloc.h i_mallocmalloc
7732eval $inhdr
7733
7734: see if this is a malloc.h system
7735: we want a real compile instead of Inhdr because some systems have a
7736: malloc.h that just gives a compile error saying to use stdlib.h instead
7737echo " "
7738$cat >try.c <<EOCP
7739#include <stdlib.h>
7740#include <malloc.h>
7741#$i_mallocmalloc I_MALLOCMALLOC
7742#ifdef I_MALLOCMALLOC
7743# include <malloc/malloc.h>
7744#endif
7745
7746int main () { return 0; }
7747EOCP
7748set try
7749if eval $compile; then
7750 echo "<malloc.h> found." >&4
7751 val="$define"
7752else
7753 echo "<malloc.h> NOT found." >&4
7754 val="$undef"
7755fi
7756$rm_try
7757set i_malloc
7758eval $setvar
7759
7760: check for length of pointer
7761echo " "
7762case "$ptrsize" in
7763'')
7764 echo "Checking to see how big your pointers are..." >&4
7765 $cat >try.c <<EOCP
7766#include <stdio.h>
7767#$i_stdlib I_STDLIB
7768#ifdef I_STDLIB
7769#include <stdlib.h>
7770#endif
7771int main()
7772{
7773 printf("%d\n", (int)sizeof(void *));
7774 exit(0);
7775}
7776EOCP
7777 set try
7778 if eval $compile_ok; then
7779 ptrsize=`$run ./try`
7780 echo "Your pointers are $ptrsize bytes long."
7781 else
7782 dflt='4'
7783 echo "(I can't seem to compile the test program. Guessing...)" >&4
7784 rp="What is the size of a pointer (in bytes)?"
7785 . ./myread
7786 ptrsize="$ans"
7787 fi
7788 ;;
7789esac
7790$rm_try
7791case "$use64bitall" in
7792"$define"|true|[yY]*)
7793 case "$ptrsize" in
7794 4) cat <<EOM >&4
7795
7796*** You have chosen a maximally 64-bit build,
7797*** but your pointers are only 4 bytes wide.
7798*** Please rerun Configure without -Duse64bitall.
7799EOM
7800 case "$d_quad" in
7801 define)
7802 cat <<EOM >&4
7803*** Since you have quads, you could possibly try with -Duse64bitint.
7804EOM
7805 ;;
7806 esac
7807 cat <<EOM >&4
7808*** Cannot continue, aborting.
7809
7810EOM
7811
7812 exit 1
7813 ;;
7814 esac
7815 ;;
7816esac
7817
7818: determine whether to use malloc wrapping
7819echo " "
7820case "$usemallocwrap" in
7821[yY]*|true|$define) dflt='y' ;;
7822[nN]*|false|$undef) dflt='n' ;;
7823*) case "$usedevel" in
7824 [yY]*|true|$define) dflt='y' ;;
7825 *) dflt='n' ;;
7826 esac
7827 ;;
7828esac
7829rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7830. ./myread
7831usemallocwrap="$ans"
7832case "$ans" in
7833y*|true)
7834 usemallocwrap="$define" ;;
7835*)
7836 usemallocwrap="$undef" ;;
7837esac
7838
7839: determine which malloc to compile in
7840echo " "
7841case "$usemymalloc" in
7842[yY]*|true|$define) dflt='y' ;;
7843[nN]*|false|$undef) dflt='n' ;;
7844*) case "$ptrsize" in
7845 4) dflt='y' ;;
7846 *) dflt='n' ;;
7847 esac
7848 if test "$useithreads" = "$define"; then dflt='n'; fi
7849 ;;
7850esac
7851rp="Do you wish to attempt to use the malloc that comes with $package?"
7852. ./myread
7853usemymalloc="$ans"
7854case "$ans" in
7855y*|true)
7856 usemymalloc='y'
7857 mallocsrc='malloc.c'
7858 mallocobj="malloc$_o"
7859 d_mymalloc="$define"
7860 case "$libs" in
7861 *-lmalloc*)
7862 : Remove malloc from list of libraries to use
7863 echo "Removing unneeded -lmalloc from library list" >&4
7864 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7865 shift
7866 libs="$*"
7867 echo "libs = $libs" >&4
7868 ;;
7869 esac
7870 ;;
7871*)
7872 usemymalloc='n'
7873 mallocsrc=''
7874 mallocobj=''
7875 d_mymalloc="$undef"
7876 ;;
7877esac
7878
7879: compute the return types of malloc and free
7880echo " "
7881$cat >malloc.c <<END
7882#$i_malloc I_MALLOC
7883#$i_stdlib I_STDLIB
7884#include <stdio.h>
7885#include <sys/types.h>
7886#ifdef I_MALLOC
7887#include <malloc.h>
7888#endif
7889#ifdef I_STDLIB
7890#include <stdlib.h>
7891#endif
7892#ifdef TRY_MALLOC
7893void *malloc();
7894#endif
7895#ifdef TRY_FREE
7896void free();
7897#endif
7898END
7899case "$malloctype" in
7900'')
7901 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7902 malloctype='void *'
7903 else
7904 malloctype='char *'
7905 fi
7906 ;;
7907esac
7908echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7909
7910case "$freetype" in
7911'')
7912 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7913 freetype='void'
7914 else
7915 freetype='int'
7916 fi
7917 ;;
7918esac
7919echo "Your system uses $freetype free(), it would seem." >&4
7920$rm -f malloc.[co]
7921: determine where site specific architecture-dependent libraries go.
7922: sitelib default is /usr/local/lib/perl5/site_perl/$version
7923: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7924: sitelib may have an optional trailing /share.
7925case "$sitearch" in
7926'') dflt=`echo $sitelib | $sed 's,/share$,,'`
7927 dflt="$dflt/$archname"
7928 ;;
7929*) dflt="$sitearch"
7930 ;;
7931esac
7932set sitearch sitearch none
7933eval $prefixit
7934$cat <<EOM
7935
7936The installation process will also create a directory for
7937architecture-dependent site-specific extensions and modules.
7938
7939EOM
7940fn=d~+
7941rp='Pathname for the site-specific architecture-dependent library files?'
7942. ./getfile
7943prefixvar=sitearch
7944. ./setprefixvar
7945if $test X"$sitearch" = X"$sitelib"; then
7946 d_sitearch="$undef"
7947else
7948 d_sitearch="$define"
7949fi
7950
7951: Set the vendorprefix variables
7952$cat <<EOM
7953
7954The installation process will also create a directory for
7955vendor-supplied add-ons. Vendors who supply perl with their system
7956may find it convenient to place all vendor-supplied files in this
7957directory rather than in the main distribution directory. This will
7958ease upgrades between binary-compatible maintenance versions of perl.
7959
7960Of course you may also use these directories in whatever way you see
7961fit. For example, you might use them to access modules shared over a
7962company-wide network.
7963
7964The default answer should be fine for most people.
7965This causes further questions about vendor add-ons to be skipped
7966and no vendor-specific directories will be configured for perl.
7967
7968EOM
7969rp='Do you want to configure vendor-specific add-on directories?'
7970case "$usevendorprefix" in
7971define|true|[yY]*) dflt=y ;;
7972*) : User may have set vendorprefix directly on Configure command line.
7973 case "$vendorprefix" in
7974 ''|' ') dflt=n ;;
7975 *) dflt=y ;;
7976 esac
7977 ;;
7978esac
7979. ./myread
7980case "$ans" in
7981[yY]*) fn=d~+
7982 rp='Installation prefix to use for vendor-supplied add-ons?'
7983 case "$vendorprefix" in
7984 '') dflt="$prefix" ;;
7985 *) dflt=$vendorprefix ;;
7986 esac
7987 . ./getfile
7988 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7989 oldvendorprefix=''
7990 case "$vendorprefix" in
7991 '') ;;
7992 *) case "$ans" in
7993 "$prefix") ;;
7994 *) oldvendorprefix="$prefix";;
7995 esac
7996 ;;
7997 esac
7998 usevendorprefix="$define"
7999 vendorprefix="$ans"
8000 vendorprefixexp="$ansexp"
8001 ;;
8002*) usevendorprefix="$undef"
8003 vendorprefix=''
8004 vendorprefixexp=''
8005 ;;
8006esac
8007
8008: Set the vendorlib variables
8009case "$vendorprefix" in
8010'') d_vendorlib="$undef"
8011 vendorlib=''
8012 vendorlibexp=''
8013 ;;
8014*) d_vendorlib="$define"
8015 : determine where vendor-supplied modules go.
8016 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8017 case "$vendorlib" in
8018 '')
8019 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8020 case "$installstyle" in
8021 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8022 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8023 esac
8024 ;;
8025 *) dflt="$vendorlib"
8026 ;;
8027 esac
8028 fn=d~+
8029 rp='Pathname for the vendor-supplied library files?'
8030 . ./getfile
8031 vendorlib="$ans"
8032 vendorlibexp="$ansexp"
8033 ;;
8034esac
8035vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8036prefixvar=vendorlib
8037. ./installprefix
8038
8039: Set the vendorarch variables
8040case "$vendorprefix" in
8041'') d_vendorarch="$undef"
8042 vendorarch=''
8043 vendorarchexp=''
8044 ;;
8045*) d_vendorarch="$define"
8046 : determine where vendor-supplied architecture-dependent libraries go.
8047 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
8048 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8049 : vendorlib may have an optional trailing /share.
8050 case "$vendorarch" in
8051 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
8052 dflt="$dflt/$archname"
8053 ;;
8054 *) dflt="$vendorarch" ;;
8055 esac
8056 fn=d~+
8057 rp='Pathname for vendor-supplied architecture-dependent files?'
8058 . ./getfile
8059 vendorarch="$ans"
8060 vendorarchexp="$ansexp"
8061 ;;
8062esac
8063prefixvar=vendorarch
8064. ./installprefix
8065if $test X"$vendorarch" = X"$vendorlib"; then
8066 d_vendorarch="$undef"
8067else
8068 d_vendorarch="$define"
8069fi
8070
8071: Final catch-all directories to search
8072$cat <<EOM
8073
8074Lastly, you can have perl look in other directories for extensions and
8075modules in addition to those already specified.
8076These directories will be searched after
8077 $sitearch
8078 $sitelib
8079EOM
8080test X"$vendorlib" != "X" && echo ' ' $vendorlib
8081test X"$vendorarch" != "X" && echo ' ' $vendorarch
8082echo ' '
8083case "$otherlibdirs" in
8084''|' ') dflt='none' ;;
8085*) dflt="$otherlibdirs" ;;
8086esac
8087$cat <<EOM
8088Enter a colon-separated set of extra paths to include in perl's @INC
8089search path, or enter 'none' for no extra paths.
8090
8091EOM
8092
8093rp='Colon-separated list of additional directories for perl to search?'
8094. ./myread
8095case "$ans" in
8096' '|''|none) otherlibdirs=' ' ;;
8097*) otherlibdirs="$ans" ;;
8098esac
8099case "$otherlibdirs" in
8100' ') val=$undef ;;
8101*) val=$define ;;
8102esac
8103set d_perl_otherlibdirs
8104eval $setvar
8105
8106: DTrace support
8107dflt_dtrace='/usr/sbin/dtrace'
8108$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8109
8110cat <<EOM
8111
8112Perl can be built to support DTrace on platforms that support it.
8113DTrace is a diagnosis and performance analysis tool from Sun.
8114
8115If this doesn't make any sense to you, just accept the default.
8116EOM
8117
8118while $test 1 ; do
8119 case "$usedtrace" in
8120 $define|true|[yY]*)
8121 dflt='y'
8122 ;;
8123 $undef|false|[nN]*)
8124 dflt='n'
8125 dflt_dtrace=""
8126 ;;
8127 ?*)
8128 dflt='y'
8129 dflt_dtrace=$usedtrace
8130 ;;
8131 *)
8132 dflt='n'
8133 ;;
8134 esac
8135
8136 rp='Support DTrace if available?'
8137 . ./myread
8138 case "$ans" in
8139 y|Y) val="$define" ;;
8140 *) val="$undef" ;;
8141 esac
8142 set usedtrace
8143 eval $setvar
8144
8145 test "X$usedtrace" != "X$define" && break
8146
8147 echo " "
8148 rp='Where is the dtrace executable?'
8149 dflt=$dflt_dtrace
8150 . ./getfile
8151 val="$ans"
8152 set dtrace
8153 eval $setvar
8154
8155 if $test -f $dtrace
8156 then
8157 if $dtrace -h -s ../perldtrace.d \
8158 -o perldtrace.tmp >/dev/null 2>&1 \
8159 && rm -f perldtrace.tmp
8160 then
8161 echo " "
8162 echo "Good: your $dtrace knows about the -h flag."
8163 else
8164 cat >&2 <<EOM
8165
8166*** $me: Fatal Error: $dtrace doesn't support -h flag
8167***
8168*** Your installed dtrace doesn't support the -h switch to compile a D
8169*** program into a C header. Can't continue.
8170
8171EOM
8172 exit 1
8173 fi
8174 break;
8175 fi
8176
8177 case "$fastread" in
8178 yes)
8179 cat >&2 <<EOM
8180
8181*** $me: Fatal Error: $dtrace not found.
8182*** Can't continue.
8183
8184EOM
8185 exit 1
8186 ;;
8187 *)
8188 echo "*** $dtrace was not found."
8189 echo " "
8190 ;;
8191 esac
8192done
8193
8194: See if we want extra modules installed
8195echo " "
8196case "$extras" in
8197'') dflt='n';;
8198*) dflt='y';;
8199esac
8200cat <<EOM
8201Perl can be built with extra modules or bundles of modules which
8202will be fetched from the CPAN and installed alongside Perl.
8203
8204Notice that you will need access to the CPAN; either via the Internet,
8205or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
8206be asked later to configure the CPAN.pm module which will in turn do
8207the installation of the rest of the extra modules or bundles.)
8208
8209Notice also that if the modules require any external software such as
8210libraries and headers (the libz library and the zlib.h header for the
8211Compress::Zlib module, for example) you MUST have any such software
8212already installed, this configuration process will NOT install such
8213things for you.
8214
8215If this doesn't make any sense to you, just accept the default '$dflt'.
8216EOM
8217rp='Install any extra modules (y or n)?'
8218. ./myread
8219case "$ans" in
8220y|Y)
8221 cat <<EOM
8222
8223Please list any extra modules or bundles to be installed from CPAN,
8224with spaces between the names. The names can be in any format the
8225'install' command of CPAN.pm will understand. (Answer 'none',
8226without the quotes, to install no extra modules or bundles.)
8227EOM
8228 rp='Extras?'
8229 dflt="$extras"
8230 . ./myread
8231 extras="$ans"
8232esac
8233case "$extras" in
8234''|'none')
8235 val=''
8236 $rm -f ../extras.lst
8237 ;;
8238*) echo "(Saving the list of extras for later...)"
8239 echo "$extras" > ../extras.lst
8240 val="'$extras'"
8241 ;;
8242esac
8243set extras
8244eval $setvar
8245echo " "
8246
8247: determine where html pages for programs go
8248set html1dir html1dir none
8249eval $prefixit
8250$cat <<EOM
8251
8252If you wish to install html files for programs in $spackage, indicate
8253the appropriate directory here. To skip installing html files,
8254answer "none".
8255EOM
8256case "$html1dir" in
8257''|none|$undef|' ') dflt=none ;;
8258*) dflt=$html1dir ;;
8259esac
8260fn=dn+~
8261rp="Directory for the main $spackage html pages?"
8262. ./getfile
8263prefixvar=html1dir
8264. ./setprefixvar
8265: Use ' ' for none so value is preserved next time through Configure
8266$test X"$html1dir" = "X" && html1dir=' '
8267
8268: determine where html pages for libraries and modules go
8269set html3dir html3dir none
8270eval $prefixit
8271$cat <<EOM
8272
8273If you wish to install html files for modules associated with $spackage,
8274indicate the appropriate directory here. To skip installing html files,
8275answer "none".
8276EOM
8277: There is no obvious default. If they have specified html1dir, then
8278: try to key off that, possibly changing .../html1 into .../html3.
8279case "$html3dir" in
8280'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8281*) dflt=$html3dir ;;
8282esac
8283fn=dn+~
8284rp="Directory for the $spackage module html pages?"
8285. ./getfile
8286prefixvar=html3dir
8287. ./setprefixvar
8288: Use ' ' for none so value is preserved next time through Configure
8289$test X"$html3dir" = "X" && html3dir=' '
8290
8291: determine whether to install perl also as /usr/bin/perl
8292
8293echo " "
8294if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8295 $cat <<EOM
8296Many scripts expect perl to be installed as /usr/bin/perl.
8297
8298If you want to, I can install the perl you are about to compile
8299as /usr/bin/perl (in addition to $bin/perl).
8300EOM
8301 if test -f /usr/bin/perl; then
8302 $cat <<EOM
8303
8304However, please note that because you already have a /usr/bin/perl,
8305overwriting that with a new Perl would very probably cause problems.
8306Therefore I'm assuming you don't want to do that (unless you insist).
8307
8308EOM
8309 case "$installusrbinperl" in
8310 "$define"|[yY]*) dflt='y';;
8311 *) dflt='n';;
8312 esac
8313 else
8314 $cat <<EOM
8315
8316Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8317
8318EOM
8319 case "$installusrbinperl" in
8320 "$undef"|[nN]*) dflt='n';;
8321 *) dflt='y';;
8322 esac
8323 fi
8324 rp="Do you want to install perl as /usr/bin/perl?"
8325 . ./myread
8326 case "$ans" in
8327 [yY]*) val="$define";;
8328 *) val="$undef" ;;
8329 esac
8330else
8331 val="$undef"
8332fi
8333set installusrbinperl
8334eval $setvar
8335
8336: see if dlopen exists
8337xxx_runnm="$runnm"
8338xxx_ccflags="$ccflags"
8339runnm=false
8340: with g++ one needs -shared to get is-in-libc to work for dlopen
8341case "$gccversion" in
8342'') ;;
8343*Clang*) ;;
8344*) case "$d_cplusplus" in
8345 "$define") ccflags="$ccflags -shared" ;;
8346 esac
8347 ;;
8348esac
8349set dlopen d_dlopen
8350eval $inlibc
8351runnm="$xxx_runnm"
8352ccflags="$xxx_ccflags"
8353
8354: see if this is a unistd.h system
8355set unistd.h i_unistd
8356eval $inhdr
8357
8358: determine which dynamic loading, if any, to compile in
8359echo " "
8360dldir="ext/DynaLoader"
8361case "$usedl" in
8362 $define|y|true)
8363 dflt='y'
8364 usedl="$define"
8365 ;;
8366 $undef|n|false)
8367 dflt='n'
8368 usedl="$undef"
8369 ;;
8370 *)
8371 dflt='n'
8372 case "$d_dlopen" in
8373 $define) dflt='y' ;;
8374 esac
8375 : Does a dl_xxx.xs file exist for this operating system
8376 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8377 ;;
8378esac
8379rp="Do you wish to use dynamic loading?"
8380. ./myread
8381usedl="$ans"
8382bin_ELF="$undef"
8383case "$ans" in
8384 y*) usedl="$define"
8385 case "$dlsrc" in
8386 '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8387 dflt="$dldir/dl_${osname}.xs"
8388 elif $test "$d_dlopen" = "$define" ; then
8389 dflt="$dldir/dl_dlopen.xs"
8390 else
8391 dflt=''
8392 fi
8393 ;;
8394 *) dflt="$dldir/$dlsrc"
8395 ;;
8396 esac
8397 echo "The following dynamic loading files are available:"
8398 : Can not go over to $dldir because getfile has path hard-coded in.
8399 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8400 rp="Source file to use for dynamic loading"
8401 fn="fne"
8402 gfpth="$src"
8403 . ./getfile
8404 usedl="$define"
8405 : emulate basename
8406 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8407
8408 $cat << EOM
8409
8410Some systems may require passing special flags to $cc -c to
8411compile modules that will be used to create a shared library.
8412To use no flags, say "none".
8413
8414EOM
8415 case "$cccdlflags" in
8416 '') case "$gccversion" in
8417 '') case "$osname" in
8418 hpux) dflt='+z' ;;
8419 irix*) dflt='-KPIC' ;;
8420 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8421 sunos) dflt='-pic' ;;
8422 *) dflt='none' ;;
8423 esac
8424 ;;
8425 *) case "$osname" in
8426 darwin) dflt='none' ;;
8427 *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8428 *) dflt='-fpic' ;;
8429 esac ;;
8430 esac ;;
8431 ' ') dflt='none' ;;
8432 *) dflt="$cccdlflags" ;;
8433 esac
8434
8435 case "$dflt" in
8436 none) dflt='' ;;
8437 esac
8438
8439 # If -Dsysroot was specified, now's the time to add it
8440 # to cccdlflags
8441 if test "X$sysroot" != X; then
8442 case "$gccversion" in
8443 '') ;;
8444 *) case "$dflt" in
8445 *sysroot*) ;;
8446 'undef'|*)
8447 dflt="$dflt --sysroot=$sysroot" ;;
8448 esac
8449 ;;
8450 esac
8451 fi
8452
8453 case "$dflt" in
8454 '') dflt='none';;
8455 esac
8456
8457 rp="Any special flags to pass to $cc -c to compile shared library modules?"
8458 . ./myread
8459 case "$ans" in
8460 none) cccdlflags=' ' ;;
8461 *) cccdlflags="$ans" ;;
8462 esac
8463
8464 cat << EOM
8465
8466Some systems use ld to create libraries that can be dynamically loaded,
8467while other systems (such as those using ELF) use $cc.
8468
8469EOM
8470
8471: Determine if this is ELF
8472 $cat >try.c <<EOM
8473/* Test for whether ELF binaries are produced */
8474#include <fcntl.h>
8475#$i_stdlib I_STDLIB
8476#ifdef I_STDLIB
8477#include <stdlib.h>
8478#endif
8479#$i_unistd I_UNISTD
8480#ifdef I_UNISTD
8481#include <unistd.h>
8482#endif
8483int main() {
8484 char b[4];
8485 int i = open("a.out",O_RDONLY);
8486 if(i == -1)
8487 exit(1); /* fail */
8488 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8489 exit(0); /* succeed (yes, it is ELF) */
8490 exit(1); /* fail */
8491}
8492EOM
8493 if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8494 bin_ELF="$define"
8495 fi
8496 $rm_try
8497
8498 case "$ld" in
8499 '') if $test $bin_ELF = "$define"; then
8500 cat <<EOM
8501You appear to have ELF support. I'll use $cc to build dynamic libraries.
8502EOM
8503 dflt="$cc"
8504 else
8505 echo "I'll use ld to build dynamic libraries."
8506 dflt='ld'
8507 fi
8508 ;;
8509 *) dflt="$ld"
8510 ;;
8511 esac
8512
8513 rp="What command should be used to create dynamic libraries?"
8514 . ./myread
8515 ld="$ans"
8516
8517 cat << EOM
8518
8519Some systems may require passing special flags to $ld to create a
8520library that can be dynamically loaded. If your ld flags include
8521-L/other/path options to locate libraries outside your loader's normal
8522search path, you may need to specify those -L options here as well. To
8523use no flags, say "none".
8524
8525EOM
8526 case "$lddlflags" in
8527 '') case "$osname" in
8528 haiku) dflt='-shared' ;;
8529 hpux) dflt='-b';
8530 case "$gccversion" in
8531 '') dflt="$dflt +vnocompatwarnings" ;;
8532 esac
8533 ;;
8534 *linux*|irix*|gnu*) dflt="-shared $optimize" ;;
8535 solaris) # See [perl #66604].
8536 # On Solaris 11, gcc -m64 on amd64
8537 # appears not to understand -G. gcc versions at
8538 # least as old as 3.4.3 support -shared, so just
8539 # use that with Solaris 11 and later, but keep
8540 # the old behavior for older Solaris versions.
8541 case "$gccversion" in
8542 '') dflt='-G' ;;
8543 *) case "$osvers" in
8544 2.?|2.10) dflt='-G' ;;
8545 *) dflt='-shared' ;;
8546 esac
8547 ;;
8548 esac
8549 ;;
8550 sunos) dflt='-assert nodefinitions' ;;
8551 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8552 *) dflt='none' ;;
8553 esac
8554 ;;
8555 *) dflt="$lddlflags" ;;
8556 esac
8557
8558 : Only do this for gcc, since, for example, qcc has no concept
8559 : of --sysroot.
8560 if $test "X$sysroot" != X; then
8561 case "$gccversion" in
8562 '') ;;
8563 *) dflt="$dflt --sysroot=$sysroot" ;;
8564 esac
8565 fi
8566
8567 : Try to guess additional flags to pick up local libraries.
8568 : Be careful not to append to a plain 'none'
8569 case "$dflt" in
8570 none) dflt='' ;;
8571 esac
8572 for thisflag in $ldflags; do
8573 case "$thisflag" in
8574 -L*|-R*|-Wl,-R*)
8575 case " $dflt " in
8576 *" $thisflag "*) ;;
8577 *) dflt="$dflt $thisflag" ;;
8578 esac
8579 ;;
8580 esac
8581 done
8582
8583 case "$dflt" in
8584 ''|' ') dflt='none' ;;
8585 esac
8586
8587 case "$ldflags" in
8588 *-fstack-protector-strong*)
8589 case "$dflt" in
8590 *-fstack-protector-strong*) ;; # Don't add it again
8591 *) dflt="$dflt -fstack-protector-strong" ;;
8592 esac
8593 ;;
8594 *-fstack-protector*)
8595 case "$dflt" in
8596 *-fstack-protector*) ;; # Don't add it again
8597 *) dflt="$dflt -fstack-protector" ;;
8598 esac
8599 ;;
8600 esac
8601
8602 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8603 . ./myread
8604 case "$ans" in
8605 none) lddlflags=' ' ;;
8606 *) lddlflags="$ans" ;;
8607 esac
8608
8609 cat <<EOM
8610
8611Some systems may require passing special flags to $cc to indicate that
8612the resulting executable will use dynamic linking. To use no flags,
8613say "none".
8614
8615EOM
8616 case "$ccdlflags" in
8617 '') case "$osname" in
8618 *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8619 sunos) dflt='none' ;;
8620 *) dflt='none' ;;
8621 esac ;;
8622 ' ') dflt='none' ;;
8623 *) dflt="$ccdlflags" ;;
8624 esac
8625 rp="Any special flags to pass to $cc to use dynamic linking?"
8626 . ./myread
8627 case "$ans" in
8628 none) ccdlflags=' ' ;;
8629 *) ccdlflags="$ans" ;;
8630 esac
8631 ;;
8632
8633 *) usedl="$undef"
8634 ld='ld'
8635 dlsrc='dl_none.xs'
8636 lddlflags=''
8637 ccdlflags=''
8638 ;;
8639esac
8640
8641ld_can_script="$undef"
8642case "$bin_ELF$usedl" in
8643 $define$define)
8644 # Abuse try.h and a.out names for neat cleanup
8645 $cat >try.c <<EOM
8646void foo() {}
8647void bar() {}
8648EOM
8649 $cat >try.h <<EOM
8650LIBTEST_42 {
8651 global:
8652 foo;
8653 local: *;
8654 };
8655EOM
8656 if $cc $cccdlflags $ccdlflags $ccflags \
8657 $ldflags $lddlflags -o a.out try.c \
8658 -Wl,--version-script=try.h >/dev/null 2>&1 \
8659 && $test -s a.out ; then
8660 echo "ld supports scripting" >&4
8661 ld_can_script="$define"
8662 else
8663 echo "ld does not support scripting" >&4
8664 fi
8665 $rm_try
8666 ;;
8667esac
8668
8669: Do we want a shared libperl?
8670also=''
8671case "$usedl" in
8672$undef)
8673 # No dynamic loading being used, so don't bother even to prompt.
8674 useshrplib='false'
8675 ;;
8676*) case "$useshrplib" in
8677 '') case "$osname" in
8678 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8679 dflt=y
8680 also='Building a shared libperl is required for dynamic loading to work on your system.'
8681 ;;
8682 *) dflt=n
8683 ;;
8684 esac
8685 ;;
8686 $define|true|[Yy]*)
8687 dflt=y
8688 ;;
8689 *) dflt=n
8690 ;;
8691 esac
8692 $cat << EOM
8693
8694The perl executable is normally obtained by linking perlmain.c with
8695libperl${_a}, any static extensions (usually just DynaLoader), and
8696any other libraries needed on this system (such as -lm, etc.). Since
8697your system supports dynamic loading, it is probably possible to build
8698a shared libperl.$so. If you will have more than one executable linked
8699to libperl.$so, this will significantly reduce the size of each
8700executable, but it may have a noticeable effect on performance. The
8701default is probably sensible for your system.
8702$also
8703
8704EOM
8705 rp="Build a shared libperl.$so (y/n)"
8706 . ./myread
8707 case "$ans" in
8708 true|$define|[Yy]*)
8709 useshrplib='true' ;;
8710 *) useshrplib='false' ;;
8711 esac
8712 ;;
8713esac
8714
8715case "$useshrplib" in
8716true)
8717 case "$userelocatableinc" in
8718 true|define)
8719 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8720 echo "See INSTALL for an explanation why that won't work." >&4
8721 exit 4
8722 ;;
8723 esac
8724 case "$libperl" in
8725 '')
8726 # Figure out a good name for libperl.so. Since it gets stored in
8727 # a version-specific architecture-dependent library, the version
8728 # number isn't really that important, except for making cc/ld happy.
8729 #
8730 # A name such as libperl.so.10.1
8731 majmin="libperl.$so.$patchlevel.$subversion"
8732 # A name such as libperl.so.100
8733 majonly=`echo $patchlevel $subversion |
8734 $awk '{printf "%d%02d", $1, $2}'`
8735 majonly=libperl.$so.$majonly
8736 # I'd prefer to keep the os-specific stuff here to a minimum, and
8737 # rely on figuring it out from the naming of libc.
8738 case "${osname}${osvers}" in
8739 *linux*|gnu*) # ld won't link with a bare -lperl otherwise.
8740 dflt=libperl.$so
8741 ;;
8742 cygwin*) # ld links now against the dll directly
8743 majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8744 majonly=`echo $patchlevel $subversion |
8745 $awk '{printf "%03d%03d", $1, $2}'`
8746 majonly=cygperl5.$majonly.$so
8747 dflt=$majmin
8748 ;;
8749 *) # Try to guess based on whether libc has major.minor.
8750 case "$libc" in
8751 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8752 *libc.$so.[0-9]*) dflt=$majonly ;;
8753 *) dflt=libperl.$so ;;
8754 esac
8755 ;;
8756 esac
8757 ;;
8758 *) dflt=$libperl
8759 ;;
8760 esac
8761 cat << EOM
8762
8763I need to select a good name for the shared libperl. If your system uses
8764library names with major and minor numbers, then you might want something
8765like $majmin. Alternatively, if your system uses a single version
8766number for shared libraries, then you might want to use $majonly.
8767Or, your system might be quite happy with a simple libperl.$so.
8768
8769Since the shared libperl will get installed into a version-specific
8770architecture-dependent directory, the version number of the shared perl
8771library probably isn't important, so the default should be o.k.
8772
8773EOM
8774 rp='What name do you want to give to the shared libperl?'
8775 . ./myread
8776 libperl=$ans
8777 echo "Ok, I'll use $libperl"
8778 ;;
8779*)
8780 libperl="libperl${_a}"
8781 ;;
8782esac
8783
8784# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8785case "$shrpdir" in
8786'') ;;
8787*) $cat >&4 <<EOM
8788WARNING: Use of the shrpdir variable for the installation location of
8789the shared $libperl is not supported. It was never documented and
8790will not work in this version. Let me (https://github.com/Perl/perl5/issues)
8791know of any problems this may cause.
8792
8793EOM
8794 case "$shrpdir" in
8795 "$archlibexp/CORE")
8796 $cat >&4 <<EOM
8797But your current setting of $shrpdir is
8798the default anyway, so it's harmless.
8799EOM
8800 ;;
8801 *)
8802 $cat >&4 <<EOM
8803Further, your current attempted setting of $shrpdir
8804conflicts with the value of $archlibexp/CORE
8805that installperl will use.
8806EOM
8807 ;;
8808 esac
8809 ;;
8810esac
8811
8812# How will the perl executable find the installed shared $libperl?
8813# Add $xxx to ccdlflags.
8814# If we can't figure out a command-line option, use $shrpenv to
8815# set env LD_RUN_PATH. The main perl makefile uses this.
8816shrpdir=$archlibexp/CORE
8817xxx=''
8818tmp_shrpenv=''
8819if "$useshrplib"; then
8820 case "$osname" in
8821 aix)
8822 # We'll set it in Makefile.SH...
8823 ;;
8824 solaris)
8825 xxx="-R $shrpdir"
8826 ;;
8827 freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8828 xxx="-Wl,-R$shrpdir"
8829 ;;
8830 bsdos|linux|irix*|dec_osf|gnu*|haiku)
8831 xxx="-Wl,-rpath,$shrpdir"
8832 ;;
8833 hpux*)
8834 # hpux doesn't like the default, either.
8835 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8836 ;;
8837 cygwin)
8838 # cygwin needs only ldlibpth
8839 ;;
8840 *)
8841 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8842 ;;
8843 esac
8844 case "$xxx" in
8845 '') ;;
8846 *)
8847 # Only add $xxx if it isn't already in ccdlflags.
8848 case " $ccdlflags " in
8849 *" $xxx "*) ;;
8850 *) ccdlflags="$ccdlflags $xxx"
8851 cat <<EOM >&4
8852
8853Adding $xxx to the flags
8854passed to $ld so that the perl executable will find the
8855installed shared $libperl.
8856
8857EOM
8858 ;;
8859 esac
8860 ;;
8861 esac
8862fi
8863# Fix ccdlflags in AIX for building external extensions.
8864# (For building Perl itself bare -bE:perl.exp is needed,
8865# Makefile.SH takes care of this.)
8866case "$osname" in
8867aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8868esac
8869# Respect a hint or command-line value.
8870case "$shrpenv" in
8871'') shrpenv="$tmp_shrpenv" ;;
8872esac
8873case "$ldlibpthname" in
8874'') ldlibpthname=LD_LIBRARY_PATH ;;
8875none) ldlibpthname='' ;;
8876esac
8877
8878: determine where manual pages are on this system
8879echo " "
8880case "$sysman" in
8881'')
8882 syspath='/usr/share/man/man1 /usr/man/man1'
8883 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8884 syspath="$syspath /usr/man/u_man/man1"
8885 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8886 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8887 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8888 sysman=`./loc . /usr/man/man1 $syspath`
8889 ;;
8890esac
8891if $test -d "$sysman"; then
8892 echo "System manual is in $sysman." >&4
8893else
8894 echo "Could not find manual pages in source form." >&4
8895fi
8896
8897: determine where manual pages go
8898set man1dir man1dir none
8899eval $prefixit
8900$cat <<EOM
8901
8902$spackage has manual pages available in source form.
8903EOM
8904case "$nroff" in
8905nroff)
8906 echo "However, you don't have nroff, so they're probably useless to you."
8907 case "$man1dir" in
8908 '') man1dir="none";;
8909 esac;;
8910esac
8911echo "If you don't want the manual sources installed, answer 'none'."
8912case "$man1dir" in
8913' ') dflt=none
8914 ;;
8915'')
8916 lookpath="$prefixexp/share/man/man1"
8917 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8918 lookpath="$lookpath $prefixexp/man/p_man/man1"
8919 lookpath="$lookpath $prefixexp/man/u_man/man1"
8920 lookpath="$lookpath $prefixexp/man/man.1"
8921 case "$sysman" in
8922 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8923 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8924 esac
8925 set dflt
8926 eval $prefixup
8927 ;;
8928*) dflt="$man1dir"
8929 ;;
8930esac
8931echo " "
8932fn=dn+~
8933rp="Where do the main $spackage manual pages (source) go?"
8934. ./getfile
8935if $test "X$man1direxp" != "X$ansexp"; then
8936 installman1dir=''
8937fi
8938prefixvar=man1dir
8939. ./setprefixvar
8940
8941case "$man1dir" in
8942'') man1dir=' '
8943 installman1dir='';;
8944esac
8945
8946: What suffix to use on installed man pages
8947
8948case "$man1dir" in
8949' ')
8950 man1ext='0'
8951 ;;
8952*)
8953 rp="What suffix should be used for the main $spackage man pages?"
8954 case "$man1ext" in
8955 '') case "$man1dir" in
8956 *1) dflt=1 ;;
8957 *1p) dflt=1p ;;
8958 *1pm) dflt=1pm ;;
8959 *l) dflt=l;;
8960 *n) dflt=n;;
8961 *o) dflt=o;;
8962 *p) dflt=p;;
8963 *C) dflt=C;;
8964 *L) dflt=L;;
8965 *L1) dflt=L1;;
8966 *) dflt=1;;
8967 esac
8968 ;;
8969 *) dflt="$man1ext";;
8970 esac
8971 . ./myread
8972 man1ext="$ans"
8973 ;;
8974esac
8975
8976: see if we can have long filenames
8977echo " "
8978first=123456789abcdef
8979$rm -f $first
8980if (echo hi >$first) 2>/dev/null; then
8981 if $test -f 123456789abcde; then
8982 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8983 val="$undef"
8984 else
8985 echo 'You can have filenames longer than 14 characters.'>&4
8986 val="$define"
8987 fi
8988else
8989 $cat <<'EOM'
8990You can't have filenames longer than 14 chars.
8991You can't even think about them!
8992EOM
8993 val="$undef"
8994fi
8995set d_flexfnam
8996eval $setvar
8997$rm -rf 123456789abcde*
8998
8999: determine where library module manual pages go
9000set man3dir man3dir none
9001eval $prefixit
9002$cat <<EOM
9003
9004$spackage has manual pages for many of the library modules.
9005EOM
9006
9007case "$nroff" in
9008nroff)
9009 $cat <<'EOM'
9010However, you don't have nroff, so they're probably useless to you.
9011EOM
9012 case "$man3dir" in
9013 '') man3dir="none";;
9014 esac;;
9015esac
9016
9017case "$d_flexfnam" in
9018undef)
9019 $cat <<'EOM'
9020However, your system can't handle the long file names like File::Basename.3.
9021EOM
9022 case "$man3dir" in
9023 '') man3dir="none";;
9024 esac;;
9025esac
9026
9027echo "If you don't want the manual sources installed, answer 'none'."
9028prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9029case "$man3dir" in
9030'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9031 if $test -d "$privlib/man/man3"; then
9032 cat <<EOM >&4
9033
9034WARNING: Previous versions of perl installed man3 pages into
9035$privlib/man/man3. This version will suggest a
9036new default of $dflt.
9037EOM
9038 tdflt=$dflt
9039 dflt='n'
9040 rp='Do you wish to preserve the old behavior?(y/n)'
9041 . ./myread
9042 case "$ans" in
9043 y*) dflt="$privlib/man/man3" ;;
9044 *) dflt=$tdflt ;;
9045 esac
9046 fi
9047 ;;
9048*) dflt="$man3dir" ;;
9049esac
9050case "$dflt" in
9051' ') dflt=none ;;
9052esac
9053echo " "
9054fn=dn+~
9055rp="Where do the $package library man pages (source) go?"
9056. ./getfile
9057prefixvar=man3dir
9058. ./setprefixvar
9059
9060case "$man3dir" in
9061'') man3dir=' '
9062 installman3dir='';;
9063esac
9064
9065: What suffix to use on installed man pages
9066case "$man3dir" in
9067' ')
9068 man3ext='0'
9069 ;;
9070*)
9071 rp="What suffix should be used for the $package library man pages?"
9072 case "$man3ext" in
9073 '') case "$man3dir" in
9074 *3) dflt=3 ;;
9075 *3p) dflt=3p ;;
9076 *3pm) dflt=3pm ;;
9077 *l) dflt=l;;
9078 *n) dflt=n;;
9079 *o) dflt=o;;
9080 *p) dflt=p;;
9081 *C) dflt=C;;
9082 *L) dflt=L;;
9083 *L3) dflt=L3;;
9084 *) dflt=3;;
9085 esac
9086 ;;
9087 *) dflt="$man3ext";;
9088 esac
9089 . ./myread
9090 man3ext="$ans"
9091 ;;
9092esac
9093
9094: see if we have to deal with yellow pages, now NIS.
9095if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9096 case "$hostcat" in
9097 nidump*) ;;
9098 *)
9099 case "$hostcat" in
9100 *ypcat*) dflt=y;;
9101 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9102 dflt=y
9103 else
9104 dflt=n
9105 fi;;
9106 *) dflt=n;;
9107 esac
9108 echo " "
9109 rp='Are you getting the hosts file via yellow pages?'
9110 . ./myread
9111 case "$ans" in
9112 y*) hostcat='ypcat hosts';;
9113 *) hostcat='cat /etc/hosts';;
9114 esac
9115 ;;
9116 esac
9117fi
9118case "$hostcat" in
9119'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9120esac
9121case "$groupcat" in
9122'') test -f /etc/group && groupcat='cat /etc/group';;
9123esac
9124case "$passcat" in
9125'') test -f /etc/passwd && passcat='cat /etc/passwd';;
9126esac
9127
9128: now get the host name
9129echo " "
9130echo "Figuring out host name..." >&4
9131case "$myhostname" in
9132'') cont=true
9133 echo 'Maybe "hostname" will work...'
9134 if tans=`sh -c hostname 2>&1` ; then
9135 myhostname=$tans
9136 phostname=hostname
9137 cont=''
9138 fi
9139 ;;
9140*) cont='';;
9141esac
9142if $test "$cont"; then
9143 if ./xenix; then
9144 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
9145 if tans=`cat /etc/systemid 2>&1` ; then
9146 myhostname=$tans
9147 phostname='cat /etc/systemid'
9148 echo "Whadyaknow. Xenix always was a bit strange..."
9149 cont=''
9150 fi
9151 elif $test -r /etc/systemid; then
9152 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9153 fi
9154fi
9155if $test "$cont"; then
9156 echo 'No, maybe "uuname -l" will work...'
9157 if tans=`sh -c 'uuname -l' 2>&1` ; then
9158 myhostname=$tans
9159 phostname='uuname -l'
9160 else
9161 echo 'Strange. Maybe "uname -n" will work...'
9162 if tans=`sh -c 'uname -n' 2>&1` ; then
9163 myhostname=$tans
9164 phostname='uname -n'
9165 else
9166 echo 'Oh well, maybe I can mine it out of whoami.h...'
9167 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9168 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9169 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9170 else
9171 case "$myhostname" in
9172 '') echo "Does this machine have an identity crisis or something?"
9173 phostname='';;
9174 *)
9175 echo "Well, you said $myhostname before..."
9176 phostname='echo $myhostname';;
9177 esac
9178 fi
9179 fi
9180 fi
9181fi
9182case "$myhostname" in
9183'') myhostname=noname ;;
9184esac
9185: you do not want to know about this
9186set $myhostname
9187myhostname=$1
9188
9189: verify guess
9190if $test "$myhostname" ; then
9191 dflt=y
9192 rp='Your host name appears to be "'$myhostname'".'" Right?"
9193 . ./myread
9194 case "$ans" in
9195 y*) ;;
9196 *) myhostname='';;
9197 esac
9198fi
9199
9200: bad guess or no guess
9201while $test "X$myhostname" = X ; do
9202 dflt=''
9203 rp="Please type the (one word) name of your host:"
9204 . ./myread
9205 myhostname="$ans"
9206done
9207
9208: translate upper to lower if necessary
9209case "$myhostname" in
9210*[A-Z]*)
9211 echo "(Normalizing case in your host name)"
9212 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9213 ;;
9214esac
9215
9216case "$myhostname" in
9217*.*)
9218 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9219 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9220 echo "(Trimming domain name from host name--host name is now $myhostname)"
9221 ;;
9222*) case "$mydomain" in
9223 '')
9224 {
9225 test "X$hostcat" = "Xypcat hosts" &&
9226 ypmatch "$myhostname" hosts 2>/dev/null |\
9227 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
9228 $test -s hosts
9229 } || {
9230 test "X$hostcat" != "X" &&
9231 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
9232 /[ ]$myhostname[ . ]/p" > hosts
9233 }
9234 tmp_re="[ . ]"
9235 if $test -f hosts; then
9236 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
9237 END { print sum }" hosts` = x1 || tmp_re="[ ]"
9238 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9239 hosts | $sort | $uniq | \
9240 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9241 case `$echo X$dflt` in
9242 X*\ *) echo "(Several hosts in the database matched hostname)"
9243 dflt=.
9244 ;;
9245 X.) echo "(You do not have fully-qualified names in the hosts database)"
9246 ;;
9247 esac
9248 else
9249 echo "(I cannot locate a hosts database anywhere)"
9250 dflt=.
9251 fi
9252 case "$dflt" in
9253 .)
9254 tans=`./loc resolv.conf X /etc /usr/etc`
9255 if $test -f "$tans"; then
9256 echo "(Attempting domain name extraction from $tans)"
9257 dflt=.`$sed -n -e 's/ / /g' \
9258 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
9259 -e 1q 2>/dev/null`
9260 case "$dflt" in
9261 .) dflt=.`$sed -n -e 's/ / /g' \
9262 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
9263 -e 1q 2>/dev/null`
9264 ;;
9265 esac
9266 fi
9267 ;;
9268 esac
9269 case "$dflt" in
9270 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9271 dflt=.`sh -c domainname 2>/dev/null`
9272 case "$dflt" in
9273 '') dflt='.';;
9274 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9275 esac
9276 ;;
9277 esac
9278 case "$dflt$osname" in
9279 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9280 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9281 ;;
9282 esac
9283 case "$dflt" in
9284 .) echo "(Lost all hope -- silly guess then)"
9285 dflt='.nonet'
9286 ;;
9287 esac
9288 $rm -f hosts
9289 ;;
9290 *) dflt="$mydomain";;
9291 esac;;
9292esac
9293echo " "
9294rp="What is your domain name?"
9295. ./myread
9296tans="$ans"
9297case "$ans" in
9298'') ;;
9299.*) ;;
9300*) tans=".$tans";;
9301esac
9302mydomain="$tans"
9303
9304: translate upper to lower if necessary
9305case "$mydomain" in
9306*[A-Z]*)
9307 echo "(Normalizing case in your domain name)"
9308 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9309 ;;
9310esac
9311
9312: a little sanity check here
9313case "$phostname" in
9314'') ;;
9315*)
9316 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9317 $myhostname$mydomain|$myhostname) ;;
9318 *)
9319 case "$phostname" in
9320 sed*)
9321 echo "(That doesn't agree with your whoami.h file, by the way.)"
9322 ;;
9323 *)
9324 echo "(That doesn't agree with your $phostname command, by the way.)"
9325 ;;
9326 esac
9327 ;;
9328 esac
9329 ;;
9330esac
9331
9332: determine the e-mail address of the user who is running us
9333$cat <<EOM
9334
9335I need to get your e-mail address in Internet format if possible, i.e.
9336something like user@host.domain. Please answer accurately since I have
9337no easy means to double check it. The default value provided below
9338is most probably close to reality but may not be valid from outside
9339your organization...
9340
9341EOM
9342cont=x
9343while test "$cont"; do
9344 case "$MAILDOMAIN" in
9345 '')
9346 if $test -s /etc/mailname; then
9347 maildomain=`$cat /etc/mailname`
9348 else
9349 maildomain="$myhostname$mydomain"
9350 fi
9351 ;;
9352 *) maildomain="$MAILDOMAIN";;
9353 esac
9354 case "$cf_email" in
9355 '') dflt="$cf_by@$maildomain";;
9356 *) dflt="$cf_email";;
9357 esac
9358 rp='What is your e-mail address?'
9359 . ./myread
9360 cf_email="$ans"
9361 case "$cf_email" in
9362 *@*.*) cont='' ;;
9363 *)
9364 rp='Address does not look like an Internet one. Use it anyway?'
9365 case "$fastread" in
9366 yes) dflt=y ;;
9367 *) dflt=n ;;
9368 esac
9369 . ./myread
9370 case "$ans" in
9371 y*) cont='' ;;
9372 *) echo " " ;;
9373 esac
9374 ;;
9375 esac
9376done
9377
9378: Ask e-mail of administrator
9379$cat <<EOM
9380
9381If you or somebody else will be maintaining perl at your site, please
9382fill in the correct e-mail address here so that they may be contacted
9383if necessary. Currently, the "perlbug" program included with perl
9384will send mail to this address in addition to perlbug@perl.org. You may
9385enter "none" for no administrator.
9386
9387EOM
9388case "$perladmin" in
9389'') dflt="$cf_email";;
9390*) dflt="$perladmin";;
9391esac
9392rp='Perl administrator e-mail address'
9393. ./myread
9394perladmin="$ans"
9395
9396: determine whether to use a version number suffix for installed binaries
9397echo " "
9398$cat <<EOM
9399Do you want to use a version number suffix for installed binaries? This
9400will install 'perl$version' instead of 'perl', and likewise for other
9401binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9402to be installed side-by-side. Unless you are a developer, you probably
9403do *not* want to do this.
9404EOM
9405case "$versiononly" in
9406"$define"|[Yy]*|true) dflt='y' ;;
9407*) dflt='n';
9408esac
9409rp="Do you want to use a version number suffix for installed binaries?"
9410. ./myread
9411case "$ans" in
9412[yY]*) val="$define";;
9413*) val="$undef" ;;
9414esac
9415set versiononly
9416eval $setvar
9417
9418case "$versiononly" in
9419"$define") inc_version_list=''
9420 inc_version_list_init=0
9421 ;;
9422esac
9423
9424: figure out how to guarantee perl startup
9425: XXX Note that this currently takes advantage of the bug that binexp ignores
9426: the Configure -Dinstallprefix setting, which in turn means that under
9427: relocatable @INC, initialinstalllocation is what binexp started as.
9428case "$startperl" in
9429'')
9430 case "$sharpbang" in
9431 *!)
9432 $cat <<EOH
9433
9434I can use the #! construct to start perl on your system. This will
9435make startup of perl scripts faster, but may cause problems if you
9436want to share those scripts and perl is not in a standard place
9437($initialinstalllocation/perl) on all your platforms. The alternative
9438is to force a shell by starting the script with a single ':' character.
9439
9440EOH
9441 case "$versiononly" in
9442 "$define") dflt="$initialinstalllocation/perl$version";;
9443 *) dflt="$initialinstalllocation/perl";;
9444 esac
9445 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9446 . ./myread
9447 case "$ans" in
9448 none) startperl=": # use perl";;
9449 *) startperl="#!$ans"
9450 if $test 30 -lt `echo "$ans" | wc -c`; then
9451 $cat >&4 <<EOM
9452
9453WARNING: Some systems limit the #! command to 32 characters.
9454If you experience difficulty running Perl scripts with #!, try
9455installing Perl in a directory with a shorter pathname.
9456
9457EOM
9458 fi ;;
9459 esac
9460 ;;
9461 *) startperl=": # use perl"
9462 ;;
9463 esac
9464 ;;
9465esac
9466echo "I'll use $startperl to start perl scripts."
9467
9468: figure best path for perl in scripts
9469case "$perlpath" in
9470'')
9471 case "$versiononly" in
9472 "$define") perlpath="$initialinstalllocation/perl$version";;
9473 *) perlpath="$initialinstalllocation/perl";;
9474 esac
9475 case "$startperl" in
9476 *!*) ;;
9477 *)
9478 $cat <<EOH
9479
9480I will use the "eval 'exec'" idiom to start Perl on your system.
9481I can use the full path of your Perl binary for this purpose, but
9482doing so may cause problems if you want to share those scripts and
9483Perl is not always in a standard place ($initialinstalllocation/perl).
9484
9485EOH
9486 dflt="$initialinstalllocation/perl"
9487 rp="What path shall I use in \"eval 'exec'\"?"
9488 . ./myread
9489 perlpath="$ans"
9490 ;;
9491 esac
9492 ;;
9493esac
9494case "$startperl" in
9495*!*) ;;
9496*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9497esac
9498
9499: determine where public executable scripts go
9500set scriptdir scriptdir
9501eval $prefixit
9502case "$scriptdir" in
9503'')
9504 dflt="$bin"
9505 : guess some guesses
9506 $test -d /usr/share/scripts && dflt=/usr/share/scripts
9507 $test -d /usr/share/bin && dflt=/usr/share/bin
9508 $test -d /usr/local/script && dflt=/usr/local/script
9509 $test -d /usr/local/scripts && dflt=/usr/local/scripts
9510 $test -d $prefixexp/script && dflt=$prefixexp/script
9511 set dflt
9512 eval $prefixup
9513 ;;
9514*) dflt="$scriptdir"
9515 ;;
9516esac
9517$cat <<EOM
9518
9519Some installations have a separate directory just for executable scripts so
9520that they can mount it across multiple architectures but keep the scripts in
9521one spot. You might, for example, have a subdirectory of /usr/share for this.
9522Or you might just lump your scripts in with all your other executables.
9523
9524EOM
9525fn=d~
9526rp='Where do you keep publicly executable scripts?'
9527. ./getfile
9528if $test "X$ansexp" != "X$scriptdirexp"; then
9529 installscript=''
9530fi
9531installscriptdir=''
9532prefixvar=scriptdir
9533. ./setprefixvar
9534: A little fix up for an irregularly named variable.
9535installscript="$installscriptdir"
9536
9537: determine where add-on public executables go
9538case "$sitebin" in
9539'') dflt=$siteprefix/bin ;;
9540*) dflt=$sitebin ;;
9541esac
9542fn=d~
9543rp='Pathname where the add-on public executables should be installed?'
9544. ./getfile
9545prefixvar=sitebin
9546. ./setprefixvar
9547
9548: determine where add-on html pages go
9549: There is no standard location, so try to copy the previously-selected
9550: directory structure for the core html pages.
9551case "$sitehtml1dir" in
9552'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9553*) dflt=$sitehtml1dir ;;
9554esac
9555case "$dflt" in
9556''|' ') dflt=none ;;
9557esac
9558fn=dn+~
9559rp='Pathname where the site-specific html pages should be installed?'
9560. ./getfile
9561prefixvar=sitehtml1dir
9562. ./setprefixvar
9563
9564: determine where add-on library html pages go
9565: There is no standard location, so try to copy the previously-selected
9566: directory structure for the core html pages.
9567case "$sitehtml3dir" in
9568'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9569*) dflt=$sitehtml3dir ;;
9570esac
9571case "$dflt" in
9572''|' ') dflt=none ;;
9573esac
9574fn=dn+~
9575rp='Pathname where the site-specific library html pages should be installed?'
9576. ./getfile
9577prefixvar=sitehtml3dir
9578. ./setprefixvar
9579
9580: determine where add-on manual pages go
9581case "$siteman1dir" in
9582'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9583*) dflt=$siteman1dir ;;
9584esac
9585case "$dflt" in
9586''|' ') dflt=none ;;
9587esac
9588fn=dn+~
9589rp='Pathname where the site-specific manual pages should be installed?'
9590. ./getfile
9591prefixvar=siteman1dir
9592. ./setprefixvar
9593
9594: determine where add-on library man pages go
9595case "$siteman3dir" in
9596'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9597*) dflt=$siteman3dir ;;
9598esac
9599case "$dflt" in
9600''|' ') dflt=none ;;
9601esac
9602fn=dn+~
9603rp='Pathname where the site-specific library manual pages should be installed?'
9604. ./getfile
9605prefixvar=siteman3dir
9606. ./setprefixvar
9607
9608: determine where add-on public executable scripts go
9609case "$sitescript" in
9610'') dflt=$siteprefix/script
9611 $test -d $dflt || dflt=$sitebin ;;
9612*) dflt="$sitescript" ;;
9613esac
9614fn=d~+
9615rp='Pathname where add-on public executable scripts should be installed?'
9616. ./getfile
9617prefixvar=sitescript
9618. ./setprefixvar
9619
9620: see if backtrace exists
9621set backtrace d_backtrace
9622eval $inlibc
9623
9624: Check if C backtrace is actually supported.
9625case "$usecbacktrace" in
9626 "") usecbacktrace=$undef ;;
9627 [yY]*|true|$define)
9628 case "$d_backtrace" in
9629 [yY]*|true|$define)
9630 ;;
9631 *)
9632 echo "This system does not support backtrace" >&4
9633 usecbacktrace=$undef
9634 ;;
9635 esac
9636 ;;
9637 esac
9638
9639: Check if faststdio is requested and available
9640case "$usefaststdio" in
9641$define|true|[yY]*|'')
9642 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9643 case "$xversion" in
9644 [68]) dflt='y' ;;
9645 *) dflt='n' ;;
9646 esac
9647 ;;
9648*) dflt='n';;
9649esac
9650cat <<EOM
9651
9652Perl can be built to use 'fast stdio', which means using the stdio
9653library but also directly manipulating the stdio buffers to enable
9654faster I/O. Using stdio is better for backward compatibility (especially
9655for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9656interface has been preferred instead of stdio.
9657
9658If this doesn't make any sense to you, just accept the default '$dflt'.
9659EOM
9660rp='Use the "fast stdio" if available?'
9661. ./myread
9662case "$ans" in
9663y|Y) val="$define" ;;
9664*) val="$undef" ;;
9665esac
9666set usefaststdio
9667eval $setvar
9668
9669: define an is-a-typedef? function
9670typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9671case "$inclist" in
9672"") inclist="sys/types.h";;
9673esac;
9674eval "varval=\$$var";
9675case "$varval" in
9676"")
9677 $rm -f temp.c;
9678 for inc in $inclist; do
9679 echo "#include <$inc>" >>temp.c;
9680 done;
9681 echo "#ifdef $type" >> temp.c;
9682 echo "printf(\"We have $type\");" >> temp.c;
9683 echo "#endif" >> temp.c;
9684 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9685 if $contains $type temp.E >/dev/null 2>&1; then
9686 eval "$var=\$type";
9687 else
9688 eval "$var=\$def";
9689 fi;
9690 $rm -f temp.?;;
9691*) eval "$var=\$varval";;
9692esac'
9693
9694: define an is-a-typedef? function that prompts if the type is not available.
9695typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9696case "$inclist" in
9697"") inclist="sys/types.h";;
9698esac;
9699eval "varval=\$$var";
9700case "$varval" in
9701"")
9702 $rm -f temp.c;
9703 for inc in $inclist; do
9704 echo "#include <$inc>" >>temp.c;
9705 done;
9706 echo "#ifdef $type" >> temp.c;
9707 echo "printf(\"We have $type\");" >> temp.c;
9708 echo "#endif" >> temp.c;
9709 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9710 echo " " ;
9711 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9712 if $contains $type temp.E >/dev/null 2>&1; then
9713 echo "$type found." >&4;
9714 eval "$var=\$type";
9715 else
9716 echo "$type NOT found." >&4;
9717 dflt="$def";
9718 . ./myread ;
9719 eval "$var=\$ans";
9720 fi;
9721 $rm -f temp.?;;
9722*) eval "$var=\$varval";;
9723esac'
9724
9725: see what type lseek is declared as in the kernel
9726rp="What is the type used for lseek's offset on this system?"
9727set off_t lseektype long stdio.h sys/types.h
9728eval $typedef_ask
9729
9730echo " "
9731echo "Checking to see how big your file offsets are..." >&4
9732$cat >try.c <<EOCP
9733#include <sys/types.h>
9734#include <stdio.h>
9735int main()
9736{
9737 printf("%d\n", (int)sizeof($lseektype));
9738 return(0);
9739}
9740EOCP
9741set try
9742if eval $compile_ok; then
9743 lseeksize=`$run ./try`
9744 echo "Your file offsets are $lseeksize bytes long."
9745else
9746 dflt=$longsize
9747 echo " "
9748 echo "(I can't seem to compile the test program. Guessing...)"
9749 rp="What is the size of your file offsets (in bytes)?"
9750 . ./myread
9751 lseeksize="$ans"
9752fi
9753$rm_try
9754
9755: see what type file positions are declared as in the library
9756rp="What is the type for file position used by fsetpos()?"
9757set fpos_t fpostype long stdio.h sys/types.h
9758eval $typedef_ask
9759
9760: Check size for Fpos_t
9761echo " "
9762case "$fpostype" in
9763*_t) zzz="$fpostype" ;;
9764*) zzz="fpos_t" ;;
9765esac
9766echo "Checking the size of $zzz..." >&4
9767cat > try.c <<EOCP
9768#include <sys/types.h>
9769#include <stdio.h>
9770#$i_stdlib I_STDLIB
9771#ifdef I_STDLIB
9772#include <stdlib.h>
9773#endif
9774int main() {
9775 printf("%d\n", (int)sizeof($fpostype));
9776 exit(0);
9777}
9778EOCP
9779set try
9780if eval $compile_ok; then
9781 yyy=`$run ./try`
9782 case "$yyy" in
9783 '') fpossize=4
9784 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9785 ;;
9786 *) fpossize=$yyy
9787 echo "Your $zzz is $fpossize bytes long."
9788 ;;
9789 esac
9790else
9791 dflt="$longsize"
9792 echo " " >&4
9793 echo "(I can't compile the test program. Guessing...)" >&4
9794 rp="What is the size of your file positions (in bytes)?"
9795 . ./myread
9796 fpossize="$ans"
9797fi
9798
9799: Check for large file support
9800# Backward compatibility (uselfs is deprecated).
9801case "$uselfs" in
9802"$define"|true|[yY]*)
9803 cat <<EOM >&4
9804
9805*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9806EOM
9807 uselargefiles="$define"
9808 ;;
9809esac
9810
9811case "$lseeksize:$fpossize" in
98128:8) cat <<EOM
9813
9814You can have files larger than 2 gigabytes.
9815EOM
9816 val="$define" ;;
9817*) case "$uselargefiles" in
9818 "$undef"|false|[nN]*) dflt='n' ;;
9819 *) dflt='y' ;;
9820 esac
9821 cat <<EOM
9822
9823Perl can be built to understand large files (files larger than 2 gigabytes)
9824on some systems. To do so, Configure can be run with -Duselargefiles.
9825
9826If this doesn't make any sense to you, just accept the default '$dflt'.
9827EOM
9828 rp='Try to understand large files, if available?'
9829 . ./myread
9830 case "$ans" in
9831 y|Y) val="$define" ;;
9832 *) val="$undef" ;;
9833 esac
9834 ;;
9835esac
9836set uselargefiles
9837eval $setvar
9838: Look for a hint-file generated 'call-back-unit'. If the
9839: user has specified that a large files perl is to be built,
9840: we may need to set or change some other defaults.
9841if $test -f uselargefiles.cbu; then
9842 echo "Your platform has some specific hints regarding large file builds, using them..."
9843 . ./uselargefiles.cbu
9844fi
9845case "$uselargefiles" in
9846"$define")
9847 if $test -f uselargefiles.cbu; then
9848 echo " "
9849 echo "Rechecking to see how big your file offsets are..." >&4
9850 $cat >try.c <<EOCP
9851#include <sys/types.h>
9852#include <stdio.h>
9853int main()
9854{
9855 printf("%d\n", (int)sizeof($lseektype));
9856 return(0);
9857}
9858EOCP
9859 set try
9860 if eval $compile_ok; then
9861 lseeksize=`$run ./try`
9862 $echo "Your file offsets are now $lseeksize bytes long."
9863 else
9864 dflt="$lseeksize"
9865 echo " "
9866 echo "(I can't seem to compile the test program. Guessing...)"
9867 rp="What is the size of your file offsets (in bytes)?"
9868 . ./myread
9869 lseeksize="$ans"
9870 fi
9871 case "$fpostype" in
9872 *_t) zzz="$fpostype" ;;
9873 *) zzz="fpos_t" ;;
9874 esac
9875 $echo $n "Rechecking the size of $zzz...$c" >&4
9876 $cat > try.c <<EOCP
9877#include <sys/types.h>
9878#include <stdio.h>
9879#$i_stdlib I_STDLIB
9880#ifdef I_STDLIB
9881#include <stdlib.h>
9882#endif
9883int main() {
9884 printf("%d\n", (int)sizeof($fpostype));
9885 return(0);
9886}
9887EOCP
9888 set try
9889 if eval $compile_ok; then
9890 yyy=`$run ./try`
9891 dflt="$lseeksize"
9892 case "$yyy" in
9893 '') echo " "
9894 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9895 ;;
9896 *) fpossize=$yyy
9897 echo " $fpossize bytes." >&4
9898 ;;
9899 esac
9900 else
9901 dflt="$fpossize"
9902 echo " "
9903 echo "(I can't compile the test program. Guessing...)" >&4
9904 rp="What is the size of your file positions (in bytes)?"
9905 . ./myread
9906 fpossize="$ans"
9907 fi
9908 $rm_try
9909 fi
9910 ;;
9911esac
9912
9913: Check if we want perlio
9914useperlio="$define"
9915
9916: Set the vendorbin variables
9917case "$vendorprefix" in
9918'') d_vendorbin="$undef"
9919 vendorbin=''
9920 vendorbinexp=''
9921 ;;
9922*) d_vendorbin="$define"
9923 : determine where vendor-supplied executables go.
9924 case "$vendorbin" in
9925 '') dflt=$vendorprefix/bin ;;
9926 *) dflt="$vendorbin" ;;
9927 esac
9928 fn=d~+
9929 rp='Pathname for the vendor-supplied executables directory?'
9930 . ./getfile
9931 vendorbin="$ans"
9932 vendorbinexp="$ansexp"
9933 ;;
9934esac
9935prefixvar=vendorbin
9936. ./installprefix
9937
9938: Set the vendorhtml1dir variables
9939case "$vendorprefix" in
9940'') vendorhtml1dir=''
9941 vendorhtml1direxp=''
9942 ;;
9943*) : determine where vendor-supplied html pages go.
9944 : There is no standard location, so try to copy the previously-selected
9945 : directory structure for the core html pages.
9946 : XXX Better default suggestions would be welcome.
9947 case "$vendorhtml1dir" in
9948 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9949 *) dflt=$vendorhtml1dir ;;
9950 esac
9951 case "$dflt" in
9952 ''|' ') dflt=none ;;
9953 esac
9954 fn=dn+~
9955 rp='Pathname for the vendor-supplied html pages?'
9956 . ./getfile
9957 vendorhtml1dir="$ans"
9958 vendorhtml1direxp="$ansexp"
9959 ;;
9960esac
9961: Use ' ' for none so value is preserved next time through Configure
9962$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9963prefixvar=vendorhtml1dir
9964. ./installprefix
9965
9966: Set the vendorhtml3dir variables
9967case "$vendorprefix" in
9968'') vendorhtml3dir=''
9969 vendorhtml3direxp=''
9970 ;;
9971*) : determine where vendor-supplied module html pages go.
9972 : There is no standard location, so try to copy the previously-selected
9973 : directory structure for the core html pages.
9974 : XXX Better default suggestions would be welcome.
9975 case "$vendorhtml3dir" in
9976 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9977 *) dflt=$vendorhtml3dir ;;
9978 esac
9979 case "$dflt" in
9980 ''|' ') dflt=none ;;
9981 esac
9982 fn=dn+~
9983 rp='Pathname for the vendor-supplied html pages?'
9984 . ./getfile
9985 vendorhtml3dir="$ans"
9986 vendorhtml3direxp="$ansexp"
9987 ;;
9988esac
9989: Use ' ' for none so value is preserved next time through Configure
9990$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9991prefixvar=vendorhtml3dir
9992. ./installprefix
9993
9994: Set the vendorman1dir variables
9995case "$vendorprefix" in
9996'') vendorman1dir=''
9997 vendorman1direxp=''
9998 ;;
9999*) : determine where vendor-supplied manual pages go.
10000 case "$vendorman1dir" in
10001 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10002 *) dflt=$vendorman1dir ;;
10003 esac
10004 case "$dflt" in
10005 ''|' ') dflt=none ;;
10006 esac
10007 fn=nd~+
10008 rp='Pathname for the vendor-supplied manual section 1 pages?'
10009 . ./getfile
10010 vendorman1dir="$ans"
10011 vendorman1direxp="$ansexp"
10012 ;;
10013esac
10014: Use ' ' for none so value is preserved next time through Configure
10015$test X"$vendorman1dir" = "X" && vendorman1dir=' '
10016prefixvar=vendorman1dir
10017. ./installprefix
10018
10019: Set the vendorman3dir variables
10020case "$vendorprefix" in
10021'') vendorman3dir=''
10022 vendorman3direxp=''
10023 ;;
10024*) : determine where vendor-supplied module manual pages go.
10025 case "$vendorman3dir" in
10026 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10027 *) dflt=$vendorman3dir ;;
10028 esac
10029 case "$dflt" in
10030 ''|' ') dflt=none ;;
10031 esac
10032 fn=nd~+
10033 rp='Pathname for the vendor-supplied manual section 3 pages?'
10034 . ./getfile
10035 vendorman3dir="$ans"
10036 vendorman3direxp="$ansexp"
10037 ;;
10038esac
10039: Use ' ' for none so value is preserved next time through Configure
10040$test X"$vendorman3dir" = "X" && vendorman3dir=' '
10041prefixvar=vendorman3dir
10042. ./installprefix
10043
10044: Set the vendorscript variables
10045case "$vendorprefix" in
10046'') d_vendorscript="$undef"
10047 vendorscript=''
10048 vendorscriptexp=''
10049 ;;
10050*) d_vendorscript="$define"
10051 : determine where vendor-supplied scripts go.
10052 case "$vendorscript" in
10053 '') dflt=$vendorprefix/script
10054 $test -d $dflt || dflt=$vendorbin ;;
10055 *) dflt="$vendorscript" ;;
10056 esac
10057 $cat <<EOM
10058
10059The installation process will create a directory for
10060vendor-supplied scripts.
10061
10062EOM
10063 fn=d~+
10064 rp='Pathname for the vendor-supplied scripts directory?'
10065 . ./getfile
10066 vendorscript="$ans"
10067 vendorscriptexp="$ansexp"
10068 ;;
10069esac
10070prefixvar=vendorscript
10071. ./installprefix
10072
10073: see if qgcvt exists
10074set qgcvt d_qgcvt
10075eval $inlibc
10076
10077: Check what kind of doubles your system has
10078$echo "Checking the kind of doubles you have..." >&4
10079$cat >try.c <<EOP
10080#$i_stdlib I_STDLIB
10081#define DOUBLESIZE $doublesize
10082#ifdef I_STDLIB
10083#include <stdlib.h>
10084#endif
10085#include <stdio.h>
10086static const double d = -0.1;
10087int main() {
10088 unsigned const char* b = (unsigned const char*)(&d);
10089#if DOUBLESIZE == 4
10090 if (b[0] == 0xCD && b[3] == 0xBD) {
10091 /* IEEE 754 32-bit little-endian */
10092 printf("1\n");
10093 exit(0);
10094 }
10095 if (b[0] == 0xBD && b[3] == 0xCD) {
10096 /* IEEE 754 32-bit big-endian */
10097 printf("2\n");
10098 exit(0);
10099 }
10100 if (b[0] == 0xCC && b[3] == 0xCC) {
10101 /* VAX format F, 32-bit PDP-style mixed endian. */
10102 printf("9\n");
10103 exit(0);
10104 }
10105 if (b[0] == 0xC0 && b[3] == 0x9A) {
10106 /* IBM single 32-bit */
10107 printf("12\n");
10108 exit(0);
10109 }
10110#endif
10111#if DOUBLESIZE == 8
10112 if (b[0] == 0x9A && b[7] == 0xBF) {
10113 /* IEEE 754 64-bit little-endian */
10114 printf("3\n");
10115 exit(0);
10116 }
10117 if (b[0] == 0xBF && b[7] == 0x9A) {
10118 /* IEEE 754 64-bit big-endian */
10119 printf("4\n");
10120 exit(0);
10121 }
10122 if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10123 /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10124 * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10125 * 99 99 b9 bf 9a 99 99 99 */
10126 printf("7\n");
10127 exit(0);
10128 }
10129 if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10130 /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10131 * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10132 * 99 99 99 9a bf b9 99 99 */
10133 printf("8\n");
10134 exit(0);
10135 }
10136 if (b[0] == 0xCC && b[7] == 0xCC) {
10137 /* VAX format D, 64-bit PDP-style mixed endian. */
10138 printf("10\n");
10139 exit(0);
10140 }
10141 if (b[0] == 0xD9 && b[7] == 0x99) {
10142 /* VAX format G, 64-bit PDP-style mixed endian. */
10143 printf("11\n");
10144 exit(0);
10145 }
10146 if (b[0] == 0xC0 && b[7] == 0x9A) {
10147 /* IBM double 64-bit */
10148 printf("13\n");
10149 exit(0);
10150 }
10151 if (b[0] == 0xBF && b[7] == 0xCD) {
10152 /* CRAY single 64-bit */
10153 printf("14\n");
10154 exit(0);
10155 }
10156#endif
10157#if DOUBLESIZE == 16
10158 if (b[0] == 0x9A && b[15] == 0xBF) {
10159 /* IEEE 754 128-bit little-endian */
10160 printf("5\n");
10161 exit(0);
10162 }
10163 if (b[0] == 0xBF && b[15] == 0x9A) {
10164 /* IEEE 754 128-bit big-endian */
10165 printf("6\n");
10166 exit(0);
10167 }
10168#endif
10169 /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10170 * Whether those environments can still build Perl is debatable. */
10171 printf("-1\n"); /* unknown */
10172 exit(0);
10173}
10174EOP
10175set try
10176if eval $compile; then
10177 doublekind=`$run ./try`
10178else
10179 doublekind=-1
10180fi
10181case "$doublekind" in
101821) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
101832) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
101843) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
101854) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
101865) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
101876) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
101887) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
101898) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
101909) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
1019110) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
1019211) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
1019312) echo "You have IBM short 32-bit doubles." >&4 ;;
1019413) echo "You have IBM long 64-bit doubles." >&4 ;;
1019514) echo "You have Cray single 64-bit doubles." >&4 ;;
10196*) echo "Cannot figure out your double. You Cyber, or something?" >&4 ;;
10197esac
10198d_double_style_ieee=$undef
10199d_double_style_vax=$undef
10200d_double_style_ibm=$undef
10201d_double_style_cray=$undef
10202case "$doublekind" in
102031|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
102049|10|11) d_double_style_vax=$define ;;
1020512|13) d_double_style_ibm=$define ;;
1020614) d_double_style_cray=$define ;;
10207esac
10208case "$d_double_style_ieee" in
10209$define)
10210 d_double_has_inf=$define
10211 d_double_has_nan=$define
10212 d_double_has_negative_zero=$define
10213 d_double_has_subnormals=$define
10214 ;;
10215*)
10216 d_double_has_inf=$undef
10217 d_double_has_nan=$undef
10218 d_double_has_negative_zero=$undef
10219 d_double_has_subnormals=$undef
10220 ;;
10221esac
10222$rm_try
10223
10224: Check print/scan long double stuff
10225echo " "
10226
10227if $test X"$d_longdbl" = X"$define"; then
10228
10229echo "Checking how to print long doubles..." >&4
10230
10231if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10232 $cat >try.c <<'EOCP'
10233#include <sys/types.h>
10234#include <stdio.h>
10235int main() {
10236 double d = 123.456;
10237 printf("%.3f\n", d);
10238}
10239EOCP
10240 set try
10241 if eval $compile; then
10242 yyy=`$run ./try`
10243 case "$yyy" in
10244 123.456)
10245 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10246 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10247 echo "We will use %f."
10248 ;;
10249 esac
10250 fi
10251fi
10252
10253if $test X"$sPRIfldbl" = X; then
10254 $cat >try.c <<'EOCP'
10255#include <sys/types.h>
10256#include <stdio.h>
10257int main() {
10258 long double d = 123.456;
10259 printf("%.3Lf\n", d);
10260}
10261EOCP
10262 set try
10263 if eval $compile; then
10264 yyy=`$run ./try`
10265 case "$yyy" in
10266 123.456)
10267 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10268 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10269 echo "We will use %Lf."
10270 ;;
10271 esac
10272 fi
10273fi
10274
10275if $test X"$sPRIfldbl" = X; then
10276 $cat >try.c <<'EOCP'
10277#include <sys/types.h>
10278#include <stdio.h>
10279int main() {
10280 long double d = 123.456;
10281 printf("%.3llf\n", d);
10282}
10283EOCP
10284 set try
10285 if eval $compile; then
10286 yyy=`$run ./try`
10287 case "$yyy" in
10288 123.456)
10289 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10290 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10291 echo "We will use %llf."
10292 ;;
10293 esac
10294 fi
10295fi
10296
10297if $test X"$sPRIfldbl" = X; then
10298 $cat >try.c <<'EOCP'
10299#include <sys/types.h>
10300#include <stdio.h>
10301int main() {
10302 long double d = 123.456;
10303 printf("%.3lf\n", d);
10304}
10305EOCP
10306 set try
10307 if eval $compile; then
10308 yyy=`$run ./try`
10309 case "$yyy" in
10310 123.456)
10311 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10312 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10313 echo "We will use %lf."
10314 ;;
10315 esac
10316 fi
10317fi
10318
10319if $test X"$sPRIfldbl" = X; then
10320 echo "Cannot figure out how to print long doubles." >&4
10321else
10322 sSCNfldbl=$sPRIfldbl # expect consistency
10323fi
10324
10325$rm_try
10326
10327fi # d_longdbl
10328
10329case "$sPRIfldbl" in
10330'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10331 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10332 d_SCNfldbl="$undef";
10333 ;;
10334*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10335 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10336 d_SCNfldbl="$define";
10337 ;;
10338esac
10339
10340: Before committing on uselongdouble, see whether that looks sane.
10341if $test "$uselongdouble" = "$define"; then
10342 message=""
10343 echo " "
10344 echo "Checking if your long double math functions work right..." >&4
10345 $cat > try.c <<EOF
10346#include <math.h>
10347#include <stdio.h>
10348int main() {
10349 printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10350}
10351EOF
10352 case "$osname:$gccversion" in
10353 aix:) saveccflags="$ccflags"
10354 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10355 esac
10356 set try
10357 if eval $compile_ok; then
10358 yyy=`$run ./try`
10359 fi
10360 case "$yyy" in
10361 3) echo "Your long double math functions are working correctly." >&4 ;;
10362 *) echo "Your long double math functions are broken, not using long doubles." >&4
10363 uselongdouble=$undef
10364 ;;
10365 esac
10366 $rm_try
10367 case "$osname:$gccversion" in
10368 aix:) ccflags="$saveccflags" ;; # restore
10369 esac
10370fi
10371
10372: Check how to convert floats to strings.
10373
10374if test "X$d_Gconvert" = X; then
10375
10376echo " "
10377echo "Checking for an efficient way to convert floats to strings."
10378echo " " > try.c
10379case "$uselongdouble" in
10380"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10381esac
10382case "$d_longdbl" in
10383"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10384esac
10385case "$d_PRIgldbl" in
10386"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
10387esac
10388$cat >>try.c <<EOP
10389#ifdef TRY_gconvert
10390#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10391const char *myname = "gconvert";
10392#endif
10393#ifdef TRY_gcvt
10394#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10395const char *myname = "gcvt";
10396#endif
10397#ifdef TRY_qgcvt
10398#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10399const char *myname = "qgcvt";
10400#define DOUBLETYPE long double
10401#endif
10402#ifdef TRY_sprintf
10403#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10404#ifdef HAS_PRIgldbl
10405#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10406#else
10407#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10408#endif
10409#else
10410#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10411#endif
10412const char *myname = "sprintf";
10413#endif
10414
10415#ifndef DOUBLETYPE
10416#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10417#define DOUBLETYPE long double
10418#else
10419#define DOUBLETYPE double
10420#endif
10421#endif
10422
10423#include <stdio.h>
10424
10425#$i_stdlib I_STDLIB
10426#ifdef I_STDLIB
10427#include <stdlib.h>
10428#endif
10429#include <string.h>
10430
10431void checkit(const char *expect, char *got)
10432{
10433 if (strcmp(expect, got)) {
10434 printf("%s oddity: Expected %s, got %s\n",
10435 myname, expect, got);
10436 exit(1);
10437 }
10438}
10439
10440int main()
10441{
10442 char buf[64];
10443 buf[63] = '\0';
10444
10445 /* This must be 1st test on (which?) platform */
10446 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10447 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10448 checkit("0.1", buf);
10449
10450 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10451 checkit("0.01", buf);
10452
10453 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10454 checkit("0.001", buf);
10455
10456 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10457 checkit("0.0001", buf);
10458
10459 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10460 if (strlen(buf) > 5)
10461 checkit("9e-005", buf); /* for Microsoft ?? */
10462 else
10463 checkit("9e-05", buf);
10464
10465 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10466 checkit("1", buf);
10467
10468 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10469 checkit("1.1", buf);
10470
10471 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10472 checkit("1.01", buf);
10473
10474 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10475 checkit("1.001", buf);
10476
10477 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10478 checkit("1.0001", buf);
10479
10480 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10481 checkit("1.00001", buf);
10482
10483 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10484 checkit("1.000001", buf);
10485
10486 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10487 checkit("0", buf);
10488
10489 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10490 checkit("-1", buf);
10491
10492 /* Some Linux gcvt's give 1.e+5 here. */
10493 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10494 checkit("100000", buf);
10495
10496 /* Some Linux gcvt's give -1.e+5 here. */
10497 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10498 checkit("-100000", buf);
10499
10500 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10501 checkit("123.456", buf);
10502
10503 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10504 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10505 /* 34 should be enough to scare even long double
10506 * places into using the e notation. */
10507 if (strlen(buf) > 5)
10508 checkit("1e+034", buf); /* for Microsoft */
10509 else
10510 checkit("1e+34", buf);
10511
10512 /* For Perl, if you add additional tests here, also add them to
10513 * t/base/num.t for benefit of platforms not using Configure or
10514 * overriding d_Gconvert */
10515
10516 exit(0);
10517}
10518EOP
10519: first add preferred functions to our list
10520xxx_list=""
10521for xxx_convert in $gconvert_preference; do
10522 case $xxx_convert in
10523 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10524 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10525 esac
10526done
10527: then add any others
10528for xxx_convert in gconvert gcvt sprintf; do
10529 case "$xxx_list" in
10530 *$xxx_convert*) ;;
10531 *) xxx_list="$xxx_list $xxx_convert" ;;
10532 esac
10533done
10534
10535case "$d_longdbl$uselongdouble" in
10536"$define$define")
10537 : again, add preferred functions to our list first
10538 xxx_ld_list=""
10539 for xxx_convert in $gconvert_ld_preference; do
10540 case $xxx_convert in
10541 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10542 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10543 esac
10544 done
10545 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10546 for xxx_convert in qgcvt sprintf $xxx_list; do
10547 case "$xxx_ld_list" in
10548 $xxx_convert*|*" $xxx_convert"*) ;;
10549 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10550 esac
10551 done
10552 : if sprintf cannot do long doubles, move it to the end
10553 if test "$d_PRIgldbl" != "$define"; then
10554 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10555 fi
10556 : if no qgcvt, remove it
10557 if test "$d_qgcvt" != "$define"; then
10558 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10559 fi
10560 : use the ld_list
10561 xxx_list="$xxx_ld_list"
10562 ;;
10563esac
10564
10565for xxx_convert in $xxx_list; do
10566 echo "Trying $xxx_convert..."
10567 $rm -f try try$_o core
10568 set try -DTRY_$xxx_convert
10569 if eval $compile; then
10570 echo "$xxx_convert() found." >&4
10571 if $run ./try; then
10572 echo "I'll use $xxx_convert to convert floats into a string." >&4
10573 break;
10574 else
10575 echo "...But $xxx_convert didn't work as I expected."
10576 xxx_convert=''
10577 fi
10578 else
10579 echo "$xxx_convert NOT found." >&4
10580 xxx_convert=''
10581 fi
10582done
10583
10584if test X$xxx_convert = X; then
10585 echo "*** WHOA THERE!!! ***" >&4
10586 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
10587 xxx_convert=sprintf
10588fi
10589
10590case "$xxx_convert" in
10591gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10592gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10593qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10594*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10595 "$define$define$define")
10596 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10597 "$define$define$undef")
10598 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10599 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10600 esac
10601 ;;
10602esac
10603
10604fi
10605$rm_try
10606
10607: see if _fwalk exists
10608set fwalk d__fwalk
10609eval $inlibc
10610
10611: see if accept4 exists
10612set accept4 d_accept4
10613eval $inlibc
10614
10615: Initialize h_fcntl
10616h_fcntl=false
10617
10618: Initialize h_sysfile
10619h_sysfile=false
10620
10621: access call always available on UNIX
10622set access d_access
10623eval $inlibc
10624
10625: locate the flags for 'access()'
10626case "$d_access" in
10627"$define")
10628 echo " "
10629 $cat >access.c <<EOCP
10630#include <sys/types.h>
10631#ifdef I_FCNTL
10632#include <fcntl.h>
10633#endif
10634#ifdef I_SYS_FILE
10635#include <sys/file.h>
10636#endif
10637#ifdef I_UNISTD
10638#include <unistd.h>
10639#endif
10640#$i_stdlib I_STDLIB
10641#ifdef I_STDLIB
10642#include <stdlib.h>
10643#endif
10644int main() {
10645 exit(R_OK);
10646}
10647EOCP
10648 : check sys/file.h first, no particular reason here
10649 if $test `./findhdr sys/file.h` && \
10650 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10651 h_sysfile=true;
10652 echo "<sys/file.h> defines the *_OK access constants." >&4
10653 elif $test `./findhdr fcntl.h` && \
10654 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10655 h_fcntl=true;
10656 echo "<fcntl.h> defines the *_OK access constants." >&4
10657 elif $test `./findhdr unistd.h` && \
10658 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10659 echo "<unistd.h> defines the *_OK access constants." >&4
10660 else
10661 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10662 fi
10663 ;;
10664esac
10665$rm -f access*
10666
10667: see if accessx exists
10668set accessx d_accessx
10669eval $inlibc
10670
10671: see if acosh exists
10672set acosh d_acosh
10673eval $inlibc
10674
10675: see if aintl exists
10676set aintl d_aintl
10677eval $inlibc
10678
10679: see if alarm exists
10680set alarm d_alarm
10681eval $inlibc
10682
10683: see if 64bit time functions exists
10684
10685set ctime64 d_ctime64
10686eval $inlibc
10687
10688set localtime64 d_localtime64
10689eval $inlibc
10690
10691set gmtime64 d_gmtime64
10692eval $inlibc
10693
10694set mktime64 d_mktime64
10695eval $inlibc
10696
10697set difftime64 d_difftime64
10698eval $inlibc
10699
10700set asctime64 d_asctime64
10701eval $inlibc
10702
10703: see if POSIX threads are available
10704set pthread.h i_pthread
10705eval $inhdr
10706
10707: define a function to check prototypes
10708$cat > protochk <<EOSH
10709$startsh
10710cc="$cc"
10711optimize="$optimize"
10712ccflags="$ccflags"
10713define="$define"
10714rm_try="$rm_try"
10715usethreads=$usethreads
10716i_pthread=$i_pthread
10717pthread_h_first=$pthread_h_first
10718EOSH
10719
10720$cat >> protochk <<'EOSH'
10721
10722$rm_try
10723foo="$1"
10724shift
10725while test $# -ge 2; do
10726 case "$1" in
10727 $define) echo "#include <$2>" >> try.c ;;
10728 literal) echo "$2" >> try.c ;;
10729 esac
10730 # Extra magic for the benefit of systems that need pthread.h
10731 # to be included early to correctly detect threadsafe functions.
10732 # Such functions must guarantee themselves, though, that the usethreads
10733 # and i_pthread have been defined, before calling protochk.
10734 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10735 echo "#include <pthread.h>" >> try.c
10736 pthread_h_done=yes
10737 fi
10738 shift 2
10739done
10740cat >> try.c <<'EOCP'
10741#define _(args) args
10742EOCP
10743echo "$foo" >> try.c
10744echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10745$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10746status=$?
10747$rm_try
10748exit $status
10749EOSH
10750chmod +x protochk
10751$eunicefix protochk
10752
10753: Define hasproto macro for Configure internal use
10754hasproto='varname=$1; func=$2; shift; shift;
10755while $test $# -ge 2; do
10756 case "$1" in
10757 $define) echo "#include <$2>";;
10758 literal) echo "$2" ;;
10759 esac ;
10760 shift 2;
10761done > try.c;
10762$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10763if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10764 echo "$func() prototype found.";
10765 val="$define";
10766else
10767 echo "$func() prototype NOT found.";
10768 val="$undef";
10769fi;
10770set $varname;
10771eval $setvar;
10772$rm_try tryout.c'
10773
10774: see if sys/types.h has to be included
10775set sys/types.h i_systypes
10776eval $inhdr
10777
10778: see if sys/select.h has to be included
10779set sys/select.h i_sysselct
10780eval $inhdr
10781
10782: Define hasfield macro for Configure internal use
10783hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10784while $test $# -ge 2; do
10785 case "$1" in
10786 $define) echo "#include <$2>";;
10787 esac ;
10788 shift 2;
10789done > try.c;
10790echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10791set try;
10792if eval $compile; then
10793 val="$define";
10794else
10795 val="$undef";
10796fi;
10797set $varname;
10798eval $setvar;
10799$rm_try'
10800
10801: see if we should include sys/time.h
10802echo " "
10803i_time='define'
10804if test "X$timeincl" = X; then
10805 echo "Testing to see if we should include <sys/time.h>." >&4
10806 $echo $n "I'm now running the test program...$c"
10807 $cat >try.c <<EOCP
10808#include <sys/types.h>
10809#include <time.h>
10810#ifdef I_SYSTIME
10811#ifdef SYSTIMEKERNEL
10812#define KERNEL
10813#endif
10814#include <sys/time.h>
10815#endif
10816#ifdef I_SYSSELECT
10817#include <sys/select.h>
10818#endif
10819#$i_stdlib I_STDLIB
10820#ifdef I_STDLIB
10821#include <stdlib.h>
10822#endif
10823int main()
10824{
10825 struct tm foo;
10826#ifdef S_TIMEVAL
10827 struct timeval bar;
10828#endif
10829#ifdef S_TIMEZONE
10830 struct timezone tzp;
10831#endif
10832 if (foo.tm_sec == foo.tm_sec)
10833 exit(0);
10834#ifdef S_TIMEVAL
10835 if (bar.tv_sec == bar.tv_sec)
10836 exit(0);
10837#endif
10838 exit(1);
10839}
10840EOCP
10841 flags=''
10842 for s_timezone in '-DS_TIMEZONE' ''; do
10843 sysselect=''
10844 for s_timeval in '-DS_TIMEVAL' ''; do
10845 for i_systimek in '' '-DSYSTIMEKERNEL'; do
10846 for i_systime in '-DI_SYSTIME' ''; do
10847 case "$flags" in
10848 '') $echo $n ".$c"
10849 set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10850 if eval $compile; then
10851 set X $i_systime $i_systimek $sysselect $s_timeval
10852 shift
10853 flags="$*"
10854 echo " "
10855 $echo $n "Succeeded with $flags$c"
10856 fi
10857 ;;
10858 esac
10859 done
10860 done
10861 done
10862 done
10863 timeincl=''
10864 echo " "
10865 case "$flags" in
10866 *SYSTIMEKERNEL*) i_systimek="$define"
10867 timeincl=`./findhdr sys/time.h`
10868 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10869 *) i_systimek="$undef";;
10870 esac
10871 case "$flags" in
10872 *I_SYSTIME*) i_systime="$define"
10873 timeincl=`./findhdr sys/time.h`" $timeincl"
10874 echo "We'll include <sys/time.h>." >&4;;
10875 *) i_systime="$undef";;
10876 esac
10877 $rm_try
10878fi
10879: see if struct tm knows about tm_zone
10880case "$i_systime$i_time" in
10881*$define*)
10882 echo " "
10883 echo "Checking to see if your struct tm has tm_zone field..." >&4
10884 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10885 eval $hasfield
10886 ;;
10887*) val="$undef"
10888 set d_tm_tm_zone
10889 eval $setvar
10890 ;;
10891esac
10892case "$d_tm_tm_zone" in
10893"$define") echo "Yes, it does." ;;
10894*) echo "No, it doesn't." ;;
10895esac
10896: see if struct tm knows about tm_gmtoff
10897case "$i_systime$i_time" in
10898*$define*)
10899 echo " "
10900 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10901 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10902 eval $hasfield
10903 ;;
10904*) val="$undef"
10905 set d_tm_tm_gmtoff
10906 eval $setvar
10907 ;;
10908esac
10909case "$d_tm_tm_gmtoff" in
10910"$define") echo "Yes, it does." ;;
10911*) echo "No, it doesn't." ;;
10912esac
10913
10914: see if asctime_r exists
10915set asctime_r d_asctime_r
10916eval $inlibc
10917case "$d_asctime_r" in
10918"$define")
10919 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10920 case "$d_asctime_r_proto:$usethreads" in
10921 ":define") d_asctime_r_proto=define
10922 set d_asctime_r_proto asctime_r $hdrs
10923 eval $hasproto ;;
10924 *) ;;
10925 esac
10926 case "$d_asctime_r_proto" in
10927 define)
10928 case "$asctime_r_proto" in
10929 ''|0) try='char* asctime_r(const struct tm*, char*);'
10930 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10931 esac
10932 case "$asctime_r_proto" in
10933 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10934 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10935 esac
10936 case "$asctime_r_proto" in
10937 ''|0) try='int asctime_r(const struct tm*, char*);'
10938 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10939 esac
10940 case "$asctime_r_proto" in
10941 ''|0) try='int asctime_r(const struct tm*, char*, int);'
10942 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10943 esac
10944 case "$asctime_r_proto" in
10945 ''|0) d_asctime_r=undef
10946 asctime_r_proto=0
10947 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10948 * ) case "$asctime_r_proto" in
10949 REENTRANT_PROTO*) ;;
10950 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10951 esac
10952 echo "Prototype: $try" ;;
10953 esac
10954 ;;
10955 *) case "$usethreads" in
10956 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10957 esac
10958 d_asctime_r=undef
10959 asctime_r_proto=0
10960 ;;
10961 esac
10962 ;;
10963*) asctime_r_proto=0
10964 ;;
10965esac
10966
10967: see if asinh exists
10968set asinh d_asinh
10969eval $inlibc
10970
10971: see if atanh exists
10972set atanh d_atanh
10973eval $inlibc
10974
10975: see if atolf exists
10976set atolf d_atolf
10977eval $inlibc
10978
10979: see if atoll exists
10980set atoll d_atoll
10981eval $inlibc
10982
10983: Look for GCC-style attribute format
10984case "$d_attribute_format" in
10985'')
10986echo " "
10987echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10988$cat >attrib.c <<'EOCP'
10989#include <stdio.h>
10990void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10991EOCP
10992if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10993 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10994 echo "Your C compiler doesn't support __attribute__((format))."
10995 val="$undef"
10996 else
10997 echo "Your C compiler supports __attribute__((format))."
10998 val="$define"
10999 fi
11000else
11001 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11002 val="$undef"
11003fi
11004;;
11005*) val="$d_attribute_format" ;;
11006esac
11007set d_attribute_format
11008eval $setvar
11009$rm -f attrib*
11010
11011: Look for GCC-style attribute format with null format allowed
11012case "$d_printf_format_null" in
11013'') case "$d_attribute_format" in
11014 $define)
11015 echo " "
11016 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11017$cat >attrib.c <<EOCP
11018#include <stdio.h>
11019#$i_stdlib I_STDLIB
11020#ifdef I_STDLIB
11021#include <stdlib.h>
11022#endif
11023#$i_inttypes I_INTTYPES
11024#ifdef I_INTTYPES
11025#include <inttypes.h>
11026#endif
11027#ifndef INTPTR_MAX
11028#define intptr_t int
11029#endif
11030int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11031int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
11032int main () { exit(null_printf(NULL)); }
11033EOCP
11034 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11035 : run the executable in case it produces a run-time warning
11036 if $run ./attrib >>attrib.out 2>&1; then
11037 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11038 echo "Your C compiler doesn't allow __printf__ format to be null."
11039 val="$undef"
11040 else
11041 echo "Your C compiler allows __printf__ format to be null."
11042 val="$define"
11043 fi
11044 else
11045 echo "Your C compiler executable failed with __printf__ format null."
11046 val="$undef"
11047 fi
11048 else
11049 echo "Your C compiler fails with __printf__ format null."
11050 val="$undef"
11051 fi
11052 ;;
11053 *) val="$undef" ;;
11054 esac
11055;;
11056*) val="$d_printf_format_null" ;;
11057esac
11058set d_printf_format_null
11059eval $setvar
11060$rm -f attrib*
11061
11062: Look for GCC-style attribute malloc
11063case "$d_attribute_malloc" in
11064'')
11065echo " "
11066echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11067$cat >attrib.c <<'EOCP'
11068#include <stdio.h>
11069char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11070EOCP
11071if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11072 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11073 echo "Your C compiler doesn't support __attribute__((malloc))."
11074 val="$undef"
11075 else
11076 echo "Your C compiler supports __attribute__((malloc))."
11077 val="$define"
11078 fi
11079else
11080 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11081 val="$undef"
11082fi
11083;;
11084*) val="$d_attribute_malloc" ;;
11085esac
11086set d_attribute_malloc
11087eval $setvar
11088$rm -f attrib*
11089
11090: Look for GCC-style attribute nonnull
11091case "$d_attribute_nonnull" in
11092'')
11093echo " "
11094echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11095$cat >attrib.c <<'EOCP'
11096#include <stdio.h>
11097void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11098EOCP
11099if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11100 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11101 echo "Your C compiler doesn't support __attribute__((nonnull))."
11102 val="$undef"
11103 else
11104 echo "Your C compiler supports __attribute__((nonnull))."
11105 val="$define"
11106 fi
11107else
11108 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11109 val="$undef"
11110fi
11111;;
11112*) val="$d_attribute_nonnull" ;;
11113esac
11114set d_attribute_nonnull
11115eval $setvar
11116$rm -f attrib*
11117
11118: Look for GCC-style attribute noreturn
11119case "$d_attribute_noreturn" in
11120'')
11121echo " "
11122echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11123$cat >attrib.c <<'EOCP'
11124#include <stdio.h>
11125void fall_over_dead( void ) __attribute__((noreturn));
11126EOCP
11127if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11128 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11129 echo "Your C compiler doesn't support __attribute__((noreturn))."
11130 val="$undef"
11131 else
11132 echo "Your C compiler supports __attribute__((noreturn))."
11133 val="$define"
11134 fi
11135else
11136 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11137 val="$undef"
11138fi
11139;;
11140*) val="$d_attribute_noreturn" ;;
11141esac
11142set d_attribute_noreturn
11143eval $setvar
11144$rm -f attrib*
11145
11146: Look for GCC-style attribute pure
11147case "$d_attribute_pure" in
11148'')
11149echo " "
11150echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11151$cat >attrib.c <<'EOCP'
11152#include <stdio.h>
11153int square( int n ) __attribute__((pure));
11154EOCP
11155if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11156 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11157 echo "Your C compiler doesn't support __attribute__((pure))."
11158 val="$undef"
11159 else
11160 echo "Your C compiler supports __attribute__((pure))."
11161 val="$define"
11162 fi
11163else
11164 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11165 val="$undef"
11166fi
11167;;
11168*) val="$d_attribute_pure" ;;
11169esac
11170set d_attribute_pure
11171eval $setvar
11172$rm -f attrib*
11173
11174: Look for GCC-style attribute unused
11175case "$d_attribute_unused" in
11176'')
11177echo " "
11178echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11179$cat >attrib.c <<'EOCP'
11180#include <stdio.h>
11181int do_something( int dummy __attribute__((unused)), int n );
11182EOCP
11183if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11184 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11185 echo "Your C compiler doesn't support __attribute__((unused))."
11186 val="$undef"
11187 else
11188 echo "Your C compiler supports __attribute__((unused))."
11189 val="$define"
11190 fi
11191else
11192 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11193 val="$undef"
11194fi
11195;;
11196*) val="$d_attribute_unused" ;;
11197esac
11198set d_attribute_unused
11199eval $setvar
11200$rm -f attrib*
11201
11202: Look for GCC-style attribute deprecated
11203case "$d_attribute_deprecated" in
11204'')
11205echo " "
11206echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11207$cat >attrib.c <<'EOCP'
11208#include <stdio.h>
11209int I_am_deprecated(void) __attribute__((deprecated));
11210EOCP
11211if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11212 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11213 echo "Your C compiler doesn't support __attribute__((deprecated))."
11214 val="$undef"
11215 else
11216 echo "Your C compiler supports __attribute__((deprecated))."
11217 val="$define"
11218 fi
11219else
11220 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11221 val="$undef"
11222fi
11223;;
11224*) val="$d_attribute_deprecated" ;;
11225esac
11226set d_attribute_deprecated
11227eval $setvar
11228$rm -f attrib*
11229
11230: Look for GCC-style attribute warn_unused_result
11231case "$d_attribute_warn_unused_result" in
11232'')
11233echo " "
11234echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11235$cat >attrib.c <<'EOCP'
11236#include <stdio.h>
11237int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11238EOCP
11239if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11240 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11241 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11242 val="$undef"
11243 else
11244 echo "Your C compiler supports __attribute__((warn_unused_result))."
11245 val="$define"
11246 fi
11247else
11248 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11249 val="$undef"
11250fi
11251;;
11252*) val="$d_attribute_warn_unused_result" ;;
11253esac
11254set d_attribute_warn_unused_result
11255eval $setvar
11256$rm -f attrib*
11257
11258: Look for GCC-style attribute always_inline
11259case "$d_attribute_always_inline" in
11260'')
11261echo " "
11262echo "Checking whether your compiler can handle __attribute__((always_inline)) ..." >&4
11263$cat >attrib.c <<'EOCP'
11264#include <stdio.h>
11265static __inline__ __attribute__((always_inline)) int I_will_always_be_inlined(void);
11266EOCP
11267if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11268 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11269 echo "Your C compiler doesn't support __attribute__((always_inline))."
11270 val="$undef"
11271 else
11272 echo "Your C compiler supports __attribute__((always_inline))."
11273 val="$define"
11274 fi
11275else
11276 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11277 val="$undef"
11278fi
11279;;
11280*) val="$d_attribute_always_inline" ;;
11281esac
11282set d_attribute_always_inline
11283eval $setvar
11284$rm -f attrib*
11285
11286: see if getpgrp exists
11287set getpgrp d_getpgrp
11288eval $inlibc
11289
11290case "$d_getpgrp" in
11291"$define")
11292 echo " "
11293 echo "Checking to see which flavor of getpgrp is in use..."
11294 $cat >try.c <<EOP
11295#include <stdio.h>
11296#$i_unistd I_UNISTD
11297#include <sys/types.h>
11298#ifdef I_UNISTD
11299# include <unistd.h>
11300#endif
11301#$i_stdlib I_STDLIB
11302#ifdef I_STDLIB
11303#include <stdlib.h>
11304#endif
11305int main()
11306{
11307 if (getuid() == 0) {
11308 printf("(I see you are running Configure as super-user...)\n");
11309 setuid(1);
11310 }
11311#ifdef TRY_BSD_PGRP
11312 if (getpgrp(1) == 0)
11313 exit(0);
11314#else
11315 if (getpgrp() > 0)
11316 exit(0);
11317#endif
11318 exit(1);
11319}
11320EOP
11321 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11322 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11323 val="$define"
11324 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11325 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11326 val="$undef"
11327 else
11328 echo "I can't seem to compile and run the test program."
11329 if ./usg; then
11330 xxx="a USG one, i.e. you use getpgrp()."
11331 else
11332 # SVR4 systems can appear rather BSD-ish.
11333 case "$i_unistd" in
11334 $undef)
11335 xxx="a BSD one, i.e. you use getpgrp(pid)."
11336 val="$define"
11337 ;;
11338 $define)
11339 xxx="probably a USG one, i.e. you use getpgrp()."
11340 val="$undef"
11341 ;;
11342 esac
11343 fi
11344 echo "Assuming your getpgrp is $xxx" >&4
11345 fi
11346 ;;
11347*) val="$undef";;
11348esac
11349set d_bsdgetpgrp
11350eval $setvar
11351$rm_try
11352
11353: see if setpgrp exists
11354set setpgrp d_setpgrp
11355eval $inlibc
11356
11357case "$d_setpgrp" in
11358"$define")
11359 echo " "
11360 echo "Checking to see which flavor of setpgrp is in use..."
11361 $cat >try.c <<EOP
11362#include <stdio.h>
11363#$i_unistd I_UNISTD
11364#include <sys/types.h>
11365#ifdef I_UNISTD
11366# include <unistd.h>
11367#endif
11368#$i_stdlib I_STDLIB
11369#ifdef I_STDLIB
11370#include <stdlib.h>
11371#endif
11372int main()
11373{
11374 if (getuid() == 0) {
11375 printf("(I see you are running Configure as super-user...)\n");
11376 setuid(1);
11377 }
11378#ifdef TRY_BSD_PGRP
11379 if (-1 == setpgrp(1, 1))
11380 exit(0);
11381#else
11382 if (setpgrp() != -1)
11383 exit(0);
11384#endif
11385 exit(1);
11386}
11387EOP
11388 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11389 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11390 val="$define"
11391 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11392 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11393 val="$undef"
11394 else
11395 echo "(I can't seem to compile and run the test program.)"
11396 if ./usg; then
11397 xxx="a USG one, i.e. you use setpgrp()."
11398 else
11399 # SVR4 systems can appear rather BSD-ish.
11400 case "$i_unistd" in
11401 $undef)
11402 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11403 val="$define"
11404 ;;
11405 $define)
11406 xxx="probably a USG one, i.e. you use setpgrp()."
11407 val="$undef"
11408 ;;
11409 esac
11410 fi
11411 echo "Assuming your setpgrp is $xxx" >&4
11412 fi
11413 ;;
11414*) val="$undef";;
11415esac
11416set d_bsdsetpgrp
11417eval $setvar
11418$rm_try
11419
11420: Look for GCC-style __builtin_add_overflow
11421case "$d_builtin_add_overflow" in
11422'')
11423 echo " "
11424 echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11425 $cat >try.c <<'EOCP'
11426int main(void) {
11427 const unsigned int uint_max = ~0u;
11428 int target_int = 0;
11429 if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11430 return 1;
11431 }
11432 if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11433 return 1;
11434 }
11435 if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11436 return 1;
11437 }
11438 return 0;
11439}
11440EOCP
11441 set try
11442 if eval $compile && $run ./try; then
11443 echo "Your C compiler supports __builtin_add_overflow."
11444 val="$define"
11445 else
11446 echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11447 val="$undef"
11448 fi
11449 ;;
11450*) val="$d_builtin_add_overflow" ;;
11451esac
11452
11453set d_builtin_add_overflow
11454eval $setvar
11455$rm_try
11456
11457: Look for GCC-style __builtin_sub_overflow
11458case "$d_builtin_sub_overflow" in
11459'')
11460 echo " "
11461 echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11462 $cat >try.c <<'EOCP'
11463int main(void) {
11464 const unsigned int uint_max = ~0u;
11465 int target_int = 0;
11466 if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11467 return 1;
11468 }
11469 if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11470 return 1;
11471 }
11472 if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11473 return 1;
11474 }
11475 return 0;
11476}
11477EOCP
11478 set try
11479 if eval $compile && $run ./try; then
11480 echo "Your C compiler supports __builtin_sub_overflow."
11481 val="$define"
11482 else
11483 echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11484 val="$undef"
11485 fi
11486 ;;
11487*) val="$d_builtin_sub_overflow" ;;
11488esac
11489
11490set d_builtin_sub_overflow
11491eval $setvar
11492$rm_try
11493
11494: Look for GCC-style __builtin_mul_overflow
11495case "$d_builtin_mul_overflow" in
11496'')
11497 echo " "
11498 echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11499 $cat >try.c <<'EOCP'
11500int main(void) {
11501 const unsigned int uint_max = ~0u;
11502 int target_int = 0;
11503 if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11504 return 1;
11505 }
11506 if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11507 return 1;
11508 }
11509 if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11510 return 1;
11511 }
11512 return 0;
11513}
11514EOCP
11515 set try
11516 if eval $compile && $run ./try; then
11517 echo "Your C compiler supports __builtin_mul_overflow."
11518 val="$define"
11519 else
11520 echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11521 val="$undef"
11522 fi
11523 ;;
11524*) val="$d_builtin_mul_overflow" ;;
11525esac
11526
11527set d_builtin_mul_overflow
11528eval $setvar
11529$rm_try
11530
11531: Look for GCC-style __builtin_choose_expr
11532case "$d_builtin_choose_expr" in
11533'')
11534 echo " "
11535 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11536 $cat >try.c <<'EOCP'
11537#include <assert.h>
11538#include <stdlib.h>
11539#include <stdio.h>
11540
11541#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11542
11543int main(void) {
11544 assert( SYRINX(1) == 2112 );
11545 assert( SYRINX(1) != 5150 );
11546 assert( SYRINX(0) == 5150 );
11547 assert( SYRINX(0) != 2112 );
11548 puts( "All good!" );
11549 exit(0);
11550}
11551
11552EOCP
11553 set try
11554 if eval $compile && $run ./try; then
11555 echo "Your C compiler supports __builtin_choose_expr."
11556 val="$define"
11557 else
11558 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11559 val="$undef"
11560 fi
11561;;
11562*) val="$d_builtin_choose_expr" ;;
11563esac
11564
11565set d_builtin_choose_expr
11566eval $setvar
11567$rm_try
11568
11569: Look for GCC-style __builtin_expect
11570case "$d_builtin_expect" in
11571'')
11572 echo " "
11573 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11574 $cat >try.c <<'EOCP'
11575int main(void) {
11576 int n = 50;
11577 if ( __builtin_expect(n, 0) ) n = 1;
11578 /* Remember shell exit code truth is 0, C truth is non-zero */
11579 return !(n == 1);
11580}
11581EOCP
11582 set try
11583 if eval $compile && $run ./try; then
11584 echo "Your C compiler supports __builtin_expect."
11585 val="$define"
11586 else
11587 echo "Your C compiler doesn't seem to understand __builtin_expect."
11588 val="$undef"
11589 fi
11590 ;;
11591*) val="$d_builtin_expect" ;;
11592esac
11593
11594set d_builtin_expect
11595eval $setvar
11596$rm_try
11597
11598: see if the Compiler supports C99 variadic macros
11599echo "Checking for C99 variadic macros." >&4
11600$cat >try.c <<EOCP
11601#include <stdio.h>
11602#include <stdarg.h>
11603
11604#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11605
11606int main() {
11607 char buf[20];
11608 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11609 puts(buf);
11610 return 0;
11611}
11612EOCP
11613set try
11614if eval $compile && $run ./try 2>&1 >/dev/null; then
11615 case "`$run ./try`" in
11616 "123 456 789")
11617 echo "You have C99 variadic macros." >&4
11618 d_c99_variadic_macros="$define"
11619 ;;
11620 *)
11621 echo "You don't have functional C99 variadic macros." >&4
11622 d_c99_variadic_macros="$undef"
11623 ;;
11624 esac
11625else
11626 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11627 d_c99_variadic_macros="$undef"
11628fi
11629$rm_try
11630
11631: see if signal is declared as pointer to function returning int or void
11632echo " "
11633xxx=`./findhdr signal.h`
11634$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11635if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
11636 echo "You have int (*signal())() instead of void." >&4
11637 val="$undef"
11638elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
11639 echo "You have void (*signal())()." >&4
11640 val="$define"
11641elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11642 echo "You have int (*signal())() instead of void." >&4
11643 val="$undef"
11644elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11645 echo "You have void (*signal())()." >&4
11646 val="$define"
11647else
11648 case "$d_voidsig" in
11649 '')
11650 echo "I can't determine whether signal handler returns void or int..." >&4
11651 dflt=void
11652 rp="What type does your signal handler return?"
11653 . ./myread
11654 case "$ans" in
11655 v*) val="$define";;
11656 *) val="$undef";;
11657 esac;;
11658 "$define")
11659 echo "As you already told me, signal handler returns void." >&4
11660 val="$define"
11661 ;;
11662 *) echo "As you already told me, signal handler returns int." >&4
11663 val="$undef"
11664 ;;
11665 esac
11666fi
11667set d_voidsig
11668eval $setvar
11669case "$d_voidsig" in
11670"$define") signal_t="void";;
11671*) signal_t="int";;
11672esac
11673$rm -f $$.tmp
11674
11675: check for ability to cast large floats to 32-bit ints.
11676echo " "
11677echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11678if $test "$intsize" -ge 4; then
11679 xxx=int
11680else
11681 xxx=long
11682fi
11683$cat >try.c <<EOCP
11684#include <stdio.h>
11685#$i_stdlib I_STDLIB
11686#ifdef I_STDLIB
11687#include <stdlib.h>
11688#endif
11689#include <sys/types.h>
11690#include <signal.h>
11691$signal_t blech(int s) { exit(3); }
11692int main()
11693{
11694 $xxx i32;
11695 double f, g;
11696 int result = 0;
11697 char str[16];
11698 signal(SIGFPE, blech);
11699
11700 /* Don't let compiler optimize the test away. Store the number
11701 in a writable string for gcc to pass to sscanf under HP-UX.
11702 */
11703 sprintf(str, "2147483647");
11704 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11705 g = 10 * f;
11706 i32 = ($xxx) g;
11707
11708 /* x86 processors will probably give 0x8000 0000, which is a
11709 sign change. We don't want that. We want to mimic SPARC
11710 behavior here, which is to preserve the sign and give
11711 back 0x7fff ffff.
11712 */
11713 if (i32 != ($xxx) f)
11714 result |= 1;
11715 exit(result);
11716}
11717EOCP
11718set try
11719if eval $compile_ok; then
11720 $run ./try 2>/dev/null
11721 yyy=$?
11722else
11723 echo "(I can't seem to compile the test program--assuming it can't)"
11724 yyy=1
11725fi
11726case "$yyy" in
117270) val="$define"
11728 echo "Yup, it can."
11729 ;;
11730*) val="$undef"
11731 echo "Nope, it can't."
11732 ;;
11733esac
11734set d_casti32
11735eval $setvar
11736$rm_try
11737
11738: check for ability to cast negative floats to unsigned
11739echo " "
11740echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11741$cat >try.c <<EOCP
11742#include <stdio.h>
11743#$i_stdlib I_STDLIB
11744#ifdef I_STDLIB
11745#include <stdlib.h>
11746#endif
11747#include <sys/types.h>
11748#include <signal.h>
11749$signal_t blech(int s) { exit(7); }
11750$signal_t blech_in_list(int s) { exit(4); }
11751unsigned long dummy_long(unsigned long p) { return p; }
11752unsigned int dummy_int(unsigned int p) { return p; }
11753unsigned short dummy_short(unsigned short p) { return p; }
11754int main()
11755{
11756 double f;
11757 unsigned long along;
11758 unsigned int aint;
11759 unsigned short ashort;
11760 int result = 0;
11761 char str[16];
11762
11763 /* Frustrate gcc-2.7.2's optimizer which failed this test with
11764 a direct f = -123. assignment. gcc-2.8.0 reportedly
11765 optimized the whole file away
11766 */
11767 /* Store the number in a writable string for gcc to pass to
11768 sscanf under HP-UX.
11769 */
11770 sprintf(str, "-123");
11771 sscanf(str, "%lf", &f); /* f = -123.; */
11772
11773 signal(SIGFPE, blech);
11774 along = (unsigned long)f;
11775 aint = (unsigned int)f;
11776 ashort = (unsigned short)f;
11777 if (along != (unsigned long)-123)
11778 result |= 1;
11779 if (aint != (unsigned int)-123)
11780 result |= 1;
11781 if (ashort != (unsigned short)-123)
11782 result |= 1;
11783 sprintf(str, "1073741824.");
11784 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11785 f = f + f;
11786 along = 0;
11787 along = (unsigned long)f;
11788 if (along != 0x80000000)
11789 result |= 2;
11790 f -= 1.;
11791 along = 0;
11792 along = (unsigned long)f;
11793 if (along != 0x7fffffff)
11794 result |= 1;
11795 f += 2.;
11796 along = 0;
11797 along = (unsigned long)f;
11798 if (along != 0x80000001)
11799 result |= 2;
11800 if (result)
11801 exit(result);
11802 signal(SIGFPE, blech_in_list);
11803 sprintf(str, "123.");
11804 sscanf(str, "%lf", &f); /* f = 123.; */
11805 along = dummy_long((unsigned long)f);
11806 aint = dummy_int((unsigned int)f);
11807 ashort = dummy_short((unsigned short)f);
11808 if (along != (unsigned long)123)
11809 result |= 4;
11810 if (aint != (unsigned int)123)
11811 result |= 4;
11812 if (ashort != (unsigned short)123)
11813 result |= 4;
11814 exit(result);
11815
11816}
11817EOCP
11818set try
11819if eval $compile_ok; then
11820 $run ./try 2>/dev/null
11821 castflags=$?
11822else
11823 echo "(I can't seem to compile the test program--assuming it can't)"
11824 castflags=7
11825fi
11826case "$castflags" in
118270) val="$define"
11828 echo "Yup, it can."
11829 ;;
11830*) val="$undef"
11831 echo "Nope, it can't."
11832 ;;
11833esac
11834set d_castneg
11835eval $setvar
11836$rm_try
11837
11838: see if cbrt exists
11839set cbrt d_cbrt
11840eval $inlibc
11841
11842: see if chown exists
11843set chown d_chown
11844eval $inlibc
11845
11846: see if chroot exists
11847set chroot d_chroot
11848eval $inlibc
11849
11850: see if chsize exists
11851set chsize d_chsize
11852eval $inlibc
11853
11854: see if class exists
11855set class d_class
11856eval $inlibc
11857
11858: see if clearenv exists
11859set clearenv d_clearenv
11860eval $inlibc
11861
11862: Define hasstruct macro for Configure internal use
11863hasstruct='varname=$1; struct=$2; shift; shift;
11864while $test $# -ge 2; do
11865 case "$1" in
11866 $define) echo "#include <$2>";;
11867 esac ;
11868 shift 2;
11869done > try.c;
11870echo "int main () { struct $struct foo; }" >> try.c;
11871set try;
11872if eval $compile; then
11873 val="$define";
11874else
11875 val="$undef";
11876fi;
11877set $varname;
11878eval $setvar;
11879$rm_try'
11880
11881: see whether socket exists
11882socketlib=''
11883sockethdr=''
11884echo " "
11885$echo $n "Hmm... $c" >&4
11886if set socket val -f d_socket; eval $csym; $val; then
11887 echo "Looks like you have Berkeley networking support." >&4
11888 d_socket="$define"
11889 if set setsockopt val -f; eval $csym; $val; then
11890 d_oldsock="$undef"
11891 else
11892 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11893 d_oldsock="$define"
11894 fi
11895else
11896 if $contains socklib libc.list >/dev/null 2>&1; then
11897 echo "Looks like you have Berkeley networking support." >&4
11898 d_socket="$define"
11899 : we will have to assume that it supports the 4.2 BSD interface
11900 d_oldsock="$undef"
11901 else
11902 echo "You don't have Berkeley networking in libc$_a..." >&4
11903 if test "X$d_socket" = "X$define"; then
11904 echo "...but you seem to believe that you have sockets." >&4
11905 else
11906 for net in net socket
11907 do
11908 if test -f $sysroot/usr/lib/lib$net$_a; then
11909 ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) || \
11910 $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11911 if $contains socket libc.list >/dev/null 2>&1; then
11912 d_socket="$define"
11913 socketlib="-l$net"
11914 case "$net" in
11915 net)
11916 echo "...but the Wollongong group seems to have hacked it in." >&4
11917 sockethdr="-I$sysroot/usr/netinclude"
11918 ;;
11919 esac
11920 echo "Found Berkeley sockets interface in lib$net." >&4
11921 if $contains setsockopt libc.list >/dev/null 2>&1; then
11922 d_oldsock="$undef"
11923 else
11924 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11925 d_oldsock="$define"
11926 fi
11927 break
11928 fi
11929 fi
11930 done
11931 if test "X$d_socket" != "X$define"; then
11932 echo "or anywhere else I see." >&4
11933 d_socket="$undef"
11934 d_oldsock="$undef"
11935 fi
11936 fi
11937 fi
11938fi
11939
11940: see if socketpair exists
11941set socketpair d_sockpair
11942eval $inlibc
11943
11944
11945echo " "
11946echo "Checking the availability sa_len in the sock struct ..." >&4
11947$cat >try.c <<EOF
11948#include <sys/types.h>
11949#include <sys/socket.h>
11950int main() {
11951struct sockaddr sa;
11952return (sa.sa_len);
11953}
11954EOF
11955val="$undef"
11956set try; if eval $compile; then
11957 val="$define"
11958fi
11959set d_sockaddr_sa_len; eval $setvar
11960$rm_try
11961
11962echo " "
11963echo "Checking the availability struct sockaddr_in6 ..." >&4
11964$cat >try.c <<EOF
11965#include <sys/types.h>
11966#include <sys/socket.h>
11967#include <netinet/in.h>
11968int main() {
11969struct sockaddr_in6 sin6;
11970return (sin6.sin6_family);
11971}
11972EOF
11973val="$undef"
11974set try; if eval $compile; then
11975 val="$define"
11976fi
11977set d_sockaddr_in6; eval $setvar
11978$rm_try
11979
11980echo " "
11981echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11982$cat >try.c <<EOF
11983#include <sys/types.h>
11984#include <sys/socket.h>
11985#include <netinet/in.h>
11986int main() {
11987struct sockaddr_in6 sin6;
11988return (sin6.sin6_scope_id);
11989}
11990EOF
11991val="$undef"
11992set try; if eval $compile; then
11993 val="$define"
11994fi
11995set d_sin6_scope_id; eval $setvar
11996$rm_try
11997
11998echo " "
11999echo "Checking the availability struct ip_mreq ..." >&4
12000$cat >try.c <<EOF
12001#include <sys/types.h>
12002#include <sys/socket.h>
12003#include <netinet/in.h>
12004int main() {
12005struct ip_mreq mreq;
12006return (mreq.imr_multiaddr.s_addr);
12007}
12008EOF
12009val="$undef"
12010set try; if eval $compile; then
12011 val="$define"
12012fi
12013set d_ip_mreq; eval $setvar
12014$rm_try
12015
12016echo " "
12017echo "Checking the availability struct ip_mreq_source ..." >&4
12018$cat >try.c <<EOF
12019#include <sys/types.h>
12020#include <sys/socket.h>
12021#include <netinet/in.h>
12022int main() {
12023struct ip_mreq_source mreq;
12024return (mreq.imr_multiaddr.s_addr);
12025}
12026EOF
12027val="$undef"
12028set try; if eval $compile; then
12029 val="$define"
12030fi
12031set d_ip_mreq_source; eval $setvar
12032$rm_try
12033
12034echo " "
12035echo "Checking the availability struct ipv6_mreq ..." >&4
12036$cat >try.c <<EOF
12037#include <sys/types.h>
12038#include <sys/socket.h>
12039#include <netinet/in.h>
12040int main() {
12041struct ipv6_mreq mreq;
12042return (mreq.ipv6mr_interface);
12043}
12044EOF
12045val="$undef"
12046set try; if eval $compile; then
12047 val="$define"
12048fi
12049set d_ipv6_mreq; eval $setvar
12050$rm_try
12051
12052echo " "
12053echo "Checking the availability struct ipv6_mreq_source ..." >&4
12054$cat >try.c <<EOF
12055#include <sys/types.h>
12056#include <sys/socket.h>
12057#include <netinet/in.h>
12058int main() {
12059struct ipv6_mreq_source mreq;
12060return (mreq.imr_multiaddr.s_addr);
12061}
12062EOF
12063val="$undef"
12064set try; if eval $compile; then
12065 val="$define"
12066fi
12067set d_ipv6_mreq_source; eval $setvar
12068$rm_try
12069
12070echo " "
12071echo "Checking the availability of certain socket constants..." >&4
12072for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12073 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12074 $cat >try.c <<EOF
12075#include <sys/types.h>
12076#include <sys/socket.h>
12077int main() {
12078 int i = $ENUM;
12079}
12080EOF
12081 val="$undef"
12082 set try; if eval $compile; then
12083 val="$define"
12084 fi
12085 set d_${enum}; eval $setvar
12086 $rm_try
12087done
12088
12089: see if this is a sys/uio.h system
12090set sys/uio.h i_sysuio
12091eval $inhdr
12092
12093: Check for cmsghdr support
12094echo " "
12095echo "Checking to see if your system supports struct cmsghdr..." >&4
12096set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12097eval $hasstruct
12098case "$d_cmsghdr_s" in
12099"$define") echo "Yes, it does." ;;
12100*) echo "No, it doesn't." ;;
12101esac
12102
12103: see if copysign exists
12104set copysign d_copysign
12105eval $inlibc
12106
12107: see if copysignl exists
12108set copysignl d_copysignl
12109eval $inlibc
12110
12111: see if crypt exists
12112echo " "
12113set crypt d_crypt
12114eval $inlibc
12115case "$d_crypt" in
12116$define) cryptlib='' ;;
12117*) if set crypt val -f d_crypt; eval $csym; $val; then
12118 echo 'crypt() found.' >&4
12119 val="$define"
12120 cryptlib=''
12121 else
12122 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12123 if $test -z "$cryptlib"; then
12124 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12125 else
12126 cryptlib=-lcrypt
12127 fi
12128 if $test -z "$cryptlib"; then
12129 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12130 else
12131 cryptlib=-lcrypt
12132 fi
12133 if $test -z "$cryptlib"; then
12134 cryptlib=`./loc libcrypt$_a "" $libpth`
12135 else
12136 cryptlib=-lcrypt
12137 fi
12138 if $test -z "$cryptlib"; then
12139 echo 'crypt() NOT found.' >&4
12140 val="$undef"
12141 else
12142 val="$define"
12143 fi
12144 fi
12145 set d_crypt
12146 eval $setvar
12147 ;;
12148esac
12149
12150: see if this is a crypt.h system
12151set crypt.h i_crypt
12152eval $inhdr
12153
12154: see if crypt_r exists
12155set crypt_r d_crypt_r
12156eval $inlibc
12157case "$d_crypt_r" in
12158"$define")
12159 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12160 case "$d_crypt_r_proto:$usethreads" in
12161 ":define") d_crypt_r_proto=define
12162 set d_crypt_r_proto crypt_r $hdrs
12163 eval $hasproto ;;
12164 *) ;;
12165 esac
12166 case "$d_crypt_r_proto" in
12167 define)
12168 case "$crypt_r_proto" in
12169 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12170 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12171 esac
12172 case "$crypt_r_proto" in
12173 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12174 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12175 esac
12176 case "$crypt_r_proto" in
12177 ''|0) d_crypt_r=undef
12178 crypt_r_proto=0
12179 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12180 * ) case "$crypt_r_proto" in
12181 REENTRANT_PROTO*) ;;
12182 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12183 esac
12184 echo "Prototype: $try" ;;
12185 esac
12186 ;;
12187 *) case "$usethreads" in
12188 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12189 esac
12190 d_crypt_r=undef
12191 crypt_r_proto=0
12192 ;;
12193 esac
12194 ;;
12195*) crypt_r_proto=0
12196 ;;
12197esac
12198
12199: get csh whereabouts
12200case "$csh" in
12201'csh') val="$undef" ;;
12202*) val="$define" ;;
12203esac
12204set d_csh
12205eval $setvar
12206: Respect a hint or command line value for full_csh.
12207case "$full_csh" in
12208'') full_csh=$csh ;;
12209esac
12210
12211: see if ctermid exists
12212set ctermid d_ctermid
12213eval $inlibc
12214
12215: see if ctermid_r exists
12216set ctermid_r d_ctermid_r
12217eval $inlibc
12218case "$d_ctermid_r" in
12219"$define")
12220 hdrs="$i_systypes sys/types.h define stdio.h "
12221 case "$d_ctermid_r_proto:$usethreads" in
12222 ":define") d_ctermid_r_proto=define
12223 set d_ctermid_r_proto ctermid_r $hdrs
12224 eval $hasproto ;;
12225 *) ;;
12226 esac
12227 case "$d_ctermid_r_proto" in
12228 define)
12229 case "$ctermid_r_proto" in
12230 ''|0) try='char* ctermid_r(char*);'
12231 ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12232 esac
12233 case "$ctermid_r_proto" in
12234 ''|0) d_ctermid_r=undef
12235 ctermid_r_proto=0
12236 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12237 * ) case "$ctermid_r_proto" in
12238 REENTRANT_PROTO*) ;;
12239 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12240 esac
12241 echo "Prototype: $try" ;;
12242 esac
12243 ;;
12244 *) case "$usethreads" in
12245 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12246 esac
12247 d_ctermid_r=undef
12248 ctermid_r_proto=0
12249 ;;
12250 esac
12251 ;;
12252*) ctermid_r_proto=0
12253 ;;
12254esac
12255
12256: see if ctime_r exists
12257set ctime_r d_ctime_r
12258eval $inlibc
12259case "$d_ctime_r" in
12260"$define")
12261 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12262 case "$d_ctime_r_proto:$usethreads" in
12263 ":define") d_ctime_r_proto=define
12264 set d_ctime_r_proto ctime_r $hdrs
12265 eval $hasproto ;;
12266 *) ;;
12267 esac
12268 case "$d_ctime_r_proto" in
12269 define)
12270 case "$ctime_r_proto" in
12271 ''|0) try='char* ctime_r(const time_t*, char*);'
12272 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12273 esac
12274 case "$ctime_r_proto" in
12275 ''|0) try='char* ctime_r(const time_t*, char*, int);'
12276 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12277 esac
12278 case "$ctime_r_proto" in
12279 ''|0) try='int ctime_r(const time_t*, char*);'
12280 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12281 esac
12282 case "$ctime_r_proto" in
12283 ''|0) try='int ctime_r(const time_t*, char*, int);'
12284 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12285 esac
12286 case "$ctime_r_proto" in
12287 ''|0) d_ctime_r=undef
12288 ctime_r_proto=0
12289 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12290 * ) case "$ctime_r_proto" in
12291 REENTRANT_PROTO*) ;;
12292 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12293 esac
12294 echo "Prototype: $try" ;;
12295 esac
12296 ;;
12297 *) case "$usethreads" in
12298 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12299 esac
12300 d_ctime_r=undef
12301 ctime_r_proto=0
12302 ;;
12303 esac
12304 ;;
12305*) ctime_r_proto=0
12306 ;;
12307esac
12308
12309: see if cuserid exists
12310set cuserid d_cuserid
12311eval $inlibc
12312
12313: see if dbm.h is available
12314: see if dbmclose exists
12315set dbmclose d_dbmclose
12316eval $inlibc
12317
12318case "$d_dbmclose" in
12319$define)
12320 set dbm.h i_dbm
12321 eval $inhdr
12322 case "$i_dbm" in
12323 $define)
12324 val="$undef"
12325 set i_rpcsvcdbm
12326 eval $setvar
12327 ;;
12328 *) set rpcsvc/dbm.h i_rpcsvcdbm
12329 eval $inhdr
12330 ;;
12331 esac
12332 ;;
12333*) echo "We won't be including <dbm.h>"
12334 val="$undef"
12335 set i_dbm
12336 eval $setvar
12337 val="$undef"
12338 set i_rpcsvcdbm
12339 eval $setvar
12340 ;;
12341esac
12342
12343: see if prototype for dbminit is available
12344echo " "
12345set d_dbminitproto dbminit $i_dbm dbm.h
12346eval $hasproto
12347
12348: see if difftime exists
12349set difftime d_difftime
12350eval $inlibc
12351
12352: see if this is a dirent system
12353echo " "
12354if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12355 val="$define"
12356 echo "<dirent.h> found." >&4
12357else
12358 val="$undef"
12359 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12360 echo "<sys/dir.h> found." >&4
12361 echo " "
12362 else
12363 xinc=`./findhdr sys/ndir.h`
12364 fi
12365 echo "<dirent.h> NOT found." >&4
12366fi
12367set i_dirent
12368eval $setvar
12369
12370: Look for type of directory structure.
12371echo " "
12372$cppstdin $cppflags $cppminus < "$xinc" > try.c
12373
12374case "$direntrytype" in
12375''|' ')
12376 case "$i_dirent" in
12377 $define) guess1='struct dirent' ;;
12378 *) guess1='struct direct' ;;
12379 esac
12380 ;;
12381*) guess1="$direntrytype"
12382 ;;
12383esac
12384
12385case "$guess1" in
12386'struct dirent') guess2='struct direct' ;;
12387*) guess2='struct dirent' ;;
12388esac
12389
12390if $contains "$guess1" try.c >/dev/null 2>&1; then
12391 direntrytype="$guess1"
12392 echo "Your directory entries are $direntrytype." >&4
12393elif $contains "$guess2" try.c >/dev/null 2>&1; then
12394 direntrytype="$guess2"
12395 echo "Your directory entries seem to be $direntrytype." >&4
12396else
12397 echo "I don't recognize your system's directory entries." >&4
12398 rp="What type is used for directory entries on this system?"
12399 dflt="$guess1"
12400 . ./myread
12401 direntrytype="$ans"
12402fi
12403$rm_try
12404
12405: see if the directory entry stores field length
12406echo " "
12407$cppstdin $cppflags $cppminus < "$xinc" > try.c
12408if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12409 echo "Good, your directory entry keeps length information in d_namlen." >&4
12410 val="$define"
12411else
12412 echo "Your directory entry does not know about the d_namlen field." >&4
12413 val="$undef"
12414fi
12415set d_dirnamlen
12416eval $setvar
12417$rm_try
12418
12419: Look for DIR.dd_fd
12420case "$i_dirent" in
12421"$define")
12422 echo "Checking to see if DIR has a dd_fd member variable" >&4
12423 $cat >try.c <<EOCP
12424#$i_stdlib I_STDLIB
12425#ifdef I_STDLIB
12426#include <stdlib.h>
12427#endif
12428#include <dirent.h>
12429
12430int main() {
12431 DIR dir;
12432 dir.dd_fd = 1;
12433 return 0;
12434}
12435EOCP
12436 val=$undef
12437 set try
12438 if eval $compile; then
12439 echo "Yes, it does."
12440 val="$define"
12441 else
12442 echo "No, it does not."
12443 val="$undef"
12444 fi
12445 ;;
12446*)
12447 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12448 val="$undef"
12449 ;;
12450esac
12451set d_dir_dd_fd
12452eval $setvar
12453$rm_try
12454
12455: see if this is an sysdir system
12456set sys/dir.h i_sysdir
12457eval $inhdr
12458
12459: see if this is an sysndir system
12460set sys/ndir.h i_sysndir
12461eval $inhdr
12462
12463: Look for dirfd
12464echo " "
12465$cat >dirfd.c <<EOM
12466#include <stdio.h>
12467#$i_stdlib I_STDLIB
12468#ifdef I_STDLIB
12469#include <stdlib.h>
12470#endif
12471#$i_dirent I_DIRENT /**/
12472#$i_sysdir I_SYS_DIR /**/
12473#$i_sysndir I_SYS_NDIR /**/
12474#$i_systypes I_SYS_TYPES /**/
12475#if defined(I_SYS_TYPES)
12476#include <sys/types.h>
12477#endif
12478#if defined(I_DIRENT)
12479#include <dirent.h>
12480#else
12481#ifdef I_SYS_NDIR
12482#include <sys/ndir.h>
12483#else
12484#ifdef I_SYS_DIR
12485#include <sys/dir.h>
12486#endif
12487#endif
12488#endif
12489int main() {
12490 DIR *dirp = opendir(".");
12491 if (dirfd(dirp) >= 0)
12492 exit(0);
12493 else
12494 exit(1);
12495}
12496EOM
12497val=$undef
12498set dirfd
12499if eval $compile; then
12500 val="$define"
12501fi
12502case "$val" in
12503$define) echo "dirfd() found." >&4 ;;
12504*) echo "dirfd() NOT found." >&4 ;;
12505esac
12506set d_dirfd
12507eval $setvar
12508$rm -f dirfd*
12509
12510: see if dladdr exists
12511set dladdr d_dladdr
12512eval $inlibc
12513
12514: see if dlerror exists
12515xxx_runnm="$runnm"
12516runnm=false
12517set dlerror d_dlerror
12518eval $inlibc
12519runnm="$xxx_runnm"
12520
12521: see if dlfcn is available
12522set dlfcn.h i_dlfcn
12523eval $inhdr
12524
12525: Check what extension to use for shared libs
12526case "$usedl" in
12527$define|y|true)
12528 $cat << EOM
12529
12530On a few systems, the dynamically loaded modules that perl generates and uses
12531will need a different extension than shared libs. The default will probably
12532be appropriate.
12533
12534EOM
12535 case "$dlext" in
12536 '') dflt="$so" ;;
12537 *) dflt="$dlext" ;;
12538 esac
12539 rp='What is the extension of dynamically loaded modules'
12540 . ./myread
12541 dlext="$ans"
12542 ;;
12543*)
12544 dlext="none"
12545 ;;
12546esac
12547
12548: Check if dlsym need a leading underscore
12549echo " "
12550val="$undef"
12551
12552case "$dlsrc" in
12553dl_dlopen.xs)
12554 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12555 $cat >dyna.c <<'EOM'
12556fred () { }
12557EOM
12558
12559$cat >fred.c<<EOM
12560
12561#include <stdio.h>
12562#$i_stdlib I_STDLIB
12563#ifdef I_STDLIB
12564#include <stdlib.h>
12565#endif
12566#$i_dlfcn I_DLFCN
12567#ifdef I_DLFCN
12568#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
12569#else
12570#include <sys/types.h>
12571#include <nlist.h>
12572#include <link.h>
12573#endif
12574
12575extern int fred() ;
12576
12577int main()
12578{
12579 void * handle ;
12580 void * symbol ;
12581#ifndef RTLD_LAZY
12582 int mode = 1 ;
12583#else
12584 int mode = RTLD_LAZY ;
12585#endif
12586 handle = dlopen("./dyna.$dlext", mode) ;
12587 if (handle == NULL) {
12588 printf ("1\n") ;
12589 fflush (stdout) ;
12590 exit(0);
12591 }
12592 symbol = dlsym(handle, "fred") ;
12593 if (symbol == NULL) {
12594 /* try putting a leading underscore */
12595 symbol = dlsym(handle, "_fred") ;
12596 if (symbol == NULL) {
12597 printf ("2\n") ;
12598 fflush (stdout) ;
12599 exit(0);
12600 }
12601 printf ("3\n") ;
12602 }
12603 else
12604 printf ("4\n") ;
12605 fflush (stdout) ;
12606 exit(0);
12607}
12608EOM
12609 : Call the object file tmp-dyna.o in case dlext=o.
12610 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12611 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12612 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12613 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12614 xxx=`$run ./fred`
12615 case $xxx in
12616 1) echo "Test program failed using dlopen." >&4
12617 echo "Perhaps you should not use dynamic loading." >&4;;
12618 2) echo "Test program failed using dlsym." >&4
12619 echo "Perhaps you should not use dynamic loading." >&4;;
12620 3) echo "dlsym needs a leading underscore" >&4
12621 val="$define" ;;
12622 4) echo "dlsym doesn't need a leading underscore." >&4;;
12623 esac
12624 else
12625 echo "I can't compile and run the test program." >&4
12626 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12627 fi
12628 ;;
12629esac
12630
12631$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12632
12633set d_dlsymun
12634eval $setvar
12635
12636: see if drand48_r exists
12637set drand48_r d_drand48_r
12638eval $inlibc
12639case "$d_drand48_r" in
12640"$define")
12641 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12642 case "$d_drand48_r_proto:$usethreads" in
12643 ":define") d_drand48_r_proto=define
12644 set d_drand48_r_proto drand48_r $hdrs
12645 eval $hasproto ;;
12646 *) ;;
12647 esac
12648 case "$d_drand48_r_proto" in
12649 define)
12650 case "$drand48_r_proto" in
12651 ''|0) try='int drand48_r(struct drand48_data*, double*);'
12652 ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12653 esac
12654 case "$drand48_r_proto" in
12655 ''|0) d_drand48_r=undef
12656 drand48_r_proto=0
12657 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12658 * ) case "$drand48_r_proto" in
12659 REENTRANT_PROTO*) ;;
12660 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12661 esac
12662 echo "Prototype: $try" ;;
12663 esac
12664 ;;
12665 *) case "$usethreads" in
12666 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12667 esac
12668 d_drand48_r=undef
12669 drand48_r_proto=0
12670 ;;
12671 esac
12672 ;;
12673*) drand48_r_proto=0
12674 ;;
12675esac
12676
12677: see if prototype for drand48 is available
12678echo " "
12679set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12680eval $hasproto
12681
12682: see if dup2 exists
12683set dup2 d_dup2
12684eval $inlibc
12685
12686: see if dup3 exists
12687set dup3 d_dup3
12688eval $inlibc
12689
12690: see if this is an xlocale.h system
12691set xlocale.h i_xlocale
12692eval $inhdr
12693
12694: see if newlocale exists
12695set newlocale d_newlocale
12696eval $inlibc
12697
12698: see if freelocale exists
12699set freelocale d_freelocale
12700eval $inlibc
12701
12702: see if uselocale exists
12703set uselocale d_uselocale
12704eval $inlibc
12705
12706: see if duplocale exists
12707set duplocale d_duplocale
12708eval $inlibc
12709
12710: see if querylocale exists
12711set querylocale d_querylocale
12712eval $inlibc
12713
12714: see if eaccess exists
12715set eaccess d_eaccess
12716eval $inlibc
12717
12718: see if endgrent exists
12719set endgrent d_endgrent
12720eval $inlibc
12721
12722: see if this is an grp system
12723set grp.h i_grp
12724eval $inhdr
12725
12726case "$i_grp" in
12727$define)
12728 xxx=`./findhdr grp.h`
12729 $cppstdin $cppflags $cppminus < $xxx >$$.h
12730
12731 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12732 val="$define"
12733 else
12734 val="$undef"
12735 fi
12736 set d_grpasswd
12737 eval $setvar
12738
12739 $rm -f $$.h
12740 ;;
12741*)
12742 val="$undef";
12743 set d_grpasswd; eval $setvar
12744 ;;
12745esac
12746
12747: see if endgrent_r exists
12748set endgrent_r d_endgrent_r
12749eval $inlibc
12750case "$d_endgrent_r" in
12751"$define")
12752 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12753 case "$d_endgrent_r_proto:$usethreads" in
12754 ":define") d_endgrent_r_proto=define
12755 set d_endgrent_r_proto endgrent_r $hdrs
12756 eval $hasproto ;;
12757 *) ;;
12758 esac
12759 case "$d_endgrent_r_proto" in
12760 define)
12761 case "$endgrent_r_proto" in
12762 ''|0) try='int endgrent_r(FILE**);'
12763 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12764 esac
12765 case "$endgrent_r_proto" in
12766 ''|0) try='void endgrent_r(FILE**);'
12767 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12768 esac
12769 case "$endgrent_r_proto" in
12770 ''|0) d_endgrent_r=undef
12771 endgrent_r_proto=0
12772 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12773 * ) case "$endgrent_r_proto" in
12774 REENTRANT_PROTO*) ;;
12775 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12776 esac
12777 echo "Prototype: $try" ;;
12778 esac
12779 ;;
12780 *) case "$usethreads" in
12781 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12782 esac
12783 d_endgrent_r=undef
12784 endgrent_r_proto=0
12785 ;;
12786 esac
12787 ;;
12788*) endgrent_r_proto=0
12789 ;;
12790esac
12791
12792: see if endhostent exists
12793set endhostent d_endhent
12794eval $inlibc
12795
12796: see if this is a netdb.h system
12797set netdb.h i_netdb
12798eval $inhdr
12799
12800: see if endhostent_r exists
12801set endhostent_r d_endhostent_r
12802eval $inlibc
12803case "$d_endhostent_r" in
12804"$define")
12805 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12806 case "$d_endhostent_r_proto:$usethreads" in
12807 ":define") d_endhostent_r_proto=define
12808 set d_endhostent_r_proto endhostent_r $hdrs
12809 eval $hasproto ;;
12810 *) ;;
12811 esac
12812 case "$d_endhostent_r_proto" in
12813 define)
12814 case "$endhostent_r_proto" in
12815 ''|0) try='int endhostent_r(struct hostent_data*);'
12816 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12817 esac
12818 case "$endhostent_r_proto" in
12819 ''|0) try='void endhostent_r(struct hostent_data*);'
12820 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12821 esac
12822 case "$endhostent_r_proto" in
12823 ''|0) d_endhostent_r=undef
12824 endhostent_r_proto=0
12825 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12826 * ) case "$endhostent_r_proto" in
12827 REENTRANT_PROTO*) ;;
12828 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12829 esac
12830 echo "Prototype: $try" ;;
12831 esac
12832 ;;
12833 *) case "$usethreads" in
12834 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12835 esac
12836 d_endhostent_r=undef
12837 endhostent_r_proto=0
12838 ;;
12839 esac
12840 ;;
12841*) endhostent_r_proto=0
12842 ;;
12843esac
12844
12845: see if endnetent exists
12846set endnetent d_endnent
12847eval $inlibc
12848
12849: see if endnetent_r exists
12850set endnetent_r d_endnetent_r
12851eval $inlibc
12852case "$d_endnetent_r" in
12853"$define")
12854 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12855 case "$d_endnetent_r_proto:$usethreads" in
12856 ":define") d_endnetent_r_proto=define
12857 set d_endnetent_r_proto endnetent_r $hdrs
12858 eval $hasproto ;;
12859 *) ;;
12860 esac
12861 case "$d_endnetent_r_proto" in
12862 define)
12863 case "$endnetent_r_proto" in
12864 ''|0) try='int endnetent_r(struct netent_data*);'
12865 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12866 esac
12867 case "$endnetent_r_proto" in
12868 ''|0) try='void endnetent_r(struct netent_data*);'
12869 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12870 esac
12871 case "$endnetent_r_proto" in
12872 ''|0) d_endnetent_r=undef
12873 endnetent_r_proto=0
12874 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12875 * ) case "$endnetent_r_proto" in
12876 REENTRANT_PROTO*) ;;
12877 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12878 esac
12879 echo "Prototype: $try" ;;
12880 esac
12881 ;;
12882 *) case "$usethreads" in
12883 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12884 esac
12885 d_endnetent_r=undef
12886 endnetent_r_proto=0
12887 ;;
12888 esac
12889 ;;
12890*) endnetent_r_proto=0
12891 ;;
12892esac
12893
12894: see if endprotoent exists
12895set endprotoent d_endpent
12896eval $inlibc
12897
12898: see if endprotoent_r exists
12899set endprotoent_r d_endprotoent_r
12900eval $inlibc
12901case "$d_endprotoent_r" in
12902"$define")
12903 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12904 case "$d_endprotoent_r_proto:$usethreads" in
12905 ":define") d_endprotoent_r_proto=define
12906 set d_endprotoent_r_proto endprotoent_r $hdrs
12907 eval $hasproto ;;
12908 *) ;;
12909 esac
12910 case "$d_endprotoent_r_proto" in
12911 define)
12912 case "$endprotoent_r_proto" in
12913 ''|0) try='int endprotoent_r(struct protoent_data*);'
12914 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12915 esac
12916 case "$endprotoent_r_proto" in
12917 ''|0) try='void endprotoent_r(struct protoent_data*);'
12918 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12919 esac
12920 case "$endprotoent_r_proto" in
12921 ''|0) d_endprotoent_r=undef
12922 endprotoent_r_proto=0
12923 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12924 * ) case "$endprotoent_r_proto" in
12925 REENTRANT_PROTO*) ;;
12926 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12927 esac
12928 echo "Prototype: $try" ;;
12929 esac
12930 ;;
12931 *) case "$usethreads" in
12932 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12933 esac
12934 d_endprotoent_r=undef
12935 endprotoent_r_proto=0
12936 ;;
12937 esac
12938 ;;
12939*) endprotoent_r_proto=0
12940 ;;
12941esac
12942
12943: see if endpwent exists
12944set endpwent d_endpwent
12945eval $inlibc
12946
12947: see if this is a pwd.h system
12948set pwd.h i_pwd
12949eval $inhdr
12950
12951case "$i_pwd" in
12952$define)
12953 xxx=`./findhdr pwd.h`
12954 $cppstdin $cppflags $cppminus < $xxx >$$.h
12955
12956 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12957 val="$define"
12958 else
12959 val="$undef"
12960 fi
12961 set d_pwquota
12962 eval $setvar
12963
12964 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12965 val="$define"
12966 else
12967 val="$undef"
12968 fi
12969 set d_pwage
12970 eval $setvar
12971
12972 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12973 val="$define"
12974 else
12975 val="$undef"
12976 fi
12977 set d_pwchange
12978 eval $setvar
12979
12980 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12981 val="$define"
12982 else
12983 val="$undef"
12984 fi
12985 set d_pwclass
12986 eval $setvar
12987
12988 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12989 val="$define"
12990 else
12991 val="$undef"
12992 fi
12993 set d_pwexpire
12994 eval $setvar
12995
12996 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12997 val="$define"
12998 else
12999 val="$undef"
13000 fi
13001 set d_pwcomment
13002 eval $setvar
13003
13004 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13005 val="$define"
13006 else
13007 val="$undef"
13008 fi
13009 set d_pwgecos
13010 eval $setvar
13011
13012 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13013 val="$define"
13014 else
13015 val="$undef"
13016 fi
13017 set d_pwpasswd
13018 eval $setvar
13019
13020 $rm -f $$.h
13021 ;;
13022*)
13023 val="$undef";
13024 set d_pwquota; eval $setvar
13025 set d_pwage; eval $setvar
13026 set d_pwchange; eval $setvar
13027 set d_pwclass; eval $setvar
13028 set d_pwexpire; eval $setvar
13029 set d_pwcomment; eval $setvar
13030 set d_pwgecos; eval $setvar
13031 set d_pwpasswd; eval $setvar
13032 ;;
13033esac
13034
13035: see if endpwent_r exists
13036set endpwent_r d_endpwent_r
13037eval $inlibc
13038case "$d_endpwent_r" in
13039"$define")
13040 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13041 case "$d_endpwent_r_proto:$usethreads" in
13042 ":define") d_endpwent_r_proto=define
13043 set d_endpwent_r_proto endpwent_r $hdrs
13044 eval $hasproto ;;
13045 *) ;;
13046 esac
13047 case "$d_endpwent_r_proto" in
13048 define)
13049 case "$endpwent_r_proto" in
13050 ''|0) try='int endpwent_r(FILE**);'
13051 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13052 esac
13053 case "$endpwent_r_proto" in
13054 ''|0) try='void endpwent_r(FILE**);'
13055 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13056 esac
13057 case "$endpwent_r_proto" in
13058 ''|0) d_endpwent_r=undef
13059 endpwent_r_proto=0
13060 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13061 * ) case "$endpwent_r_proto" in
13062 REENTRANT_PROTO*) ;;
13063 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13064 esac
13065 echo "Prototype: $try" ;;
13066 esac
13067 ;;
13068 *) case "$usethreads" in
13069 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13070 esac
13071 d_endpwent_r=undef
13072 endpwent_r_proto=0
13073 ;;
13074 esac
13075 ;;
13076*) endpwent_r_proto=0
13077 ;;
13078esac
13079
13080: see if endservent exists
13081set endservent d_endsent
13082eval $inlibc
13083
13084: see if endservent_r exists
13085set endservent_r d_endservent_r
13086eval $inlibc
13087case "$d_endservent_r" in
13088"$define")
13089 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13090 case "$d_endservent_r_proto:$usethreads" in
13091 ":define") d_endservent_r_proto=define
13092 set d_endservent_r_proto endservent_r $hdrs
13093 eval $hasproto ;;
13094 *) ;;
13095 esac
13096 case "$d_endservent_r_proto" in
13097 define)
13098 case "$endservent_r_proto" in
13099 ''|0) try='int endservent_r(struct servent_data*);'
13100 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13101 esac
13102 case "$endservent_r_proto" in
13103 ''|0) try='void endservent_r(struct servent_data*);'
13104 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13105 esac
13106 case "$endservent_r_proto" in
13107 ''|0) d_endservent_r=undef
13108 endservent_r_proto=0
13109 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13110 * ) case "$endservent_r_proto" in
13111 REENTRANT_PROTO*) ;;
13112 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13113 esac
13114 echo "Prototype: $try" ;;
13115 esac
13116 ;;
13117 *) case "$usethreads" in
13118 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13119 esac
13120 d_endservent_r=undef
13121 endservent_r_proto=0
13122 ;;
13123 esac
13124 ;;
13125*) endservent_r_proto=0
13126 ;;
13127esac
13128
13129: Locate the flags for 'open()'
13130echo " "
13131$cat >try.c <<EOCP
13132#include <sys/types.h>
13133#ifdef I_FCNTL
13134#include <fcntl.h>
13135#endif
13136#ifdef I_SYS_FILE
13137#include <sys/file.h>
13138#endif
13139#$i_stdlib I_STDLIB
13140#ifdef I_STDLIB
13141#include <stdlib.h>
13142#endif
13143int main() {
13144 if(O_RDONLY);
13145#ifdef O_TRUNC
13146 exit(0);
13147#else
13148 exit(1);
13149#endif
13150}
13151EOCP
13152: check sys/file.h first to get FREAD on Sun
13153if $test `./findhdr sys/file.h` && \
13154 set try -DI_SYS_FILE && eval $compile; then
13155 h_sysfile=true;
13156 echo "<sys/file.h> defines the O_* constants..." >&4
13157 if $run ./try; then
13158 echo "and you have the 3 argument form of open()." >&4
13159 val="$define"
13160 else
13161 echo "but not the 3 argument form of open(). Oh, well." >&4
13162 val="$undef"
13163 fi
13164elif $test `./findhdr fcntl.h` && \
13165 set try -DI_FCNTL && eval $compile; then
13166 h_fcntl=true;
13167 echo "<fcntl.h> defines the O_* constants..." >&4
13168 if $run ./try; then
13169 echo "and you have the 3 argument form of open()." >&4
13170 val="$define"
13171 else
13172 echo "but not the 3 argument form of open(). Oh, well." >&4
13173 val="$undef"
13174 fi
13175else
13176 val="$undef"
13177 echo "I can't find the O_* constant definitions! You got problems." >&4
13178fi
13179set d_open3
13180eval $setvar
13181$rm_try
13182
13183: see if this is a sys/file.h system
13184val=''
13185set sys/file.h val
13186eval $inhdr
13187
13188: do we need to include sys/file.h ?
13189case "$val" in
13190"$define")
13191 echo " "
13192 if $h_sysfile; then
13193 val="$define"
13194 echo "We'll be including <sys/file.h>." >&4
13195 else
13196 val="$undef"
13197 echo "We won't be including <sys/file.h>." >&4
13198 fi
13199 ;;
13200*)
13201 h_sysfile=false
13202 ;;
13203esac
13204set i_sysfile
13205eval $setvar
13206
13207: see if fcntl.h is there
13208val=''
13209set fcntl.h val
13210eval $inhdr
13211
13212: see if we can include fcntl.h
13213case "$val" in
13214"$define")
13215 echo " "
13216 if $h_fcntl; then
13217 val="$define"
13218 echo "We'll be including <fcntl.h>." >&4
13219 else
13220 val="$undef"
13221 if $h_sysfile; then
13222 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13223 else
13224 echo "We won't be including <fcntl.h>." >&4
13225 fi
13226 fi
13227 ;;
13228*)
13229 h_fcntl=false
13230 val="$undef"
13231 ;;
13232esac
13233set i_fcntl
13234eval $setvar
13235
13236: see if fork exists
13237set fork d_fork
13238eval $inlibc
13239
13240: see if pipe exists
13241set pipe d_pipe
13242eval $inlibc
13243
13244: check for non-blocking I/O stuff
13245case "$h_sysfile" in
13246true) echo "#include <sys/file.h>" > head.c;;
13247*)
13248 case "$h_fcntl" in
13249 true) echo "#include <fcntl.h>" > head.c;;
13250 *) echo "#include <sys/fcntl.h>" > head.c;;
13251 esac
13252 ;;
13253esac
13254echo " "
13255echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13256case "$o_nonblock" in
13257'')
13258 $cat head.c > try.c
13259 $cat >>try.c <<EOCP
13260#include <stdio.h>
13261#$i_stdlib I_STDLIB
13262#ifdef I_STDLIB
13263#include <stdlib.h>
13264#endif
13265#$i_fcntl I_FCNTL
13266#ifdef I_FCNTL
13267#include <fcntl.h>
13268#endif
13269int main() {
13270#ifdef O_NONBLOCK
13271 printf("O_NONBLOCK\n");
13272 exit(0);
13273#endif
13274#ifdef O_NDELAY
13275 printf("O_NDELAY\n");
13276 exit(0);
13277#endif
13278#ifdef FNDELAY
13279 printf("FNDELAY\n");
13280 exit(0);
13281#endif
13282 exit(0);
13283}
13284EOCP
13285 set try
13286 if eval $compile_ok; then
13287 o_nonblock=`$run ./try`
13288 case "$o_nonblock" in
13289 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13290 *) echo "Seems like we can use $o_nonblock.";;
13291 esac
13292 else
13293 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13294 fi
13295 ;;
13296*) echo "Using $hint value $o_nonblock.";;
13297esac
13298$rm_try
13299
13300echo " "
13301echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13302case "$eagain" in
13303'')
13304 case "$d_fork:$d_pipe:$d_alarm" in
13305 define:define:define)
13306 $cat head.c > try.c
13307 $cat >>try.c <<EOCP
13308#include <errno.h>
13309#include <sys/types.h>
13310#include <signal.h>
13311#include <stdio.h>
13312#$i_stdlib I_STDLIB
13313#ifdef I_STDLIB
13314#include <stdlib.h>
13315#endif
13316#$i_fcntl I_FCNTL
13317#ifdef I_FCNTL
13318#include <fcntl.h>
13319#endif
13320#define MY_O_NONBLOCK $o_nonblock
13321#ifndef errno /* XXX need better Configure test */
13322extern int errno;
13323#endif
13324#$i_unistd I_UNISTD
13325#ifdef I_UNISTD
13326#include <unistd.h>
13327#endif
13328#include <string.h>
13329$signal_t blech(int x) { exit(3); }
13330EOCP
13331 $cat >> try.c <<'EOCP'
13332int main()
13333{
13334 int pd[2];
13335 int pu[2];
13336 char buf[1];
13337 char string[100];
13338 int ret;
13339
13340 ret = pipe(pd); /* Down: child -> parent */
13341 if (ret != 0)
13342 exit(3);
13343 ret = pipe(pu); /* Up: parent -> child */
13344 if (ret != 0)
13345 exit(3);
13346 if (0 != fork()) {
13347 close(pd[1]); /* Parent reads from pd[0] */
13348 close(pu[0]); /* Parent writes (blocking) to pu[1] */
13349#ifdef F_SETFL
13350 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13351 exit(1);
13352#else
13353 exit(4);
13354#endif
13355 signal(SIGALRM, blech);
13356 alarm(5);
13357 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
13358 exit(2);
13359 sprintf(string, "%d\n", ret);
13360 ret = write(2, string, strlen(string));
13361 if (ret != strlen(string))
13362 exit(3);
13363 alarm(0);
13364#ifdef EAGAIN
13365 if (errno == EAGAIN) {
13366 printf("EAGAIN\n");
13367 goto ok;
13368 }
13369#endif
13370#ifdef EWOULDBLOCK
13371 if (errno == EWOULDBLOCK)
13372 printf("EWOULDBLOCK\n");
13373#endif
13374 ok:
13375 ret = write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
13376 if (ret != 1)
13377 exit(3);
13378 sleep(2); /* Give it time to close our pipe */
13379 alarm(5);
13380 ret = read(pd[0], buf, 1); /* Should read EOF */
13381 alarm(0);
13382 sprintf(string, "%d\n", ret);
13383 ret = write(4, string, strlen(string));
13384 if (ret != strlen(string))
13385 exit(3);
13386 exit(0);
13387 }
13388
13389 close(pd[0]); /* We write to pd[1] */
13390 close(pu[1]); /* We read from pu[0] */
13391 ret = read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
13392 if (ret != 1)
13393 exit(3);
13394 close(pd[1]); /* Pipe pd is now fully closed! */
13395 exit(0); /* Bye bye, thank you for playing! */
13396}
13397EOCP
13398 set try
13399 if eval $compile_ok; then
13400 echo "$startsh" >mtry
13401 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13402 chmod +x mtry
13403 $run ./mtry >/dev/null 2>&1
13404 case $? in
13405 0) eagain=`$cat try.out`;;
13406 1) echo "Could not perform non-blocking setting!";;
13407 2) echo "I did a successful read() for something that was not there!";;
13408 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13409 4) echo "Could not find F_SETFL!";;
13410 *) echo "Something terribly wrong happened during testing.";;
13411 esac
13412 rd_nodata=`$cat try.ret`
13413 echo "A read() system call with no data present returns $rd_nodata."
13414 case "$rd_nodata" in
13415 0|-1) ;;
13416 *)
13417 echo "(That's peculiar, fixing that to be -1.)"
13418 rd_nodata=-1
13419 ;;
13420 esac
13421 case "$eagain" in
13422 '')
13423 echo "Forcing errno EAGAIN on read() with no data available."
13424 eagain=EAGAIN
13425 ;;
13426 *)
13427 echo "Your read() sets errno to $eagain when no data is available."
13428 ;;
13429 esac
13430 status=`$cat try.err`
13431 case "$status" in
13432 0) echo "And it correctly returns 0 to signal EOF.";;
13433 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13434 *) echo "However, your read() returns '$status' on EOF??";;
13435 esac
13436 val="$define"
13437 if test "$status" = "$rd_nodata"; then
13438 echo "WARNING: you can't distinguish between EOF and no data!"
13439 val="$undef"
13440 fi
13441 else
13442 echo "I can't compile the test program--assuming errno EAGAIN will do."
13443 eagain=EAGAIN
13444 fi
13445 ;;
13446 *) echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13447 eagain=EAGAIN
13448 val="$define"
13449 ;;
13450 esac
13451 set d_eofnblk
13452 eval $setvar
13453 ;;
13454*)
13455 echo "Using $hint value $eagain."
13456 echo "Your read() returns $rd_nodata when no data is present."
13457 case "$d_eofnblk" in
13458 "$define") echo "And you can see EOF because read() returns 0.";;
13459 "$undef") echo "But you can't see EOF status from read() returned value.";;
13460 *)
13461 echo "(Assuming you can't see EOF status from read anyway.)"
13462 d_eofnblk=$undef
13463 ;;
13464 esac
13465 ;;
13466esac
13467$rm_try head.c mtry
13468
13469: see if erf exists
13470set erf d_erf
13471eval $inlibc
13472
13473: see if erfc exists
13474set erfc d_erfc
13475eval $inlibc
13476
13477: see if exp2 exists
13478set exp2 d_exp2
13479eval $inlibc
13480
13481: see if expm1 exists
13482set expm1 d_expm1
13483eval $inlibc
13484
13485: see if _ptr and _cnt from stdio act std
13486echo " "
13487
13488if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13489 echo "(Looks like you have stdio.h from BSD.)"
13490 case "$stdio_ptr" in
13491 '') stdio_ptr='((fp)->_p)'
13492 ptr_lval=$define
13493 ;;
13494 *) ptr_lval=$d_stdio_ptr_lval;;
13495 esac
13496 case "$stdio_cnt" in
13497 '') stdio_cnt='((fp)->_r)'
13498 cnt_lval=$define
13499 ;;
13500 *) cnt_lval=$d_stdio_cnt_lval;;
13501 esac
13502 case "$stdio_base" in
13503 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13504 esac
13505 case "$stdio_bufsiz" in
13506 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13507 esac
13508elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13509 echo "(Looks like you have stdio.h from Linux.)"
13510 case "$stdio_ptr" in
13511 '') stdio_ptr='((fp)->_IO_read_ptr)'
13512 ptr_lval=$define
13513 ;;
13514 *) ptr_lval=$d_stdio_ptr_lval;;
13515 esac
13516 case "$stdio_cnt" in
13517 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13518 cnt_lval=$undef
13519 ;;
13520 *) cnt_lval=$d_stdio_cnt_lval;;
13521 esac
13522 case "$stdio_base" in
13523 '') stdio_base='((fp)->_IO_read_base)';;
13524 esac
13525 case "$stdio_bufsiz" in
13526 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13527 esac
13528else
13529 case "$stdio_ptr" in
13530 '') stdio_ptr='((fp)->_ptr)'
13531 ptr_lval=$define
13532 ;;
13533 *) ptr_lval=$d_stdio_ptr_lval;;
13534 esac
13535 case "$stdio_cnt" in
13536 '') stdio_cnt='((fp)->_cnt)'
13537 cnt_lval=$define
13538 ;;
13539 *) cnt_lval=$d_stdio_cnt_lval;;
13540 esac
13541 case "$stdio_base" in
13542 '') stdio_base='((fp)->_base)';;
13543 esac
13544 case "$stdio_bufsiz" in
13545 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13546 esac
13547fi
13548
13549: test whether _ptr and _cnt really work
13550echo "Checking how std your stdio is..." >&4
13551$cat >try.c <<EOP
13552#include <stdio.h>
13553#$i_stdlib I_STDLIB
13554#ifdef I_STDLIB
13555#include <stdlib.h>
13556#endif
13557#define FILE_ptr(fp) $stdio_ptr
13558#define FILE_cnt(fp) $stdio_cnt
13559int main() {
13560 FILE *fp = fopen("try.c", "r");
13561 char c = getc(fp);
13562 if (
13563 18 <= FILE_cnt(fp) &&
13564 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13565 )
13566 exit(0);
13567 exit(1);
13568}
13569EOP
13570val="$undef"
13571set try
13572if eval $compile && $to try.c; then
13573 if $run ./try; then
13574 echo "Your stdio acts pretty std."
13575 val="$define"
13576 else
13577 echo "Your stdio isn't very std."
13578 fi
13579else
13580 echo "Your stdio doesn't appear very std."
13581fi
13582$rm_try
13583
13584# glibc 2.2.90 and above apparently change stdio streams so Perl's
13585# direct buffer manipulation no longer works. The Configure tests
13586# should be changed to correctly detect this, but until then,
13587# the following check should at least let perl compile and run.
13588# (This quick fix should be updated before 5.8.1.)
13589# To be defensive, reject all unknown versions, and all versions > 2.2.9.
13590# A. Dougherty, June 3, 2002.
13591case "$d_gnulibc" in
13592$define)
13593 case "$gnulibc_version" in
13594 2.[01]*) ;;
13595 2.2) ;;
13596 2.2.[0-9]) ;;
13597 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13598 val="$undef"
13599 ;;
13600 esac
13601 ;;
13602esac
13603set d_stdstdio
13604eval $setvar
13605
13606: Can _ptr be used as an lvalue?
13607case "$d_stdstdio$ptr_lval" in
13608$define$define) val=$define ;;
13609*) val=$undef ;;
13610esac
13611set d_stdio_ptr_lval
13612eval $setvar
13613
13614: Can _cnt be used as an lvalue?
13615case "$d_stdstdio$cnt_lval" in
13616$define$define) val=$define ;;
13617*) val=$undef ;;
13618esac
13619set d_stdio_cnt_lval
13620eval $setvar
13621
13622
13623: test whether setting _ptr sets _cnt as a side effect
13624d_stdio_ptr_lval_sets_cnt="$undef"
13625d_stdio_ptr_lval_nochange_cnt="$undef"
13626case "$d_stdio_ptr_lval$d_stdstdio" in
13627$define$define)
13628 echo "Checking to see what happens if we set the stdio ptr..." >&4
13629$cat >try.c <<EOP
13630#include <stdio.h>
13631/* Can we scream? */
13632/* Eat dust sed :-) */
13633/* In the buffer space, no one can hear you scream. */
13634#$i_stdlib I_STDLIB
13635#ifdef I_STDLIB
13636#include <stdlib.h>
13637#endif
13638#define FILE_ptr(fp) $stdio_ptr
13639#define FILE_cnt(fp) $stdio_cnt
13640#include <sys/types.h>
13641int main() {
13642 FILE *fp = fopen("try.c", "r");
13643 int c;
13644 char *ptr;
13645 size_t cnt;
13646 if (!fp) {
13647 puts("Fail even to read");
13648 exit(1);
13649 }
13650 c = getc(fp); /* Read away the first # */
13651 if (c == EOF) {
13652 puts("Fail even to read");
13653 exit(1);
13654 }
13655 if (!(
13656 18 <= FILE_cnt(fp) &&
13657 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13658 )) {
13659 puts("Fail even to read");
13660 exit (1);
13661 }
13662 ptr = (char*) FILE_ptr(fp);
13663 cnt = (size_t)FILE_cnt(fp);
13664
13665 FILE_ptr(fp) += 42;
13666
13667 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13668 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13669 exit (1);
13670 }
13671 if (FILE_cnt(fp) <= 20) {
13672 printf ("Fail (<20 chars to test)");
13673 exit (1);
13674 }
13675 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13676 puts("Fail compare");
13677 exit (1);
13678 }
13679 if (cnt == FILE_cnt(fp)) {
13680 puts("Pass_unchanged");
13681 exit (0);
13682 }
13683 if (FILE_cnt(fp) == (cnt - 42)) {
13684 puts("Pass_changed");
13685 exit (0);
13686 }
13687 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13688 return 1;
13689
13690}
13691EOP
13692 set try
13693 if eval $compile && $to try.c; then
13694 case `$run ./try` in
13695 Pass_changed)
13696 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
13697 d_stdio_ptr_lval_sets_cnt="$define" ;;
13698 Pass_unchanged)
13699 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
13700 d_stdio_ptr_lval_nochange_cnt="$define" ;;
13701 Fail*)
13702 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
13703 *)
13704 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13705 esac
13706 else
13707 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
13708 fi
13709 $rm_try
13710 ;;
13711esac
13712
13713: see if _base is also standard
13714val="$undef"
13715case "$d_stdstdio" in
13716$define)
13717 $cat >try.c <<EOP
13718#include <stdio.h>
13719#$i_stdlib I_STDLIB
13720#ifdef I_STDLIB
13721#include <stdlib.h>
13722#endif
13723#define FILE_base(fp) $stdio_base
13724#define FILE_bufsiz(fp) $stdio_bufsiz
13725int main() {
13726 FILE *fp = fopen("try.c", "r");
13727 char c = getc(fp);
13728 if (
13729 19 <= FILE_bufsiz(fp) &&
13730 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13731 )
13732 exit(0);
13733 exit(1);
13734}
13735EOP
13736 set try
13737 if eval $compile && $to try.c; then
13738 if $run ./try; then
13739 echo "And its _base field acts std."
13740 val="$define"
13741 else
13742 echo "But its _base field isn't std."
13743 fi
13744 else
13745 echo "However, it seems to be lacking the _base field."
13746 fi
13747 $rm_try
13748 ;;
13749esac
13750set d_stdiobase
13751eval $setvar
13752
13753: see if fast_stdio exists
13754val="$undef"
13755case "$d_stdstdio:$d_stdio_ptr_lval" in
13756"$define:$define")
13757 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13758 *$define*)
13759 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13760 val="$define"
13761 ;;
13762 esac
13763 ;;
13764esac
13765set d_faststdio
13766eval $setvar
13767
13768: see if fchdir exists
13769set fchdir d_fchdir
13770eval $inlibc
13771
13772: see if fchmod exists
13773set fchmod d_fchmod
13774eval $inlibc
13775
13776: check for openat, unlinkat, renameat, linkat, fchmodat
13777set openat d_openat
13778eval $inlibc
13779
13780set unlinkat d_unlinkat
13781eval $inlibc
13782
13783set renameat d_renameat
13784eval $inlibc
13785
13786set linkat d_linkat
13787eval $inlibc
13788
13789set fchmodat d_fchmodat
13790eval $inlibc
13791
13792: see if fchown exists
13793set fchown d_fchown
13794eval $inlibc
13795
13796: see if this is an fcntl system
13797set fcntl d_fcntl
13798eval $inlibc
13799
13800: See if fcntl-based locking works.
13801echo " "
13802$cat >try.c <<EOCP
13803#$i_stdlib I_STDLIB
13804#ifdef I_STDLIB
13805#include <stdlib.h>
13806#endif
13807#include <unistd.h>
13808#include <fcntl.h>
13809#include <signal.h>
13810$signal_t blech(int x) { exit(3); }
13811int main() {
13812#if defined(F_SETLK) && defined(F_SETLKW)
13813 struct flock flock;
13814 int retval, fd;
13815 fd = open("try.c", O_RDONLY);
13816 flock.l_type = F_RDLCK;
13817 flock.l_whence = SEEK_SET;
13818 flock.l_start = flock.l_len = 0;
13819 signal(SIGALRM, blech);
13820 alarm(10);
13821 retval = fcntl(fd, F_SETLK, &flock);
13822 close(fd);
13823 (retval < 0 ? exit(2) : exit(0));
13824#else
13825 exit(2);
13826#endif
13827}
13828EOCP
13829echo "Checking if fcntl-based file locking works... "
13830case "$d_fcntl" in
13831"$define")
13832 set try
13833 if eval $compile_ok; then
13834 if $run ./try; then
13835 echo "Yes, it seems to work."
13836 val="$define"
13837 else
13838 echo "Nope, it didn't work."
13839 val="$undef"
13840 case "$?" in
13841 3) $cat >&4 <<EOM
13842***
13843*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13844*** This is (almost) impossible.
13845*** If your NFS lock daemons are not feeling well, something like
13846*** this may happen, please investigate. Cannot continue, aborting.
13847***
13848EOM
13849 exit 1
13850 ;;
13851 esac
13852 fi
13853 else
13854 echo "I'm unable to compile the test program, so I'll assume not."
13855 val="$undef"
13856 fi
13857 ;;
13858*) val="$undef";
13859 echo "Nope, since you don't even have fcntl()."
13860 ;;
13861esac
13862set d_fcntl_can_lock
13863eval $setvar
13864$rm_try
13865
13866: check for fd_set items
13867$cat <<EOM
13868
13869Checking to see how well your C compiler handles fd_set and friends ...
13870EOM
13871$cat >try.c <<EOCP
13872#$i_stdlib I_STDLIB
13873#ifdef I_STDLIB
13874#include <stdlib.h>
13875#endif
13876#$i_systime I_SYS_TIME
13877#$i_sysselct I_SYS_SELECT
13878#$d_socket HAS_SOCKET
13879#include <sys/types.h>
13880#ifdef HAS_SOCKET
13881#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13882#endif
13883#ifdef I_SYS_TIME
13884#include <sys/time.h>
13885#endif
13886#ifdef I_SYS_SELECT
13887#include <sys/select.h>
13888#endif
13889int main() {
13890 fd_set fds;
13891
13892#ifdef TRYBITS
13893 if(fds.fds_bits);
13894#endif
13895
13896#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13897 exit(0);
13898#else
13899 exit(1);
13900#endif
13901}
13902EOCP
13903set try -DTRYBITS
13904if eval $compile; then
13905 d_fds_bits="$define"
13906 d_fd_set="$define"
13907 echo "Well, your system knows about the normal fd_set typedef..." >&4
13908 if $run ./try; then
13909 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13910 d_fd_macros="$define"
13911 else
13912 $cat >&4 <<'EOM'
13913but not the normal fd_set macros! Gaaack! I'll have to cover for you.
13914EOM
13915 d_fd_macros="$undef"
13916 fi
13917else
13918 $cat <<'EOM'
13919Hmm, your compiler has some difficulty with fd_set. Checking further...
13920EOM
13921 set try
13922 if eval $compile; then
13923 d_fds_bits="$undef"
13924 d_fd_set="$define"
13925 echo "Well, your system has some sort of fd_set available..." >&4
13926 if $run ./try; then
13927 echo "and you have the normal fd_set macros." >&4
13928 d_fd_macros="$define"
13929 else
13930 $cat <<'EOM'
13931but not the normal fd_set macros! Gross! More work for me...
13932EOM
13933 d_fd_macros="$undef"
13934 fi
13935 else
13936 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
13937 d_fd_set="$undef"
13938 d_fds_bits="$undef"
13939 d_fd_macros="$undef"
13940 fi
13941fi
13942$rm_try
13943
13944: see if fdclose exists
13945set fdclose d_fdclose
13946eval $inlibc
13947
13948: see if fdim exists
13949set fdim d_fdim
13950eval $inlibc
13951
13952: see if fegetround exists
13953set fegetround d_fegetround
13954eval $inlibc
13955
13956: see if fgetpos exists
13957set fgetpos d_fgetpos
13958eval $inlibc
13959
13960: see if finite exists
13961set finite d_finite
13962eval $inlibc
13963
13964: see if finitel exists
13965set finitel d_finitel
13966eval $inlibc
13967
13968: see if flock exists
13969set flock d_flock
13970eval $inlibc
13971
13972: see if prototype for flock is available
13973echo " "
13974set d_flockproto flock $i_sysfile sys/file.h
13975eval $hasproto
13976
13977: see if fma exists
13978set fma d_fma
13979eval $inlibc
13980
13981: see if fmax exists
13982set fmax d_fmax
13983eval $inlibc
13984
13985: see if fmin exists
13986set fmin d_fmin
13987eval $inlibc
13988
13989: see if fp_class exists
13990set fp_class d_fp_class
13991eval $inlibc
13992
13993: check for fpclassify
13994echo "Checking to see if you have fpclassify..." >&4
13995$cat >try.c <<EOCP
13996#include <math.h>
13997int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13998EOCP
13999set try
14000if eval $compile; then
14001 val="$define"
14002 echo "You have fpclassify."
14003else
14004 val="$undef"
14005 echo "You do not have fpclassify."
14006fi
14007$rm_try
14008set d_fpclassify
14009eval $setvar
14010
14011: see if fp_classify exists
14012set fp_classify d_fp_classify
14013eval $inlibc
14014
14015: see if fp_classl exists
14016set fp_classl d_fp_classl
14017eval $inlibc
14018
14019: see if pathconf exists
14020set pathconf d_pathconf
14021eval $inlibc
14022
14023: see if fpathconf exists
14024set fpathconf d_fpathconf
14025eval $inlibc
14026
14027: see if fpclass exists
14028set fpclass d_fpclass
14029eval $inlibc
14030
14031: see if fpclassl exists
14032set fpclassl d_fpclassl
14033eval $inlibc
14034
14035: see if fpgetround exists
14036set fpgetround d_fpgetround
14037eval $inlibc
14038
14039: check for fpos64_t
14040echo " "
14041echo "Checking to see if you have fpos64_t..." >&4
14042$cat >try.c <<EOCP
14043#include <stdio.h>
14044int main() { fpos64_t x = 7; }
14045EOCP
14046set try
14047if eval $compile; then
14048 val="$define"
14049 echo "You have fpos64_t."
14050else
14051 val="$undef"
14052 echo "You do not have fpos64_t."
14053 case "$fpossize" in
14054 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14055 esac
14056fi
14057$rm_try
14058set d_fpos64_t
14059eval $setvar
14060
14061: see if frexpl exists
14062set frexpl d_frexpl
14063eval $inlibc
14064
14065: see if this is a sys/param system
14066set sys/param.h i_sysparam
14067eval $inhdr
14068
14069: see if this is a sys/mount.h system
14070set sys/mount.h i_sysmount
14071eval $inhdr
14072
14073: Check for fs_data_s
14074echo " "
14075echo "Checking to see if your system supports struct fs_data..." >&4
14076set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14077eval $hasstruct
14078case "$d_fs_data_s" in
14079"$define") echo "Yes, it does." ;;
14080*) echo "No, it doesn't." ;;
14081esac
14082
14083: see if fseeko exists
14084set fseeko d_fseeko
14085eval $inlibc
14086case "$longsize" in
140878) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14088esac
14089
14090: see if fsetpos exists
14091set fsetpos d_fsetpos
14092eval $inlibc
14093
14094: see if fstatfs exists
14095set fstatfs d_fstatfs
14096eval $inlibc
14097
14098: see if statvfs exists
14099set statvfs d_statvfs
14100eval $inlibc
14101
14102: see if fstatvfs exists
14103set fstatvfs d_fstatvfs
14104eval $inlibc
14105
14106: see if fsync exists
14107set fsync d_fsync
14108eval $inlibc
14109
14110: see if ftello exists
14111set ftello d_ftello
14112eval $inlibc
14113case "$longsize" in
141148) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14115esac
14116
14117: check for a working futimes
14118d_futimes="$undef"
14119echo " "
14120echo "Checking if you have a working futimes()" >&4
14121$cat >try.c <<EOCP
14122#include <stdio.h>
14123#include <stdlib.h>
14124#include <sys/time.h>
14125#include <errno.h>
14126#include <fcntl.h>
14127#include <stdlib.h>
14128
14129int main ()
14130{
14131 int fd, rv;
14132 fd = open ("try.c", O_RDWR);
14133 if (-1 == fd) exit (1);
14134 rv = futimes (fd, NULL);
14135 exit (rv == -1 ? errno : 0);
14136}
14137EOCP
14138set try
14139if eval $compile; then
14140 `$run ./try`
14141 rc=$?
14142 case "$rc" in
14143 0) echo "Yes, you have" >&4
14144 d_futimes="$define"
14145 ;;
14146 *) echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14147 ;;
14148 esac
14149else
14150 echo "No, it does not (probably harmless)" >&4
14151fi
14152$rm_try
14153
14154: look for gai_strerror
14155echo " "
14156$cat >try.c <<'EOCP'
14157#include <sys/types.h>
14158#include <sys/socket.h>
14159#include <netdb.h>
14160int main ()
14161{
14162 return (gai_strerror (0) ? 0 : 1);
14163 }
14164EOCP
14165set try
14166val="$undef"
14167if eval $compile; then
14168 `$run ./try`
14169 case "$?" in
14170 0) echo "A working gai_strerror() found." >&4
14171 val="$define" ;;
14172 *) echo "gai_strerror() found, but it doesn't work" >&4
14173 ;;
14174 esac
14175else
14176 echo "gai_strerror() NOT found." >&4
14177 fi
14178set d_gai_strerror
14179eval $setvar
14180$rm_try
14181
14182: see if ndbm.h is available
14183set ndbm.h i_ndbm
14184eval $inhdr
14185: Compatibility location for RedHat 7.1
14186set gdbm/ndbm.h i_gdbmndbm
14187eval $inhdr
14188: Compatibility location for Debian 4.0
14189set gdbm-ndbm.h i_gdbm_ndbm
14190eval $inhdr
14191
14192val="$undef"
14193if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14194 : see if dbm_open exists
14195 set dbm_open d_dbm_open
14196 eval $inlibc
14197 case "$d_dbm_open" in
14198 $undef)
14199 i_ndbm="$undef"
14200 i_gdbmndbm="$undef"
14201 i_gdbm_ndbm="$undef"
14202 echo "We won't be including <ndbm.h>"
14203 val="$undef"
14204 ;;
14205 *) val="$define"
14206 ;;
14207 esac
14208fi
14209set d_ndbm
14210eval $setvar
14211
14212ndbm_hdr_protochk='name=$1; hdr=$2;
14213eval "ihdr=\$""i_$name";
14214val="$undef";
14215if $test "$ihdr" = "$define"; then
14216 $echo "Checking if your <$hdr> uses prototypes..." >&4;
14217 case "$d_cplusplus" in
14218 $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14219 *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14220 esac;
14221 case "$val" in
14222 $define) $echo "Your <$hdr> seems to have prototypes";;
14223 *) $echo "Your <$hdr> does not seem to have prototypes";;
14224 esac;
14225fi;
14226set "d_${name}_h_uses_prototypes";
14227eval $setvar'
14228
14229set ndbm ndbm.h
14230eval $ndbm_hdr_protochk
14231set gdbmndbm gdbm/ndbm.h
14232eval $ndbm_hdr_protochk
14233set gdbm_ndbm gdbm-ndbm.h
14234eval $ndbm_hdr_protochk
14235
14236: see if getaddrinfo exists
14237set getaddrinfo d_getaddrinfo
14238eval $inlibc
14239
14240: see if getcwd exists
14241set getcwd d_getcwd
14242eval $inlibc
14243
14244: see if getespwnam exists
14245set getespwnam d_getespwnam
14246eval $inlibc
14247
14248: see if getfsstat exists
14249set getfsstat d_getfsstat
14250eval $inlibc
14251
14252: see if getgrent exists
14253set getgrent d_getgrent
14254eval $inlibc
14255
14256: see if getgrent_r exists
14257set getgrent_r d_getgrent_r
14258eval $inlibc
14259case "$d_getgrent_r" in
14260"$define")
14261 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14262 case "$d_getgrent_r_proto:$usethreads" in
14263 ":define") d_getgrent_r_proto=define
14264 set d_getgrent_r_proto getgrent_r $hdrs
14265 eval $hasproto ;;
14266 *) ;;
14267 esac
14268 case "$d_getgrent_r_proto" in
14269 define)
14270 case "$getgrent_r_proto" in
14271 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14272 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14273 esac
14274 case "$getgrent_r_proto" in
14275 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14276 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14277 esac
14278 case "$getgrent_r_proto" in
14279 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14280 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14281 esac
14282 case "$getgrent_r_proto" in
14283 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14284 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14285 esac
14286 case "$getgrent_r_proto" in
14287 ''|0) try='int getgrent_r(struct group*, char*, int);'
14288 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14289 esac
14290 case "$getgrent_r_proto" in
14291 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14292 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14293 esac
14294 case "$getgrent_r_proto" in
14295 ''|0) d_getgrent_r=undef
14296 getgrent_r_proto=0
14297 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14298 * ) case "$getgrent_r_proto" in
14299 REENTRANT_PROTO*) ;;
14300 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14301 esac
14302 echo "Prototype: $try" ;;
14303 esac
14304 ;;
14305 *) case "$usethreads" in
14306 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14307 esac
14308 d_getgrent_r=undef
14309 getgrent_r_proto=0
14310 ;;
14311 esac
14312 ;;
14313*) getgrent_r_proto=0
14314 ;;
14315esac
14316
14317: see if getgrgid_r exists
14318set getgrgid_r d_getgrgid_r
14319eval $inlibc
14320case "$d_getgrgid_r" in
14321"$define")
14322 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14323 case "$d_getgrgid_r_proto:$usethreads" in
14324 ":define") d_getgrgid_r_proto=define
14325 set d_getgrgid_r_proto getgrgid_r $hdrs
14326 eval $hasproto ;;
14327 *) ;;
14328 esac
14329 case "$d_getgrgid_r_proto" in
14330 define)
14331 case "$getgrgid_r_proto" in
14332 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14333 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14334 esac
14335 case "$getgrgid_r_proto" in
14336 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14337 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14338 esac
14339 case "$getgrgid_r_proto" in
14340 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14341 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14342 esac
14343 case "$getgrgid_r_proto" in
14344 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14345 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14346 esac
14347 case "$getgrgid_r_proto" in
14348 ''|0) d_getgrgid_r=undef
14349 getgrgid_r_proto=0
14350 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14351 * ) case "$getgrgid_r_proto" in
14352 REENTRANT_PROTO*) ;;
14353 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14354 esac
14355 echo "Prototype: $try" ;;
14356 esac
14357 ;;
14358 *) case "$usethreads" in
14359 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14360 esac
14361 d_getgrgid_r=undef
14362 getgrgid_r_proto=0
14363 ;;
14364 esac
14365 ;;
14366*) getgrgid_r_proto=0
14367 ;;
14368esac
14369
14370: see if getgrnam_r exists
14371set getgrnam_r d_getgrnam_r
14372eval $inlibc
14373case "$d_getgrnam_r" in
14374"$define")
14375 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14376 case "$d_getgrnam_r_proto:$usethreads" in
14377 ":define") d_getgrnam_r_proto=define
14378 set d_getgrnam_r_proto getgrnam_r $hdrs
14379 eval $hasproto ;;
14380 *) ;;
14381 esac
14382 case "$d_getgrnam_r_proto" in
14383 define)
14384 case "$getgrnam_r_proto" in
14385 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14386 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14387 esac
14388 case "$getgrnam_r_proto" in
14389 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14390 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14391 esac
14392 case "$getgrnam_r_proto" in
14393 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14394 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14395 esac
14396 case "$getgrnam_r_proto" in
14397 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14398 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14399 esac
14400 case "$getgrnam_r_proto" in
14401 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14402 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14403 esac
14404 case "$getgrnam_r_proto" in
14405 ''|0) d_getgrnam_r=undef
14406 getgrnam_r_proto=0
14407 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14408 * ) case "$getgrnam_r_proto" in
14409 REENTRANT_PROTO*) ;;
14410 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14411 esac
14412 echo "Prototype: $try" ;;
14413 esac
14414 ;;
14415 *) case "$usethreads" in
14416 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14417 esac
14418 d_getgrnam_r=undef
14419 getgrnam_r_proto=0
14420 ;;
14421 esac
14422 ;;
14423*) getgrnam_r_proto=0
14424 ;;
14425esac
14426
14427: see if gethostbyaddr exists
14428set gethostbyaddr d_gethbyaddr
14429eval $inlibc
14430
14431: see if gethostbyname exists
14432set gethostbyname d_gethbyname
14433eval $inlibc
14434
14435: see if gethostent exists
14436set gethostent d_gethent
14437eval $inlibc
14438
14439: see how we will look up host name
14440echo " "
14441call=''
14442if set gethostname val -f d_gethname; eval $csym; $val; then
14443 echo 'gethostname() found.' >&4
14444 d_gethname="$define"
14445 call=gethostname
14446fi
14447if set uname val -f d_uname; eval $csym; $val; then
14448 if ./xenix; then
14449 $cat <<'EOM'
14450uname() was found, but you're running xenix, and older versions of xenix
14451have a broken uname(). If you don't really know whether your xenix is old
14452enough to have a broken system call, use the default answer.
14453
14454EOM
14455 dflt=y
14456 case "$d_uname" in
14457 "$define") dflt=n;;
14458 esac
14459 rp='Is your uname() broken?'
14460 . ./myread
14461 case "$ans" in
14462 n*) d_uname="$define"; call=uname;;
14463 esac
14464 else
14465 echo 'uname() found.' >&4
14466 d_uname="$define"
14467 case "$call" in
14468 '') call=uname ;;
14469 esac
14470 fi
14471fi
14472case "$d_gethname" in
14473'') d_gethname="$undef";;
14474esac
14475case "$d_uname" in
14476'') d_uname="$undef";;
14477esac
14478case "$d_uname$d_gethname" in
14479*define*)
14480 dflt=n
14481 cat <<EOM
14482
14483Every now and then someone has a $call() that lies about the hostname
14484but can't be fixed for political or economic reasons. If you wish, I can
14485pretend $call() isn't there and maybe compute hostname at run-time
14486thanks to the '$phostname' command.
14487
14488EOM
14489 rp="Shall I ignore $call() from now on?"
14490 . ./myread
14491 case "$ans" in
14492 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14493 esac;;
14494esac
14495case "$phostname" in
14496'') aphostname='';;
14497*) case "$aphostname" in
14498 /*) ;;
14499 *) set X $phostname
14500 shift
14501 file=$1
14502 shift
14503 file=`./loc $file $file $pth`
14504 aphostname=`echo $file $*`
14505 ;;
14506 esac
14507 ;;
14508esac
14509case "$d_uname$d_gethname" in
14510*define*) ;;
14511*)
14512 case "$phostname" in
14513 '')
14514 echo "There will be no way for $package to get your hostname." >&4;;
14515 *)
14516 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14517 ;;
14518 esac;;
14519esac
14520case "$d_phostname" in
14521'') d_phostname="$undef";;
14522esac
14523
14524: see if gethostbyaddr_r exists
14525set gethostbyaddr_r d_gethostbyaddr_r
14526eval $inlibc
14527case "$d_gethostbyaddr_r" in
14528"$define")
14529 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14530 case "$d_gethostbyaddr_r_proto:$usethreads" in
14531 ":define") d_gethostbyaddr_r_proto=define
14532 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14533 eval $hasproto ;;
14534 *) ;;
14535 esac
14536 case "$d_gethostbyaddr_r_proto" in
14537 define)
14538 case "$gethostbyaddr_r_proto" in
14539 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14540 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14541 esac
14542 case "$gethostbyaddr_r_proto" in
14543 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14544 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14545 esac
14546 case "$gethostbyaddr_r_proto" in
14547 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14548 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14549 esac
14550 case "$gethostbyaddr_r_proto" in
14551 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14552 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14553 esac
14554 case "$gethostbyaddr_r_proto" in
14555 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14556 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14557 esac
14558 case "$gethostbyaddr_r_proto" in
14559 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14560 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14561 esac
14562 case "$gethostbyaddr_r_proto" in
14563 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14564 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14565 esac
14566 case "$gethostbyaddr_r_proto" in
14567 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14568 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14569 esac
14570 case "$gethostbyaddr_r_proto" in
14571 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14572 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14573 esac
14574 case "$gethostbyaddr_r_proto" in
14575 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14576 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14577 esac
14578 case "$gethostbyaddr_r_proto" in
14579 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14580 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14581 esac
14582 case "$gethostbyaddr_r_proto" in
14583 ''|0) d_gethostbyaddr_r=undef
14584 gethostbyaddr_r_proto=0
14585 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14586 * ) case "$gethostbyaddr_r_proto" in
14587 REENTRANT_PROTO*) ;;
14588 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14589 esac
14590 echo "Prototype: $try" ;;
14591 esac
14592 ;;
14593 *) case "$usethreads" in
14594 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14595 esac
14596 d_gethostbyaddr_r=undef
14597 gethostbyaddr_r_proto=0
14598 ;;
14599 esac
14600 ;;
14601*) gethostbyaddr_r_proto=0
14602 ;;
14603esac
14604
14605: see if gethostbyname_r exists
14606set gethostbyname_r d_gethostbyname_r
14607eval $inlibc
14608case "$d_gethostbyname_r" in
14609"$define")
14610 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14611 case "$d_gethostbyname_r_proto:$usethreads" in
14612 ":define") d_gethostbyname_r_proto=define
14613 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14614 eval $hasproto ;;
14615 *) ;;
14616 esac
14617 case "$d_gethostbyname_r_proto" in
14618 define)
14619 case "$gethostbyname_r_proto" in
14620 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14621 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14622 esac
14623 case "$gethostbyname_r_proto" in
14624 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14625 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14626 esac
14627 case "$gethostbyname_r_proto" in
14628 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14629 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14630 esac
14631 case "$gethostbyname_r_proto" in
14632 ''|0) d_gethostbyname_r=undef
14633 gethostbyname_r_proto=0
14634 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14635 * ) case "$gethostbyname_r_proto" in
14636 REENTRANT_PROTO*) ;;
14637 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14638 esac
14639 echo "Prototype: $try" ;;
14640 esac
14641 ;;
14642 *) case "$usethreads" in
14643 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14644 esac
14645 d_gethostbyname_r=undef
14646 gethostbyname_r_proto=0
14647 ;;
14648 esac
14649 ;;
14650*) gethostbyname_r_proto=0
14651 ;;
14652esac
14653
14654: see if gethostent_r exists
14655set gethostent_r d_gethostent_r
14656eval $inlibc
14657case "$d_gethostent_r" in
14658"$define")
14659 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14660 case "$d_gethostent_r_proto:$usethreads" in
14661 ":define") d_gethostent_r_proto=define
14662 set d_gethostent_r_proto gethostent_r $hdrs
14663 eval $hasproto ;;
14664 *) ;;
14665 esac
14666 case "$d_gethostent_r_proto" in
14667 define)
14668 case "$gethostent_r_proto" in
14669 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14670 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14671 esac
14672 case "$gethostent_r_proto" in
14673 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14674 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14675 esac
14676 case "$gethostent_r_proto" in
14677 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14678 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14679 esac
14680 case "$gethostent_r_proto" in
14681 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14682 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14683 esac
14684 case "$gethostent_r_proto" in
14685 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14686 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14687 esac
14688 case "$gethostent_r_proto" in
14689 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14690 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14691 esac
14692 case "$gethostent_r_proto" in
14693 ''|0) d_gethostent_r=undef
14694 gethostent_r_proto=0
14695 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14696 * ) case "$gethostent_r_proto" in
14697 REENTRANT_PROTO*) ;;
14698 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14699 esac
14700 echo "Prototype: $try" ;;
14701 esac
14702 ;;
14703 *) case "$usethreads" in
14704 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14705 esac
14706 d_gethostent_r=undef
14707 gethostent_r_proto=0
14708 ;;
14709 esac
14710 ;;
14711*) gethostent_r_proto=0
14712 ;;
14713esac
14714
14715: see if prototypes for various gethostxxx netdb.h functions are available
14716echo " "
14717set d_gethostprotos gethostent $i_netdb netdb.h
14718eval $hasproto
14719
14720: see if getitimer exists
14721set getitimer d_getitimer
14722eval $inlibc
14723
14724: see if getlogin exists
14725set getlogin d_getlogin
14726eval $inlibc
14727
14728: see if getlogin_r exists
14729set getlogin_r d_getlogin_r
14730eval $inlibc
14731case "$d_getlogin_r" in
14732"$define")
14733 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14734 case "$d_getlogin_r_proto:$usethreads" in
14735 ":define") d_getlogin_r_proto=define
14736 set d_getlogin_r_proto getlogin_r $hdrs
14737 eval $hasproto ;;
14738 *) ;;
14739 esac
14740 case "$d_getlogin_r_proto" in
14741 define)
14742 case "$getlogin_r_proto" in
14743 ''|0) try='int getlogin_r(char*, size_t);'
14744 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14745 esac
14746 case "$getlogin_r_proto" in
14747 ''|0) try='int getlogin_r(char*, int);'
14748 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14749 esac
14750 case "$getlogin_r_proto" in
14751 ''|0) try='char* getlogin_r(char*, size_t);'
14752 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14753 esac
14754 case "$getlogin_r_proto" in
14755 ''|0) try='char* getlogin_r(char*, int);'
14756 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14757 esac
14758 case "$getlogin_r_proto" in
14759 ''|0) d_getlogin_r=undef
14760 getlogin_r_proto=0
14761 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14762 * ) case "$getlogin_r_proto" in
14763 REENTRANT_PROTO*) ;;
14764 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14765 esac
14766 echo "Prototype: $try" ;;
14767 esac
14768 ;;
14769 *) case "$usethreads" in
14770 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14771 esac
14772 d_getlogin_r=undef
14773 getlogin_r_proto=0
14774 ;;
14775 esac
14776 ;;
14777*) getlogin_r_proto=0
14778 ;;
14779esac
14780
14781: see if getmnt exists
14782set getmnt d_getmnt
14783eval $inlibc
14784
14785: see if getmntent exists
14786set getmntent d_getmntent
14787eval $inlibc
14788
14789: see if getnameinfo exists
14790set getnameinfo d_getnameinfo
14791eval $inlibc
14792
14793: see if getnetbyaddr exists
14794set getnetbyaddr d_getnbyaddr
14795eval $inlibc
14796
14797: see if getnetbyname exists
14798set getnetbyname d_getnbyname
14799eval $inlibc
14800
14801: see if getnetent exists
14802set getnetent d_getnent
14803eval $inlibc
14804
14805: see if getnetbyaddr_r exists
14806set getnetbyaddr_r d_getnetbyaddr_r
14807eval $inlibc
14808case "$d_getnetbyaddr_r" in
14809"$define")
14810 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14811 case "$d_getnetbyaddr_r_proto:$usethreads" in
14812 ":define") d_getnetbyaddr_r_proto=define
14813 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14814 eval $hasproto ;;
14815 *) ;;
14816 esac
14817 case "$d_getnetbyaddr_r_proto" in
14818 define)
14819 case "$getnetbyaddr_r_proto" in
14820 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14821 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14822 esac
14823 case "$getnetbyaddr_r_proto" in
14824 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14825 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14826 esac
14827 case "$getnetbyaddr_r_proto" in
14828 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14829 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14830 esac
14831 case "$getnetbyaddr_r_proto" in
14832 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14833 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14834 esac
14835 case "$getnetbyaddr_r_proto" in
14836 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14837 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14838 esac
14839 case "$getnetbyaddr_r_proto" in
14840 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14841 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14842 esac
14843 case "$getnetbyaddr_r_proto" in
14844 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14845 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14846 esac
14847 case "$getnetbyaddr_r_proto" in
14848 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14849 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14850 esac
14851 case "$getnetbyaddr_r_proto" in
14852 ''|0) d_getnetbyaddr_r=undef
14853 getnetbyaddr_r_proto=0
14854 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14855 * ) case "$getnetbyaddr_r_proto" in
14856 REENTRANT_PROTO*) ;;
14857 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14858 esac
14859 echo "Prototype: $try" ;;
14860 esac
14861 ;;
14862 *) case "$usethreads" in
14863 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14864 esac
14865 d_getnetbyaddr_r=undef
14866 getnetbyaddr_r_proto=0
14867 ;;
14868 esac
14869 ;;
14870*) getnetbyaddr_r_proto=0
14871 ;;
14872esac
14873
14874: see if getnetbyname_r exists
14875set getnetbyname_r d_getnetbyname_r
14876eval $inlibc
14877case "$d_getnetbyname_r" in
14878"$define")
14879 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14880 case "$d_getnetbyname_r_proto:$usethreads" in
14881 ":define") d_getnetbyname_r_proto=define
14882 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14883 eval $hasproto ;;
14884 *) ;;
14885 esac
14886 case "$d_getnetbyname_r_proto" in
14887 define)
14888 case "$getnetbyname_r_proto" in
14889 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14890 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14891 esac
14892 case "$getnetbyname_r_proto" in
14893 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14894 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14895 esac
14896 case "$getnetbyname_r_proto" in
14897 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14898 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14899 esac
14900 case "$getnetbyname_r_proto" in
14901 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14902 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14903 esac
14904 case "$getnetbyname_r_proto" in
14905 ''|0) d_getnetbyname_r=undef
14906 getnetbyname_r_proto=0
14907 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14908 * ) case "$getnetbyname_r_proto" in
14909 REENTRANT_PROTO*) ;;
14910 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14911 esac
14912 echo "Prototype: $try" ;;
14913 esac
14914 ;;
14915 *) case "$usethreads" in
14916 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14917 esac
14918 d_getnetbyname_r=undef
14919 getnetbyname_r_proto=0
14920 ;;
14921 esac
14922 ;;
14923*) getnetbyname_r_proto=0
14924 ;;
14925esac
14926
14927: see if getnetent_r exists
14928set getnetent_r d_getnetent_r
14929eval $inlibc
14930case "$d_getnetent_r" in
14931"$define")
14932 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14933 case "$d_getnetent_r_proto:$usethreads" in
14934 ":define") d_getnetent_r_proto=define
14935 set d_getnetent_r_proto getnetent_r $hdrs
14936 eval $hasproto ;;
14937 *) ;;
14938 esac
14939 case "$d_getnetent_r_proto" in
14940 define)
14941 case "$getnetent_r_proto" in
14942 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14943 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14944 esac
14945 case "$getnetent_r_proto" in
14946 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14947 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14948 esac
14949 case "$getnetent_r_proto" in
14950 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14951 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14952 esac
14953 case "$getnetent_r_proto" in
14954 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14955 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14956 esac
14957 case "$getnetent_r_proto" in
14958 ''|0) try='int getnetent_r(struct netent*, char*, int);'
14959 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14960 esac
14961 case "$getnetent_r_proto" in
14962 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14963 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14964 esac
14965 case "$getnetent_r_proto" in
14966 ''|0) d_getnetent_r=undef
14967 getnetent_r_proto=0
14968 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14969 * ) case "$getnetent_r_proto" in
14970 REENTRANT_PROTO*) ;;
14971 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14972 esac
14973 echo "Prototype: $try" ;;
14974 esac
14975 ;;
14976 *) case "$usethreads" in
14977 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14978 esac
14979 d_getnetent_r=undef
14980 getnetent_r_proto=0
14981 ;;
14982 esac
14983 ;;
14984*) getnetent_r_proto=0
14985 ;;
14986esac
14987
14988: see if prototypes for various getnetxxx netdb.h functions are available
14989echo " "
14990set d_getnetprotos getnetent $i_netdb netdb.h
14991eval $hasproto
14992
14993: see if getpagesize exists
14994set getpagesize d_getpagsz
14995eval $inlibc
14996
14997: Optional checks for getprotobyname and getprotobynumber
14998
14999: see if getprotobyname exists
15000set getprotobyname d_getpbyname
15001eval $inlibc
15002
15003: see if getprotobynumber exists
15004set getprotobynumber d_getpbynumber
15005eval $inlibc
15006
15007: see if getprotoent exists
15008set getprotoent d_getpent
15009eval $inlibc
15010
15011: see if getpgid exists
15012set getpgid d_getpgid
15013eval $inlibc
15014
15015: see if getpgrp2 exists
15016set getpgrp2 d_getpgrp2
15017eval $inlibc
15018
15019: see if getppid exists
15020set getppid d_getppid
15021eval $inlibc
15022
15023: see if getpriority exists
15024set getpriority d_getprior
15025eval $inlibc
15026
15027: see if getprotobyname_r exists
15028set getprotobyname_r d_getprotobyname_r
15029eval $inlibc
15030case "$d_getprotobyname_r" in
15031"$define")
15032 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15033 case "$d_getprotobyname_r_proto:$usethreads" in
15034 ":define") d_getprotobyname_r_proto=define
15035 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15036 eval $hasproto ;;
15037 *) ;;
15038 esac
15039 case "$d_getprotobyname_r_proto" in
15040 define)
15041 case "$getprotobyname_r_proto" in
15042 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15043 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15044 esac
15045 case "$getprotobyname_r_proto" in
15046 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15047 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15048 esac
15049 case "$getprotobyname_r_proto" in
15050 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15051 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15052 esac
15053 case "$getprotobyname_r_proto" in
15054 ''|0) d_getprotobyname_r=undef
15055 getprotobyname_r_proto=0
15056 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15057 * ) case "$getprotobyname_r_proto" in
15058 REENTRANT_PROTO*) ;;
15059 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15060 esac
15061 echo "Prototype: $try" ;;
15062 esac
15063 ;;
15064 *) case "$usethreads" in
15065 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15066 esac
15067 d_getprotobyname_r=undef
15068 getprotobyname_r_proto=0
15069 ;;
15070 esac
15071 ;;
15072*) getprotobyname_r_proto=0
15073 ;;
15074esac
15075
15076: see if getprotobynumber_r exists
15077set getprotobynumber_r d_getprotobynumber_r
15078eval $inlibc
15079case "$d_getprotobynumber_r" in
15080"$define")
15081 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15082 case "$d_getprotobynumber_r_proto:$usethreads" in
15083 ":define") d_getprotobynumber_r_proto=define
15084 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15085 eval $hasproto ;;
15086 *) ;;
15087 esac
15088 case "$d_getprotobynumber_r_proto" in
15089 define)
15090 case "$getprotobynumber_r_proto" in
15091 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15092 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15093 esac
15094 case "$getprotobynumber_r_proto" in
15095 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15096 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15097 esac
15098 case "$getprotobynumber_r_proto" in
15099 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15100 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15101 esac
15102 case "$getprotobynumber_r_proto" in
15103 ''|0) d_getprotobynumber_r=undef
15104 getprotobynumber_r_proto=0
15105 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15106 * ) case "$getprotobynumber_r_proto" in
15107 REENTRANT_PROTO*) ;;
15108 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15109 esac
15110 echo "Prototype: $try" ;;
15111 esac
15112 ;;
15113 *) case "$usethreads" in
15114 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15115 esac
15116 d_getprotobynumber_r=undef
15117 getprotobynumber_r_proto=0
15118 ;;
15119 esac
15120 ;;
15121*) getprotobynumber_r_proto=0
15122 ;;
15123esac
15124
15125: see if getprotoent_r exists
15126set getprotoent_r d_getprotoent_r
15127eval $inlibc
15128case "$d_getprotoent_r" in
15129"$define")
15130 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15131 case "$d_getprotoent_r_proto:$usethreads" in
15132 ":define") d_getprotoent_r_proto=define
15133 set d_getprotoent_r_proto getprotoent_r $hdrs
15134 eval $hasproto ;;
15135 *) ;;
15136 esac
15137 case "$d_getprotoent_r_proto" in
15138 define)
15139 case "$getprotoent_r_proto" in
15140 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15141 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15142 esac
15143 case "$getprotoent_r_proto" in
15144 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15145 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15146 esac
15147 case "$getprotoent_r_proto" in
15148 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15149 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15150 esac
15151 case "$getprotoent_r_proto" in
15152 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15153 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15154 esac
15155 case "$getprotoent_r_proto" in
15156 ''|0) d_getprotoent_r=undef
15157 getprotoent_r_proto=0
15158 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15159 * ) case "$getprotoent_r_proto" in
15160 REENTRANT_PROTO*) ;;
15161 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15162 esac
15163 echo "Prototype: $try" ;;
15164 esac
15165 ;;
15166 *) case "$usethreads" in
15167 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15168 esac
15169 d_getprotoent_r=undef
15170 getprotoent_r_proto=0
15171 ;;
15172 esac
15173 ;;
15174*) getprotoent_r_proto=0
15175 ;;
15176esac
15177
15178: see if prototypes for various getprotoxxx netdb.h functions are available
15179echo " "
15180set d_getprotoprotos getprotoent $i_netdb netdb.h
15181eval $hasproto
15182
15183: see if getprpwnam exists
15184set getprpwnam d_getprpwnam
15185eval $inlibc
15186
15187: see if getpwent exists
15188set getpwent d_getpwent
15189eval $inlibc
15190
15191: see if getpwent_r exists
15192set getpwent_r d_getpwent_r
15193eval $inlibc
15194case "$d_getpwent_r" in
15195"$define")
15196 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15197 case "$d_getpwent_r_proto:$usethreads" in
15198 ":define") d_getpwent_r_proto=define
15199 set d_getpwent_r_proto getpwent_r $hdrs
15200 eval $hasproto ;;
15201 *) ;;
15202 esac
15203 case "$d_getpwent_r_proto" in
15204 define)
15205 case "$getpwent_r_proto" in
15206 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15207 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15208 esac
15209 case "$getpwent_r_proto" in
15210 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15211 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15212 esac
15213 case "$getpwent_r_proto" in
15214 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15215 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15216 esac
15217 case "$getpwent_r_proto" in
15218 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15219 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15220 esac
15221 case "$getpwent_r_proto" in
15222 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15223 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15224 esac
15225 case "$getpwent_r_proto" in
15226 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15227 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15228 esac
15229 case "$getpwent_r_proto" in
15230 ''|0) d_getpwent_r=undef
15231 getpwent_r_proto=0
15232 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15233 * ) case "$getpwent_r_proto" in
15234 REENTRANT_PROTO*) ;;
15235 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15236 esac
15237 echo "Prototype: $try" ;;
15238 esac
15239 ;;
15240 *) case "$usethreads" in
15241 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15242 esac
15243 d_getpwent_r=undef
15244 getpwent_r_proto=0
15245 ;;
15246 esac
15247 ;;
15248*) getpwent_r_proto=0
15249 ;;
15250esac
15251
15252: see if getpwnam_r exists
15253set getpwnam_r d_getpwnam_r
15254eval $inlibc
15255case "$d_getpwnam_r" in
15256"$define")
15257 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15258 case "$d_getpwnam_r_proto:$usethreads" in
15259 ":define") d_getpwnam_r_proto=define
15260 set d_getpwnam_r_proto getpwnam_r $hdrs
15261 eval $hasproto ;;
15262 *) ;;
15263 esac
15264 case "$d_getpwnam_r_proto" in
15265 define)
15266 case "$getpwnam_r_proto" in
15267 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15268 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15269 esac
15270 case "$getpwnam_r_proto" in
15271 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15272 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15273 esac
15274 case "$getpwnam_r_proto" in
15275 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15276 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15277 esac
15278 case "$getpwnam_r_proto" in
15279 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15280 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15281 esac
15282 case "$getpwnam_r_proto" in
15283 ''|0) d_getpwnam_r=undef
15284 getpwnam_r_proto=0
15285 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15286 * ) case "$getpwnam_r_proto" in
15287 REENTRANT_PROTO*) ;;
15288 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15289 esac
15290 echo "Prototype: $try" ;;
15291 esac
15292 ;;
15293 *) case "$usethreads" in
15294 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15295 esac
15296 d_getpwnam_r=undef
15297 getpwnam_r_proto=0
15298 ;;
15299 esac
15300 ;;
15301*) getpwnam_r_proto=0
15302 ;;
15303esac
15304
15305: see if getpwuid_r exists
15306set getpwuid_r d_getpwuid_r
15307eval $inlibc
15308case "$d_getpwuid_r" in
15309"$define")
15310 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15311 case "$d_getpwuid_r_proto:$usethreads" in
15312 ":define") d_getpwuid_r_proto=define
15313 set d_getpwuid_r_proto getpwuid_r $hdrs
15314 eval $hasproto ;;
15315 *) ;;
15316 esac
15317 case "$d_getpwuid_r_proto" in
15318 define)
15319 case "$getpwuid_r_proto" in
15320 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15321 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15322 esac
15323 case "$getpwuid_r_proto" in
15324 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15325 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15326 esac
15327 case "$getpwuid_r_proto" in
15328 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15329 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15330 esac
15331 case "$getpwuid_r_proto" in
15332 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15333 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15334 esac
15335 case "$getpwuid_r_proto" in
15336 ''|0) d_getpwuid_r=undef
15337 getpwuid_r_proto=0
15338 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15339 * ) case "$getpwuid_r_proto" in
15340 REENTRANT_PROTO*) ;;
15341 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15342 esac
15343 echo "Prototype: $try" ;;
15344 esac
15345 ;;
15346 *) case "$usethreads" in
15347 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15348 esac
15349 d_getpwuid_r=undef
15350 getpwuid_r_proto=0
15351 ;;
15352 esac
15353 ;;
15354*) getpwuid_r_proto=0
15355 ;;
15356esac
15357
15358: Optional checks for getsbyname and getsbyport
15359
15360: see if getservbyname exists
15361set getservbyname d_getsbyname
15362eval $inlibc
15363
15364: see if getservbyport exists
15365set getservbyport d_getsbyport
15366eval $inlibc
15367
15368: see if getservent exists
15369set getservent d_getsent
15370eval $inlibc
15371
15372: see if getservbyname_r exists
15373set getservbyname_r d_getservbyname_r
15374eval $inlibc
15375case "$d_getservbyname_r" in
15376"$define")
15377 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15378 case "$d_getservbyname_r_proto:$usethreads" in
15379 ":define") d_getservbyname_r_proto=define
15380 set d_getservbyname_r_proto getservbyname_r $hdrs
15381 eval $hasproto ;;
15382 *) ;;
15383 esac
15384 case "$d_getservbyname_r_proto" in
15385 define)
15386 case "$getservbyname_r_proto" in
15387 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15388 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15389 esac
15390 case "$getservbyname_r_proto" in
15391 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15392 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15393 esac
15394 case "$getservbyname_r_proto" in
15395 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15396 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15397 esac
15398 case "$getservbyname_r_proto" in
15399 ''|0) d_getservbyname_r=undef
15400 getservbyname_r_proto=0
15401 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15402 * ) case "$getservbyname_r_proto" in
15403 REENTRANT_PROTO*) ;;
15404 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15405 esac
15406 echo "Prototype: $try" ;;
15407 esac
15408 ;;
15409 *) case "$usethreads" in
15410 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15411 esac
15412 d_getservbyname_r=undef
15413 getservbyname_r_proto=0
15414 ;;
15415 esac
15416 ;;
15417*) getservbyname_r_proto=0
15418 ;;
15419esac
15420
15421: see if getservbyport_r exists
15422set getservbyport_r d_getservbyport_r
15423eval $inlibc
15424case "$d_getservbyport_r" in
15425"$define")
15426 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15427 case "$d_getservbyport_r_proto:$usethreads" in
15428 ":define") d_getservbyport_r_proto=define
15429 set d_getservbyport_r_proto getservbyport_r $hdrs
15430 eval $hasproto ;;
15431 *) ;;
15432 esac
15433 case "$d_getservbyport_r_proto" in
15434 define)
15435 case "$getservbyport_r_proto" in
15436 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15437 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15438 esac
15439 case "$getservbyport_r_proto" in
15440 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15441 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15442 esac
15443 case "$getservbyport_r_proto" in
15444 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15445 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15446 esac
15447 case "$getservbyport_r_proto" in
15448 ''|0) d_getservbyport_r=undef
15449 getservbyport_r_proto=0
15450 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15451 * ) case "$getservbyport_r_proto" in
15452 REENTRANT_PROTO*) ;;
15453 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15454 esac
15455 echo "Prototype: $try" ;;
15456 esac
15457 ;;
15458 *) case "$usethreads" in
15459 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15460 esac
15461 d_getservbyport_r=undef
15462 getservbyport_r_proto=0
15463 ;;
15464 esac
15465 ;;
15466*) getservbyport_r_proto=0
15467 ;;
15468esac
15469
15470: see if getservent_r exists
15471set getservent_r d_getservent_r
15472eval $inlibc
15473case "$d_getservent_r" in
15474"$define")
15475 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15476 case "$d_getservent_r_proto:$usethreads" in
15477 ":define") d_getservent_r_proto=define
15478 set d_getservent_r_proto getservent_r $hdrs
15479 eval $hasproto ;;
15480 *) ;;
15481 esac
15482 case "$d_getservent_r_proto" in
15483 define)
15484 case "$getservent_r_proto" in
15485 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15486 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15487 esac
15488 case "$getservent_r_proto" in
15489 ''|0) try='int getservent_r(struct servent*, char*, int);'
15490 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15491 esac
15492 case "$getservent_r_proto" in
15493 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15494 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15495 esac
15496 case "$getservent_r_proto" in
15497 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15498 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15499 esac
15500 case "$getservent_r_proto" in
15501 ''|0) d_getservent_r=undef
15502 getservent_r_proto=0
15503 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15504 * ) case "$getservent_r_proto" in
15505 REENTRANT_PROTO*) ;;
15506 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15507 esac
15508 echo "Prototype: $try" ;;
15509 esac
15510 ;;
15511 *) case "$usethreads" in
15512 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15513 esac
15514 d_getservent_r=undef
15515 getservent_r_proto=0
15516 ;;
15517 esac
15518 ;;
15519*) getservent_r_proto=0
15520 ;;
15521esac
15522
15523: see if prototypes for various getservxxx netdb.h functions are available
15524echo " "
15525set d_getservprotos getservent $i_netdb netdb.h
15526eval $hasproto
15527
15528: see if getspnam exists
15529set getspnam d_getspnam
15530eval $inlibc
15531
15532: see if this is a shadow.h system
15533set shadow.h i_shadow
15534eval $inhdr
15535
15536: see if getspnam_r exists
15537set getspnam_r d_getspnam_r
15538eval $inlibc
15539case "$d_getspnam_r" in
15540"$define")
15541 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15542 case "$d_getspnam_r_proto:$usethreads" in
15543 ":define") d_getspnam_r_proto=define
15544 set d_getspnam_r_proto getspnam_r $hdrs
15545 eval $hasproto ;;
15546 *) ;;
15547 esac
15548 case "$d_getspnam_r_proto" in
15549 define)
15550 case "$getspnam_r_proto" in
15551 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15552 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15553 esac
15554 case "$getspnam_r_proto" in
15555 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15556 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15557 esac
15558 case "$getspnam_r_proto" in
15559 ''|0) d_getspnam_r=undef
15560 getspnam_r_proto=0
15561 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15562 * ) case "$getspnam_r_proto" in
15563 REENTRANT_PROTO*) ;;
15564 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15565 esac
15566 echo "Prototype: $try" ;;
15567 esac
15568 ;;
15569 *) case "$usethreads" in
15570 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15571 esac
15572 d_getspnam_r=undef
15573 getspnam_r_proto=0
15574 ;;
15575 esac
15576 ;;
15577*) getspnam_r_proto=0
15578 ;;
15579esac
15580
15581: see if gettimeofday or ftime exists
15582set gettimeofday d_gettimeod
15583eval $inlibc
15584case "$d_gettimeod" in
15585"$undef")
15586 set ftime d_ftime
15587 eval $inlibc
15588 ;;
15589*)
15590 val="$undef"; set d_ftime; eval $setvar
15591 ;;
15592esac
15593case "$d_gettimeod$d_ftime" in
15594"$undef$undef")
15595 echo " "
15596 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15597 ;;
15598esac
15599
15600: see if gmtime_r exists
15601set gmtime_r d_gmtime_r
15602eval $inlibc
15603case "$d_gmtime_r" in
15604"$define")
15605 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15606 case "$d_gmtime_r_proto:$usethreads" in
15607 ":define") d_gmtime_r_proto=define
15608 set d_gmtime_r_proto gmtime_r $hdrs
15609 eval $hasproto ;;
15610 *) ;;
15611 esac
15612 case "$d_gmtime_r_proto" in
15613 define)
15614 case "$gmtime_r_proto" in
15615 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15616 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15617 esac
15618 case "$gmtime_r_proto" in
15619 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15620 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15621 esac
15622 case "$gmtime_r_proto" in
15623 ''|0) d_gmtime_r=undef
15624 gmtime_r_proto=0
15625 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15626 * ) case "$gmtime_r_proto" in
15627 REENTRANT_PROTO*) ;;
15628 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15629 esac
15630 echo "Prototype: $try" ;;
15631 esac
15632 ;;
15633 *) case "$usethreads" in
15634 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15635 esac
15636 d_gmtime_r=undef
15637 gmtime_r_proto=0
15638 ;;
15639 esac
15640 ;;
15641*) gmtime_r_proto=0
15642 ;;
15643esac
15644
15645: see if hasmntopt exists
15646set hasmntopt d_hasmntopt
15647eval $inlibc
15648
15649: see if this is a netinet/in.h or sys/in.h system
15650set netinet/in.h i_niin sys/in.h i_sysin
15651eval $inhdr
15652
15653: see if arpa/inet.h has to be included
15654set arpa/inet.h i_arpainet
15655eval $inhdr
15656
15657: see if htonl --and friends-- exists
15658val=''
15659set htonl val
15660eval $inlibc
15661
15662: Maybe they are macros.
15663case "$val" in
15664$undef)
15665 $cat >htonl.c <<EOM
15666#include <stdio.h>
15667#include <sys/types.h>
15668#$i_niin I_NETINET_IN
15669#$i_sysin I_SYS_IN
15670#$i_arpainet I_ARPA_INET
15671#ifdef I_NETINET_IN
15672#include <netinet/in.h>
15673#endif
15674#ifdef I_SYS_IN
15675#include <sys/in.h>
15676#endif
15677#ifdef I_ARPA_INET
15678#include <arpa/inet.h>
15679#endif
15680#ifdef htonl
15681printf("Defined as a macro.");
15682#endif
15683EOM
15684 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15685 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15686 val="$define"
15687 echo "But it seems to be defined as a macro." >&4
15688 fi
15689 $rm -f htonl.?
15690 ;;
15691esac
15692set d_htonl
15693eval $setvar
15694
15695: see if hypot exists
15696set hypot d_hypot
15697eval $inlibc
15698
15699: see if ilogb exists
15700set ilogb d_ilogb
15701eval $inlibc
15702
15703: see if ilogbl exists
15704set ilogbl d_ilogbl
15705eval $inlibc
15706
15707: check whether inet_aton exists
15708set inet_aton d_inetaton
15709eval $inlibc
15710
15711: see if inet_ntop exists
15712set inet_ntop d_inetntop
15713eval $inlibc
15714
15715: see if inet_pton exists
15716set inet_pton d_inetpton
15717eval $inlibc
15718
15719: Look for isascii
15720echo " "
15721$cat >isascii.c <<EOCP
15722#include <stdio.h>
15723#include <ctype.h>
15724#$i_stdlib I_STDLIB
15725#ifdef I_STDLIB
15726#include <stdlib.h>
15727#endif
15728int main() {
15729 int c = 'A';
15730 if (isascii(c))
15731 exit(0);
15732 else
15733 exit(1);
15734}
15735EOCP
15736set isascii
15737if eval $compile; then
15738 echo "isascii() found." >&4
15739 val="$define"
15740else
15741 echo "isascii() NOT found." >&4
15742 val="$undef"
15743fi
15744set d_isascii
15745eval $setvar
15746$rm -f isascii*
15747
15748: Look for isblank
15749echo " "
15750$cat >isblank.c <<'EOCP'
15751#include <stdio.h>
15752#include <ctype.h>
15753int main() {
15754 int c = ' ';
15755 if (isblank(c))
15756 return 0 ;
15757 else
15758 return 1 ;
15759}
15760EOCP
15761if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15762 echo "isblank() found." >&4
15763 val="$define"
15764else
15765 echo "isblank() NOT found." >&4
15766 val="$undef"
15767fi
15768set d_isblank
15769eval $setvar
15770$rm -f isblank*
15771
15772: check for isfinite
15773echo "Checking to see if you have isfinite..." >&4
15774$cat >try.c <<EOCP
15775#include <math.h>
15776int main() { return isfinite(0.0); }
15777EOCP
15778set try
15779if eval $compile; then
15780 val="$define"
15781 echo "You have isfinite."
15782else
15783 val="$undef"
15784 echo "You do not have isfinite."
15785fi
15786$rm_try
15787set d_isfinite
15788eval $setvar
15789
15790: see if isfinitel exists
15791set isfinitel d_isfinitel
15792eval $inlibc
15793
15794: check for isinf
15795echo "Checking to see if you have isinf..." >&4
15796$cat >try.c <<EOCP
15797#include <math.h>
15798int main() { return isinf(0.0); }
15799EOCP
15800set try
15801if eval $compile; then
15802 val="$define"
15803 echo "You have isinf."
15804else
15805 val="$undef"
15806 echo "You do not have isinf."
15807fi
15808$rm_try
15809set d_isinf
15810eval $setvar
15811
15812: see if isinfl exists
15813set isinfl d_isinfl
15814eval $inlibc
15815
15816: check for isless
15817echo "Checking to see if you have isless..." >&4
15818$cat >try.c <<EOCP
15819#include <math.h>
15820int main() { return isless(2.0, 1.0); }
15821EOCP
15822set try
15823if eval $compile; then
15824 val="$define"
15825 echo "You have isless."
15826else
15827 val="$undef"
15828 echo "You do not have isless."
15829fi
15830$rm_try
15831set d_isless
15832eval $setvar
15833
15834: check for isnan
15835echo "Checking to see if you have isnan..." >&4
15836$cat >try.c <<EOCP
15837#include <math.h>
15838int main() { return isnan(0.0); }
15839EOCP
15840set try
15841if eval $compile; then
15842 val="$define"
15843 echo "You have isnan."
15844else
15845 val="$undef"
15846 echo "You do not have isnan."
15847fi
15848$rm_try
15849set d_isnan
15850eval $setvar
15851
15852: see if isnanl exists
15853set isnanl d_isnanl
15854eval $inlibc
15855
15856: check for isnormal
15857echo "Checking to see if you have isnormal..." >&4
15858$cat >try.c <<EOCP
15859#include <math.h>
15860int main() { return isnormal(0.0); }
15861EOCP
15862set try
15863if eval $compile; then
15864 val="$define"
15865 echo "You have isnormal."
15866else
15867 val="$undef"
15868 echo "You do not have isnormal."
15869fi
15870$rm_try
15871set d_isnormal
15872eval $setvar
15873
15874: see if j0 exists
15875set j0 d_j0
15876eval $inlibc
15877
15878: see if j0l exists
15879set j0l d_j0l
15880eval $inlibc
15881
15882: see if killpg exists
15883set killpg d_killpg
15884eval $inlibc
15885
15886: see if localeconv exists
15887set localeconv d_locconv
15888eval $inlibc
15889
15890: see if libc has the POSIX.1-2008 currency locale rules
15891case "$d_locconv:$d_lc_monetary_2008" in
15892$define:)
15893 $cat >try.c <<EOCP
15894#include <locale.h>
15895int main() {
15896 struct lconv *lc = localeconv();
15897 char int_p_cs_precedes = lc->int_p_cs_precedes;
15898 return 0;
15899}
15900EOCP
15901 set try
15902 if eval $compile; then
15903 d_lc_monetary_2008="$define"
15904 else
15905 d_lc_monetary_2008="$undef"
15906 fi;
15907 $rm_try
15908 ;;
15909esac
15910
15911: see if lchown exists
15912echo " "
15913$cat > try.c <<EOCP
15914#include <pwd.h>
15915#include <stdio.h>
15916#include <stdlib.h>
15917#$i_unistd I_UNISTD
15918#ifdef I_UNISTD
15919# include <unistd.h>
15920#endif
15921int main(int argc, char *argv[])
15922{
15923 if (lchown("./try.c", -1, getgid()) == -1) {
15924 exit(EXIT_FAILURE);
15925 }
15926 exit(EXIT_SUCCESS);
15927}
15928EOCP
15929set try
15930if eval $compile && ./try; then
15931 $echo "lchown() found." >&4
15932 val="$define"
15933else
15934 $echo "lchown() NOT found." >&4
15935 val="$undef"
15936fi
15937set d_lchown
15938eval $setvar
15939$rm_try
15940
15941: See if number of significant digits in a double precision number is known
15942echo " "
15943$cat >ldbl_dig.c <<EOM
15944#include <limits.h>
15945#include <float.h>
15946#ifdef LDBL_DIG
15947printf("Contains LDBL_DIG");
15948#endif
15949EOM
15950$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15951if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15952 echo "LDBL_DIG found." >&4
15953 val="$define"
15954else
15955 echo "LDBL_DIG NOT found." >&4
15956 val="$undef"
15957fi
15958$rm -f ldbl_dig.?
15959set d_ldbl_dig
15960eval $setvar
15961
15962: see if lgamma exists
15963set lgamma d_lgamma
15964eval $inlibc
15965
15966: see if lgamma_r exists
15967set lgamma_r d_lgamma_r
15968eval $inlibc
15969
15970: check to see if math.h defines _LIB_VERSION
15971d_libm_lib_version="$undef"
15972echo " "
15973echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15974$cat >try.c <<EOCP
15975#include <unistd.h>
15976#include <math.h>
15977int main (int argc, char *argv[])
15978{
15979 printf ("%d\n", _LIB_VERSION);
15980 return (0);
15981 } /* main */
15982EOCP
15983set try
15984if eval $compile; then
15985 foo=`$run ./try`
15986 echo "Yes, it does ($foo)" >&4
15987 d_libm_lib_version="$define"
15988else
15989 echo "No, it does not (probably harmless)" >&4
15990 fi
15991$rm_try
15992
15993: see if link exists
15994set link d_link
15995eval $inlibc
15996
15997: see if llrint exists
15998set llrint d_llrint
15999eval $inlibc
16000
16001: see if llrintl exists
16002set llrintl d_llrintl
16003eval $inlibc
16004
16005: see if llround exists
16006set llround d_llround
16007eval $inlibc
16008
16009: see if llroundl exists
16010set llroundl d_llroundl
16011eval $inlibc
16012
16013: see if localeconv_l exists
16014set localeconv_l d_localeconv_l
16015eval $inlibc
16016
16017: see if localtime_r exists
16018set localtime_r d_localtime_r
16019eval $inlibc
16020case "$d_localtime_r" in
16021"$define")
16022 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16023 case "$d_localtime_r_proto:$usethreads" in
16024 ":define") d_localtime_r_proto=define
16025 set d_localtime_r_proto localtime_r $hdrs
16026 eval $hasproto ;;
16027 *) ;;
16028 esac
16029 case "$d_localtime_r_proto" in
16030 define)
16031 case "$localtime_r_proto" in
16032 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16033 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16034 esac
16035 case "$localtime_r_proto" in
16036 ''|0) try='int localtime_r(const time_t*, struct tm*);'
16037 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16038 esac
16039 case "$localtime_r_proto" in
16040 ''|0) d_localtime_r=undef
16041 localtime_r_proto=0
16042 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16043 * ) case "$localtime_r_proto" in
16044 REENTRANT_PROTO*) ;;
16045 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16046 esac
16047 echo "Prototype: $try" ;;
16048 esac
16049 ;;
16050 *) case "$usethreads" in
16051 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16052 esac
16053 d_localtime_r=undef
16054 localtime_r_proto=0
16055 ;;
16056 esac
16057 ;;
16058*) localtime_r_proto=0
16059 ;;
16060esac
16061
16062: see if localtime_r calls tzset
16063case "$localtime_r_proto" in
16064REENTRANT_PROTO*)
16065 $cat >try.c <<EOCP
16066/* Does our libc's localtime_r call tzset ?
16067 * return 0 if so, 1 otherwise.
16068 */
16069#$i_systypes I_SYS_TYPES
16070#$i_unistd I_UNISTD
16071#$i_time I_TIME
16072#$i_stdlib I_STDLIB
16073#$i_malloc I_MALLOC
16074#ifdef I_SYS_TYPES
16075# include <sys/types.h>
16076#endif
16077#ifdef I_UNISTD
16078# include <unistd.h>
16079#endif
16080#ifdef I_TIME
16081# include <time.h>
16082#endif
16083#ifdef I_STDLIB
16084#include <stdlib.h>
16085#endif
16086#include <string.h>
16087#ifdef I_MALLOC
16088# include <malloc.h>
16089#endif
16090int main()
16091{
16092 time_t t = time(0L);
16093 char w_tz[]="TZ" "=GMT+5",
16094 e_tz[]="TZ" "=GMT-5",
16095 *tz_e = (char*)malloc(16),
16096 *tz_w = (char*)malloc(16);
16097 struct tm tm_e, tm_w;
16098 memset(&tm_e,'\0',sizeof(struct tm));
16099 memset(&tm_w,'\0',sizeof(struct tm));
16100 strcpy(tz_e,e_tz);
16101 strcpy(tz_w,w_tz);
16102
16103 putenv(tz_e);
16104 localtime_r(&t, &tm_e);
16105
16106 putenv(tz_w);
16107 localtime_r(&t, &tm_w);
16108
16109 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16110 return 1;
16111 return 0;
16112}
16113EOCP
16114 set try
16115 if eval $compile; then
16116 if $run ./try; then
16117 d_localtime_r_needs_tzset=undef;
16118 else
16119 d_localtime_r_needs_tzset=define;
16120 fi;
16121 else
16122 d_localtime_r_needs_tzset=undef;
16123 fi;
16124 ;;
16125 *)
16126 d_localtime_r_needs_tzset=undef;
16127 ;;
16128esac
16129$rm_try
16130
16131: see if lockf exists
16132set lockf d_lockf
16133eval $inlibc
16134
16135: see if log1p exists
16136set log1p d_log1p
16137eval $inlibc
16138
16139: see if log2 exists
16140set log2 d_log2
16141eval $inlibc
16142
16143: see if logb exists
16144set logb d_logb
16145eval $inlibc
16146
16147: see if lrint exists
16148set lrint d_lrint
16149eval $inlibc
16150
16151: see if lrintl exists
16152set lrintl d_lrintl
16153eval $inlibc
16154
16155: see if lround exists
16156set lround d_lround
16157eval $inlibc
16158
16159: see if lroundl exists
16160set lroundl d_lroundl
16161eval $inlibc
16162
16163: see if prototype for lseek is available
16164echo " "
16165set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16166eval $hasproto
16167
16168: see if lstat exists
16169set lstat d_lstat
16170eval $inlibc
16171
16172: see if madvise exists
16173set madvise d_madvise
16174eval $inlibc
16175
16176: see if malloc_size exists
16177set malloc_size d_malloc_size
16178eval $inlibc
16179
16180: see if malloc_size_good exists
16181set malloc_good_size d_malloc_good_size
16182eval $inlibc
16183
16184: see if malloc_usable_size exists
16185set malloc_usable_size d_malloc_usable_size
16186eval $inlibc
16187
16188: see if mblen exists
16189set mblen d_mblen
16190eval $inlibc
16191
16192: see if mbrlen exists
16193set mbrlen d_mbrlen
16194eval $inlibc
16195
16196: see if mbrtowc exists
16197set mbrtowc d_mbrtowc
16198eval $inlibc
16199
16200: see if mbstowcs exists
16201set mbstowcs d_mbstowcs
16202eval $inlibc
16203
16204: see if mbtowc exists
16205set mbtowc d_mbtowc
16206eval $inlibc
16207
16208: see if memmem exists
16209: We need both a prototype in string.h and the symbol in libc.
16210echo " "
16211d_memmem_proto=''
16212xx1="#$d_gnulibc HAS_GNULIBC"
16213xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16214xx3='# define _GNU_SOURCE'
16215xx4='#endif'
16216set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16217eval $hasproto
16218case "$d_memmem_proto" in
16219 define) # see if memmem exists
16220 set memmem d_memmem
16221 eval $inlibc
16222 ;;
16223 *) val=$undef
16224 set d_memmem
16225 eval $setvar
16226 ;;
16227esac
16228
16229: see if memrchr exists
16230: We need both a prototype in string.h and the symbol in libc.
16231echo " "
16232d_memrchr_proto=''
16233xx1="#$d_gnulibc HAS_GNULIBC"
16234xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16235xx3='# define _GNU_SOURCE'
16236xx4='#endif'
16237set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16238eval $hasproto
16239case "$d_memrchr_proto" in
16240 define) # see if memrchr exists
16241 set memrchr d_memrchr
16242 eval $inlibc
16243 ;;
16244 *) val=$undef
16245 set d_memrchr
16246 eval $setvar
16247 ;;
16248esac
16249
16250: see if mkdir exists
16251set mkdir d_mkdir
16252eval $inlibc
16253
16254: see if mkdtemp exists
16255set mkdtemp d_mkdtemp
16256eval $inlibc
16257
16258: see if mkfifo exists
16259set mkfifo d_mkfifo
16260eval $inlibc
16261
16262: see if mkostemp exists
16263set mkostemp d_mkostemp
16264eval $inlibc
16265
16266: see if mkstemp exists
16267set mkstemp d_mkstemp
16268eval $inlibc
16269
16270: see if mkstemps exists
16271set mkstemps d_mkstemps
16272eval $inlibc
16273
16274: see if mktime exists
16275set mktime d_mktime
16276eval $inlibc
16277
16278: see if sys/mman.h has to be included
16279set sys/mman.h i_sysmman
16280eval $inhdr
16281
16282: see if mmap exists
16283set mmap d_mmap
16284eval $inlibc
16285: see what shmat returns
16286: default to something harmless
16287mmaptype='void *'
16288case "$i_sysmman$d_mmap" in
16289"$define$define")
16290 $cat >mmap.c <<'END'
16291#include <sys/mman.h>
16292void *mmap();
16293END
16294 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16295 mmaptype='void *'
16296 else
16297 mmaptype='caddr_t'
16298 fi
16299 echo "and it returns ($mmaptype)." >&4
16300 ;;
16301esac
16302
16303: see if sqrtl exists
16304set sqrtl d_sqrtl
16305eval $inlibc
16306
16307: see if scalbnl exists
16308set scalbnl d_scalbnl
16309eval $inlibc
16310
16311: see if truncl exists
16312set truncl d_truncl
16313eval $inlibc
16314
16315: see if modfl exists
16316set modfl d_modfl
16317eval $inlibc
16318
16319: see if prototype for modfl is available
16320echo " "
16321set d_modflproto modfl define math.h
16322eval $hasproto
16323
16324if $test "$uselongdouble" = "$define"; then
16325 message=""
16326 if $test "$d_sqrtl" != "$define"; then
16327 message="$message sqrtl"
16328 fi
16329 if $test "$d_modfl" != "$define"; then
16330 if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16331 echo "You have both truncl and copysignl, so I can emulate modfl."
16332 else
16333 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16334 echo "You have both aintl and copysignl, so I can emulate modfl."
16335 else
16336 message="$message modfl"
16337 fi
16338 fi
16339 fi
16340 if $test "$d_frexpl" != "$define"; then
16341 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16342 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16343 else
16344 message="$message frexpl"
16345 fi
16346 fi
16347 if $test "$d_ldexpl" != "$define"; then
16348 message="$message ldexpl"
16349 fi
16350
16351 if $test "$message" != ""; then
16352 $cat <<EOM >&4
16353
16354*** You requested the use of long doubles but you do not seem to have
16355*** the following mathematical functions needed for long double support:
16356*** $message
16357*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16358*** Cannot continue, aborting.
16359
16360EOM
16361
16362 exit 1
16363 fi
16364fi
16365
16366: see if mprotect exists
16367set mprotect d_mprotect
16368eval $inlibc
16369
16370: see if msgctl exists
16371set msgctl d_msgctl
16372eval $inlibc
16373
16374: see if msgget exists
16375set msgget d_msgget
16376eval $inlibc
16377
16378: see if msgsnd exists
16379set msgsnd d_msgsnd
16380eval $inlibc
16381
16382: see if msgrcv exists
16383set msgrcv d_msgrcv
16384eval $inlibc
16385
16386: see how much of the 'msg*(2)' library is present.
16387h_msg=true
16388echo " "
16389case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16390*"$undef"*) h_msg=false;;
16391esac
16392case "$osname" in
16393freebsd)
16394 case "`ipcs 2>&1`" in
16395 "SVID messages"*"not configured"*)
16396 echo "Your $osname does not have the msg*(2) configured." >&4
16397 h_msg=false
16398 val="$undef"
16399 set msgctl d_msgctl
16400 eval $setvar
16401 set msgget d_msgget
16402 eval $setvar
16403 set msgsnd d_msgsnd
16404 eval $setvar
16405 set msgrcv d_msgrcv
16406 eval $setvar
16407 ;;
16408 esac
16409 ;;
16410esac
16411: we could also check for sys/ipc.h ...
16412if $h_msg && $test `./findhdr sys/msg.h`; then
16413 echo "You have the full msg*(2) library." >&4
16414 val="$define"
16415else
16416 echo "You don't have the full msg*(2) library." >&4
16417 val="$undef"
16418fi
16419set d_msg
16420eval $setvar
16421
16422: Check for msghdr_s
16423echo " "
16424echo "Checking to see if your system supports struct msghdr..." >&4
16425set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16426eval $hasstruct
16427case "$d_msghdr_s" in
16428"$define") echo "Yes, it does." ;;
16429*) echo "No, it doesn't." ;;
16430esac
16431
16432: see if msync exists
16433set msync d_msync
16434eval $inlibc
16435
16436: see if munmap exists
16437set munmap d_munmap
16438eval $inlibc
16439
16440: see if nan exists
16441set nan d_nan
16442eval $inlibc
16443
16444: see if nanosleep exists
16445set nanosleep d_nanosleep
16446eval $inlibc
16447
16448: see if nearbyint exists
16449set nearbyint d_nearbyint
16450eval $inlibc
16451
16452: see if nextafter exists
16453set nextafter d_nextafter
16454eval $inlibc
16455
16456: see if nexttoward exists
16457set nexttoward d_nexttoward
16458eval $inlibc
16459
16460: see if nice exists
16461set nice d_nice
16462eval $inlibc
16463
16464: see if this is a langinfo.h system
16465set langinfo.h i_langinfo
16466eval $inhdr
16467
16468: see if nl_langinfo exists
16469set nl_langinfo d_nl_langinfo
16470eval $inlibc
16471
16472: see if this is a quadmath.h system
16473set quadmath.h i_quadmath
16474eval $inhdr
16475
16476: Check basic sizes
16477echo " "
16478$echo "Choosing the C types to be used for Perl's internal types..." >&4
16479
16480case "$use64bitint:$d_quad:$quadtype" in
16481define:define:?*)
16482 ivtype="$quadtype"
16483 uvtype="$uquadtype"
16484 ivsize=8
16485 uvsize=8
16486 ;;
16487*) ivtype="long"
16488 uvtype="unsigned long"
16489 ivsize=$longsize
16490 uvsize=$longsize
16491 ;;
16492esac
16493
16494case "$uselongdouble:$d_longdbl" in
16495define:define)
16496 nvtype="long double"
16497 nvsize=$longdblsize
16498 ;;
16499*) nvtype=double
16500 nvsize=$doublesize
16501 ;;
16502esac
16503
16504case "$usequadmath:$i_quadmath" in
16505define:define)
16506 nvtype="__float128"
16507 nvsize=16
16508 case "$libs" in
16509 *quadmath*) ;;
16510 *) $cat <<EOM >&4
16511
16512*** You requested the use of the quadmath library, but you
16513*** do not seem to have the quadmath library installed.
16514*** Cannot continue, aborting.
16515EOM
16516 exit 1
16517 ;;
16518 esac
16519 ;;
16520define:*) $cat <<EOM >&4
16521
16522*** You requested the use of the quadmath library, but you
16523*** do not seem to have the required header, <quadmath.h>.
16524EOM
16525 case "$gccversion" in
16526 [23].*|4.[0-5]*)
16527 $cat <<EOM >&4
16528*** Your gcc looks a bit old:
16529*** $gccversion
16530EOM
16531 ;;
16532 '')
16533 $cat <<EOM >&4
16534*** You are not running a gcc.
16535EOM
16536 ;;
16537 esac
16538 $cat <<EOM >&4
16539*** For the quadmath library you need at least gcc 4.6.
16540*** Cannot continue, aborting.
16541EOM
16542 exit 1
16543 ;;
16544esac
16545
16546$echo "(IV will be "$ivtype", $ivsize bytes)"
16547$echo "(UV will be "$uvtype", $uvsize bytes)"
16548$echo "(NV will be "$nvtype", $nvsize bytes)"
16549
16550$cat >try.c <<EOCP
16551#$i_inttypes I_INTTYPES
16552#ifdef I_INTTYPES
16553#include <inttypes.h>
16554#endif
16555#include <stdio.h>
16556int main() {
16557#ifdef INT8
16558 int8_t i = INT8_MAX;
16559 uint8_t u = UINT8_MAX;
16560 printf("int8_t\n");
16561#endif
16562#ifdef INT16
16563 int16_t i = INT16_MAX;
16564 uint16_t u = UINT16_MAX;
16565 printf("int16_t\n");
16566#endif
16567#ifdef INT32
16568 int32_t i = INT32_MAX;
16569 uint32_t u = UINT32_MAX;
16570 printf("int32_t\n");
16571#endif
16572}
16573EOCP
16574
16575i8type="signed char"
16576u8type="unsigned char"
16577i8size=1
16578u8size=1
16579
16580case "$i16type" in
16581'') case "$shortsize" in
16582 2) i16type=short
16583 u16type="unsigned short"
16584 i16size=$shortsize
16585 u16size=$shortsize
16586 ;;
16587 esac
16588 ;;
16589esac
16590case "$i16type" in
16591'') set try -DINT16
16592 if eval $compile; then
16593 case "`$run ./try`" in
16594 int16_t)
16595 i16type=int16_t
16596 u16type=uint16_t
16597 i16size=2
16598 u16size=2
16599 ;;
16600 esac
16601 fi
16602 ;;
16603esac
16604case "$i16type" in
16605'') if $test $shortsize -ge 2; then
16606 i16type=short
16607 u16type="unsigned short"
16608 i16size=$shortsize
16609 u16size=$shortsize
16610 fi
16611 ;;
16612esac
16613
16614case "$i32type" in
16615'') case "$longsize" in
16616 4) i32type=long
16617 u32type="unsigned long"
16618 i32size=$longsize
16619 u32size=$longsize
16620 ;;
16621 *) case "$intsize" in
16622 4) i32type=int
16623 u32type="unsigned int"
16624 i32size=$intsize
16625 u32size=$intsize
16626 ;;
16627 esac
16628 ;;
16629 esac
16630 ;;
16631esac
16632case "$i32type" in
16633'') set try -DINT32
16634 if eval $compile; then
16635 case "`$run ./try`" in
16636 int32_t)
16637 i32type=int32_t
16638 u32type=uint32_t
16639 i32size=4
16640 u32size=4
16641 ;;
16642 esac
16643 fi
16644 ;;
16645esac
16646case "$i32type" in
16647'') if $test $intsize -ge 4; then
16648 i32type=int
16649 u32type="unsigned int"
16650 i32size=$intsize
16651 u32size=$intsize
16652 fi
16653 ;;
16654esac
16655
16656case "$i64type" in
16657'') case "$d_quad:$quadtype" in
16658 define:?*)
16659 i64type="$quadtype"
16660 u64type="$uquadtype"
16661 i64size=8
16662 u64size=8
16663 ;;
16664 esac
16665 ;;
16666esac
16667
16668$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16669$cat <<EOP >try.c
16670#include <stdio.h>
16671#$i_stdlib I_STDLIB
16672#ifdef I_STDLIB
16673#include <stdlib.h>
16674#endif
16675#include <sys/types.h>
16676#include <signal.h>
16677#ifdef SIGFPE
16678/* volatile so that the compiler has to store it out to memory */
16679volatile int bletched = 0;
16680$signal_t blech(int s) { bletched = 1; }
16681#endif
16682int main() {
16683 $uvtype u = 0;
16684 $nvtype d;
16685 int n = 8 * $uvsize;
16686 int i;
16687#ifdef SIGFPE
16688 signal(SIGFPE, blech);
16689#endif
16690
16691 for (i = 0; i < n; i++) {
16692 u = u << 1 | ($uvtype)1;
16693 d = ($nvtype)u;
16694 if (($uvtype)d != u)
16695 break;
16696 if (d <= 0)
16697 break;
16698 d = ($nvtype)(u - 1);
16699 if (($uvtype)d != (u - 1))
16700 break;
16701#ifdef SIGFPE
16702 if (bletched)
16703 break;
16704#endif
16705 }
16706 printf("%d\n", ((i == n) ? -n : i));
16707 exit(0);
16708}
16709EOP
16710set try
16711
16712d_nv_preserves_uv="$undef"
16713if eval $compile; then
16714 nv_preserves_uv_bits="`$run ./try`"
16715fi
16716case "$nv_preserves_uv_bits" in
16717\-[1-9]*)
16718 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16719 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
16720 d_nv_preserves_uv="$define"
16721 ;;
16722[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
16723 d_nv_preserves_uv="$undef" ;;
16724*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
16725 nv_preserves_uv_bits="0" ;;
16726esac
16727$rm_try
16728
16729$echo "Checking to find the largest integer value your NVs can hold..." >&4
16730$cat <<EOP >try.c
16731#include <stdio.h>
16732
16733typedef $nvtype NV;
16734
16735int
16736main() {
16737 NV value = 2;
16738 int count = 1;
16739
16740 while(count < 256) {
16741 /* volatile so that the compiler has to store it out to memory */
16742 volatile NV up = value + 1.0;
16743 volatile NV negated = -value;
16744 volatile NV down = negated - 1.0;
16745 volatile NV got_up = up - value;
16746 int up_good = got_up == 1.0;
16747 int got_down = down - negated;
16748 int down_good = got_down == -1.0;
16749
16750 if (down_good != up_good) {
16751 fprintf(stderr,
16752 "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16753 up_good, (double) got_up, down_good, (double) got_down,
16754 count, (double) value);
16755 return 1;
16756 }
16757 if (!up_good) {
16758 while (1) {
16759 if (count > 8) {
16760 count -= 8;
16761 fputs("256.0", stdout);
16762 } else {
16763 count--;
16764 fputs("2.0", stdout);
16765 }
16766 if (!count) {
16767 puts("");
16768 return 0;
16769 }
16770 fputs("*", stdout);
16771 }
16772 }
16773 value *= 2;
16774 ++count;
16775 }
16776 fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16777 count, (double) value);
16778 return 1;
16779}
16780EOP
16781set try
16782
16783nv_overflows_integers_at='0'
16784if eval $compile; then
16785 xxx="`$run ./try`"
16786 case "$?" in
16787 0)
16788 case "$xxx" in
16789 2*) cat >&4 <<EOM
16790The largest integer your NVs can preserve is equal to $xxx
16791EOM
16792 nv_overflows_integers_at="$xxx"
16793 ;;
16794 *) cat >&4 <<EOM
16795Cannot determine the largest integer value your NVs can hold, unexpected output
16796'$xxx'
16797EOM
16798 ;;
16799 esac
16800 ;;
16801 *) cat >&4 <<EOM
16802Cannot determine the largest integer value your NVs can hold
16803EOM
16804 ;;
16805 esac
16806fi
16807$rm_try
16808
16809$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16810$cat <<EOP >try.c
16811#include <stdio.h>
16812#$i_stdlib I_STDLIB
16813#ifdef I_STDLIB
16814#include <stdlib.h>
16815#endif
16816#include <string.h>
16817#include <sys/types.h>
16818#include <signal.h>
16819#ifdef SIGFPE
16820/* volatile so that the compiler has to store it out to memory */
16821volatile int bletched = 0;
16822$signal_t blech(int s) { bletched = 1; }
16823#endif
16824
16825int checkit($nvtype d, const char *where) {
16826 void *v = &d;
16827 unsigned char *p = (unsigned char *)v;
16828 unsigned char *end = p + sizeof(d);
16829 int fail = 0;
16830
16831 while (p < end)
16832 fail += *p++;
16833
16834 if (!fail)
16835 return 0;
16836
16837 p = (unsigned char *)v;
16838 printf("No - %s: 0x", where);
16839 while (p < end)
16840 printf ("%02X", *p++);
16841 printf("\n");
16842 return 1;
16843}
16844
16845int main(int argc, char **argv) {
16846 $nvtype d = 0.0;
16847 int fail = 0;
16848 fail += checkit(d, "0.0");
16849
16850 /* The compiler shouldn't be assuming that bletched is 0 */
16851 d = bletched;
16852
16853 fail += checkit(d, "bleched");
16854
16855#ifdef SIGFPE
16856 signal(SIGFPE, blech);
16857#endif
16858
16859 /* Paranoia - the compiler should have no way of knowing that ANSI says
16860 that argv[argc] will always be NULL. Actually, if it did assume this it
16861 would be buggy, as this is C and main() can be called from elsewhere in
16862 the program. */
16863 d = argv[argc] ? 1 : 0;
16864
16865 if (d) {
16866 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16867 }
16868
16869 fail += checkit(d, "ternary");
16870
16871 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16872
16873 if (d != 0.0) {
16874 printf("No - memset doesn't give 0.0\n");
16875 /* This might just blow up: */
16876 printf("(gives %g)\n", d);
16877 return 1;
16878 }
16879
16880#ifdef SIGFPE
16881 if (bletched) {
16882 printf("No - something bleched\n");
16883 return 1;
16884 }
16885#endif
16886 if (fail) {
16887 printf("No - %d fail(s)\n", fail);
16888 return 1;
16889 }
16890 printf("Yes\n");
16891 return 0;
16892}
16893EOP
16894set try
16895
16896d_nv_zero_is_allbits_zero="$undef"
16897if eval $compile; then
16898 xxx="`$run ./try`"
16899 case "$?" in
16900 0)
16901 case "$xxx" in
16902 Yes) cat >&4 <<EOM
169030.0 is represented as all bits zero in memory
16904EOM
16905 d_nv_zero_is_allbits_zero="$define"
16906 ;;
16907 *) cat >&4 <<EOM
169080.0 is not represented as all bits zero in memory
16909EOM
16910 d_nv_zero_is_allbits_zero="$undef"
16911 ;;
16912 esac
16913 ;;
16914 *) cat >&4 <<EOM
169150.0 is not represented as all bits zero in memory
16916EOM
16917 d_nv_zero_is_allbits_zero="$undef"
16918 ;;
16919 esac
16920fi
16921$rm_try
16922
16923: check for off64_t
16924echo " "
16925echo "Checking to see if you have off64_t..." >&4
16926$cat >try.c <<EOCP
16927#include <sys/types.h>
16928#include <unistd.h>
16929int main() { off64_t x = 7; }
16930EOCP
16931set try
16932if eval $compile; then
16933 val="$define"
16934 echo "You have off64_t."
16935else
16936 val="$undef"
16937 echo "You do not have off64_t."
16938 case "$lseeksize" in
16939 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16940 esac
16941fi
16942$rm_try
16943set d_off64_t
16944eval $setvar
16945
16946: how to create joinable pthreads
16947if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16948 echo " "
16949 echo "Checking what constant to use for creating joinable pthreads..." >&4
16950 $cat >try.c <<'EOCP'
16951#include <pthread.h>
16952int main() {
16953 int detachstate = JOINABLE;
16954}
16955EOCP
16956 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16957 if eval $compile; then
16958 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16959 val="$undef" # Yes, undef.
16960 set d_old_pthread_create_joinable
16961 eval $setvar
16962 val=""
16963 set old_pthread_create_joinable
16964 eval $setvar
16965 else
16966 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16967 if eval $compile; then
16968 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16969 val="$define"
16970 set d_old_pthread_create_joinable
16971 eval $setvar
16972 val=PTHREAD_CREATE_UNDETACHED
16973 set old_pthread_create_joinable
16974 eval $setvar
16975 else
16976 set try -DJOINABLE=__UNDETACHED
16977 if eval $compile; then
16978 echo "You seem to use __UNDETACHED." >&4
16979 val="$define"
16980 set d_old_pthread_create_joinable
16981 eval $setvar
16982 val=__UNDETACHED
16983 set old_pthread_create_joinable
16984 eval $setvar
16985 else
16986 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
16987 val="$define"
16988 set d_old_pthread_create_joinable
16989 eval $setvar
16990 val=0
16991 set old_pthread_create_joinable
16992 eval $setvar
16993 fi
16994 fi
16995 fi
16996 $rm_try
16997else
16998 d_old_pthread_create_joinable="$undef"
16999 old_pthread_create_joinable=""
17000fi
17001
17002: see if pause exists
17003set pause d_pause
17004eval $inlibc
17005
17006: see if pipe2 exists
17007set pipe2 d_pipe2
17008eval $inlibc
17009
17010: see if poll exists
17011set poll d_poll
17012eval $inlibc
17013
17014: see if prctl exists
17015set prctl d_prctl
17016eval $inlibc
17017
17018: see if prctl supports PR_SET_NAME
17019d_prctl_set_name=$undef
17020case $d_prctl in
17021 $define)
17022 $cat >try.c <<EOM
17023#ifdef __ANDROID__
17024#include <unistd.h>
17025#endif
17026#include <sys/prctl.h>
17027
17028int main (int argc, char *argv[])
17029{
17030 return (prctl (PR_SET_NAME, "Test"));
17031 } /* main */
17032EOM
17033 set try
17034 if eval $compile_ok && $run ./try; then
17035 echo "Your prctl (PR_SET_NAME, ...) works"
17036 d_prctl_set_name=$define
17037 fi
17038 $rm_try
17039 ;;
17040 esac
17041
17042: see if readlink exists
17043set readlink d_readlink
17044eval $inlibc
17045
17046: Check if there is a /proc symlink to the abs path of
17047: the executing program. We will honor hints of d_procselfexe=$undef
17048: or procselfexe being non-empty, otherwise will try to determine both
17049: if we have readlink.
17050: AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17051: referenced, and AmigaOS does not have a proc filesystem anyway.
17052echo " "
17053val="$undef"
17054if $test "X$d_procselfexe" = Xundef; then
17055 procselfexe=''
17056elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17057 val="$define"
17058elif $test "X$d_readlink" = Xdefine; then
17059 : NetBSD first as /proc/self is a symlink to /proc/curproc,
17060 : and it feels more tidy to avoid an extra level of symlink
17061 set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17062 while test $# -gt 0; do
17063 type=$1; try=$2
17064 shift; shift
17065 if $issymlink $try; then
17066 $ls -l $try > reflect
17067 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17068 echo "You have $type-like $try."
17069 procselfexe='"'$try'"'
17070 val="$define"
17071 : This will break out of the loop
17072 set X; shift
17073 fi
17074 fi
17075 done
17076fi
17077$rm -f reflect
17078set d_procselfexe
17079eval $setvar
17080
17081: backward compatibility for d_hvfork
17082if test X$d_hvfork != X; then
17083 d_vfork="$d_hvfork"
17084 d_hvfork=''
17085fi
17086: see if there is a vfork
17087val=''
17088set vfork val
17089eval $inlibc
17090
17091d_pseudofork=$undef
17092
17093: Ok, but do we want to use it. vfork is reportedly unreliable in
17094: perl on Solaris 2.x, and probably elsewhere.
17095case "$val" in
17096$define)
17097 echo " "
17098 case "$usevfork" in
17099 false) dflt='n';;
17100 *) dflt='y';;
17101 esac
17102 cat <<'EOM'
17103
17104Perl can only use a vfork() that doesn't suffer from strict
17105restrictions on calling functions or modifying global data in
17106the child. For example, glibc-2.1 contains such a vfork()
17107that is unsuitable. If your system provides a proper fork()
17108call, chances are that you do NOT want perl to use vfork().
17109
17110EOM
17111 rp="Do you still want to use vfork()?"
17112 . ./myread
17113 case "$ans" in
17114 y|Y) ;;
17115 *)
17116 echo "Ok, we won't use vfork()."
17117 val="$undef"
17118 ;;
17119 esac
17120 ;;
17121esac
17122set d_vfork
17123eval $setvar
17124case "$d_vfork" in
17125$define) usevfork='true';;
17126*) usevfork='false';;
17127esac
17128
17129: see whether the pthread_atfork exists
17130$cat >try.c <<EOP
17131#include <pthread.h>
17132#include <stdio.h>
17133int main() {
17134#ifdef PTHREAD_ATFORK
17135 pthread_atfork(NULL,NULL,NULL);
17136#endif
17137}
17138EOP
17139
17140: see if pthread_atfork exists
17141set try -DPTHREAD_ATFORK
17142if eval $compile; then
17143 val="$define"
17144else
17145 val="$undef"
17146fi
17147case "$usethreads" in
17148$define)
17149 case "$val" in
17150 $define) echo 'pthread_atfork found.' >&4 ;;
17151 *) echo 'pthread_atfork NOT found.' >&4 ;;
17152 esac
17153esac
17154set d_pthread_atfork
17155eval $setvar
17156
17157: see if pthread_attr_setscope exists
17158set pthread_attr_setscope d_pthread_attr_setscope
17159eval $inlibc
17160
17161: see whether the various POSIXish _yields exist
17162$cat >try.c <<EOP
17163#include <pthread.h>
17164#include <stdio.h>
17165int main() {
17166#ifdef SCHED_YIELD
17167 sched_yield();
17168#else
17169#ifdef PTHREAD_YIELD
17170 pthread_yield();
17171#else
17172#ifdef PTHREAD_YIELD_NULL
17173 pthread_yield(NULL);
17174#endif
17175#endif
17176#endif
17177}
17178EOP
17179: see if sched_yield exists
17180set try -DSCHED_YIELD
17181if eval $compile; then
17182 val="$define"
17183 sched_yield='sched_yield()'
17184else
17185 val="$undef"
17186fi
17187case "$usethreads" in
17188$define)
17189 case "$val" in
17190 $define) echo 'sched_yield() found.' >&4 ;;
17191 *) echo 'sched_yield() NOT found.' >&4 ;;
17192 esac
17193esac
17194set d_sched_yield
17195eval $setvar
17196
17197: see if pthread_yield exists
17198set try -DPTHREAD_YIELD
17199if eval $compile; then
17200 val="$define"
17201 case "$sched_yield" in
17202 '') sched_yield='pthread_yield()' ;;
17203 esac
17204else
17205 set try -DPTHREAD_YIELD_NULL
17206 if eval $compile; then
17207 val="$define"
17208 case "$sched_yield" in
17209 '') sched_yield='pthread_yield(NULL)' ;;
17210 esac
17211 else
17212 val="$undef"
17213 fi
17214fi
17215case "$usethreads" in
17216$define)
17217 case "$val" in
17218 $define) echo 'pthread_yield() found.' >&4 ;;
17219 *) echo 'pthread_yield() NOT found.' >&4 ;;
17220 esac
17221 ;;
17222esac
17223set d_pthread_yield
17224eval $setvar
17225case "$sched_yield" in
17226'') sched_yield=undef ;;
17227esac
17228$rm_try
17229
17230: check for ptrdiff_t
17231echo " "
17232echo "Checking to see if you have ptrdiff_t..." >&4
17233$cat >try.c <<EOCP
17234#include <stddef.h>
17235int main() { ptrdiff_t x = 7; }
17236EOCP
17237set try
17238if eval $compile; then
17239 val="$define"
17240 echo "You have ptrdiff_t."
17241else
17242 val="$undef"
17243 echo "You do not have ptrdiff_t."
17244fi
17245$rm_try
17246set d_ptrdiff_t
17247eval $setvar
17248
17249: see if random_r exists
17250set random_r d_random_r
17251eval $inlibc
17252case "$d_random_r" in
17253"$define")
17254 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17255 case "$d_random_r_proto:$usethreads" in
17256 ":define") d_random_r_proto=define
17257 set d_random_r_proto random_r $hdrs
17258 eval $hasproto ;;
17259 *) ;;
17260 esac
17261 case "$d_random_r_proto" in
17262 define)
17263 case "$random_r_proto" in
17264 ''|0) try='int random_r(int*, struct random_data*);'
17265 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17266 esac
17267 case "$random_r_proto" in
17268 ''|0) try='int random_r(long*, struct random_data*);'
17269 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17270 esac
17271 case "$random_r_proto" in
17272 ''|0) try='int random_r(struct random_data*, int32_t*);'
17273 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17274 esac
17275 case "$random_r_proto" in
17276 ''|0) d_random_r=undef
17277 random_r_proto=0
17278 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17279 * ) case "$random_r_proto" in
17280 REENTRANT_PROTO*) ;;
17281 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17282 esac
17283 echo "Prototype: $try" ;;
17284 esac
17285 ;;
17286 *) case "$usethreads" in
17287 define) echo "random_r has no prototype, not using it." >&4 ;;
17288 esac
17289 d_random_r=undef
17290 random_r_proto=0
17291 ;;
17292 esac
17293 ;;
17294*) random_r_proto=0
17295 ;;
17296esac
17297
17298: see if readdir and friends exist
17299set readdir d_readdir
17300eval $inlibc
17301set seekdir d_seekdir
17302eval $inlibc
17303set telldir d_telldir
17304eval $inlibc
17305set rewinddir d_rewinddir
17306eval $inlibc
17307
17308: see if readdir64_r exists
17309set readdir64_r d_readdir64_r
17310eval $inlibc
17311case "$d_readdir64_r" in
17312"$define")
17313 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17314 case "$d_readdir64_r_proto:$usethreads" in
17315 ":define") d_readdir64_r_proto=define
17316 set d_readdir64_r_proto readdir64_r $hdrs
17317 eval $hasproto ;;
17318 *) ;;
17319 esac
17320 case "$d_readdir64_r_proto" in
17321 define)
17322 case "$readdir64_r_proto" in
17323 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17324 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17325 esac
17326 case "$readdir64_r_proto" in
17327 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17328 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17329 esac
17330 case "$readdir64_r_proto" in
17331 ''|0) d_readdir64_r=undef
17332 readdir64_r_proto=0
17333 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17334 * ) case "$readdir64_r_proto" in
17335 REENTRANT_PROTO*) ;;
17336 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17337 esac
17338 echo "Prototype: $try" ;;
17339 esac
17340 ;;
17341 *) case "$usethreads" in
17342 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17343 esac
17344 d_readdir64_r=undef
17345 readdir64_r_proto=0
17346 ;;
17347 esac
17348 ;;
17349*) readdir64_r_proto=0
17350 ;;
17351esac
17352
17353: see if readdir_r exists
17354set readdir_r d_readdir_r
17355eval $inlibc
17356case "$d_readdir_r" in
17357"$define")
17358 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17359 case "$d_readdir_r_proto:$usethreads" in
17360 ":define") d_readdir_r_proto=define
17361 set d_readdir_r_proto readdir_r $hdrs
17362 eval $hasproto ;;
17363 *) ;;
17364 esac
17365 case "$d_readdir_r_proto" in
17366 define)
17367 case "$readdir_r_proto" in
17368 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17369 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17370 esac
17371 case "$readdir_r_proto" in
17372 ''|0) try='int readdir_r(DIR*, struct dirent*);'
17373 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17374 esac
17375 case "$readdir_r_proto" in
17376 ''|0) d_readdir_r=undef
17377 readdir_r_proto=0
17378 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17379 * ) case "$readdir_r_proto" in
17380 REENTRANT_PROTO*) ;;
17381 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17382 esac
17383 echo "Prototype: $try" ;;
17384 esac
17385 ;;
17386 *) case "$usethreads" in
17387 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17388 esac
17389 d_readdir_r=undef
17390 readdir_r_proto=0
17391 ;;
17392 esac
17393 ;;
17394*) readdir_r_proto=0
17395 ;;
17396esac
17397
17398: see if readv exists
17399set readv d_readv
17400eval $inlibc
17401
17402: see if recvmsg exists
17403set recvmsg d_recvmsg
17404eval $inlibc
17405
17406: see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17407echo " "
17408if set regcomp val -f d_regcomp; eval $csym; $val; then
17409 echo 'regcomp() found.' >&4
17410 d_regcomp="$define"
17411 d_regcmp="$undef"
17412 d_re_comp="$undef"
17413elif set regcmp val -f d_regcmp; eval $csym; $val; then
17414 echo 'regcmp() found.' >&4
17415 d_regcmp="$define"
17416 d_regcomp="$undef"
17417 d_re_comp="$undef"
17418elif set re_comp val -f d_re_comp; eval $csym; $val; then
17419 echo 're_comp() found, assuming re_exec() also exists.' >&4
17420 d_re_comp="$define"
17421 d_regcomp="$undef"
17422 d_regcmp="$undef"
17423else
17424 $cat >&4 <<EOM
17425No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17426EOM
17427 d_regcmp="$undef"
17428 d_re_comp="$undef"
17429 d_regcomp="$undef"
17430fi
17431
17432: see if remainder exists
17433set remainder d_remainder
17434eval $inlibc
17435
17436: see if remquo exists
17437set remquo d_remquo
17438eval $inlibc
17439
17440: see if rename exists
17441set rename d_rename
17442eval $inlibc
17443
17444: see if rint exists
17445set rint d_rint
17446eval $inlibc
17447
17448: see if rmdir exists
17449set rmdir d_rmdir
17450eval $inlibc
17451
17452: see if round exists
17453set round d_round
17454eval $inlibc
17455
17456: see if prototype for sbrk is available
17457echo " "
17458set d_sbrkproto sbrk $i_unistd unistd.h
17459eval $hasproto
17460
17461: see if scalbn exists
17462set scalbn d_scalbn
17463eval $inlibc
17464
17465: see if select exists
17466set select d_select
17467eval $inlibc
17468
17469: see if semctl exists
17470set semctl d_semctl
17471eval $inlibc
17472
17473: see if semget exists
17474set semget d_semget
17475eval $inlibc
17476
17477: see if semop exists
17478set semop d_semop
17479eval $inlibc
17480
17481: see how much of the 'sem*(2)' library is present.
17482h_sem=true
17483echo " "
17484case "$d_semctl$d_semget$d_semop" in
17485*"$undef"*) h_sem=false;;
17486esac
17487case "$osname" in
17488freebsd)
17489 case "`ipcs 2>&1`" in
17490 "SVID messages"*"not configured"*)
17491 echo "Your $osname does not have the sem*(2) configured." >&4
17492 h_sem=false
17493 val="$undef"
17494 set semctl d_semctl
17495 eval $setvar
17496 set semget d_semget
17497 eval $setvar
17498 set semop d_semop
17499 eval $setvar
17500 ;;
17501 esac
17502 ;;
17503esac
17504: we could also check for sys/ipc.h ...
17505if $h_sem && $test `./findhdr sys/sem.h`; then
17506 echo "You have the full sem*(2) library." >&4
17507 val="$define"
17508else
17509 echo "You don't have the full sem*(2) library." >&4
17510 val="$undef"
17511fi
17512set d_sem
17513eval $setvar
17514
17515: see whether sys/sem.h defines union semun
17516echo " "
17517$cat > try.c <<'END'
17518#include <sys/types.h>
17519#include <sys/ipc.h>
17520#include <sys/sem.h>
17521int main () { union semun semun; semun.buf = 0; }
17522END
17523set try
17524if eval $compile; then
17525 echo "You have union semun in <sys/sem.h>." >&4
17526 val="$define"
17527else
17528 echo "You do not have union semun in <sys/sem.h>." >&4
17529 val="$undef"
17530fi
17531$rm_try
17532set d_union_semun
17533eval $setvar
17534
17535: see how to do semctl IPC_STAT
17536case "$d_sem" in
17537$define)
17538 echo " "
17539 $cat > tryh.h <<END
17540#ifndef S_IRUSR
17541# ifdef S_IREAD
17542# define S_IRUSR S_IREAD
17543# define S_IWUSR S_IWRITE
17544# define S_IXUSR S_IEXEC
17545# else
17546# define S_IRUSR 0400
17547# define S_IWUSR 0200
17548# define S_IXUSR 0100
17549# endif
17550# define S_IRGRP (S_IRUSR>>3)
17551# define S_IWGRP (S_IWUSR>>3)
17552# define S_IXGRP (S_IXUSR>>3)
17553# define S_IROTH (S_IRUSR>>6)
17554# define S_IWOTH (S_IWUSR>>6)
17555# define S_IXOTH (S_IXUSR>>6)
17556#endif
17557#ifndef S_IRWXU
17558# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17559# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17560# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17561#endif
17562END
17563 : see whether semctl IPC_STAT can use union semun
17564 case "$d_semctl_semun" in
17565 '')
17566 val="$undef"
17567 $cat > try.c <<END
17568#include <sys/types.h>
17569#include <sys/ipc.h>
17570#include <sys/sem.h>
17571#include <sys/stat.h>
17572#include <stdio.h>
17573#include <errno.h>
17574#include "tryh.h"
17575#ifndef errno
17576extern int errno;
17577#endif
17578#$d_union_semun HAS_UNION_SEMUN
17579int main() {
17580 union semun
17581#ifndef HAS_UNION_SEMUN
17582 {
17583 int val;
17584 struct semid_ds *buf;
17585 unsigned short *array;
17586 }
17587#endif
17588 arg;
17589 int sem, st;
17590
17591#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17592 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17593 if (sem > -1) {
17594 struct semid_ds argbuf;
17595 arg.buf = &argbuf;
17596# ifdef IPC_STAT
17597 st = semctl(sem, 0, IPC_STAT, arg);
17598 if (st == 0)
17599 printf("semun\n");
17600 else
17601# endif /* IPC_STAT */
17602 printf("semctl IPC_STAT failed: errno = %d\n", errno);
17603# ifdef IPC_RMID
17604 if (semctl(sem, 0, IPC_RMID, arg) != 0)
17605# endif /* IPC_RMID */
17606 printf("semctl IPC_RMID failed: errno = %d\n", errno);
17607 } else
17608#endif /* IPC_PRIVATE && ... */
17609 printf("semget failed: errno = %d\n", errno);
17610 return 0;
17611}
17612END
17613 set try
17614 if eval $compile; then
17615 xxx=`$run ./try`
17616 case "$xxx" in
17617 semun) val="$define" ;;
17618 esac
17619 fi
17620 $rm_try
17621 set d_semctl_semun
17622 eval $setvar
17623 ;;
17624 esac
17625 case "$d_semctl_semun" in
17626 $define)
17627 echo "You can use union semun for semctl IPC_STAT." >&4
17628 also='also'
17629 ;;
17630 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
17631 also=''
17632 ;;
17633 esac
17634
17635 : see whether semctl IPC_STAT can use struct semid_ds pointer
17636 case "$d_semctl_semid_ds" in
17637 '')
17638 val="$undef"
17639 $cat > try.c <<'END'
17640#include <sys/types.h>
17641#include <sys/ipc.h>
17642#include <sys/sem.h>
17643#include <sys/stat.h>
17644#include "tryh.h"
17645#include <stdio.h>
17646#include <errno.h>
17647#ifndef errno
17648extern int errno;
17649#endif
17650int main() {
17651 union semun
17652#ifndef HAS_UNION_SEMUN
17653 {
17654 int val;
17655 struct semid_ds *buf;
17656 unsigned short *array;
17657 }
17658#endif
17659 arg;
17660 struct semid_ds argbuf;
17661 int sem, st;
17662
17663#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17664 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17665 if (sem > -1) {
17666 arg.buf = &argbuf;
17667# ifdef IPC_STAT
17668 st = semctl(sem, 0, IPC_STAT, arg);
17669 if (st == 0)
17670 printf("semid_ds\n");
17671 else
17672# endif /* IPC_STAT */
17673 printf("semctl IPC_STAT failed: errno = %d\n", errno);
17674# ifdef IPC_RMID
17675 if (semctl(sem, 0, IPC_RMID, arg) != 0)
17676# endif /* IPC_RMID */
17677 printf("semctl IPC_RMID failed: errno = %d\n", errno);
17678 } else
17679#endif /* IPC_PRIVATE && ... */
17680 printf("semget failed: errno = %d\n", errno);
17681
17682 return 0;
17683}
17684END
17685 set try
17686 if eval $compile; then
17687 xxx=`$run ./try`
17688 case "$xxx" in
17689 semid_ds) val="$define" ;;
17690 esac
17691 fi
17692 $rm_try
17693 set d_semctl_semid_ds
17694 eval $setvar
17695 ;;
17696 esac
17697 case "$d_semctl_semid_ds" in
17698 $define)
17699 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17700 ;;
17701 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17702 ;;
17703 esac
17704 ;;
17705*) val="$undef"
17706
17707 # We do not have the full sem*(2) library, so assume we can not
17708 # use either.
17709
17710 set d_semctl_semun
17711 eval $setvar
17712
17713 set d_semctl_semid_ds
17714 eval $setvar
17715 ;;
17716esac
17717$rm_try tryh.h
17718
17719: see if sendmsg exists
17720set sendmsg d_sendmsg
17721eval $inlibc
17722
17723: see if setegid exists
17724set setegid d_setegid
17725eval $inlibc
17726
17727: see if seteuid exists
17728set seteuid d_seteuid
17729eval $inlibc
17730
17731: see if setgrent exists
17732set setgrent d_setgrent
17733eval $inlibc
17734
17735: see if setgrent_r exists
17736set setgrent_r d_setgrent_r
17737eval $inlibc
17738case "$d_setgrent_r" in
17739"$define")
17740 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17741 case "$d_setgrent_r_proto:$usethreads" in
17742 ":define") d_setgrent_r_proto=define
17743 set d_setgrent_r_proto setgrent_r $hdrs
17744 eval $hasproto ;;
17745 *) ;;
17746 esac
17747 case "$d_setgrent_r_proto" in
17748 define)
17749 case "$setgrent_r_proto" in
17750 ''|0) try='int setgrent_r(FILE**);'
17751 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17752 esac
17753 case "$setgrent_r_proto" in
17754 ''|0) try='void setgrent_r(FILE**);'
17755 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17756 esac
17757 case "$setgrent_r_proto" in
17758 ''|0) d_setgrent_r=undef
17759 setgrent_r_proto=0
17760 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17761 * ) case "$setgrent_r_proto" in
17762 REENTRANT_PROTO*) ;;
17763 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17764 esac
17765 echo "Prototype: $try" ;;
17766 esac
17767 ;;
17768 *) case "$usethreads" in
17769 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17770 esac
17771 d_setgrent_r=undef
17772 setgrent_r_proto=0
17773 ;;
17774 esac
17775 ;;
17776*) setgrent_r_proto=0
17777 ;;
17778esac
17779
17780: see if sethostent exists
17781set sethostent d_sethent
17782eval $inlibc
17783
17784: see if sethostent_r exists
17785set sethostent_r d_sethostent_r
17786eval $inlibc
17787case "$d_sethostent_r" in
17788"$define")
17789 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17790 case "$d_sethostent_r_proto:$usethreads" in
17791 ":define") d_sethostent_r_proto=define
17792 set d_sethostent_r_proto sethostent_r $hdrs
17793 eval $hasproto ;;
17794 *) ;;
17795 esac
17796 case "$d_sethostent_r_proto" in
17797 define)
17798 case "$sethostent_r_proto" in
17799 ''|0) try='int sethostent_r(int, struct hostent_data*);'
17800 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17801 esac
17802 case "$sethostent_r_proto" in
17803 ''|0) try='void sethostent_r(int, struct hostent_data*);'
17804 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17805 esac
17806 case "$sethostent_r_proto" in
17807 ''|0) d_sethostent_r=undef
17808 sethostent_r_proto=0
17809 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17810 * ) case "$sethostent_r_proto" in
17811 REENTRANT_PROTO*) ;;
17812 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17813 esac
17814 echo "Prototype: $try" ;;
17815 esac
17816 ;;
17817 *) case "$usethreads" in
17818 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17819 esac
17820 d_sethostent_r=undef
17821 sethostent_r_proto=0
17822 ;;
17823 esac
17824 ;;
17825*) sethostent_r_proto=0
17826 ;;
17827esac
17828
17829: see if setitimer exists
17830set setitimer d_setitimer
17831eval $inlibc
17832
17833: see if setlinebuf exists
17834set setlinebuf d_setlinebuf
17835eval $inlibc
17836
17837: see if locale.h is available
17838set locale.h i_locale
17839eval $inhdr
17840
17841: see if this system has wctype.h
17842set wctype.h i_wctype
17843eval $inhdr
17844
17845: see if towupper exists
17846set towupper d_towupper
17847eval $inlibc
17848
17849: check for setlocale function and behavior
17850$cat <<EOM
17851
17852Checking to see if you have setlocale() and its behavior
17853EOM
17854$cat >try.c <<EOCP
17855#include <stdlib.h>
17856#include <string.h>
17857#$i_locale I_LOCALE
17858#ifdef I_LOCALE
17859# include <locale.h>
17860#endif
17861#$i_wctype I_WCTYPE
17862#ifdef I_WCTYPE
17863# include <wctype.h>
17864#endif
17865
17866int main() {
17867 const char * invalid_name = "\a"; /* This is really invalid! */
17868 int accepts_any_locale_name = 0;
17869 int has_C_UTF8 = 0;
17870 unsigned char bad_setlocale = 255;
17871
17872 /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
17873 * disabled. It's hard to imagine an instance where meaningful locale
17874 * handling could be done without LC_CTYPE */
17875 const char * name = setlocale(LC_CTYPE, "C");
17876
17877 if (name == NULL || strcmp(name, "C") != 0) {
17878 exit(bad_setlocale);
17879 }
17880
17881 name = setlocale(LC_CTYPE, invalid_name);
17882 if (name != NULL) {
17883
17884 /* Let it pass if it accepts the name but gives back one of the C
17885 * locales */
17886 if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
17887 accepts_any_locale_name = 1;
17888 }
17889 }
17890
17891 name = setlocale(LC_CTYPE, "C.UTF-8");
17892 if (name != NULL) {
17893 unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
17894
17895#$d_towupper HAS_TOWUPPER
17896#ifdef HAS_TOWUPPER
17897
17898 /* We assume that if the machine doesn't have the C99 towupper, it
17899 * doesn't have C.UTF-8, even if we successfully changed locales to
17900 * include it. This seems safer even on platforms that didn't accept
17901 * the really invalid name */
17902
17903 if (towupper(y_with_diaeresis) == 0x178) {
17904 has_C_UTF8 = 1;
17905 }
17906
17907#endif
17908
17909 }
17910
17911#if 0
17912
17913 /* Currently unused code to determine if LC_ALL with disparate values uses
17914 * category = value pairs or positional, and to determine the separator
17915 * between the categories. We could add code so that if the separator were
17916 * > '9', we subtract 10; similarly for 'Z' and 'z', and then just about
17917 * every possible ASCII separator would fit in the 5 bits available in the
17918 * exit code. This would not be true in EBCDIC. And then if LC_ALL is
17919 * positional, we probably would want to know the order of the categories.
17920 * Using a file between the C program and the shell script would really be
17921 * require to do that */
17922#ifdef LC_ALL
17923
17924 unsigned char min_separator = ' ' - 1;
17925 unsigned char separator = min_separator;
17926 int uses_name_value_pair_names = 0;
17927
17928 name = setlocale(LC_ALL, "C");
17929 if (name == NULL || strcmp(name, "C") != 0) {
17930 exit(bad_setlocale);
17931 }
17932
17933 if (has_C_UTF8) {
17934 char * pos;
17935
17936 name = setlocale(LC_CTYPE, "C.UTF-8");
17937 if (name == NULL) {
17938 exit(bad_setlocale);
17939 }
17940 name = setlocale(LC_ALL, NULL);
17941 if (name == NULL) {
17942 exit(bad_setlocale);
17943 }
17944
17945 pos = strstr(name, "LC_CTYPE" "=C.UTF-8");
17946 if (pos != NULL) {
17947 uses_name_value_pair_names = 1;
17948 if (pos == name) {
17949 separator = name[sizeof("LC_CTYPE=C.UTF-8") - 1];
17950 }
17951 else {
17952 separator = *(pos - 1);
17953 }
17954 }
17955 else {
17956 pos = strstr(name, "C.UTF-8");
17957 if (pos == NULL) {
17958 /* bad */
17959 }
17960 else if (pos == name) {
17961 separator = name[sizeof("C.UTF-8") - 1];
17962 }
17963 else {
17964 separator = *(pos - 1);
17965 }
17966 }
17967 }
17968
17969#endif
17970#endif
17971
17972 exit( 0 /* (separator - min_separator) << 3
17973 | uses_name_value_pair_names << 2
17974 */
17975 | has_C_UTF8 << 1
17976 | accepts_any_locale_name);
17977
17978}
17979EOCP
17980set try
17981if eval $compile; then
17982 echo "Your system has setlocale()..." >&4
17983 $run ./try
17984 case $? in
17985 0) echo "and it seems sane" >&4
17986 d_setlocale="$define"
17987 d_setlocale_accepts_any_locale_name="$undef"
17988 d_has_C_UTF8="false"
17989 ;;
17990 1) echo "and it seems sane, but accepts any locale name as valid" >&4
17991 d_setlocale="$define"
17992 d_setlocale_accepts_any_locale_name="$define"
17993 d_has_C_UTF8="false"
17994 ;;
17995 2) echo "and it seems sane" >&4
17996 d_setlocale="$define"
17997 d_setlocale_accepts_any_locale_name="$undef"
17998 d_has_C_UTF8="true"
17999 ;;
18000 3) echo "and it seems sane, but accepts any locale name as valid" >&4
18001 d_setlocale="$define"
18002 d_setlocale_accepts_any_locale_name="$define"
18003 d_has_C_UTF8="true"
18004 ;;
18005 *) echo "but it doesn't seem to work, so we won't use it." >&4
18006 d_setlocale="$undef"
18007 d_setlocale_accepts_any_locale_name="$undef"
18008 d_has_C_UTF8="false"
18009 ;;
18010 esac
18011else
18012 echo "your system does not have setlocale()" >&4
18013 d_setlocale="$undef"
18014 d_setlocale_accepts_any_locale_name="$undef"
18015 d_has_C_UTF8="false"
18016fi
18017$rm_try
18018
18019: see if setlocale_r exists
18020set setlocale_r d_setlocale_r
18021eval $inlibc
18022case "$d_setlocale_r" in
18023"$define")
18024 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18025 case "$d_setlocale_r_proto:$usethreads" in
18026 ":define") d_setlocale_r_proto=define
18027 set d_setlocale_r_proto setlocale_r $hdrs
18028 eval $hasproto ;;
18029 *) ;;
18030 esac
18031 case "$d_setlocale_r_proto" in
18032 define)
18033 case "$setlocale_r_proto" in
18034 ''|0) try='int setlocale_r(int, const char*, char*, int);'
18035 ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18036 esac
18037 case "$setlocale_r_proto" in
18038 ''|0) d_setlocale_r=undef
18039 setlocale_r_proto=0
18040 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18041 * ) case "$setlocale_r_proto" in
18042 REENTRANT_PROTO*) ;;
18043 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18044 esac
18045 echo "Prototype: $try" ;;
18046 esac
18047 ;;
18048 *) case "$usethreads" in
18049 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18050 esac
18051 d_setlocale_r=undef
18052 setlocale_r_proto=0
18053 ;;
18054 esac
18055 ;;
18056*) setlocale_r_proto=0
18057 ;;
18058esac
18059
18060: see if setnetent exists
18061set setnetent d_setnent
18062eval $inlibc
18063
18064: see if setnetent_r exists
18065set setnetent_r d_setnetent_r
18066eval $inlibc
18067case "$d_setnetent_r" in
18068"$define")
18069 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18070 case "$d_setnetent_r_proto:$usethreads" in
18071 ":define") d_setnetent_r_proto=define
18072 set d_setnetent_r_proto setnetent_r $hdrs
18073 eval $hasproto ;;
18074 *) ;;
18075 esac
18076 case "$d_setnetent_r_proto" in
18077 define)
18078 case "$setnetent_r_proto" in
18079 ''|0) try='int setnetent_r(int, struct netent_data*);'
18080 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18081 esac
18082 case "$setnetent_r_proto" in
18083 ''|0) try='void setnetent_r(int, struct netent_data*);'
18084 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18085 esac
18086 case "$setnetent_r_proto" in
18087 ''|0) d_setnetent_r=undef
18088 setnetent_r_proto=0
18089 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18090 * ) case "$setnetent_r_proto" in
18091 REENTRANT_PROTO*) ;;
18092 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18093 esac
18094 echo "Prototype: $try" ;;
18095 esac
18096 ;;
18097 *) case "$usethreads" in
18098 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18099 esac
18100 d_setnetent_r=undef
18101 setnetent_r_proto=0
18102 ;;
18103 esac
18104 ;;
18105*) setnetent_r_proto=0
18106 ;;
18107esac
18108
18109: see if setprotoent exists
18110set setprotoent d_setpent
18111eval $inlibc
18112
18113: see if setpgid exists
18114set setpgid d_setpgid
18115eval $inlibc
18116
18117: see if setpgrp2 exists
18118set setpgrp2 d_setpgrp2
18119eval $inlibc
18120
18121: see if setpriority exists
18122set setpriority d_setprior
18123eval $inlibc
18124
18125: see if setproctitle exists
18126set setproctitle d_setproctitle
18127eval $inlibc
18128
18129: see if setprotoent_r exists
18130set setprotoent_r d_setprotoent_r
18131eval $inlibc
18132case "$d_setprotoent_r" in
18133"$define")
18134 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18135 case "$d_setprotoent_r_proto:$usethreads" in
18136 ":define") d_setprotoent_r_proto=define
18137 set d_setprotoent_r_proto setprotoent_r $hdrs
18138 eval $hasproto ;;
18139 *) ;;
18140 esac
18141 case "$d_setprotoent_r_proto" in
18142 define)
18143 case "$setprotoent_r_proto" in
18144 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18145 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18146 esac
18147 case "$setprotoent_r_proto" in
18148 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18149 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18150 esac
18151 case "$setprotoent_r_proto" in
18152 ''|0) d_setprotoent_r=undef
18153 setprotoent_r_proto=0
18154 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18155 * ) case "$setprotoent_r_proto" in
18156 REENTRANT_PROTO*) ;;
18157 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18158 esac
18159 echo "Prototype: $try" ;;
18160 esac
18161 ;;
18162 *) case "$usethreads" in
18163 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18164 esac
18165 d_setprotoent_r=undef
18166 setprotoent_r_proto=0
18167 ;;
18168 esac
18169 ;;
18170*) setprotoent_r_proto=0
18171 ;;
18172esac
18173
18174: see if setpwent exists
18175set setpwent d_setpwent
18176eval $inlibc
18177
18178: see if setpwent_r exists
18179set setpwent_r d_setpwent_r
18180eval $inlibc
18181case "$d_setpwent_r" in
18182"$define")
18183 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18184 case "$d_setpwent_r_proto:$usethreads" in
18185 ":define") d_setpwent_r_proto=define
18186 set d_setpwent_r_proto setpwent_r $hdrs
18187 eval $hasproto ;;
18188 *) ;;
18189 esac
18190 case "$d_setpwent_r_proto" in
18191 define)
18192 case "$setpwent_r_proto" in
18193 ''|0) try='int setpwent_r(FILE**);'
18194 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18195 esac
18196 case "$setpwent_r_proto" in
18197 ''|0) try='void setpwent_r(FILE**);'
18198 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18199 esac
18200 case "$setpwent_r_proto" in
18201 ''|0) d_setpwent_r=undef
18202 setpwent_r_proto=0
18203 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18204 * ) case "$setpwent_r_proto" in
18205 REENTRANT_PROTO*) ;;
18206 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18207 esac
18208 echo "Prototype: $try" ;;
18209 esac
18210 ;;
18211 *) case "$usethreads" in
18212 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18213 esac
18214 d_setpwent_r=undef
18215 setpwent_r_proto=0
18216 ;;
18217 esac
18218 ;;
18219*) setpwent_r_proto=0
18220 ;;
18221esac
18222
18223: see if setregid exists
18224set setregid d_setregid
18225eval $inlibc
18226set setresgid d_setresgid
18227eval $inlibc
18228
18229: see if setreuid exists
18230set setreuid d_setreuid
18231eval $inlibc
18232set setresuid d_setresuid
18233eval $inlibc
18234
18235: see if setrgid exists
18236set setrgid d_setrgid
18237eval $inlibc
18238
18239: see if setruid exists
18240set setruid d_setruid
18241eval $inlibc
18242
18243: see if setservent exists
18244set setservent d_setsent
18245eval $inlibc
18246
18247: see if setservent_r exists
18248set setservent_r d_setservent_r
18249eval $inlibc
18250case "$d_setservent_r" in
18251"$define")
18252 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18253 case "$d_setservent_r_proto:$usethreads" in
18254 ":define") d_setservent_r_proto=define
18255 set d_setservent_r_proto setservent_r $hdrs
18256 eval $hasproto ;;
18257 *) ;;
18258 esac
18259 case "$d_setservent_r_proto" in
18260 define)
18261 case "$setservent_r_proto" in
18262 ''|0) try='int setservent_r(int, struct servent_data*);'
18263 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18264 esac
18265 case "$setservent_r_proto" in
18266 ''|0) try='void setservent_r(int, struct servent_data*);'
18267 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18268 esac
18269 case "$setservent_r_proto" in
18270 ''|0) d_setservent_r=undef
18271 setservent_r_proto=0
18272 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18273 * ) case "$setservent_r_proto" in
18274 REENTRANT_PROTO*) ;;
18275 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18276 esac
18277 echo "Prototype: $try" ;;
18278 esac
18279 ;;
18280 *) case "$usethreads" in
18281 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18282 esac
18283 d_setservent_r=undef
18284 setservent_r_proto=0
18285 ;;
18286 esac
18287 ;;
18288*) setservent_r_proto=0
18289 ;;
18290esac
18291
18292: see if setsid exists
18293set setsid d_setsid
18294eval $inlibc
18295
18296: see if setvbuf exists
18297set setvbuf d_setvbuf
18298eval $inlibc
18299
18300: see if shmctl exists
18301set shmctl d_shmctl
18302eval $inlibc
18303
18304: see if shmget exists
18305set shmget d_shmget
18306eval $inlibc
18307
18308: see if shmat exists
18309set shmat d_shmat
18310eval $inlibc
18311: see what shmat returns
18312case "$d_shmat" in
18313"$define")
18314 $cat >shmat.c <<'END'
18315#include <sys/shm.h>
18316void *shmat();
18317END
18318 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18319 shmattype='void *'
18320 else
18321 shmattype='char *'
18322 fi
18323 echo "and it returns ($shmattype)." >&4
18324 : see if a prototype for shmat is available
18325 xxx=`./findhdr sys/shm.h`
18326 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18327 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18328 val="$define"
18329 else
18330 val="$undef"
18331 fi
18332 $rm -f shmat.[co]
18333 ;;
18334*)
18335 val="$undef"
18336 ;;
18337esac
18338set d_shmatprototype
18339eval $setvar
18340
18341: see if shmdt exists
18342set shmdt d_shmdt
18343eval $inlibc
18344
18345: see how much of the 'shm*(2)' library is present.
18346h_shm=true
18347echo " "
18348case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18349*"$undef"*) h_shm=false;;
18350esac
18351case "$osname" in
18352freebsd)
18353 case "`ipcs 2>&1`" in
18354 "SVID shared memory"*"not configured"*)
18355 echo "Your $osname does not have the shm*(2) configured." >&4
18356 h_shm=false
18357 val="$undef"
18358 set shmctl d_shmctl
18359 eval $setvar
18360 set shmget d_shmget
18361 eval $setvar
18362 set shmat d_shmat
18363 eval $setvar
18364 set shmdt d_shmdt
18365 eval $setvar
18366 ;;
18367 esac
18368 ;;
18369esac
18370: we could also check for sys/ipc.h ...
18371if $h_shm && $test `./findhdr sys/shm.h`; then
18372 echo "You have the full shm*(2) library." >&4
18373 val="$define"
18374else
18375 echo "You don't have the full shm*(2) library." >&4
18376 val="$undef"
18377fi
18378set d_shm
18379eval $setvar
18380
18381: see if we have sigaction
18382echo " "
18383if set sigaction val -f d_sigaction; eval $csym; $val; then
18384 echo 'sigaction() found.' >&4
18385 $cat > try.c <<EOP
18386#include <stdio.h>
18387#include <sys/types.h>
18388#include <signal.h>
18389#$i_stdlib I_STDLIB
18390#ifdef I_STDLIB
18391#include <stdlib.h>
18392#endif
18393int main()
18394{
18395 struct sigaction act, oact;
18396 act.sa_flags = 0;
18397 oact.sa_handler = 0;
18398 /* so that act and oact are used */
18399 exit(act.sa_flags == 0 && oact.sa_handler == 0);
18400}
18401EOP
18402 set try
18403 if eval $compile_ok; then
18404 val="$define"
18405 else
18406 echo "But you don't seem to have a usable struct sigaction." >&4
18407 val="$undef"
18408 fi
18409else
18410 echo 'sigaction NOT found.' >&4
18411 val="$undef"
18412fi
18413set d_sigaction; eval $setvar
18414$rm_try
18415
18416: see what type pids are declared as in the kernel
18417rp="What is the type of process ids on this system?"
18418set pid_t pidtype int stdio.h sys/types.h
18419eval $typedef_ask
18420
18421: see what type uids are declared as in the kernel
18422echo " "
18423echo "Looking for the type for user ids returned by getuid()."
18424set uid_t uidtype xxx stdio.h sys/types.h
18425eval $typedef
18426case "$uidtype" in
18427xxx)
18428 xxx=`./findhdr sys/user.h`
18429 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18430 case $1 in
18431 unsigned) dflt="$1 $2" ;;
18432 *) dflt="$1" ;;
18433 esac
18434 ;;
18435*) dflt="$uidtype";;
18436esac
18437case "$uidtype" in
18438uid_t) echo "uid_t found." ;;
18439*) rp="What is the type for user ids returned by getuid()?"
18440 . ./myread
18441 uidtype="$ans"
18442 ;;
18443esac
18444
18445: Define hasfield_t macro for Configure internal use
18446hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18447while $test $# -ge 2; do
18448 case "$1" in
18449 $define) echo "#include <$2>";;
18450 esac ;
18451 shift 2;
18452done > try.c;
18453echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18454set try;
18455if eval $compile; then
18456 val="$define";
18457else
18458 val="$undef";
18459fi;
18460set $varname;
18461eval $setvar;
18462$rm_try'
18463
18464: see what siginfo fields we have
18465case "$d_sigaction" in
18466"$define")
18467 echo "Checking if your siginfo_t has si_errno field...">&4
18468 set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18469 eval $hasfield_t;
18470
18471 echo "Checking if your siginfo_t has si_pid field...">&4
18472 set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18473 eval $hasfield_t;
18474
18475 echo "Checking if your siginfo_t has si_uid field...">&4
18476 set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18477 eval $hasfield_t;
18478
18479 echo "Checking if your siginfo_t has si_addr field...">&4
18480 set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18481 eval $hasfield_t;
18482
18483 echo "Checking if your siginfo_t has si_status field...">&4
18484 set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18485 eval $hasfield_t;
18486
18487 echo "Checking if your siginfo_t has si_band field...">&4
18488 set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18489 eval $hasfield_t;
18490
18491 echo "Checking if your siginfo_t has si_value field...">&4
18492 set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18493 eval $hasfield_t;
18494
18495 echo "Checking if your siginfo_t has si_fd field...">&4
18496 set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18497 eval $hasfield_t;
18498
18499 ;;
18500*)
18501 d_siginfo_si_errno="$undef"
18502 d_siginfo_si_pid="$undef"
18503 d_siginfo_si_uid="$undef"
18504 d_siginfo_si_addr="$undef"
18505 d_siginfo_si_status="$undef"
18506 d_siginfo_si_band="$undef"
18507 d_siginfo_si_value="$undef"
18508 d_siginfo_si_fd="$undef"
18509 ;;
18510esac
18511
18512: see if this is a sunmath.h system
18513set sunmath.h i_sunmath
18514eval $inhdr
18515
18516: see if signbit exists
18517$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18518$cat >try.c <<EOCP
18519#$i_sunmath I_SUNMATH
18520#include <math.h>
18521#ifdef I_SUNMATH /* Solaris special math library */
18522# include <sunmath.h>
18523#endif
18524#define NV $nvtype
18525int main(int argc, char **argv)
18526{
18527 NV x = 0.0;
18528 NV y = -1.0;
18529 if ((signbit(x) == 0) && (signbit(y) != 0))
18530 return 0;
18531 else
18532 return 1;
18533}
18534EOCP
18535val="$undef"
18536set try
18537if eval $compile; then
18538 if $run ./try; then
18539 $echo "Yes." >&4
18540 val="$define"
18541 else
18542 $echo "Signbit seems to be available, but doesn't work as I expected."
18543 $echo "I won't use it." >&4
18544 val="$undef"
18545 fi
18546else
18547 $echo "Nope." >&4
18548 dflt="$undef"
18549fi
18550set d_signbit
18551eval $setvar
18552$rm_try
18553
18554: see if sigprocmask exists
18555set sigprocmask d_sigprocmask
18556eval $inlibc
18557
18558: see if sigsetjmp exists
18559echo " "
18560case "$d_sigsetjmp" in
18561'')
18562 $cat >try.c <<EOP
18563#include <setjmp.h>
18564#$i_stdlib I_STDLIB
18565#ifdef I_STDLIB
18566#include <stdlib.h>
18567#endif
18568sigjmp_buf env;
18569int set = 1;
18570int main()
18571{
18572 if (sigsetjmp(env,1))
18573 exit(set);
18574 set = 0;
18575 siglongjmp(env, 1);
18576 exit(1);
18577}
18578EOP
18579 set try
18580 if eval $compile; then
18581 if $run ./try >/dev/null 2>&1; then
18582 echo "POSIX sigsetjmp found." >&4
18583 val="$define"
18584 else
18585 $cat >&4 <<EOM
18586Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18587I'll ignore them.
18588EOM
18589 val="$undef"
18590 fi
18591 else
18592 echo "sigsetjmp not found." >&4
18593 val="$undef"
18594 fi
18595 ;;
18596*) val="$d_sigsetjmp"
18597 case "$d_sigsetjmp" in
18598 $define) echo "POSIX sigsetjmp found." >&4;;
18599 $undef) echo "sigsetjmp not found." >&4;;
18600 esac
18601 ;;
18602esac
18603set d_sigsetjmp
18604eval $setvar
18605$rm_try
18606
18607: see if snprintf exists
18608set snprintf d_snprintf
18609eval $inlibc
18610
18611: see if vsnprintf exists
18612set vsnprintf d_vsnprintf
18613eval $inlibc
18614
18615case "$d_snprintf-$d_vsnprintf" in
18616"$define-$define")
18617 $cat <<EOM
18618Checking whether your snprintf() and vsnprintf() work okay...
18619EOM
18620 $cat >try.c <<'EOCP'
18621/* v?snprintf testing logic courtesy of Russ Allbery.
18622 * According to C99:
18623 * - if the buffer is too short it still must be \0-terminated
18624 * - if the buffer is too short the potentially required length
18625 * must be returned and not -1
18626 * - if the buffer is NULL the potentially required length
18627 * must be returned and not -1 or core dump
18628 */
18629#include <stdio.h>
18630#include <stdarg.h>
18631
18632char buf[2];
18633
18634int test (char *format, ...)
18635{
18636 va_list args;
18637 int count;
18638
18639 va_start (args, format);
18640 count = vsnprintf (buf, sizeof buf, format, args);
18641 va_end (args);
18642 return count;
18643}
18644
18645int main ()
18646{
18647 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18648 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18649}
18650EOCP
18651 set try
18652 if eval $compile; then
18653 `$run ./try`
18654 case "$?" in
18655 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18656 *) cat <<EOM >&4
18657Your snprintf() and snprintf() don't seem to be working okay.
18658EOM
18659 d_snprintf="$undef"
18660 d_vsnprintf="$undef"
18661 ;;
18662 esac
18663 else
18664 echo "(I can't seem to compile the test program--assuming they don't)"
18665 d_snprintf="$undef"
18666 d_vsnprintf="$undef"
18667 fi
18668 $rm_try
18669 ;;
18670esac
18671
18672: see if sockatmark exists
18673set sockatmark d_sockatmark
18674eval $inlibc
18675
18676: see if prototype for sockatmark is available
18677echo " "
18678set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18679eval $hasproto
18680
18681: see if socks5_init exists
18682set socks5_init d_socks5_init
18683eval $inlibc
18684
18685: see if srand48_r exists
18686set srand48_r d_srand48_r
18687eval $inlibc
18688case "$d_srand48_r" in
18689"$define")
18690 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18691 case "$d_srand48_r_proto:$usethreads" in
18692 ":define") d_srand48_r_proto=define
18693 set d_srand48_r_proto srand48_r $hdrs
18694 eval $hasproto ;;
18695 *) ;;
18696 esac
18697 case "$d_srand48_r_proto" in
18698 define)
18699 case "$srand48_r_proto" in
18700 ''|0) try='int srand48_r(long, struct drand48_data*);'
18701 ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18702 esac
18703 case "$srand48_r_proto" in
18704 ''|0) d_srand48_r=undef
18705 srand48_r_proto=0
18706 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18707 * ) case "$srand48_r_proto" in
18708 REENTRANT_PROTO*) ;;
18709 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18710 esac
18711 echo "Prototype: $try" ;;
18712 esac
18713 ;;
18714 *) case "$usethreads" in
18715 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18716 esac
18717 d_srand48_r=undef
18718 srand48_r_proto=0
18719 ;;
18720 esac
18721 ;;
18722*) srand48_r_proto=0
18723 ;;
18724esac
18725
18726: see if srandom_r exists
18727set srandom_r d_srandom_r
18728eval $inlibc
18729case "$d_srandom_r" in
18730"$define")
18731 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18732 case "$d_srandom_r_proto:$usethreads" in
18733 ":define") d_srandom_r_proto=define
18734 set d_srandom_r_proto srandom_r $hdrs
18735 eval $hasproto ;;
18736 *) ;;
18737 esac
18738 case "$d_srandom_r_proto" in
18739 define)
18740 case "$srandom_r_proto" in
18741 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18742 ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18743 esac
18744 case "$srandom_r_proto" in
18745 ''|0) d_srandom_r=undef
18746 srandom_r_proto=0
18747 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18748 * ) case "$srandom_r_proto" in
18749 REENTRANT_PROTO*) ;;
18750 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18751 esac
18752 echo "Prototype: $try" ;;
18753 esac
18754 ;;
18755 *) case "$usethreads" in
18756 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18757 esac
18758 d_srandom_r=undef
18759 srandom_r_proto=0
18760 ;;
18761 esac
18762 ;;
18763*) srandom_r_proto=0
18764 ;;
18765esac
18766
18767: see if prototype for setresgid is available
18768echo " "
18769set d_sresgproto setresgid $i_unistd unistd.h
18770eval $hasproto
18771
18772: see if prototype for setresuid is available
18773echo " "
18774set d_sresuproto setresuid $i_unistd unistd.h
18775eval $hasproto
18776
18777: see if stat exists
18778set stat d_stat
18779eval $inlibc
18780
18781: see if sys/stat.h is available
18782set sys/stat.h i_sysstat
18783eval $inhdr
18784
18785: see if stat knows about block sizes
18786echo " "
18787echo "Checking to see if your struct stat has st_blocks field..." >&4
18788set d_statblks stat st_blocks $i_sysstat sys/stat.h
18789eval $hasfield
18790
18791: see if this is a sys/vfs.h system
18792set sys/vfs.h i_sysvfs
18793eval $inhdr
18794
18795: see if this is a sys/statfs.h system
18796set sys/statfs.h i_sysstatfs
18797eval $inhdr
18798
18799: Check for statfs_s
18800echo " "
18801echo "Checking to see if your system supports struct statfs..." >&4
18802set 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
18803eval $hasstruct
18804case "$d_statfs_s" in
18805"$define") echo "Yes, it does." ;;
18806*) echo "No, it doesn't." ;;
18807esac
18808
18809: see if struct statfs knows about f_flags
18810case "$d_statfs_s" in
18811define)
18812 echo " "
18813 echo "Checking to see if your struct statfs has f_flags field..." >&4
18814 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
18815 eval $hasfield
18816 ;;
18817*) val="$undef"
18818 set d_statfs_f_flags
18819 eval $setvar
18820 ;;
18821esac
18822case "$d_statfs_f_flags" in
18823"$define") echo "Yes, it does." ;;
18824*) echo "No, it doesn't." ;;
18825esac
18826
18827: see what flavor, if any, of static inline is supported
18828echo " "
18829echo "Checking to see if your system supports static inline..."
18830$cat > try.c <<'EOCP'
18831#include <stdlib.h>
18832extern int f_via_a(int x);
18833extern int f_via_b(int x);
18834int main(int argc, char **argv)
18835{
18836 int y;
18837
18838 y = f_via_a(0);
18839#ifdef USE_B
18840 y = f_via_b(0);
18841#endif
18842 if (y == 42) {
18843 return EXIT_SUCCESS;
18844 }
18845 else {
18846 return EXIT_FAILURE;
18847 }
18848}
18849EOCP
18850$cat > a.c <<'EOCP'
18851static INLINE int f(int x) {
18852 int y;
18853 y = x + 42;
18854 return y;
18855}
18856
18857int f_via_a(int x)
18858{
18859 return f(x);
18860}
18861EOCP
18862$cat > b.c <<'EOCP'
18863extern int f(int x);
18864
18865int f_via_b(int x)
18866{
18867 return f(x);
18868}
18869EOCP
18870
18871# Respect a hint (or previous) value for perl_static_inline, if there is one.
18872case "$perl_static_inline" in
18873'') # Check the various possibilities, and break out on success.
18874 # For gcc, prefer __inline__, which will still permit
18875 # cflags.SH to add in -ansi.
18876 case "$gccversion" in
18877 '') xxx="inline __inline__ __inline _inline";;
18878 *) xxx="__inline__ inline __inline _inline";;
18879 esac
18880 for inline in $xxx; do
18881 set try -DINLINE=$inline a.c
18882 if eval $compile && $run ./try; then
18883 # Now make sure there is no external linkage of static
18884 # functions
18885 set try -DINLINE=$inline -DUSE_B a.c b.c
18886 if eval $compile && $run ./try; then
18887 $echo "Your compiler supports static $inline, " >&4
18888 $echo "but it also creates an external definition," >&4
18889 $echo "so I won't use it." >&4
18890 val=$undef
18891 else
18892 $echo "Your compiler supports static $inline." >&4
18893 val=$define
18894 perl_static_inline="static $inline";
18895 break;
18896 fi
18897 else
18898 $echo "Your compiler does NOT support static $inline." >&4
18899 val="$undef"
18900 fi
18901 done
18902 ;;
18903*inline*) # Some variant of inline exists.
18904 echo "Keeping your $hint value of $perl_static_inline."
18905 val=$define
18906 ;;
18907static) # No inline capabilities
18908 echo "Keeping your $hint value of $perl_static_inline."
18909 val=$undef
18910 ;;
18911*) # Unrecognized previous value -- blindly trust the supplied
18912 # value and hope it makes sense. Use old value for
18913 # d_static_inline, if there is one.
18914 echo "Keeping your $hint value of $perl_static_inline."
18915 case "$d_static_inline" in
18916 '') val=$define ;;
18917 *) val=$d_static_inline ;;
18918 esac
18919 ;;
18920esac
18921# Fallback to plain 'static' if nothing worked.
18922case "$perl_static_inline" in
18923'')
18924 perl_static_inline="static"
18925 val=$undef
18926 ;;
18927esac
18928set d_static_inline
18929eval $setvar
18930$rm -f a.[co] b.[co]
18931$rm_try
18932
18933: Check stream access
18934$cat >&4 <<EOM
18935Checking how to access stdio streams by file descriptor number...
18936EOM
18937case "$stdio_stream_array" in
18938'') $cat >try.c <<EOCP
18939#include <stdio.h>
18940int main() {
18941 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18942 printf("yes\n");
18943}
18944EOCP
18945 for s in _iob __iob __sF
18946 do
18947 set try -DSTDIO_STREAM_ARRAY=$s
18948 if eval $compile; then
18949 case "`$run ./try`" in
18950 yes) stdio_stream_array=$s; break ;;
18951 esac
18952 fi
18953 done
18954 $rm_try
18955esac
18956case "$stdio_stream_array" in
18957'') $cat >&4 <<EOM
18958I can't figure out how to access stdio streams by file descriptor number.
18959EOM
18960 d_stdio_stream_array="$undef"
18961 ;;
18962*) $cat >&4 <<EOM
18963You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18964EOM
18965 d_stdio_stream_array="$define"
18966 ;;
18967esac
18968
18969: see if strcoll exists
18970set strcoll d_strcoll
18971eval $inlibc
18972
18973: see if strerror_l exists
18974set strerror_l d_strerror_l
18975eval $inlibc
18976
18977: see if strerror_r exists
18978set strerror_r d_strerror_r
18979eval $inlibc
18980case "$d_strerror_r" in
18981"$define")
18982 hdrs="$i_systypes sys/types.h define stdio.h define string.h"
18983 case "$d_strerror_r_proto:$usethreads" in
18984 ":define") d_strerror_r_proto=define
18985 set d_strerror_r_proto strerror_r $hdrs
18986 eval $hasproto ;;
18987 *) ;;
18988 esac
18989 case "$d_strerror_r_proto" in
18990 define)
18991 case "$strerror_r_proto" in
18992 ''|0) try='int strerror_r(int, char*, size_t);'
18993 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18994 esac
18995 case "$strerror_r_proto" in
18996 ''|0) try='int strerror_r(int, char*, int);'
18997 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18998 esac
18999 case "$strerror_r_proto" in
19000 ''|0) try='char* strerror_r(int, char*, size_t);'
19001 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19002 esac
19003 case "$strerror_r_proto" in
19004 ''|0) d_strerror_r=undef
19005 strerror_r_proto=0
19006 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19007 * ) case "$strerror_r_proto" in
19008 REENTRANT_PROTO*) ;;
19009 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19010 esac
19011 echo "Prototype: $try" ;;
19012 esac
19013 ;;
19014 *) case "$usethreads" in
19015 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19016 esac
19017 d_strerror_r=undef
19018 strerror_r_proto=0
19019 ;;
19020 esac
19021 ;;
19022*) strerror_r_proto=0
19023 ;;
19024esac
19025
19026: see if strftime exists
19027set strftime d_strftime
19028eval $inlibc
19029
19030: see if strlcat exists
19031: We need both a prototype in string.h and the symbol in libc.
19032echo " "
19033d_strlcat_proto=''
19034xx1="#$d_gnulibc HAS_GNULIBC"
19035xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19036xx3='# define _GNU_SOURCE'
19037xx4='#endif'
19038set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19039eval $hasproto
19040case "$d_strlcat_proto" in
19041 define) # see if strlcat exists
19042 set strlcat d_strlcat
19043 eval $inlibc
19044 ;;
19045 *) val=$undef
19046 set d_strlcat
19047 eval $setvar
19048 ;;
19049esac
19050
19051: see if strlcpy exists
19052: We need both a prototype in string.h and the symbol in libc.
19053echo " "
19054d_strlcpy_proto=''
19055xx1="#$d_gnulibc HAS_GNULIBC"
19056xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19057xx3='# define _GNU_SOURCE'
19058xx4='#endif'
19059set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19060eval $hasproto
19061case "$d_strlcpy_proto" in
19062 define) # see if strlcpy exists
19063 set strlcpy d_strlcpy
19064 eval $inlibc
19065 ;;
19066 *) val=$undef
19067 set d_strlcpy
19068 eval $setvar
19069 ;;
19070esac
19071
19072: see if strnlen exists
19073set strnlen d_strnlen
19074eval $inlibc
19075
19076: see if strtod exists
19077set strtod d_strtod
19078eval $inlibc
19079
19080: see if strtod_l exists
19081set strtod_l d_strtod_l
19082eval $inlibc
19083
19084: see if strtol exists
19085set strtol d_strtol
19086eval $inlibc
19087
19088: see if strtold exists
19089set strtold d_strtold
19090eval $inlibc
19091
19092: see if strtold_l exists
19093set strtold_l d_strtold_l
19094eval $inlibc
19095
19096: see if strtoll exists
19097set strtoll d_strtoll
19098eval $inlibc
19099
19100case "$d_longlong-$d_strtoll" in
19101"$define-$define")
19102 $cat <<EOM
19103Checking whether your strtoll() works okay...
19104EOM
19105 $cat >try.c <<'EOCP'
19106#include <errno.h>
19107#ifdef __hpux
19108#define strtoll __strtoll
19109#endif
19110#ifdef __EMX__
19111#define strtoll _strtoll
19112#endif
19113#include <stdio.h>
19114#include <stdlib.h>
19115static int bad = 0;
19116void check(const char *s, long long ell, int een) {
19117 long long gll;
19118 errno = 0;
19119 gll = strtoll(s, 0, 10);
19120 if (!((gll == ell) && (errno == een)))
19121 bad++;
19122}
19123int main() {
19124 check(" 1", 1LL, 0);
19125 check(" 0", 0LL, 0);
19126 check("-1", -1LL, 0);
19127 check("-9223372036854775808", -9223372036854775808LL, 0);
19128 check("-9223372036854775808", -9223372036854775808LL, 0);
19129 check(" 9223372036854775807", 9223372036854775807LL, 0);
19130 check("-9223372036854775808", -9223372036854775808LL, 0);
19131 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
19132 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19133 if (!bad)
19134 printf("ok\n");
19135}
19136EOCP
19137 set try
19138 if eval $compile; then
19139 yyy=`$run ./try`
19140 case "$yyy" in
19141 ok) echo "Your strtoll() seems to be working okay." ;;
19142 *) cat <<EOM >&4
19143Your strtoll() doesn't seem to be working okay.
19144EOM
19145 d_strtoll="$undef"
19146 ;;
19147 esac
19148 else
19149 echo "(I can't seem to compile the test program--assuming it doesn't)"
19150 d_strtoll="$undef"
19151 fi
19152 ;;
19153esac
19154
19155: see if strtoq exists
19156set strtoq d_strtoq
19157eval $inlibc
19158
19159: see if strtoul exists
19160set strtoul d_strtoul
19161eval $inlibc
19162
19163case "$d_strtoul" in
19164"$define")
19165 $cat <<EOM
19166Checking whether your strtoul() works okay...
19167EOM
19168 $cat >try.c <<'EOCP'
19169#include <stdlib.h>
19170#include <errno.h>
19171#include <stdio.h>
19172static int bad = 0;
19173void check(const char *s, unsigned long eul, int een) {
19174 unsigned long gul;
19175 errno = 0;
19176 gul = strtoul(s, 0, 10);
19177 if (!((gul == eul) && (errno == een)))
19178 bad++;
19179}
19180int main() {
19181 check(" 1", 1L, 0);
19182 check(" 0", 0L, 0);
19183EOCP
19184 case "$longsize" in
19185 8)
19186 $cat >>try.c <<'EOCP'
19187 check("18446744073709551615", 18446744073709551615UL, 0);
19188 check("18446744073709551616", 18446744073709551615UL, ERANGE);
19189#if 0 /* strtoul() for /^-/ strings is undefined. */
19190 check("-1", 18446744073709551615UL, 0);
19191 check("-18446744073709551614", 2, 0);
19192 check("-18446744073709551615", 1, 0);
19193 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19194 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19195#endif
19196EOCP
19197 ;;
19198 4)
19199 $cat >>try.c <<'EOCP'
19200 check("4294967295", 4294967295UL, 0);
19201 check("4294967296", 4294967295UL, ERANGE);
19202#if 0 /* strtoul() for /^-/ strings is undefined. */
19203 check("-1", 4294967295UL, 0);
19204 check("-4294967294", 2, 0);
19205 check("-4294967295", 1, 0);
19206 check("-4294967296", 4294967295UL, ERANGE);
19207 check("-4294967297", 4294967295UL, ERANGE);
19208#endif
19209EOCP
19210 ;;
19211 *)
19212: Should we write these tests to be more portable by sprintf-ing
19213: ~0 and then manipulating that char string as input for strtol?
19214 ;;
19215 esac
19216 $cat >>try.c <<'EOCP'
19217 if (!bad)
19218 printf("ok\n");
19219 return 0;
19220}
19221EOCP
19222 set try
19223 if eval $compile; then
19224 case "`$run ./try`" in
19225 ok) echo "Your strtoul() seems to be working okay." ;;
19226 *) cat <<EOM >&4
19227Your strtoul() doesn't seem to be working okay.
19228EOM
19229 d_strtoul="$undef"
19230 ;;
19231 esac
19232 else
19233 echo "(I can't seem to compile the test program--assuming it doesn't)"
19234 d_strtoul="$undef"
19235 fi
19236 ;;
19237esac
19238
19239: see if strtoull exists
19240set strtoull d_strtoull
19241eval $inlibc
19242
19243case "$d_longlong-$d_strtoull" in
19244"$define-$define")
19245 $cat <<EOM
19246Checking whether your strtoull() works okay...
19247EOM
19248 $cat >try.c <<'EOCP'
19249#include <stdlib.h>
19250#include <errno.h>
19251#ifdef __hpux
19252#define strtoull __strtoull
19253#endif
19254#include <stdio.h>
19255static int bad = 0;
19256void check(const char *s, long long eull, int een) {
19257 long long gull;
19258 errno = 0;
19259 gull = strtoull(s, 0, 10);
19260 if (!((gull == eull) && (errno == een)))
19261 bad++;
19262}
19263int main() {
19264 check(" 1", 1LL, 0);
19265 check(" 0", 0LL, 0);
19266 check("18446744073709551615", 18446744073709551615ULL, 0);
19267 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
19268#if 0 /* strtoull() for /^-/ strings is undefined. */
19269 check("-1", 18446744073709551615ULL, 0);
19270 check("-18446744073709551614", 2LL, 0);
19271 check("-18446744073709551615", 1LL, 0);
19272 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19273 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19274#endif
19275 if (!bad)
19276 printf("ok\n");
19277}
19278EOCP
19279 set try
19280 if eval $compile; then
19281 case "`$run ./try`" in
19282 ok) echo "Your strtoull() seems to be working okay." ;;
19283 *) cat <<EOM >&4
19284Your strtoull() doesn't seem to be working okay.
19285EOM
19286 d_strtoull="$undef"
19287 ;;
19288 esac
19289 else
19290 echo "(I can't seem to compile the test program--assuming it doesn't)"
19291 d_strtoull="$undef"
19292 fi
19293 ;;
19294esac
19295
19296: see if strtouq exists
19297set strtouq d_strtouq
19298eval $inlibc
19299
19300case "$d_strtouq" in
19301"$define")
19302 $cat <<EOM
19303Checking whether your strtouq() works okay...
19304EOM
19305 $cat >try.c <<'EOCP'
19306#include <stdlib.h>
19307#include <errno.h>
19308#include <stdio.h>
19309static int bad = 0;
19310void check(const char *s, unsigned long long eull, int een) {
19311 unsigned long long gull;
19312 errno = 0;
19313 gull = strtouq(s, 0, 10);
19314 if (!((gull == eull) && (errno == een)))
19315 bad++;
19316}
19317int main() {
19318 check(" 1", 1LL, 0);
19319 check(" 0", 0LL, 0);
19320 check("18446744073709551615", 18446744073709551615ULL, 0);
19321 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
19322#if 0 /* strtouq() for /^-/ strings is undefined. */
19323 check("-1", 18446744073709551615ULL, 0);
19324 check("-18446744073709551614", 2LL, 0);
19325 check("-18446744073709551615", 1LL, 0);
19326 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19327 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19328#endif
19329 if (!bad)
19330 printf("ok\n");
19331 return 0;
19332}
19333EOCP
19334 set try
19335 if eval $compile; then
19336 case "`$run ./try`" in
19337 ok) echo "Your strtouq() seems to be working okay." ;;
19338 *) cat <<EOM >&4
19339Your strtouq() doesn't seem to be working okay.
19340EOM
19341 d_strtouq="$undef"
19342 ;;
19343 esac
19344 else
19345 echo "(I can't seem to compile the test program--assuming it doesn't)"
19346 d_strtouq="$undef"
19347 fi
19348 ;;
19349esac
19350
19351: see if strxfrm exists
19352set strxfrm d_strxfrm
19353eval $inlibc
19354
19355: see if symlink exists
19356set symlink d_symlink
19357eval $inlibc
19358
19359: see if syscall exists
19360set syscall d_syscall
19361eval $inlibc
19362
19363: see if prototype for syscall is available
19364echo " "
19365set d_syscallproto syscall $i_unistd unistd.h
19366eval $hasproto
19367
19368: see if sysconf exists
19369set sysconf d_sysconf
19370eval $inlibc
19371
19372: see if sys_errlist[] exists
19373echo " "
19374if test "X$d_syserrlst" = X; then
19375 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19376 echo "You have sys_errlist[], so we could roll our own strerror."
19377 d_syserrlst="$define"
19378 else
19379 echo "You don't have sys_errlist[], so strerror() is welcome."
19380 d_syserrlst="$undef"
19381 fi
19382fi
19383
19384: see if system exists
19385set system d_system
19386eval $inlibc
19387
19388: see if tcgetpgrp exists
19389set tcgetpgrp d_tcgetpgrp
19390eval $inlibc
19391
19392: see if tcsetpgrp exists
19393set tcsetpgrp d_tcsetpgrp
19394eval $inlibc
19395
19396: see if prototype for telldir is available
19397echo " "
19398set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19399eval $hasproto
19400
19401: see if tgamma exists
19402set tgamma d_tgamma
19403eval $inlibc
19404
19405: check for thread_safe_nl_langinfo_l item
19406$cat <<EOM
19407
19408Checking to see if you have nl_langinfo_l() and that it is thread-safe
19409EOM
19410$cat >try.c <<EOCP
19411#$i_stdlib I_STDLIB
19412#ifdef I_STDLIB
19413# include <stdlib.h>
19414#endif
19415#include <string.h>
19416#$i_langinfo I_LANGINFO
19417#ifdef I_LANGINFO
19418# include <langinfo.h>
19419#endif
19420#$i_pthread I_PTHREAD
19421#ifdef I_PTHREAD
19422# include <pthread.h>
19423#endif
19424#$i_locale I_LOCALE
19425#ifdef I_LOCALE
19426# include <locale.h>
19427#endif
19428
19429void *
19430thread_start(void * arg)
19431{
19432 nl_langinfo(RADIXCHAR);
19433}
19434
19435int main() {
19436 char * main_buffer;
19437 char save_main_buffer[1000];
19438 pthread_t subthread;
19439 pthread_attr_t attr;
19440
19441 main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19442
19443 /* If too large for our generous allowance, just assume we don't have
19444 * it. */
19445 if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19446 exit(1);
19447 }
19448
19449 strcpy(save_main_buffer, main_buffer);
19450
19451 if (pthread_attr_init(&attr) != 0) {
19452 exit(1);
19453 }
19454
19455 if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19456 exit(1);
19457 }
19458
19459 if (pthread_join(subthread, NULL) != 0) {
19460 exit(1);
19461 }
19462
19463 exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19464}
19465EOCP
19466case "$usethreads" in
19467 define)
19468 set try
19469 if eval $compile; then
19470 echo "Your system has nl_langinfo_l()..." >&4
19471 if $run ./try; then
19472 echo "and it is thread-safe (just as I'd hoped)." >&4
19473 d_thread_safe_nl_langinfo_l="$define"
19474 echo "$d_thread_safe_nl_langinfo_l" >&4
19475 else
19476 echo "but it isn't thread-safe, so we won't use it." >&4
19477 fi
19478 else
19479 echo "your system does not have nl_langinfo_l()" >&4
19480 fi
19481 ;;
19482 *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19483esac
19484if test X"$d_thread_safe_nl_langinfo_l" = X; then
19485 d_thread_safe_nl_langinfo_l="$undef"
19486fi
19487$rm_try
19488
19489: see if time exists
19490echo " "
19491if test "X$d_time" = X -o X"$timetype" = X; then
19492 if set time val -f d_time; eval $csym; $val; then
19493 echo 'time() found.' >&4
19494 val="$define"
19495 rp="What is the type returned by time() on this system?"
19496 set time_t timetype long stdio.h sys/types.h
19497 eval $typedef_ask
19498 else
19499 echo 'time() not found, hope that will do.' >&4
19500 val="$undef"
19501 timetype='int';
19502 fi
19503 set d_time
19504 eval $setvar
19505fi
19506
19507: see if timegm exists
19508set timegm d_timegm
19509eval $inlibc
19510
19511: see if this is a sys/times.h system
19512set sys/times.h i_systimes
19513eval $inhdr
19514
19515: see if times exists
19516echo " "
19517if set times val -f d_times; eval $csym; $val; then
19518 echo 'times() found.' >&4
19519 d_times="$define"
19520 inc=''
19521 case "$i_systimes" in
19522 "$define") inc='sys/times.h';;
19523 esac
19524 rp="What is the type returned by times() on this system?"
19525 set clock_t clocktype long stdio.h sys/types.h $inc
19526 eval $typedef_ask
19527else
19528 echo 'times() NOT found, hope that will do.' >&4
19529 d_times="$undef"
19530 clocktype='int'
19531fi
19532
19533: see if tmpnam_r exists
19534set tmpnam_r d_tmpnam_r
19535eval $inlibc
19536case "$d_tmpnam_r" in
19537"$define")
19538 hdrs="$i_systypes sys/types.h define stdio.h "
19539 case "$d_tmpnam_r_proto:$usethreads" in
19540 ":define") d_tmpnam_r_proto=define
19541 set d_tmpnam_r_proto tmpnam_r $hdrs
19542 eval $hasproto ;;
19543 *) ;;
19544 esac
19545 case "$d_tmpnam_r_proto" in
19546 define)
19547 case "$tmpnam_r_proto" in
19548 ''|0) try='char* tmpnam_r(char*);'
19549 ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19550 esac
19551 case "$tmpnam_r_proto" in
19552 ''|0) d_tmpnam_r=undef
19553 tmpnam_r_proto=0
19554 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19555 * ) case "$tmpnam_r_proto" in
19556 REENTRANT_PROTO*) ;;
19557 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19558 esac
19559 echo "Prototype: $try" ;;
19560 esac
19561 ;;
19562 *) case "$usethreads" in
19563 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19564 esac
19565 d_tmpnam_r=undef
19566 tmpnam_r_proto=0
19567 ;;
19568 esac
19569 ;;
19570*) tmpnam_r_proto=0
19571 ;;
19572esac
19573
19574: see if towlower exists
19575set towlower d_towlower
19576eval $inlibc
19577
19578: see if trunc exists
19579set trunc d_trunc
19580eval $inlibc
19581
19582: see if truncate exists
19583set truncate d_truncate
19584eval $inlibc
19585
19586: see if ttyname_r exists
19587set ttyname_r d_ttyname_r
19588eval $inlibc
19589case "$d_ttyname_r" in
19590"$define")
19591 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19592 case "$d_ttyname_r_proto:$usethreads" in
19593 ":define") d_ttyname_r_proto=define
19594 set d_ttyname_r_proto ttyname_r $hdrs
19595 eval $hasproto ;;
19596 *) ;;
19597 esac
19598 case "$d_ttyname_r_proto" in
19599 define)
19600 case "$ttyname_r_proto" in
19601 ''|0) try='int ttyname_r(int, char*, size_t);'
19602 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19603 esac
19604 case "$ttyname_r_proto" in
19605 ''|0) try='int ttyname_r(int, char*, int);'
19606 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19607 esac
19608 case "$ttyname_r_proto" in
19609 ''|0) try='char* ttyname_r(int, char*, int);'
19610 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19611 esac
19612 case "$ttyname_r_proto" in
19613 ''|0) d_ttyname_r=undef
19614 ttyname_r_proto=0
19615 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19616 * ) case "$ttyname_r_proto" in
19617 REENTRANT_PROTO*) ;;
19618 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19619 esac
19620 echo "Prototype: $try" ;;
19621 esac
19622 ;;
19623 *) case "$usethreads" in
19624 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19625 esac
19626 d_ttyname_r=undef
19627 ttyname_r_proto=0
19628 ;;
19629 esac
19630 ;;
19631*) ttyname_r_proto=0
19632 ;;
19633esac
19634
19635: see if tzname[] exists
19636echo " "
19637if set tzname val -a d_tzname; eval $csym; $val; then
19638 val="$define"
19639 echo 'tzname[] found.' >&4
19640else
19641 val="$undef"
19642 echo 'tzname[] NOT found.' >&4
19643fi
19644set d_tzname
19645eval $setvar
19646
19647: Check if is a multiplatform env
19648case "$osname" in
19649darwin) multiarch="$define" ;;
19650esac
19651case "$multiarch" in
19652''|[nN]*) multiarch="$undef" ;;
19653esac
19654
19655: check for ordering of bytes in a UV
19656echo " "
19657case "$multiarch" in
19658*$define*)
19659 $cat <<EOM
19660You seem to be doing a multiarchitecture build,
19661skipping the byteorder check.
19662
19663EOM
19664 byteorder='ffff'
19665 ;;
19666*)
19667 case "$byteorder" in
19668 '')
19669 $cat <<'EOM'
19670In the following, larger digits indicate more significance. A big-endian
19671machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19672little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19673machines may have weird orders like 3412. A Cray will report 87654321,
19674an Alpha will report 12345678. If the test program works the default is
19675probably right.
19676I'm now running the test program...
19677EOM
19678 $cat >try.c <<EOCP
19679#include <stdio.h>
19680#$i_stdlib I_STDLIB
19681#ifdef I_STDLIB
19682#include <stdlib.h>
19683#endif
19684#include <sys/types.h>
19685typedef $uvtype UV;
19686int main()
19687{
19688 int i;
19689 union {
19690 UV l;
19691 char c[$uvsize];
19692 } u;
19693
19694 if ($uvsize > 4)
19695 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19696 else
19697 u.l = (UV)0x04030201;
19698 for (i = 0; i < $uvsize; i++)
19699 printf("%c", u.c[i]+'0');
19700 printf("\n");
19701 exit(0);
19702}
19703EOCP
19704 xxx_prompt=y
19705 set try
19706 if eval $compile && $run ./try > /dev/null; then
19707 dflt=`$run ./try`
19708 case "$dflt" in
19709 [1-4][1-4][1-4][1-4]|12345678|87654321)
19710 echo "(The test program ran ok.)"
19711 echo "byteorder=$dflt"
19712 xxx_prompt=n
19713 ;;
19714 ????|????????) echo "(The test program ran ok.)" ;;
19715 *) echo "(The test program didn't run right for some reason.)" ;;
19716 esac
19717 else
19718 dflt='4321'
19719 cat <<'EOM'
19720(I can't seem to compile the test program. Guessing big-endian...)
19721EOM
19722 fi
19723 case "$xxx_prompt" in
19724 y)
19725 rp="What is the order of bytes in $uvtype?"
19726 . ./myread
19727 byteorder="$ans"
19728 ;;
19729 *) byteorder=$dflt
19730 ;;
19731 esac
19732 ;;
19733 esac
19734 $rm_try
19735 ;;
19736esac
19737
19738: Checking 32bit alignedness
19739$cat <<EOM
19740
19741Checking to see whether you can access character data unalignedly...
19742EOM
19743case "$d_u32align" in
19744'') $cat >try.c <<EOCP
19745#include <stdio.h>
19746#$i_stdlib I_STDLIB
19747#ifdef I_STDLIB
19748#include <stdlib.h>
19749#endif
19750#define U32 $u32type
19751#define BYTEORDER 0x$byteorder
19752#define U8 $u8type
19753#include <signal.h>
19754#ifdef SIGBUS
19755$signal_t bletch(int s) { exit(4); }
19756#endif
19757int main() {
19758#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19759 volatile U8 buf[8];
19760 volatile U32 *up;
19761 int i;
19762
19763 if (sizeof(U32) != 4) {
19764 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19765 exit(1);
19766 }
19767
19768 fflush(stdout);
19769
19770#ifdef SIGBUS
19771 signal(SIGBUS, bletch);
19772#endif
19773
19774 buf[0] = 0;
19775 buf[1] = 0;
19776 buf[2] = 0;
19777 buf[3] = 1;
19778 buf[4] = 0;
19779 buf[5] = 0;
19780 buf[6] = 0;
19781 buf[7] = 1;
19782
19783 for (i = 0; i < 4; i++) {
19784 up = (U32*)(buf + i);
19785 if (! ((*up == 1 << (8*i)) || /* big-endian */
19786 (*up == 1 << (8*(3-i))) /* little-endian */
19787 )
19788 )
19789 {
19790 printf("read failed (%x)\n", *up);
19791 exit(2);
19792 }
19793 }
19794
19795 /* write test */
19796 for (i = 0; i < 4; i++) {
19797 up = (U32*)(buf + i);
19798 *up = 0xBeef;
19799 if (*up != 0xBeef) {
19800 printf("write failed (%x)\n", *up);
19801 exit(3);
19802 }
19803 }
19804
19805 exit(0);
19806#else
19807 printf("1\n");
19808 exit(1);
19809#endif
19810 return 0;
19811}
19812EOCP
19813set try
19814if eval $compile_ok; then
19815 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
19816 $run ./try 2>&1 >/dev/null
19817 case "$?" in
19818 0) cat >&4 <<EOM
19819You can access character data pretty unalignedly.
19820EOM
19821 d_u32align="$undef"
19822 ;;
19823 *) cat >&4 <<EOM
19824It seems that you must access character data in an aligned manner.
19825EOM
19826 d_u32align="$define"
19827 ;;
19828 esac
19829else
19830 rp='Can you access character data at unaligned addresses?'
19831 dflt='n'
19832 . ./myread
19833 case "$ans" in
19834 [yY]*) d_u32align="$undef" ;;
19835 *) d_u32align="$define" ;;
19836 esac
19837fi
19838$rm_try
19839;;
19840esac
19841
19842: see if ualarm exists
19843set ualarm d_ualarm
19844eval $inlibc
19845
19846: see if umask exists
19847set umask d_umask
19848eval $inlibc
19849
19850: see if unordered exists
19851set unordered d_unordered
19852eval $inlibc
19853
19854: see if unsetenv exists
19855set unsetenv d_unsetenv
19856eval $inlibc
19857
19858: see if usleep exists
19859set usleep d_usleep
19860eval $inlibc
19861
19862: see if prototype for usleep is available
19863echo " "
19864set d_usleepproto usleep $i_unistd unistd.h
19865eval $hasproto
19866
19867: see if ustat exists
19868set ustat d_ustat
19869eval $inlibc
19870
19871: see if closedir exists
19872set closedir d_closedir
19873eval $inlibc
19874
19875case "$d_closedir" in
19876"$define")
19877 echo " "
19878 echo "Checking whether closedir() returns a status..." >&4
19879 cat > try.c <<EOM
19880#$i_dirent I_DIRENT /**/
19881#$i_sysdir I_SYS_DIR /**/
19882#$i_sysndir I_SYS_NDIR /**/
19883#$i_systypes I_SYS_TYPES /**/
19884
19885#if defined(I_SYS_TYPES)
19886#include <sys/types.h>
19887#endif
19888#if defined(I_DIRENT)
19889#include <dirent.h>
19890#else
19891#ifdef I_SYS_NDIR
19892#include <sys/ndir.h>
19893#else
19894#ifdef I_SYS_DIR
19895#include <sys/dir.h>
19896#endif
19897#endif
19898#endif
19899int main() { return closedir(opendir(".")); }
19900EOM
19901 set try
19902 if eval $compile_ok; then
19903 if $run ./try > /dev/null 2>&1 ; then
19904 echo "Yes, it does."
19905 val="$undef"
19906 else
19907 echo "No, it doesn't."
19908 val="$define"
19909 fi
19910 else
19911 echo "(I can't seem to compile the test program--assuming it doesn't)"
19912 val="$define"
19913 fi
19914 ;;
19915*)
19916 val="$undef";
19917 ;;
19918esac
19919set d_void_closedir
19920eval $setvar
19921$rm_try
19922
19923: see if there is a wait4
19924set wait4 d_wait4
19925eval $inlibc
19926
19927: see if waitpid exists
19928set waitpid d_waitpid
19929eval $inlibc
19930
19931: see if wcrtomb exists
19932set wcrtomb d_wcrtomb
19933eval $inlibc
19934
19935: look for wcscmp
19936echo " "
19937$cat >try.c <<'EOCP'
19938#include <stdio.h>
19939#include <wchar.h>
19940int main ()
19941{
19942 wchar_t *s = L" ";
19943 return (wcscmp (s, s) ? 1 : 0);
19944 }
19945EOCP
19946set try
19947val="$undef"
19948if eval $compile; then
19949 `$run ./try`
19950 case "$?" in
19951 0) echo "A working wcscmp() found." >&4
19952 val="$define" ;;
19953 *) echo "wcscmp() found, but it doesn't work" >&4
19954 ;;
19955 esac
19956else
19957 echo "wcscmp() NOT found." >&4
19958 fi
19959set d_wcscmp
19960eval $setvar
19961$rm_try
19962
19963: see if wcstombs exists
19964set wcstombs d_wcstombs
19965eval $inlibc
19966
19967: look for wcsxfrm
19968echo " "
19969$cat >try.c <<'EOCP'
19970#include <errno.h>
19971#include <wchar.h>
19972int main ()
19973{
19974 wchar_t dst[4], *src = L" ";
19975 errno = 0;
19976 return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19977 }
19978EOCP
19979set try
19980val="$undef"
19981if eval $compile; then
19982 `$run ./try`
19983 case "$?" in
19984 0) echo "A working wcsxfrm() found." >&4
19985 val="$define" ;;
19986 *) echo "wcsxfrm() found, but it doesn't work" >&4
19987 ;;
19988 esac
19989else
19990 echo "wcsxfrm() NOT found." >&4
19991 fi
19992set d_wcsxfrm
19993eval $setvar
19994$rm_try
19995
19996: see if wctomb exists
19997set wctomb d_wctomb
19998eval $inlibc
19999
20000: see if writev exists
20001set writev d_writev
20002eval $inlibc
20003
20004: check for alignment requirements
20005echo " "
20006case "$alignbytes" in
20007 '') echo "Checking alignment constraints..." >&4
20008 $cat >try.c <<EOCP
20009#include <stdio.h>
20010struct foobar {
20011 char foo;
20012 $nvtype bar;
20013} try_algn;
20014int main()
20015{
20016 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20017 return(0);
20018}
20019EOCP
20020 set try
20021 if eval $compile_ok; then
20022 dflt=`$run ./try`
20023 else
20024 dflt='8'
20025 echo "(I can't seem to compile the test program...)"
20026 fi
20027 case "$multiarch" in
20028 *$define*)
20029 : The usual safe value is 8, but Darwin with -Duselongdouble
20030 : needs 16. Hence, we will take 8 as a minimum, but allow
20031 : Configure to pick a larger value if needed.
20032 if $test "$dflt" -lt 8; then
20033 dflt='8'
20034 echo "Setting alignment to 8 for multiarch support.">&4
20035 fi
20036 ;;
20037 esac
20038 ;;
20039 *) dflt="$alignbytes"
20040 ;;
20041esac
20042rp="Doubles must be aligned on a how-many-byte boundary?"
20043. ./myread
20044alignbytes="$ans"
20045$rm_try
20046
20047: set the base revision
20048baserev=5.0
20049
20050: length of character in bytes. Is always 1, otherwise it is not C
20051: This used to be a test using sizeof
20052charsize=1
20053
20054: Check for the number of bits in a character
20055case "$charbits" in
20056'') echo "Checking how long a character is (in bits)..." >&4
20057 $cat >try.c <<EOCP
20058#include <stdio.h>
20059int main ()
20060{
20061 int n;
20062 unsigned char c;
20063 for (c = 1, n = 0; c; c <<= 1, n++) ;
20064 printf ("%d\n", n);
20065 return (0);
20066 }
20067EOCP
20068 set try
20069 if eval $compile_ok; then
20070 dflt=`$run ./try`
20071 else
20072 dflt='8'
20073 echo "(I can't seem to compile the test program. Guessing...)"
20074 fi
20075 ;;
20076*)
20077 dflt="$charbits"
20078 ;;
20079esac
20080rp="What is the length of a character (in bits)?"
20081. ./myread
20082charbits="$ans"
20083$rm_try
20084case "$charbits" in
200858) ;;
20086*) cat >&4 << EOM
20087Your system has an unsigned character size of $charbits bits, which
20088is rather unusual (normally it is 8 bits). Perl likely will not work
20089correctly on your system, with subtle bugs in various places.
20090EOM
20091 rp='Do you really want to continue?'
20092 dflt='n'
20093 . ./myread
20094 case "$ans" in
20095 [yY]) echo >&4 "Okay, continuing." ;;
20096 *) exit 1 ;;
20097 esac
20098esac
20099
20100: how do we concatenate cpp tokens here?
20101echo " "
20102echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20103$cat >cpp_stuff.c <<'EOCP'
20104#define RCAT(a,b)a/**/b
20105#define ACAT(a,b)a ## b
20106RCAT(Rei,ser)
20107ACAT(Cir,cus)
20108EOCP
20109$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20110if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20111 echo "Oh! Smells like ANSI's been here." >&4
20112 echo "We can catify or stringify, separately or together!"
20113 cpp_stuff=42
20114elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20115 echo "Ah, yes! The good old days!" >&4
20116 echo "However, in the good old days we don't know how to stringify and"
20117 echo "catify at the same time."
20118 cpp_stuff=1
20119else
20120 $cat >&4 <<EOM
20121Hmm, I don't seem to be able to concatenate tokens with your cpp.
20122You're going to have to edit the values of CAT[2-5] in config.h...
20123EOM
20124 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20125fi
20126$rm -f cpp_stuff.*
20127
20128: see if this is a db.h system
20129set db.h i_db
20130eval $inhdr
20131
20132case "$i_db" in
20133$define)
20134 : Check db version.
20135 echo " "
20136 echo "Checking Berkeley DB version ..." >&4
20137 $cat >try.c <<EOCP
20138#include <sys/types.h>
20139#include <stdio.h>
20140#$i_stdlib I_STDLIB
20141#ifdef I_STDLIB
20142#include <stdlib.h>
20143#endif
20144#include <db.h>
20145int main(int argc, char *argv[])
20146{
20147#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20148 int Major, Minor, Patch ;
20149 unsigned long Version ;
20150 (void)db_version(&Major, &Minor, &Patch) ;
20151 if (argc == 2) {
20152 printf("%d %d %d %d %d %d\n",
20153 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20154 Major, Minor, Patch);
20155 exit(0);
20156 }
20157 printf("You have Berkeley DB Version 2 or greater.\n");
20158
20159 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20160 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20161 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20162 Major, Minor, Patch) ;
20163
20164 /* check that db.h & libdb are compatible */
20165 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20166 printf("db.h and libdb are incompatible.\n") ;
20167 exit(3);
20168 }
20169
20170 printf("db.h and libdb are compatible.\n") ;
20171
20172 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20173 + DB_VERSION_PATCH ;
20174
20175 /* needs to be >= 2.3.4 */
20176 if (Version < 2003004) {
20177 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20178 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20179 exit(2);
20180 }
20181
20182 exit(0);
20183#else
20184#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20185 if (argc == 2) {
20186 printf("1 0 0\n");
20187 exit(0);
20188 }
20189 printf("You have Berkeley DB Version 1.\n");
20190 exit(0); /* DB version < 2: the coast is clear. */
20191#else
20192 exit(1); /* <db.h> not Berkeley DB? */
20193#endif
20194#endif
20195}
20196EOCP
20197 set try
20198 if eval $compile_ok && $run ./try; then
20199 echo 'Looks OK.' >&4
20200 set `$run ./try 1`
20201 db_version_major=$1
20202 db_version_minor=$2
20203 db_version_patch=$3
20204 else
20205 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
20206 i_db=$undef
20207 case " $libs " in
20208 *"-ldb "*)
20209 : Remove db from list of libraries to use
20210 echo "Removing unusable -ldb from library list" >&4
20211 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20212 shift
20213 libs="$*"
20214 echo "libs = $libs" >&4
20215 ;;
20216 esac
20217 fi
20218 $rm_try
20219 ;;
20220esac
20221
20222case "$i_db" in
20223define)
20224 : Check the return type needed for hash
20225 echo " "
20226 echo "Checking return type needed for hash for Berkeley DB ..." >&4
20227 $cat >try.c <<EOCP
20228#include <sys/types.h>
20229#include <db.h>
20230
20231#ifndef DB_VERSION_MAJOR
20232u_int32_t hash_cb (const void* ptr, size_t size)
20233{
20234 return 0;
20235}
20236HASHINFO info;
20237int main()
20238{
20239 info.hash = hash_cb;
20240}
20241#endif
20242EOCP
20243 if $cc $ccflags -c try.c >try.out 2>&1 ; then
20244 if $contains warning try.out >>/dev/null 2>&1 ; then
20245 db_hashtype='int'
20246 else
20247 db_hashtype='u_int32_t'
20248 fi
20249 else
20250 : XXX Maybe we should just give up here.
20251 db_hashtype=u_int32_t
20252 $cat try.out >&4
20253 echo "Help: I can't seem to compile the db test program." >&4
20254 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20255 fi
20256 $rm_try
20257 echo "Your version of Berkeley DB uses $db_hashtype for hash."
20258 ;;
20259*) db_hashtype=u_int32_t
20260 ;;
20261esac
20262case "$i_db" in
20263define)
20264 : Check the return type needed for prefix
20265 echo " "
20266 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20267 cat >try.c <<EOCP
20268#include <sys/types.h>
20269#include <db.h>
20270
20271#ifndef DB_VERSION_MAJOR
20272size_t prefix_cb (const DBT *key1, const DBT *key2)
20273{
20274 return 0;
20275}
20276BTREEINFO info;
20277int main()
20278{
20279 info.prefix = prefix_cb;
20280}
20281#endif
20282EOCP
20283 if $cc $ccflags -c try.c >try.out 2>&1 ; then
20284 if $contains warning try.out >>/dev/null 2>&1 ; then
20285 db_prefixtype='int'
20286 else
20287 db_prefixtype='size_t'
20288 fi
20289 else
20290 db_prefixtype='size_t'
20291 : XXX Maybe we should just give up here.
20292 $cat try.out >&4
20293 echo "Help: I can't seem to compile the db test program." >&4
20294 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20295 fi
20296 $rm_try
20297 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20298 ;;
20299*) db_prefixtype='size_t'
20300 ;;
20301esac
20302
20303: Include . in @INC
20304$cat <<EOM
20305
20306Historically Perl has provided a final fallback of the current working
20307directory '.' when searching for a library. This, however, can lead to
20308problems when a Perl program which loads optional modules is called from
20309a shared directory. This can lead to executing unexpected code.
20310
20311EOM
20312
20313# When changing to exclude by default:
20314case "$default_inc_excludes_dot" in
20315 $undef|false|[nN]*) dflt="n" ;;
20316 *) dflt="y" ;;
20317esac
20318# To turn exclude off by default:
20319#case "$default_inc_excludes_dot" in
20320# $define|true|[yY]*) dflt="y" ;;
20321# *) dflt="n" ;;
20322#esac
20323
20324rp='Exclude '.' from @INC by default? '
20325. ./myread
20326case "$ans" in
20327 [nN]|undef) default_inc_excludes_dot="$undef" ;;
20328 *) default_inc_excludes_dot="$define" ;;
20329esac
20330
20331: Check what kind of inf/nan your system has
20332$echo "Checking the kind of infinities and nans you have..." >&4
20333$echo "(The following tests may crash. That's okay.)" >&4
20334$cat >try.c <<EOP
20335#define DOUBLESIZE $doublesize
20336#$d_longdbl HAS_LONG_DOUBLE
20337#ifdef HAS_LONG_DOUBLE
20338#define LONG_DOUBLESIZE $longdblsize
20339#define LONG_DOUBLEKIND $longdblkind
20340#endif
20341#include <math.h>
20342#include <string.h>
20343#include <stdio.h>
20344/* Note that whether the sign bit is on or off
20345 * for NaN depends on the CPU/FPU, and possibly
20346 * can be affected by the build toolchain.
20347 *
20348 * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20349 * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20350 * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20351 * (respectively) as opposed to the more usual
20352 * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20353 *
20354 * Pre-IEEE-754 floating point format do not even have inf/nan support
20355 * at all. They might have a "max" value (DBL_MAX), which may be deadly
20356 * to even mention, causing immediate SIGFPE or equivalent: this is
20357 * the case with VAX floating point, for example.
20358 */
20359static void bytes(void *v, unsigned int n) {
20360 unsigned char *p = (unsigned char *)v;
20361 int i;
20362 for (i = 0; i < n; i++) {
20363 printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20364 }
20365}
20366int main(int argc, char *argv[]) {
20367 /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20368 * because some compilers are 'smart' and not only warn but refuse to
20369 * compile such 'illegal' values. */
20370 double dinf = exp(1e9);
20371 double dnan = sqrt(-1.0);
20372#ifdef HAS_LONG_DOUBLE
20373 long double ldinf = (long double)exp(1e9);
20374 long double ldnan = (long double)sqrt(-1.0);
20375# if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20376/* the 80-bit long doubles might have garbage in their excess bytes */
20377 memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20378 memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20379# endif
20380 if (argc == 2) {
20381 switch (argv[1][0]) {
20382 case '1': bytes(&dinf, sizeof(dinf)); break;
20383 case '2': bytes(&dnan, sizeof(dnan)); break;
20384 case '3': bytes(&ldinf, sizeof(ldinf)); break;
20385 case '4': bytes(&ldnan, sizeof(ldnan)); break;
20386#endif
20387 }
20388 }
20389 return 0;
20390}
20391EOP
20392set try
20393if eval $compile; then
20394 doubleinfbytes=`$run ./try 1`
20395 doublenanbytes=`$run ./try 2`
20396 case "$d_longdbl" in
20397 $define)
20398 longdblinfbytes=`$run ./try 3`
20399 longdblnanbytes=`$run ./try 4`
20400 ;;
20401 esac
20402else
20403 # Defaults in case the above test program failed.
20404 case "$doublekind" in
20405 1) # IEEE 754 32-bit LE
20406 doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20407 doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20408 ;;
20409 2) # IEEE 754 32-bit BE
20410 doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20411 doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20412 ;;
20413 3) # IEEE 754 64-bit LE
20414 doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20415 doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20416 ;;
20417 4) # IEEE 754 64-bit BE
20418 doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20419 doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20420 ;;
20421 5) # IEEE 754 128-bit LE
20422 doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20423 doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20424 ;;
20425 6) # IEEE 754 128-bit BE
20426 doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20427 doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20428 ;;
20429 7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20430 doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20431 doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20432 ;;
20433 8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20434 doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20435 doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20436 ;;
20437 9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20438 doubleinfbytes=$undef
20439 doublenanbytes=$undef
20440 ;;
20441 *) # No idea.
20442 doubleinfbytes=$undef
20443 doublenanbytes=$undef
20444 ;;
20445 esac
20446 case "$longdblkind" in
20447 1) # IEEE 754 128-bit LE
20448 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20449 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20450 ;;
20451 2) # IEEE 754 128-bit BE
20452 longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20453 longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20454 ;;
20455 3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20456 case "$longdblsize" in
20457 12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20458 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20459 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20460 ;;
20461 16) # x86_64
20462 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20463 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20464 ;;
20465 *) # No idea.
20466 longdblinfbytes=$undef
20467 longdblnanbytes=$undef
20468 ;;
20469 esac
20470 ;;
20471 4) # IEEE 754 80-bit BE, 12 or 16 bytes
20472 case "$longdblsize" in
20473 12) # 32-bit system
20474 longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20475 longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20476 ;;
20477 16) # 64-bit system
20478 longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20479 longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20480 ;;
20481 *) # No idea.
20482 longdblinfbytes=$undef
20483 longdblnanbytes=$undef
20484 ;;
20485 esac
20486 ;;
20487 5) # 128-bit LE-LE "double double"
20488 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20489 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20490 ;;
20491 6) # 128-bit BE-BE "double double"
20492 longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20493 longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20494 ;;
20495 7) # 128-bit LE-BE "double double"
20496 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20497 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20498 ;;
20499 8) # 128-bit BE-LE "double double"
20500 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20501 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20502 ;;
20503 9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20504 longdblinfbytes=$undef
20505 longdblnanbytes=$undef
20506 ;;
20507 *) # No idea.
20508 longdblinfbytes=$undef
20509 longdblnanbytes=$undef
20510 ;;
20511 esac
20512fi
20513# In case the program crashed the values are empty, turn them undef.
20514case "$doubleinfbytes" in
20515'') doubleinfbytes=$undef ;;
20516esac
20517case "$doublenanbytes" in
20518'') doublenanbytes=$undef ;;
20519esac
20520case "$longdblinfbytes" in
20521'') longdblinfbytes=$undef ;;
20522esac
20523case "$longdblnanbytes" in
20524'') longdblnanbytes=$undef ;;
20525esac
20526$rm_try
20527
20528: Check the length of the double mantissa
20529$echo "Checking how many mantissa bits your doubles have..." >&4
20530$cat >try.c <<EOP
20531#$i_sunmath I_SUNMATH
20532#include <float.h>
20533#ifdef I_SUNMATH
20534# include <sunmath.h>
20535#endif
20536#ifdef DBL_MANT_DIG
20537# define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20538#endif
20539#include <stdio.h>
20540int main(int argc, char *argv[]) {
20541#ifdef BITS
20542 printf("%d\n", BITS);
20543#endif
20544 return 0;
20545}
20546EOP
20547set try
20548if eval $compile; then
20549 doublemantbits=`$run ./try`
20550else
20551 doublemantbits="$undef"
20552fi
20553$rm_try
20554
20555: Check the length of the longdouble mantissa
20556$echo "Checking how many mantissa bits your long doubles have..." >&4
20557$cat >try.c <<EOP
20558#$i_sunmath I_SUNMATH
20559#include <float.h>
20560#ifdef I_SUNMATH
20561# include <sunmath.h>
20562#endif
20563#$d_longdbl HAS_LONG_DOUBLE
20564#if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20565# if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20566/* This format has no implicit bit. Beware, however, that for
20567 * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20568 * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20569 * and the top bit must have been one since 387, zero is plain invalid.
20570 * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20571# define BITS LDBL_MANT_DIG
20572# elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20573/* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20574 * reason e.g. Irix thinks 107. But in any case, we want only
20575 * the number of real bits, the implicit bits are of no interest. */
20576# define BITS 2 * (DBL_MANT_DIG - 1)
20577# else
20578# define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20579# endif
20580#endif
20581#include <stdio.h>
20582int main(int argc, char *argv[]) {
20583#ifdef BITS
20584 printf("%d\n", BITS);
20585#endif
20586 return 0;
20587}
20588EOP
20589set try
20590if eval $compile; then
20591 longdblmantbits=`$run ./try`
20592else
20593 longdblmantbits="$undef"
20594fi
20595$rm_try
20596
20597: Check the length of the NV mantissa
20598$echo "Checking how many mantissa bits your NVs have..." >&4
20599if test "X$usequadmath" = "X$define"; then
20600 nvmantbits=112 # 128-1-15
20601else
20602 if test "X$nvsize" = "X$doublesize"; then
20603 nvmantbits="$doublemantbits"
20604 else
20605 if test "X$nvsize" = "X$longdblsize"; then
20606 nvmantbits="$longdblmantbits"
20607 else
20608 nvmantbits="$undef"
20609 fi
20610 fi
20611fi
20612
20613: How can we generate normalized random numbers ?
20614echo " "
20615echo "Using our internal random number implementation..." >&4
20616
20617case "$ccflags" in
20618*-Dmy_rand=*|*-Dmy_srand=*)
20619 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20620 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20621 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20622 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20623 ;;
20624esac
20625
20626randfunc=Perl_drand48
20627drand01="Perl_drand48()"
20628seedfunc="Perl_drand48_init"
20629randbits=48
20630randseedtype=U32
20631
20632: Probe whether dtrace builds an object, as newer Illumos requires an input
20633: object file that uses at least one of the probes defined in the .d file
20634case "$usedtrace" in
20635$define)
20636 case "$dtracexnolibs" in
20637 $define|true|[yY]*)
20638 dtracexnolibs=$define
20639 $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20640 ;;
20641 ' '|'')
20642 if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20643 dtracexnolibs=$define
20644 echo "Your dtrace accepts -xnolibs"
20645 elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20646 dtracexnolibs=$undef
20647 echo "Your dtrace doesn't accept -xnolibs"
20648 else
20649 echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20650 exit 1
20651 fi
20652 ;;
20653 *)
20654 dtracexnolibs=$undef
20655 $dtrace -h -s ../perldtrace.d -o perldtrace.h
20656 ;;
20657 esac
20658 case $dtracexnolibs in
20659 $define) xnolibs=-xnolibs ;;
20660 *) xnolibs= ;;
20661 esac
20662
20663 case "$dtraceobject" in
20664 $define|true|[yY]*)
20665 dtraceobject=$define
20666 ;;
20667 ' '|'')
20668 $cat >try.c <<EOM
20669#include "perldtrace.h"
20670int main(void) {
20671 PERL_LOADED_FILE("dummy");
20672 return 0;
20673}
20674EOM
20675 dtraceobject=$undef
20676 if $cc -c -o try.o $optimize $ccflags try.c \
20677 && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20678 dtraceobject=$define
20679 echo "Your dtrace builds an object file"
20680 fi
20681 ;;
20682 *) dtraceobject=$undef ;;
20683 esac
20684 $rm_try perldtrace.o perldtrace.h
20685esac
20686
20687: Determine if this is an EBCDIC system
20688echo " "
20689echo "Determining whether or not we are on an EBCDIC system..." >&4
20690$cat >try.c <<'EOM'
20691int main()
20692{
20693 if ('M'==0xd4) return 0;
20694 return 1;
20695}
20696EOM
20697
20698val=$undef
20699set try
20700if eval $compile_ok; then
20701 if $run ./try; then
20702 echo "You seem to speak EBCDIC." >&4
20703 val="$define"
20704 else
20705 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20706 fi
20707else
20708 echo "I'm unable to compile the test program." >&4
20709 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20710fi
20711$rm_try
20712set ebcdic
20713eval $setvar
20714
20715: Check how to flush
20716echo " "
20717$cat >&4 <<EOM
20718Checking how to flush all pending stdio output...
20719EOM
20720# I only know how to find the first 32 possibly open files on SunOS.
20721# See also hints/sunos_4_1.sh and util.c --AD
20722case "$osname" in
20723sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20724esac
20725$cat >>try.c <<EOCP
20726#include <stdio.h>
20727#$i_stdlib I_STDLIB
20728#ifdef I_STDLIB
20729#include <stdlib.h>
20730#endif
20731#$i_unistd I_UNISTD
20732#ifdef I_UNISTD
20733# include <unistd.h>
20734#endif
20735#$d_sysconf HAS_SYSCONF
20736#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20737#ifdef HAS_STDIO_STREAM_ARRAY
20738# define STDIO_STREAM_ARRAY $stdio_stream_array
20739#endif
20740int main() {
20741 FILE* p;
20742 unlink("try.out");
20743 p = fopen("try.out", "w");
20744#ifdef TRY_FPUTC
20745 fputc('x', p);
20746#else
20747# ifdef TRY_FPRINTF
20748 fprintf(p, "x");
20749# endif
20750#endif
20751#ifdef TRY_FFLUSH_NULL
20752 fflush(NULL);
20753#endif
20754#ifdef TRY_FFLUSH_ALL
20755 {
20756 long open_max = -1;
20757# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20758 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20759# else
20760# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20761 open_max = sysconf(_SC_OPEN_MAX);
20762# else
20763# ifdef FOPEN_MAX
20764 open_max = FOPEN_MAX;
20765# else
20766# ifdef OPEN_MAX
20767 open_max = OPEN_MAX;
20768# else
20769# ifdef _NFILE
20770 open_max = _NFILE;
20771# endif
20772# endif
20773# endif
20774# endif
20775# endif
20776# ifdef HAS_STDIO_STREAM_ARRAY
20777 if (open_max > 0) {
20778 long i;
20779 for (i = 0; i < open_max; i++)
20780 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20781 STDIO_STREAM_ARRAY[i]._file < open_max &&
20782 STDIO_STREAM_ARRAY[i]._flag)
20783 fflush(&STDIO_STREAM_ARRAY[i]);
20784 }
20785 }
20786# endif
20787#endif
20788 _exit(42);
20789}
20790EOCP
20791: first we have to find out how _not_ to flush
20792$to try.c
20793if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20794 output=''
20795 set try -DTRY_FPUTC
20796 if eval $compile; then
20797 $run ./try 2>/dev/null
20798 code="$?"
20799 $from try.out
20800 if $test ! -s try.out -a "X$code" = X42; then
20801 output=-DTRY_FPUTC
20802 fi
20803 fi
20804 case "$output" in
20805 '')
20806 set try -DTRY_FPRINTF
20807 if eval $compile; then
20808 $run ./try 2>/dev/null
20809 code="$?"
20810 $from try.out
20811 if $test ! -s try.out -a "X$code" = X42; then
20812 output=-DTRY_FPRINTF
20813 fi
20814 fi
20815 ;;
20816 esac
20817fi
20818: check for fflush NULL behavior
20819case "$fflushNULL" in
20820'') set try -DTRY_FFLUSH_NULL $output
20821 if eval $compile; then
20822 $run ./try 2>/dev/null
20823 code="$?"
20824 $from try.out
20825 if $test -s try.out -a "X$code" = X42; then
20826 fflushNULL="`$cat try.out`"
20827 else
20828 if $test "X$code" != X42; then
20829 $cat >&4 <<EOM
20830(If this test failed, don't worry, we'll try another method shortly.)
20831EOM
20832 fi
20833 fi
20834 fi
20835 $rm -f core try.core core.try.*
20836 case "$fflushNULL" in
20837 x) $cat >&4 <<EOM
20838Your fflush(NULL) works okay for output streams.
20839Let's see if it clobbers input pipes...
20840EOM
20841# As of mid-March 2000 all versions of Solaris appear to have a stdio
20842# bug that improperly flushes the input end of pipes. So we avoid the
20843# autoflush on fork/system/exec support for now. :-(
20844$cat >tryp.c <<EOCP
20845#include <stdio.h>
20846int
20847main(int argc, char **argv)
20848{
20849 char buf[1024];
20850 int i;
20851 char *bp = buf;
20852 while (1) {
20853 while ((i = getc(stdin)) != -1
20854 && (*bp++ = i) != '\n'
20855 && bp < &buf[1024])
20856 /* DO NOTHING */ ;
20857 *bp = '\0';
20858 fprintf(stdout, "%s", buf);
20859 fflush(NULL);
20860 if (i == -1)
20861 return 0;
20862 bp = buf;
20863 }
20864}
20865EOCP
20866 fflushNULL="$define"
20867 set tryp
20868 if eval $compile; then
20869 $rm -f tryp.out
20870 # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20871 if $test "X$targethost" != X; then
20872 $to tryp.c
20873 $to tryp
20874 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20875 else
20876 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
20877 fi
20878 if cmp tryp.c tryp.out >/dev/null 2>&1; then
20879 $cat >&4 <<EOM
20880fflush(NULL) seems to behave okay with input streams.
20881EOM
20882 fflushNULL="$define"
20883 else
20884 $cat >&4 <<EOM
20885Ouch, fflush(NULL) clobbers input pipes! We will not use it.
20886EOM
20887 fflushNULL="$undef"
20888 fi
20889 fi
20890 $rm -f core tryp.c tryp.core core.tryp.*
20891 ;;
20892 '') $cat >&4 <<EOM
20893Your fflush(NULL) isn't working (contrary to ANSI C).
20894EOM
20895 fflushNULL="$undef"
20896 ;;
20897 *) $cat >&4 <<EOM
20898Cannot figure out whether your fflush(NULL) works or not.
20899I'm assuming it doesn't (contrary to ANSI C).
20900EOM
20901 fflushNULL="$undef"
20902 ;;
20903 esac
20904 ;;
20905$define|true|[yY]*)
20906 fflushNULL="$define"
20907 ;;
20908*)
20909 fflushNULL="$undef"
20910 ;;
20911esac
20912: check explicit looping only if NULL did not work, and if the pipe
20913: bug does not show up on an explicit flush too
20914case "$fflushNULL" in
20915"$undef")
20916 $cat >tryp.c <<EOCP
20917#include <stdio.h>
20918int
20919main(int argc, char **argv)
20920{
20921 char buf[1024];
20922 int i;
20923 char *bp = buf;
20924 while (1) {
20925 while ((i = getc(stdin)) != -1
20926 && (*bp++ = i) != '\n'
20927 && bp < &buf[1024])
20928 /* DO NOTHING */ ;
20929 *bp = '\0';
20930 fprintf(stdout, "%s", buf);
20931 fflush(stdin);
20932 if (i == -1)
20933 return 0;
20934 bp = buf;
20935 }
20936}
20937EOCP
20938 set tryp
20939 if eval $compile; then
20940 $rm -f tryp.out
20941 if $test "X$targethost" != X; then
20942 $to tryp.c
20943 $to tryp
20944 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20945 else
20946 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
20947 fi
20948 if cmp tryp.c tryp.out >/dev/null 2>&1; then
20949 $cat >&4 <<EOM
20950Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20951EOM
20952 : now check for fflushall behaviour
20953 case "$fflushall" in
20954 '') set try -DTRY_FFLUSH_ALL $output
20955 if eval $compile; then
20956 $cat >&4 <<EOM
20957(Now testing the other method--but note that this also may fail.)
20958EOM
20959 $run ./try 2>/dev/null
20960 code=$?
20961 $from try.out
20962 if $test -s try.out -a "X$code" = X42; then
20963 fflushall="`$cat try.out`"
20964 fi
20965 fi
20966 $rm_try
20967 case "$fflushall" in
20968 x) $cat >&4 <<EOM
20969Whew. Flushing explicitly all the stdio streams works.
20970EOM
20971 fflushall="$define"
20972 ;;
20973 '') $cat >&4 <<EOM
20974Sigh. Flushing explicitly all the stdio streams doesn't work.
20975EOM
20976 fflushall="$undef"
20977 ;;
20978 *) $cat >&4 <<EOM
20979Cannot figure out whether flushing stdio streams explicitly works or not.
20980I'm assuming it doesn't.
20981EOM
20982 fflushall="$undef"
20983 ;;
20984 esac
20985 ;;
20986 "$define"|true|[yY]*)
20987 fflushall="$define"
20988 ;;
20989 *)
20990 fflushall="$undef"
20991 ;;
20992 esac
20993 else
20994 $cat >&4 <<EOM
20995All is futile. Even fflush(stdin) clobbers input pipes!
20996EOM
20997 fflushall="$undef"
20998 fi
20999 else
21000 fflushall="$undef"
21001 fi
21002 $rm -f core tryp.c tryp.core core.tryp.*
21003 ;;
21004*) fflushall="$undef"
21005 ;;
21006esac
21007
21008case "$fflushNULL$fflushall" in
21009undefundef)
21010 $cat <<EOM
21011OK, I give up. I cannot figure out how to flush pending stdio output.
21012We won't be flushing handles at all before fork/exec/popen.
21013EOM
21014 ;;
21015esac
21016$rm_try tryp
21017
21018: Store the full pathname to the ar program for use in the C program
21019: Respect a hint or command line value for full_ar.
21020case "$full_ar" in
21021'') full_ar=$ar ;;
21022esac
21023
21024: Store the full pathname to the sed program for use in the C program
21025full_sed=$sed
21026
21027: see what type gids are declared as in the kernel
21028echo " "
21029echo "Looking for the type for group ids returned by getgid()."
21030set gid_t gidtype xxx stdio.h sys/types.h
21031eval $typedef
21032case "$gidtype" in
21033xxx)
21034 xxx=`./findhdr sys/user.h`
21035 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21036 case $1 in
21037 unsigned) dflt="$1 $2" ;;
21038 *) dflt="$1" ;;
21039 esac
21040 ;;
21041*) dflt="$gidtype";;
21042esac
21043case "$gidtype" in
21044gid_t) echo "gid_t found." ;;
21045*) rp="What is the type for group ids returned by getgid()?"
21046 . ./myread
21047 gidtype="$ans"
21048 ;;
21049esac
21050
21051: Check the size of GID
21052echo " "
21053case "$gidtype" in
21054*_t) zzz="$gidtype" ;;
21055*) zzz="gid" ;;
21056esac
21057echo "Checking the size of $zzz..." >&4
21058cat > try.c <<EOCP
21059#include <sys/types.h>
21060#include <stdio.h>
21061#$i_stdlib I_STDLIB
21062#ifdef I_STDLIB
21063#include <stdlib.h>
21064#endif
21065int main() {
21066 printf("%d\n", (int)sizeof($gidtype));
21067 exit(0);
21068}
21069EOCP
21070set try
21071if eval $compile_ok; then
21072 yyy=`$run ./try`
21073 case "$yyy" in
21074 '') gidsize=4
21075 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21076 ;;
21077 *) gidsize=$yyy
21078 echo "Your $zzz is $gidsize bytes long."
21079 ;;
21080 esac
21081else
21082 gidsize=4
21083 echo "(I can't compile the test program--guessing $gidsize.)" >&4
21084fi
21085
21086: Check if GID is signed
21087echo " "
21088case "$gidtype" in
21089*_t) zzz="$gidtype" ;;
21090*) zzz="gid" ;;
21091esac
21092echo "Checking the sign of $zzz..." >&4
21093cat > try.c <<EOCP
21094#include <sys/types.h>
21095#include <stdio.h>
21096int main() {
21097 $gidtype foo = -1;
21098 if (foo < 0)
21099 printf("-1\n");
21100 else
21101 printf("1\n");
21102}
21103EOCP
21104set try
21105if eval $compile; then
21106 yyy=`$run ./try`
21107 case "$yyy" in
21108 '') gidsign=1
21109 echo "(I can't execute the test program--guessing unsigned.)" >&4
21110 ;;
21111 *) gidsign=$yyy
21112 case "$gidsign" in
21113 1) echo "Your $zzz is unsigned." ;;
21114 -1) echo "Your $zzz is signed." ;;
21115 esac
21116 ;;
21117 esac
21118else
21119 gidsign=1
21120 echo "(I can't compile the test program--guessing unsigned.)" >&4
21121fi
21122
21123: Check 64bit sizes
21124echo " "
21125
21126if $test X"$quadtype" != X; then
21127
21128echo "Checking how to print 64-bit integers..." >&4
21129
21130if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21131 $cat >try.c <<'EOCP'
21132#include <sys/types.h>
21133#include <stdio.h>
21134int main() {
21135 int q = 12345678901;
21136 printf("%ld\n", q);
21137}
21138EOCP
21139 set try
21140 if eval $compile; then
21141 yyy=`$run ./try`
21142 case "$yyy" in
21143 12345678901)
21144 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21145 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21146 echo "We will use %d."
21147 ;;
21148 esac
21149 fi
21150fi
21151
21152if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21153 $cat >try.c <<'EOCP'
21154#include <sys/types.h>
21155#include <stdio.h>
21156int main() {
21157 long q = 12345678901;
21158 printf("%ld\n", q);
21159}
21160EOCP
21161 set try
21162 if eval $compile; then
21163 yyy=`$run ./try`
21164 case "$yyy" in
21165 12345678901)
21166 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21167 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21168 echo "We will use %ld."
21169 ;;
21170 esac
21171 fi
21172fi
21173
21174if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21175 $cat >try.c <<'EOCP'
21176#include <sys/types.h>
21177#include <inttypes.h>
21178#include <stdio.h>
21179int main() {
21180 int64_t q = 12345678901;
21181 printf("%" PRId64 "\n", q);
21182}
21183EOCP
21184 set try
21185 if eval $compile; then
21186 yyy=`$run ./try`
21187 case "$yyy" in
21188 12345678901)
21189 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21190 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21191 echo "We will use the C9X style."
21192 ;;
21193 esac
21194 fi
21195fi
21196
21197if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21198 $cat >try.c <<EOCP
21199#include <sys/types.h>
21200#include <stdio.h>
21201int main() {
21202 $quadtype q = 12345678901;
21203 printf("%Ld\n", q);
21204}
21205EOCP
21206 set try
21207 if eval $compile; then
21208 yyy=`$run ./try`
21209 case "$yyy" in
21210 12345678901)
21211 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21212 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21213 echo "We will use %Ld."
21214 ;;
21215 esac
21216 fi
21217fi
21218
21219if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21220 $cat >try.c <<'EOCP'
21221#include <sys/types.h>
21222#include <stdio.h>
21223int main() {
21224 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21225 printf("%lld\n", q);
21226}
21227EOCP
21228 set try
21229 if eval $compile; then
21230 yyy=`$run ./try`
21231 case "$yyy" in
21232 12345678901)
21233 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21234 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21235 echo "We will use the %lld style."
21236 ;;
21237 esac
21238 fi
21239fi
21240
21241if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21242 $cat >try.c <<EOCP
21243#include <sys/types.h>
21244#include <stdio.h>
21245int main() {
21246 $quadtype q = 12345678901;
21247 printf("%qd\n", q);
21248}
21249EOCP
21250 set try
21251 if eval $compile; then
21252 yyy=`$run ./try`
21253 case "$yyy" in
21254 12345678901)
21255 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21256 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21257 echo "We will use %qd."
21258 ;;
21259 esac
21260 fi
21261fi
21262
21263if $test X"$sPRId64" = X; then
21264 echo "Cannot figure out how to print 64-bit integers." >&4
21265fi
21266$rm_try
21267
21268fi
21269
21270case "$sPRId64" in
21271'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21272 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21273 ;;
21274*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21275 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21276 ;;
21277esac
21278
21279: Check format strings for internal types
21280echo " "
21281$echo "Checking the format strings to be used for Perl's internal types..." >&4
21282
21283if $test X"$ivsize" = X8; then
21284 ivdformat="$sPRId64"
21285 uvuformat="$sPRIu64"
21286 uvoformat="$sPRIo64"
21287 uvxformat="$sPRIx64"
21288 uvXUformat="$sPRIXU64"
21289else
21290 if $test X"$ivsize" = X"$longsize"; then
21291 ivdformat='"ld"'
21292 uvuformat='"lu"'
21293 uvoformat='"lo"'
21294 uvxformat='"lx"'
21295 uvXUformat='"lX"'
21296 else
21297 if $test X"$ivsize" = X"$intsize"; then
21298 ivdformat='"d"'
21299 uvuformat='"u"'
21300 uvoformat='"o"'
21301 uvxformat='"x"'
21302 uvXUformat='"X"'
21303 else
21304 : far out
21305 if $test X"$ivsize" = X"$shortsize"; then
21306 ivdformat='"hd"'
21307 uvuformat='"hu"'
21308 uvoformat='"ho"'
21309 uvxformat='"hx"'
21310 uvXUformat='"hX"'
21311 fi
21312 fi
21313 fi
21314fi
21315
21316if $test X"$usequadmath" = X"$define"; then
21317 nveformat='"Qe"'
21318 nvfformat='"Qf"'
21319 nvgformat='"Qg"'
21320 nvEUformat='"QE"'
21321 nvFUformat='"QF"'
21322 nvGUformat='"QG"'
21323else
21324 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21325 nveformat="$sPRIeldbl"
21326 nvfformat="$sPRIfldbl"
21327 nvgformat="$sPRIgldbl"
21328 nvEUformat="$sPRIEUldbl"
21329 nvFUformat="$sPRIFUldbl"
21330 nvGUformat="$sPRIGUldbl"
21331 else
21332 nveformat='"e"'
21333 nvfformat='"f"'
21334 nvgformat='"g"'
21335 nvEUformat='"E"'
21336 nvFUformat='"F"'
21337 nvGUformat='"G"'
21338 fi
21339fi
21340
21341case "$ivdformat" in
21342'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21343 exit 1
21344 ;;
21345esac
21346
21347: Check format string for GID
21348
21349echo " "
21350$echo "Checking the format string to be used for gids..." >&4
21351
21352case "$gidsign" in
21353-1) if $test X"$gidsize" = X"$ivsize"; then
21354 gidformat="$ivdformat"
21355 else
21356 if $test X"$gidsize" = X"$longsize"; then
21357 gidformat='"ld"'
21358 else
21359 if $test X"$gidsize" = X"$intsize"; then
21360 gidformat='"d"'
21361 else
21362 if $test X"$gidsize" = X"$shortsize"; then
21363 gidformat='"hd"'
21364 fi
21365 fi
21366 fi
21367 fi
21368 ;;
21369*) if $test X"$gidsize" = X"$uvsize"; then
21370 gidformat="$uvuformat"
21371 else
21372 if $test X"$gidsize" = X"$longsize"; then
21373 gidformat='"lu"'
21374 else
21375 if $test X"$gidsize" = X"$intsize"; then
21376 gidformat='"u"'
21377 else
21378 if $test X"$gidsize" = X"$shortsize"; then
21379 gidformat='"hu"'
21380 fi
21381 fi
21382 fi
21383 fi
21384 ;;
21385esac
21386
21387: see if getgroups exists
21388set getgroups d_getgrps
21389eval $inlibc
21390
21391: see if setgroups exists
21392set setgroups d_setgrps
21393eval $inlibc
21394
21395: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21396echo " "
21397case "$d_getgrps$d_setgrps" in
21398*define*)
21399 case "$groupstype" in
21400 '') dflt="$gidtype" ;;
21401 *) dflt="$groupstype" ;;
21402 esac
21403 $cat <<EOM
21404What type of pointer is the second argument to getgroups() and setgroups()?
21405Usually this is the same as group ids, $gidtype, but not always.
21406
21407EOM
21408 rp='What type pointer is the second argument to getgroups() and setgroups()?'
21409 . ./myread
21410 groupstype="$ans"
21411 ;;
21412*) groupstype="$gidtype";;
21413esac
21414
21415: check whether make sets MAKE
21416echo " "
21417echo "Checking if your $make program sets \$(MAKE)..." >&4
21418case "$make_set_make" in
21419'')
21420 $sed 's/^X //' > testmake.mak << 'EOF'
21421Xall:
21422X @echo 'maketemp="$(MAKE)"'
21423EOF
21424 case "`$make -f testmake.mak 2>/dev/null`" in
21425 *maketemp=*) make_set_make='#' ;;
21426 *) make_set_make="MAKE=$make" ;;
21427 esac
21428 $rm -f testmake.mak
21429 ;;
21430esac
21431case "$make_set_make" in
21432'#') echo "Yup, it does.";;
21433*) echo "Nope, it doesn't.";;
21434esac
21435
21436: see what type is used for mode_t
21437rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21438set mode_t modetype int stdio.h sys/types.h
21439eval $typedef_ask
21440
21441: see if we need va_copy
21442echo " "
21443$cat >try.c <<EOCP
21444#include <stdarg.h>
21445#include <stdio.h>
21446#include <stdlib.h>
21447#include <signal.h>
21448
21449int
21450ivfprintf(FILE *f, const char *fmt, va_list *valp)
21451{
21452 return vfprintf(f, fmt, *valp);
21453}
21454
21455int
21456myvfprintf(FILE *f, const char *fmt, va_list val)
21457{
21458 return ivfprintf(f, fmt, &val);
21459}
21460
21461int
21462myprintf(char *fmt, ...)
21463{
21464 va_list val;
21465 va_start(val, fmt);
21466 return myvfprintf(stdout, fmt, val);
21467}
21468
21469int
21470main(int ac, char **av)
21471{
21472 signal(SIGSEGV, exit);
21473
21474 myprintf("%s%cs all right, then\n", "that", '\'');
21475 exit(0);
21476}
21477EOCP
21478set try
21479if eval $compile && $run ./try 2>&1 >/dev/null; then
21480 case "`$run ./try`" in
21481 "that's all right, then")
21482 okay=yes
21483 ;;
21484 esac
21485fi
21486case "$okay" in
21487yes) echo "It seems that you don't need va_copy()." >&4
21488 need_va_copy="$undef"
21489 ;;
21490*) echo "It seems that va_copy() or similar will be needed." >&4
21491 need_va_copy="$define"
21492 ;;
21493esac
21494$rm_try
21495
21496: see what type is used for size_t
21497rp="What is the type used for the length parameter for string functions?"
21498set size_t sizetype 'unsigned int' stdio.h sys/types.h
21499eval $typedef_ask
21500
21501: check for type of arguments to gethostbyaddr.
21502if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21503 case "$d_gethbyaddr" in
21504 $define)
21505 $cat <<EOM
21506
21507Checking to see what type of arguments are accepted by gethostbyaddr().
21508EOM
21509 hdrs="$define sys/types.h
21510 $d_socket sys/socket.h
21511 $i_niin netinet/in.h
21512 $i_netdb netdb.h
21513 $i_unistd unistd.h"
21514 : The first arg can 'char *' or 'void *'
21515 : The second arg is some of integral type
21516 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21517 for yyy in size_t long int; do
21518 case "$netdb_host_type" in
21519 '') try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21520 if ./protochk "$try" $hdrs; then
21521 echo "Your system accepts $xxx for the first arg."
21522 echo "...and $yyy for the second arg."
21523 netdb_host_type="$xxx"
21524 netdb_hlen_type="$yyy"
21525 fi
21526 ;;
21527 esac
21528 done
21529 done
21530 : In case none of those worked, prompt the user.
21531 case "$netdb_host_type" in
21532 '') rp='What is the type for the 1st argument to gethostbyaddr?'
21533 dflt='char *'
21534 . ./myread
21535 netdb_host_type=$ans
21536 rp='What is the type for the 2nd argument to gethostbyaddr?'
21537 dflt="$sizetype"
21538 . ./myread
21539 netdb_hlen_type=$ans
21540 ;;
21541 esac
21542 ;;
21543 *) : no gethostbyaddr, so pick harmless defaults
21544 netdb_host_type='char *'
21545 netdb_hlen_type="$sizetype"
21546 ;;
21547 esac
21548 # Remove the "const" if needed. -- but then we'll have a
21549 # prototype clash!
21550 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21551fi
21552
21553: check for type of argument to gethostbyname.
21554if test "X$netdb_name_type" = X ; then
21555 case "$d_gethbyname" in
21556 $define)
21557 $cat <<EOM
21558
21559Checking to see what type of argument is accepted by gethostbyname().
21560EOM
21561 hdrs="$define sys/types.h
21562 $d_socket sys/socket.h
21563 $i_niin netinet/in.h
21564 $i_netdb netdb.h
21565 $i_unistd unistd.h"
21566 for xxx in "const char *" "char *"; do
21567 case "$netdb_name_type" in
21568 '') try="$extern_C struct hostent *gethostbyname($xxx);"
21569 if ./protochk "$try" $hdrs; then
21570 echo "Your system accepts $xxx."
21571 netdb_name_type="$xxx"
21572 fi
21573 ;;
21574 esac
21575 done
21576 : In case none of those worked, prompt the user.
21577 case "$netdb_name_type" in
21578 '') rp='What is the type for the 1st argument to gethostbyname?'
21579 dflt='char *'
21580 . ./myread
21581 netdb_name_type=$ans
21582 ;;
21583 esac
21584 ;;
21585 *) : no gethostbyname, so pick harmless default
21586 netdb_name_type='char *'
21587 ;;
21588 esac
21589fi
21590
21591: check for type of 1st argument to getnetbyaddr.
21592if test "X$netdb_net_type" = X ; then
21593 case "$d_getnbyaddr" in
21594 $define)
21595 $cat <<EOM
21596
21597Checking to see what type of 1st argument is accepted by getnetbyaddr().
21598EOM
21599 hdrs="$define sys/types.h
21600 $d_socket sys/socket.h
21601 $i_niin netinet/in.h
21602 $i_netdb netdb.h
21603 $i_unistd unistd.h"
21604 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21605 case "$netdb_net_type" in
21606 '') try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21607 if ./protochk "$try" $hdrs; then
21608 echo "Your system accepts $xxx."
21609 netdb_net_type="$xxx"
21610 fi
21611 ;;
21612 esac
21613 done
21614 : In case none of those worked, prompt the user.
21615 case "$netdb_net_type" in
21616 '') rp='What is the type for the 1st argument to getnetbyaddr?'
21617 dflt='long'
21618 . ./myread
21619 netdb_net_type=$ans
21620 ;;
21621 esac
21622 ;;
21623 *) : no getnetbyaddr, so pick harmless default
21624 netdb_net_type='long'
21625 ;;
21626 esac
21627fi
21628: locate the preferred pager for this system
21629fn=f/
21630case "$pager" in
21631'')
21632 dflt=''
21633 case "$pg" in
21634 /*) dflt=$pg;;
21635 [a-zA-Z]:/*) dflt=$pg;;
21636 esac
21637 case "$more" in
21638 /*) dflt=$more;;
21639 [a-zA-Z]:/*) dflt=$more;;
21640 esac
21641 case "$less" in
21642 /*) dflt=$less;;
21643 [a-zA-Z]:/*) dflt=$less;;
21644 esac
21645 case "$dflt" in
21646 '') dflt=/usr/ucb/more;;
21647 esac
21648 ;;
21649*) dflt="$pager"
21650 ;;
21651esac
21652fn="f/($dflt)"
21653echo " "
21654rp='What pager is used on your system?'
21655. ./getfile
21656pager="$ans"
21657
21658: see if ar generates random libraries by itself
21659echo " "
21660echo "Checking how to generate random libraries on your machine..." >&4
21661echo 'int bar1() { return bar2(); }' > bar1.c
21662echo 'int bar2() { return 2; }' > bar2.c
21663$cat > foo.c <<EOP
21664#$i_stdlib I_STDLIB
21665#ifdef I_STDLIB
21666#include <stdlib.h>
21667#endif
21668int main() { printf("%d\n", bar1()); exit(0); }
21669EOP
21670$cc $ccflags -c bar1.c >/dev/null 2>&1
21671$cc $ccflags -c bar2.c >/dev/null 2>&1
21672$cc $ccflags -c foo.c >/dev/null 2>&1
21673$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21674if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21675 $run ./foobar >/dev/null 2>&1; then
21676 echo "$ar appears to generate random libraries itself."
21677 orderlib=false
21678 if [ "X$ranlib" = "X" ]; then
21679 ranlib=":"
21680 fi
21681elif $ar s bar$_a >/dev/null 2>&1 &&
21682 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21683 $run ./foobar >/dev/null 2>&1; then
21684 echo "a table of contents needs to be added with '$ar s'."
21685 orderlib=false
21686 ranlib="$ar s"
21687elif $ar ts bar$_a >/dev/null 2>&1 &&
21688 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21689 $run ./foobar >/dev/null 2>&1; then
21690 echo "a table of contents needs to be added with '$ar ts'."
21691 orderlib=false
21692 ranlib="$ar ts"
21693else
21694 case "$ranlib" in
21695 :) ranlib='';;
21696 '')
21697 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21698 $test -f $ranlib || ranlib=''
21699 ;;
21700 esac
21701 if $test -n "$ranlib"; then
21702 echo "your system has '$ranlib'; we'll use that."
21703 orderlib=false
21704 else
21705 echo "your system doesn't seem to support random libraries"
21706 echo "so we'll use lorder and tsort to order the libraries."
21707 orderlib=true
21708 ranlib=":"
21709 fi
21710fi
21711$rm -f foo* bar*
21712
21713: Check the max offset that gmtime and localtime accept
21714echo "Checking max offsets that gmtime () accepts"
21715
21716case "$sGMTIME_min/$sGMTIME_max" in
21717 0/0|/)
21718 $cat >try.c <<EOCP
21719#include <sys/types.h>
21720#include <stdio.h>
21721#include <time.h>
21722
21723int i;
21724struct tm *tmp;
21725time_t pt;
21726
21727void gm_check (time_t t, int min_year, int max_year)
21728{
21729 tmp = gmtime (&t);
21730 if ( tmp == NULL ||
21731 /* Check tm_year overflow */
21732 tmp->tm_year < min_year || tmp->tm_year > max_year)
21733 tmp = NULL;
21734 else
21735 pt = t;
21736 } /* gm_check */
21737
21738int check_max ()
21739{
21740 tmp = NULL;
21741 pt = 0;
21742#ifdef MAXLONG
21743 gm_check (MAXLONG, 69, 0x7fffffff);
21744#endif
21745 if (tmp == NULL || tmp->tm_year < 0) {
21746 for (i = 63; i >= 0; i--) {
21747 time_t x = pt | ((time_t)1 << i);
21748 if (x < 0 || x < pt) continue;
21749 gm_check (x, 69, 0x7fffffff);
21750 }
21751 }
21752 printf ("sGMTIME_max=%ld\n", pt);
21753 return (0);
21754 } /* check_max */
21755
21756int check_min ()
21757{
21758 tmp = NULL;
21759 pt = 0;
21760#ifdef MINLONG
21761 gm_check (MINLONG, -1900, 70);
21762#endif
21763 if (tmp == NULL) {
21764 for (i = 36; i >= 0; i--) {
21765 time_t x = pt - ((time_t)1 << i);
21766 if (x > 0) continue;
21767 gm_check (x, -1900, 70);
21768 }
21769 }
21770 printf ("sGMTIME_min=%ld\n", pt);
21771 return (0);
21772 } /* check_min */
21773
21774int main (int argc, char *argv[])
21775{
21776 /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21777 check_max ();
21778 check_min ();
21779 return (0);
21780 } /* main */
21781EOCP
21782 set try
21783 if eval $compile; then
21784 eval `$run ./try 2>/dev/null`
21785 else
21786 echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21787 fi
21788 $rm_try
21789 ;;
21790 esac
21791
21792echo "Checking max offsets that localtime () accepts"
21793
21794case "$sLOCALTIME_min/$sLOCALTIME_max" in
21795 0/0|/)
21796 $cat >try.c <<EOCP
21797#include <sys/types.h>
21798#include <stdio.h>
21799#include <time.h>
21800
21801int i;
21802struct tm *tmp;
21803time_t pt;
21804
21805void local_check (time_t t, int min_year, int max_year)
21806{
21807 if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21808 tmp = NULL;
21809 else
21810 tmp = localtime (&t);
21811 if ( tmp == NULL ||
21812 /* Check tm_year overflow */
21813 tmp->tm_year < min_year || tmp->tm_year > max_year)
21814 tmp = NULL;
21815 else
21816 pt = t;
21817 } /* local_check */
21818
21819int check_max ()
21820{
21821 tmp = NULL;
21822 pt = 0;
21823#ifdef MAXLONG
21824 local_check (MAXLONG, 69, 0x7fffffff);
21825#endif
21826 if (tmp == NULL || tmp->tm_year < 0) {
21827 for (i = 63; i >= 0; i--) {
21828 time_t x = pt | ((time_t)1 << i);
21829 if (x < 0 || x < pt) continue;
21830 local_check (x, 69, 0x7fffffff);
21831 }
21832 }
21833 printf ("sLOCALTIME_max=%ld\n", pt);
21834 return (0);
21835 } /* check_max */
21836
21837int check_min ()
21838{
21839 tmp = NULL;
21840 pt = 0;
21841#ifdef MINLONG
21842 local_check (MINLONG, -1900, 70);
21843#endif
21844 if (tmp == NULL) {
21845 for (i = 36; i >= 0; i--) {
21846 time_t x = pt - ((time_t)1 << i);
21847 if (x > 0) continue;
21848 local_check (x, -1900, 70);
21849 }
21850 }
21851 printf ("sLOCALTIME_min=%ld\n", pt);
21852 return (0);
21853 } /* check_min */
21854
21855int main (int argc, char *argv[])
21856{
21857 check_max ();
21858 check_min ();
21859 return (0);
21860 } /* main */
21861EOCP
21862 set try
21863 if eval $compile; then
21864 eval `$run ./try 2>/dev/null`
21865 else
21866 echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21867 fi
21868 $rm_try
21869 ;;
21870 esac
21871
21872: check for type of arguments to select.
21873case "$selecttype" in
21874'') case "$d_select" in
21875 $define)
21876 echo " "
21877 $cat <<EOM
21878Checking to see what type of arguments are accepted by select().
21879EOM
21880 hdrs="$define sys/types.h
21881 $i_systime sys/time.h
21882 $i_sysselct sys/select.h
21883 $d_socket sys/socket.h"
21884 : The first arg can be int, unsigned, or size_t
21885 : The last arg may or may not be 'const'
21886 val=''
21887 : void pointer has been seen but using that
21888 : breaks the selectminbits test
21889 for xxx in 'fd_set *' 'int *'; do
21890 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21891 for tmo in 'struct timeval *' 'const struct timeval *'; do
21892 case "$val" in
21893 '') try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21894 if ./protochk "$try" $hdrs; then
21895 echo "Your system accepts $xxx."
21896 val="$xxx"
21897 fi
21898 ;;
21899 esac
21900 done
21901 done
21902 done
21903 case "$val" in
21904 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21905 case "$d_fd_set" in
21906 $define) dflt="fd_set *" ;;
21907 *) dflt="int *" ;;
21908 esac
21909 . ./myread
21910 val=$ans
21911 ;;
21912 esac
21913 selecttype="$val"
21914 ;;
21915 *) : no select, so pick a harmless default
21916 selecttype='int *'
21917 ;;
21918 esac
21919 ;;
21920esac
21921
21922: check for the select 'width'
21923case "$selectminbits" in
21924'') safebits=`expr $ptrsize \* 8`
21925 case "$d_select" in
21926 $define)
21927 $cat <<EOM
21928
21929Checking to see on how many bits at a time your select() operates...
21930EOM
21931 $cat >try.c <<EOCP
21932#include <sys/types.h>
21933#$i_time I_TIME
21934#$i_systime I_SYS_TIME
21935#$i_systimek I_SYS_TIME_KERNEL
21936#ifdef I_TIME
21937# include <time.h>
21938#endif
21939#ifdef I_SYS_TIME
21940# ifdef I_SYS_TIME_KERNEL
21941# define KERNEL
21942# endif
21943# include <sys/time.h>
21944# ifdef I_SYS_TIME_KERNEL
21945# undef KERNEL
21946# endif
21947#endif
21948#$i_sysselct I_SYS_SELECT
21949#ifdef I_SYS_SELECT
21950#include <sys/select.h>
21951#endif
21952#$d_socket HAS_SOCKET
21953#ifdef HAS_SOCKET
21954# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21955#endif
21956#include <stdio.h>
21957#$i_stdlib I_STDLIB
21958#ifdef I_STDLIB
21959#include <stdlib.h>
21960#endif
21961$selecttype b;
21962#define S sizeof(*(b))
21963#define MINBITS 64
21964#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21965#define NBITS (NBYTES * 8)
21966int main() {
21967 char *s = (char *)malloc(NBYTES);
21968 struct timeval t;
21969 int i;
21970 FILE* fp;
21971 int fd;
21972
21973 if (!s)
21974 exit(1);
21975 fclose(stdin);
21976 fp = fopen("try.c", "r");
21977 if (fp == 0)
21978 exit(2);
21979 fd = fileno(fp);
21980 if (fd < 0)
21981 exit(3);
21982 b = ($selecttype)s;
21983 for (i = 0; i < NBITS; i++)
21984 FD_SET(i, b);
21985 t.tv_sec = 0;
21986 t.tv_usec = 0;
21987 select(fd + 1, b, 0, 0, &t);
21988 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21989 free(s);
21990 printf("%d\n", i + 1);
21991 return 0;
21992}
21993EOCP
21994 set try
21995 if eval $compile_ok; then
21996 selectminbits=`$run ./try 2>/dev/null`
21997 case "$selectminbits" in
21998 '') cat >&4 <<EOM
21999Cannot figure out on how many bits at a time your select() operates.
22000I'll play safe and guess it is $safebits bits.
22001EOM
22002 selectminbits=$safebits
22003 bits="$safebits bits"
22004 ;;
22005 1) bits="1 bit" ;;
22006 *) bits="$selectminbits bits" ;;
22007 esac
22008 echo "Your select() operates on $bits at a time." >&4
22009 else
22010 rp='What is the minimum number of bits your select() operates on?'
22011 case "$byteorder" in
22012 12345678) dflt=64 ;;
22013 1234) dflt=32 ;;
22014 *) dflt=1 ;;
22015 esac
22016 . ./myread
22017 val=$ans
22018 selectminbits="$val"
22019 fi
22020 $rm_try
22021 ;;
22022 *) : no select, so pick a harmless default
22023 selectminbits=$safebits
22024 ;;
22025 esac
22026 ;;
22027esac
22028
22029: Trace out the files included by signal.h, then look for SIGxxx names.
22030case "$sig_num_init" in
22031'')
22032if [ "X$fieldn" = X ]; then
22033 : Just make some guesses. We check them later.
22034 xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22035else
22036 xxx=`echo '#include <signal.h>' |
22037 $cppstdin $cppminus $cppflags 2>/dev/null |
22038 $grep '^[ ]*#.*include' |
22039 $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22040 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22041fi
22042xxxfiles=''
22043for xx in $xxx /dev/null ; do
22044 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22045done
22046case "$xxxfiles" in
22047'') xxxfiles=`./findhdr signal.h` ;;
22048esac
22049xxx=`awk '
22050$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22051 print substr($2, 4, 20)
22052}
22053$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22054 print substr($3, 4, 20)
22055}' $xxxfiles`
22056: Append some common names just in case the awk scan failed.
22057xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22058xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22059xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22060xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22061xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22062
22063: generate a few handy files for later
22064$cat > signal.c <<EOCP
22065#include <sys/types.h>
22066#include <signal.h>
22067#$i_stdlib I_STDLIB
22068#ifdef I_STDLIB
22069#include <stdlib.h>
22070#endif
22071#include <stdio.h>
22072int main() {
22073
22074/* Strange style to avoid deeply-nested #if/#else/#endif */
22075#ifndef NSIG
22076# ifdef _NSIG
22077# define NSIG (_NSIG)
22078# endif
22079#endif
22080
22081#ifndef NSIG
22082# ifdef SIGMAX
22083# define NSIG (SIGMAX+1)
22084# endif
22085#endif
22086
22087#ifndef NSIG
22088# ifdef SIG_MAX
22089# define NSIG (SIG_MAX+1)
22090# endif
22091#endif
22092
22093#ifndef NSIG
22094# ifdef _SIG_MAX
22095# define NSIG (_SIG_MAX+1)
22096# endif
22097#endif
22098
22099#ifndef NSIG
22100# ifdef MAXSIG
22101# define NSIG (MAXSIG+1)
22102# endif
22103#endif
22104
22105#ifndef NSIG
22106# ifdef MAX_SIG
22107# define NSIG (MAX_SIG+1)
22108# endif
22109#endif
22110
22111#ifndef NSIG
22112# ifdef SIGARRAYSIZE
22113# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22114# endif
22115#endif
22116
22117#ifndef NSIG
22118# ifdef _sys_nsig
22119# define NSIG (_sys_nsig) /* Solaris 2.5 */
22120# endif
22121#endif
22122
22123/* Default to some arbitrary number that's big enough to get most
22124 of the common signals.
22125*/
22126#ifndef NSIG
22127# define NSIG 50
22128#endif
22129
22130printf("NSIG %d\n", NSIG);
22131
22132#ifndef JUST_NSIG
22133
22134EOCP
22135
22136echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22137{
22138 printf "#ifdef SIG"; printf $1; printf "\n"
22139 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22140 printf $1; printf ");\n"
22141 printf "#endif\n"
22142}
22143END {
22144 printf "#endif /* JUST_NSIG */\n";
22145 printf "exit(0);\n}\n";
22146}
22147' >>signal.c
22148$cat >signal.awk <<'EOP'
22149BEGIN { ndups = 0 }
22150$1 ~ /^NSIG$/ { nsig = $2 }
22151($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22152 if ($2 > maxsig) { maxsig = $2 }
22153 if (sig_name[$2]) {
22154 dup_name[ndups] = $1
22155 dup_num[ndups] = $2
22156 ndups++
22157 }
22158 else {
22159 sig_name[$2] = $1
22160 sig_num[$2] = $2
22161 }
22162}
22163END {
22164 if (nsig == 0) {
22165 nsig = maxsig + 1
22166 }
22167 printf("NSIG %d\n", nsig);
22168 for (n = 1; n < nsig; n++) {
22169 if (sig_name[n]) {
22170 printf("%s %d\n", sig_name[n], sig_num[n])
22171 }
22172 else {
22173 printf("NUM%d %d\n", n, n)
22174 }
22175 }
22176 for (n = 0; n < ndups; n++) {
22177 printf("%s %d\n", dup_name[n], dup_num[n])
22178 }
22179}
22180EOP
22181$cat >signal_cmd <<EOS
22182$startsh
22183if $test -s signal.lst; then
22184 echo "Using your existing signal.lst file"
22185 exit 0
22186fi
22187xxx="$xxx"
22188EOS
22189$cat >>signal_cmd <<'EOS'
22190
22191set signal
22192if eval $compile_ok; then
22193 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22194 $uniq | $awk -f signal.awk >signal.lst
22195else
22196 echo "(I can't seem be able to compile the whole test program)" >&4
22197 echo "(I'll try it in little pieces.)" >&4
22198 set signal -DJUST_NSIG
22199 if eval $compile_ok; then
22200 $run ./signal$_exe > signal.nsg
22201 $cat signal.nsg
22202 else
22203 echo "I can't seem to figure out how many signals you have." >&4
22204 echo "Guessing 50." >&4
22205 echo 'NSIG 50' > signal.nsg
22206 fi
22207 : Now look at all the signal names, one at a time.
22208 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22209 $cat > signal.c <<EOCP
22210#include <sys/types.h>
22211#include <signal.h>
22212#include <stdio.h>
22213int main() {
22214printf("$xx %d\n", SIG${xx});
22215return 0;
22216}
22217EOCP
22218 set signal
22219 if eval $compile; then
22220 echo "SIG${xx} found."
22221 $run ./signal$_exe >> signal.ls1
22222 else
22223 echo "SIG${xx} NOT found."
22224 fi
22225 done
22226 if $test -s signal.ls1; then
22227 $cat signal.nsg signal.ls1 |
22228 $sort -n | $uniq | $awk -f signal.awk >signal.lst
22229 fi
22230
22231fi
22232if $test -s signal.lst; then
22233 :
22234else
22235 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22236 echo 'kill -l' >signal
22237 set X `csh -f <signal`
22238 $rm -f signal
22239 shift
22240 case $# in
22241 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22242 esac
22243 echo $@ | $tr ' ' $trnl | \
22244 $awk '{ printf "%s %d\n", $1, ++s; }
22245 END { printf "NSIG %d\n", ++s }' >signal.lst
22246fi
22247$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22248EOS
22249chmod a+x signal_cmd
22250$eunicefix signal_cmd
22251;;
22252esac
22253
22254: generate list of signal names
22255case "$sig_num_init" in
22256'')
22257echo " "
22258case "$sig_name_init" in
22259'') doinit=yes ;;
22260*) case "$sig_num_init" in
22261 ''|*,*) doinit=yes ;;
22262 esac ;;
22263esac
22264case "$doinit" in
22265yes)
22266 echo "Generating a list of signal names and numbers..." >&4
22267 . ./signal_cmd
22268 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22269 sig_name=`$awk 'BEGIN { printf "ZERO " }
22270 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22271 sig_num=`$awk 'BEGIN { printf "0 " }
22272 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22273 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
22274 !/^NSIG/ { printf "\"%s\", ", $1 }
22275 END { printf "0\n" }' signal.lst`
22276 sig_num_init=`$awk 'BEGIN { printf "0, " }
22277 !/^NSIG/ { printf "%d, ", $2}
22278 END { printf "0\n"}' signal.lst`
22279 ;;
22280esac
22281echo "The following $sig_count signals are available:"
22282echo " "
22283echo $sig_name | $awk \
22284'BEGIN { linelen = 0 }
22285{
22286 for (i = 1; i <= NF; i++) {
22287 name = "SIG" $i " "
22288 linelen = linelen + length(name)
22289 if (linelen > 70) {
22290 printf "\n"
22291 linelen = length(name)
22292 }
22293 printf "%s", name
22294 }
22295 printf "\n"
22296}'
22297sig_size=`echo $sig_name | awk '{print NF}'`
22298$rm -f signal signal.c signal.awk signal.lst signal_cmd
22299;;
22300esac
22301
22302: Check size of size
22303echo " "
22304case "$sizetype" in
22305*_t) zzz="$sizetype" ;;
22306*) zzz="filesize" ;;
22307esac
22308echo "Checking the size of $zzz..." >&4
22309cat > try.c <<EOCP
22310#include <sys/types.h>
22311#include <stdio.h>
22312#$i_stdlib I_STDLIB
22313#ifdef I_STDLIB
22314#include <stdlib.h>
22315#endif
22316int main() {
22317 printf("%d\n", (int)sizeof($sizetype));
22318 exit(0);
22319}
22320EOCP
22321set try
22322if eval $compile_ok; then
22323 yyy=`$run ./try`
22324 case "$yyy" in
22325 '') sizesize=4
22326 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22327 ;;
22328 *) sizesize=$yyy
22329 echo "Your $zzz size is $sizesize bytes."
22330 ;;
22331 esac
22332else
22333 sizesize=4
22334 echo "(I can't compile the test program--guessing $sizesize.)" >&4
22335fi
22336
22337: check for socklen_t
22338echo " "
22339echo "Checking to see if you have socklen_t..." >&4
22340$cat >try.c <<EOCP
22341#include <sys/types.h>
22342#$d_socket HAS_SOCKET
22343#ifdef HAS_SOCKET
22344#include <sys/socket.h>
22345#endif
22346int main() { socklen_t x = 16; }
22347EOCP
22348set try
22349if eval $compile; then
22350 val="$define"
22351 echo "You have socklen_t."
22352else
22353 val="$undef"
22354 echo "You do not have socklen_t."
22355 case "$sizetype" in
22356 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22357 esac
22358fi
22359$rm_try
22360set d_socklen_t
22361eval $setvar
22362
22363: see if this is a socks.h system
22364set socks.h i_socks
22365eval $inhdr
22366
22367: check for type of the size argument to socket calls
22368case "$d_socket" in
22369"$define")
22370 $cat <<EOM
22371
22372Checking to see what type is the last argument of accept().
22373EOM
22374 yyy=''
22375 case "$d_socklen_t" in
22376 "$define") yyy="$yyy socklen_t"
22377 esac
22378 yyy="$yyy $sizetype int long unsigned"
22379 for xxx in $yyy; do
22380 case "$socksizetype" in
22381 '') try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22382 case "$usesocks" in
22383 "$define")
22384 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22385 echo "Your system accepts '$xxx *' for the last argument of accept()."
22386 socksizetype="$xxx"
22387 fi
22388 ;;
22389 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
22390 echo "Your system accepts '$xxx *' for the last argument of accept()."
22391 socksizetype="$xxx"
22392 fi
22393 ;;
22394 esac
22395 ;;
22396 esac
22397 done
22398: In case none of those worked, prompt the user.
22399 case "$socksizetype" in
22400 '') rp='What is the type for socket address structure sizes?'
22401 dflt='int'
22402 . ./myread
22403 socksizetype=$ans
22404 ;;
22405 esac
22406 ;;
22407*) : no sockets, so pick relatively harmless default
22408 socksizetype='int'
22409 ;;
22410esac
22411
22412: see what type is used for signed size_t
22413set ssize_t ssizetype int stdio.h sys/types.h
22414eval $typedef
22415dflt="$ssizetype"
22416$cat > try.c <<EOM
22417#include <stdio.h>
22418#$i_stdlib I_STDLIB
22419#ifdef I_STDLIB
22420#include <stdlib.h>
22421#endif
22422#include <sys/types.h>
22423#define Size_t $sizetype
22424#define SSize_t $dflt
22425int main()
22426{
22427 if (sizeof(Size_t) == sizeof(SSize_t))
22428 printf("$dflt\n");
22429 else if (sizeof(Size_t) == sizeof(int))
22430 printf("int\n");
22431 else
22432 printf("long\n");
22433 exit(0);
22434}
22435EOM
22436echo " "
22437set try
22438if eval $compile_ok && $run ./try > /dev/null; then
22439 ssizetype=`$run ./try`
22440 echo "I'll be using $ssizetype for functions returning a byte count." >&4
22441else
22442 $cat >&4 <<EOM
22443Help! I can't compile and run the ssize_t test program: please enlighten me!
22444(This is probably a misconfiguration in your system or libraries, and
22445you really ought to fix it. Still, I'll try anyway.)
22446
22447I need a type that is the same size as $sizetype, but is guaranteed to
22448be signed. Common values are ssize_t, int and long.
22449
22450EOM
22451 rp="What signed type is the same size as $sizetype?"
22452 . ./myread
22453 ssizetype="$ans"
22454fi
22455$rm_try
22456
22457: Check the size of st_ino
22458$echo " "
22459$echo "Checking the size of st_ino..." >&4
22460$cat > try.c <<EOCP
22461#include <sys/stat.h>
22462#include <stdio.h>
22463#$i_stdlib I_STDLIB
22464#ifdef I_STDLIB
22465#include <stdlib.h>
22466#endif
22467int main() {
22468 struct stat st;
22469 printf("%d\n", (int)sizeof(st.st_ino));
22470 exit(0);
22471}
22472EOCP
22473set try
22474if eval $compile_ok; then
22475 val=`$run ./try`
22476 case "$val" in
22477 '') st_ino_size=4
22478 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22479 ;;
22480 *) st_ino_size=$val
22481 $echo "Your st_ino is $st_ino_size bytes long."
22482 ;;
22483 esac
22484else
22485 st_ino_size=4
22486 $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22487fi
22488$rm_try
22489
22490: Check if st_ino is signed
22491$echo " "
22492$echo "Checking the sign of st_ino..." >&4
22493$cat > try.c <<EOCP
22494#include <sys/stat.h>
22495#include <stdio.h>
22496int main() {
22497 struct stat foo;
22498 foo.st_ino = -1;
22499 if (foo.st_ino < 0)
22500 printf("-1\n");
22501 else
22502 printf("1\n");
22503}
22504EOCP
22505set try
22506if eval $compile; then
22507 val=`$run ./try`
22508 case "$val" in
22509 '') st_ino_sign=1
22510 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22511 ;;
22512 *) st_ino_sign=$val
22513 case "$st_ino_sign" in
22514 1) $echo "Your st_ino is unsigned." ;;
22515 -1) $echo "Your st_ino is signed." ;;
22516 esac
22517 ;;
22518 esac
22519else
22520 st_ino_sign=1
22521 $echo "(I can't compile the test program--guessing unsigned.)" >&4
22522fi
22523$rm_try
22524
22525: see what type of char stdio uses.
22526echo " "
22527echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22528if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22529 echo "Your stdio uses unsigned chars." >&4
22530 stdchar="unsigned char"
22531else
22532 echo "Your stdio uses signed chars." >&4
22533 stdchar="char"
22534fi
22535$rm -f stdioh
22536
22537: Check size of UID
22538echo " "
22539case "$uidtype" in
22540*_t) zzz="$uidtype" ;;
22541*) zzz="uid" ;;
22542esac
22543echo "Checking the size of $zzz..." >&4
22544cat > try.c <<EOCP
22545#include <sys/types.h>
22546#include <stdio.h>
22547#$i_stdlib I_STDLIB
22548#ifdef I_STDLIB
22549#include <stdlib.h>
22550#endif
22551int main() {
22552 printf("%d\n", (int)sizeof($uidtype));
22553 exit(0);
22554}
22555EOCP
22556set try
22557if eval $compile_ok; then
22558 yyy=`$run ./try`
22559 case "$yyy" in
22560 '') uidsize=4
22561 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22562 ;;
22563 *) uidsize=$yyy
22564 echo "Your $zzz is $uidsize bytes long."
22565 ;;
22566 esac
22567else
22568 uidsize=4
22569 echo "(I can't compile the test program--guessing $uidsize.)" >&4
22570fi
22571
22572: Check if UID is signed
22573echo " "
22574case "$uidtype" in
22575*_t) zzz="$uidtype" ;;
22576*) zzz="uid" ;;
22577esac
22578echo "Checking the sign of $zzz..." >&4
22579cat > try.c <<EOCP
22580#include <sys/types.h>
22581#include <stdio.h>
22582int main() {
22583 $uidtype foo = -1;
22584 if (foo < 0)
22585 printf("-1\n");
22586 else
22587 printf("1\n");
22588}
22589EOCP
22590set try
22591if eval $compile; then
22592 yyy=`$run ./try`
22593 case "$yyy" in
22594 '') uidsign=1
22595 echo "(I can't execute the test program--guessing unsigned.)" >&4
22596 ;;
22597 *) uidsign=$yyy
22598 case "$uidsign" in
22599 1) echo "Your $zzz is unsigned." ;;
22600 -1) echo "Your $zzz is signed." ;;
22601 esac
22602 ;;
22603 esac
22604else
22605 uidsign=1
22606 echo "(I can't compile the test program--guessing unsigned.)" >&4
22607fi
22608
22609: Check format string for UID
22610echo " "
22611$echo "Checking the format string to be used for uids..." >&4
22612
22613case "$uidsign" in
22614-1) if $test X"$uidsize" = X"$ivsize"; then
22615 uidformat="$ivdformat"
22616 else
22617 if $test X"$uidsize" = X"$longsize"; then
22618 uidformat='"ld"'
22619 else
22620 if $test X"$uidsize" = X"$intsize"; then
22621 uidformat='"d"'
22622 else
22623 if $test X"$uidsize" = X"$shortsize"; then
22624 uidformat='"hd"'
22625 fi
22626 fi
22627 fi
22628 fi
22629 ;;
22630*) if $test X"$uidsize" = X"$uvsize"; then
22631 uidformat="$uvuformat"
22632 else
22633 if $test X"$uidsize" = X"$longsize"; then
22634 uidformat='"lu"'
22635 else
22636 if $test X"$uidsize" = X"$intsize"; then
22637 uidformat='"u"'
22638 else
22639 if $test X"$uidsize" = X"$shortsize"; then
22640 uidformat='"hu"'
22641 fi
22642 fi
22643 fi
22644 fi
22645 ;;
22646esac
22647
22648: Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22649echo " "
22650echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22651$cat >try.c <<'EOM'
22652/* Intentionally a long probe as I'd like to sanity check that the exact
22653 approach is going to work, as thinking it will work, but only having it
22654 part working at runtime is worse than not having it. */
22655
22656#include <sys/types.h>
22657#include <sys/sysctl.h>
22658#include <sys/param.h>
22659#include <stdio.h>
22660#include <string.h>
22661#include <stdlib.h>
22662#include <unistd.h>
22663
22664int
22665main(int argc, char **argv) {
22666 char *buffer;
22667 char *argv_leaf = strrchr(argv[0], '/');
22668 char *buffer_leaf;
22669 size_t size = 0;
22670 int mib[4];
22671
22672 mib[0] = CTL_KERN;
22673 mib[1] = KERN_PROC;
22674 mib[2] = KERN_PROC_PATHNAME;
22675 mib[3] = -1;
22676
22677 if (!argv_leaf) {
22678 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22679 return 1;
22680 }
22681
22682 if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22683 perror("sysctl");
22684 return 2;
22685 }
22686
22687 if (size < strlen(argv_leaf) + 1) {
22688 fprintf(stderr, "size %lu is too short for a path\n",
22689 (unsigned long) size);
22690 return 3;
22691 }
22692
22693 if (size > MAXPATHLEN * MAXPATHLEN) {
22694 fprintf(stderr, "size %lu is too long for a path\n",
22695 (unsigned long) size);
22696 return 4;
22697 }
22698
22699 buffer = (char *)malloc(size);
22700 if (!buffer) {
22701 perror("malloc");
22702 return 5;
22703 }
22704
22705 if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22706 perror("sysctl");
22707 return 6;
22708 }
22709
22710 if (strlen(buffer) + 1 != size) {
22711 fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22712 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22713 return 7;
22714 }
22715
22716
22717 if (*buffer != '/') {
22718 fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22719 return 8;
22720 }
22721
22722 if (strstr(buffer, "/./")) {
22723 fprintf(stderr, "Contains /./: '%s'\n", buffer);
22724 return 9;
22725 }
22726
22727 if (strstr(buffer, "/../")) {
22728 fprintf(stderr, "Contains /../: '%s'\n", buffer);
22729 return 10;
22730 }
22731
22732 buffer_leaf = strrchr(buffer, '/');
22733 if (strcmp(buffer_leaf, argv_leaf) != 0) {
22734 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22735 return 11;
22736 }
22737
22738 free(buffer);
22739
22740 return 0;
22741}
22742EOM
22743
22744val=$undef
22745set try
22746if eval $compile; then
22747 if $run ./try; then
22748 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22749 val="$define"
22750 else
22751 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22752 val="$undef"
22753 fi
22754else
22755 echo "I'm unable to compile the test program." >&4
22756 echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22757 val="$undef"
22758fi
22759$rm_try
22760set usekernprocpathname
22761eval $setvar
22762
22763: Determine if we can use _NSGetExecutablePath to find executing program
22764echo " "
22765echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22766$cat >try.c <<'EOM'
22767/* Intentionally a long probe as I'd like to sanity check that the exact
22768 approach is going to work, as thinking it will work, but only having it
22769 part working at runtime is worse than not having it. */
22770#include <mach-o/dyld.h>
22771#include <stdio.h>
22772#include <stdlib.h>
22773#include <sys/param.h>
22774#include <string.h>
22775
22776int
22777main(int argc, char **argv) {
22778 char buf[1];
22779 uint32_t size = sizeof(buf);
22780 int result;
22781 char *buffer;
22782 char *tidied;
22783 char *argv_leaf = strrchr(argv[0], '/');
22784 char *tidied_leaf;
22785
22786 if (!argv_leaf) {
22787 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22788 return 1;
22789 }
22790
22791 _NSGetExecutablePath(buf, &size);
22792 if (size > MAXPATHLEN * MAXPATHLEN) {
22793 fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22794 (unsigned int) size);
22795 return 2;
22796 }
22797
22798 buffer = (char *)malloc(size);
22799 if (!buffer) {
22800 perror("malloc");
22801 return 3;
22802 }
22803
22804 result = _NSGetExecutablePath(buffer, &size);
22805 if (result != 0) {
22806 fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22807 result, (unsigned int) size);
22808 return 4;
22809 }
22810
22811 tidied = realpath(buffer, NULL);
22812 if (!tidied) {
22813 perror("realpath");
22814 return 5;
22815 }
22816
22817 free(buffer);
22818
22819 if (*tidied != '/') {
22820 fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22821 return 6;
22822 }
22823
22824 if (strstr(tidied, "/./")) {
22825 fprintf(stderr, "Contains /./: '%s'\n", tidied);
22826 return 7;
22827 }
22828
22829 if (strstr(tidied, "/../")) {
22830 fprintf(stderr, "Contains /../: '%s'\n", tidied);
22831 return 8;
22832 }
22833
22834 tidied_leaf = strrchr(tidied, '/');
22835 if (strcmp(tidied_leaf, argv_leaf) != 0) {
22836 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22837 return 9;
22838 }
22839
22840 free(tidied);
22841
22842 return 0;
22843}
22844EOM
22845
22846val=$undef
22847set try
22848if eval $compile; then
22849 if $run ./try; then
22850 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22851 val="$define"
22852 else
22853 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22854 fi
22855else
22856 echo "I'm unable to compile the test program." >&4
22857 echo "I'll assume no _NSGetExecutablePath here." >&4
22858fi
22859$rm_try
22860set usensgetexecutablepath
22861eval $setvar
22862
22863: Check if site customization support was requested
22864case "$usesitecustomize" in
22865 $define|true|[Yy]*)
22866 usesitecustomize="$define"
22867 ;;
22868 *)
22869 usesitecustomize="$undef"
22870 ;;
22871 esac
22872
22873: determine compiler compiler
22874case "$yacc" in
22875'')
22876 dflt=yacc;;
22877*)
22878 dflt="$yacc";;
22879esac
22880echo " "
22881comp='yacc'
22882if $test -f "$byacc$_exe"; then
22883 dflt="$byacc"
22884 comp="byacc or $comp"
22885fi
22886if $test -f "$bison$_exe"; then
22887 comp="$comp or bison -y"
22888fi
22889rp="Which compiler compiler ($comp) shall I use?"
22890. ./myread
22891yacc="$ans"
22892case "$yacc" in
22893*bis*)
22894 case "$yacc" in
22895 *-y*) ;;
22896 *)
22897 yacc="$yacc -y"
22898 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22899 ;;
22900 esac
22901 ;;
22902esac
22903
22904: see if this is a bfd.h system
22905set bfd.h i_bfd
22906eval $inhdr
22907
22908: see if this is an execinfo.h system
22909set execinfo.h i_execinfo
22910eval $inhdr
22911
22912: see if this is a fenv.h system
22913set fenv.h i_fenv
22914eval $inhdr
22915
22916: see if this is a fp.h system
22917set fp.h i_fp
22918eval $inhdr
22919
22920: see if this is a fp_class.h system
22921set fp_class.h i_fp_class
22922eval $inhdr
22923
22924: see if gdbm.h is available
22925set gdbm.h t_gdbm
22926eval $inhdr
22927case "$t_gdbm" in
22928$define)
22929 : see if gdbm_open exists
22930 set gdbm_open d_gdbm_open
22931 eval $inlibc
22932 case "$d_gdbm_open" in
22933 $undef)
22934 t_gdbm="$undef"
22935 echo "We won't be including <gdbm.h>"
22936 ;;
22937 esac
22938 ;;
22939esac
22940val="$t_gdbm"
22941set i_gdbm
22942eval $setvar
22943
22944: see if this is a ieeefp.h system
22945case "$i_ieeefp" in
22946'' ) set ieeefp.h i_ieeefp
22947 eval $inhdr
22948 ;;
22949esac
22950
22951: see if this is a libutil.h system
22952set libutil.h i_libutil
22953eval $inhdr
22954
22955: see if mach cthreads are available
22956if test "X$usethreads" = "X$define"; then
22957 set mach/cthreads.h i_machcthr
22958 eval $inhdr
22959else
22960 i_machcthr="$undef"
22961fi
22962
22963: see if this is a mntent.h system
22964set mntent.h i_mntent
22965eval $inhdr
22966
22967: see if net/errno.h is available
22968val=''
22969set net/errno.h val
22970eval $inhdr
22971
22972: Unfortunately, it causes problems on some systems. Arrgh.
22973case "$val" in
22974$define)
22975 cat > try.c <<'EOM'
22976#include <stdio.h>
22977#include <errno.h>
22978#include <net/errno.h>
22979int func()
22980{
22981 return ENOTSOCK;
22982}
22983EOM
22984 if $cc $ccflags -c try.c >/dev/null 2>&1; then
22985 echo "We'll be including <net/errno.h>." >&4
22986 else
22987 echo "We won't be including <net/errno.h>." >&4
22988 val="$undef"
22989 fi
22990 $rm_try
22991 ;;
22992esac
22993set i_neterrno
22994eval $setvar
22995
22996: see if netinet/tcp.h is available
22997set netinet/tcp.h i_netinettcp
22998eval $inhdr
22999
23000: see if this is a poll.h system
23001set poll.h i_poll
23002eval $inhdr
23003
23004: see if this is a prot.h system
23005set prot.h i_prot
23006eval $inhdr
23007
23008: Preprocessor symbols
23009echo " "
23010$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23011$cat <<'EOSH' > Cppsym.know
23012a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23013AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23014AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23015arch_pwr ardent ARM ARM32 atarist att386 att3b
23016BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23017BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23018byteorder byte_order
23019c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23020convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23021DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23022ELF encore EPI EXTENSIONS
23023FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23024GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23025GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23026H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23027hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
23028hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23029i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23030iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23031INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23032ksr1
23033LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23034LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23035LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23036luna88k Lynx
23037M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23038MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23039mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23040merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23041MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
23042MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23043M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23044M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23045n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23046news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23047ns32000 ns32016 ns32332 ns32k nsc32000
23048OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23049PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23050plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23051POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23052QK_USER QNX
23053R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23054S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23055SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23056sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23057stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23058SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23059SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23060SYSV4 SYSV5 sysV68 sysV88
23061Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23062TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23063tower32_800 tower32_850 tss
23064u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23065UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23066USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23067USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23068USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23069USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23070uxpm uxps
23071vax venix VMESA vms
23072x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23073XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23074z8000 zarch
23075EOSH
23076# Maybe put other stuff here too.
23077./tr '-' '_' <<EOSH >>Cppsym.know
23078$osname
23079EOSH
23080./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23081./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23082$cat Cppsym.know > Cppsym.c
23083$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23084$rm -f Cppsym.a Cppsym.b Cppsym.c
23085cat <<EOSH > Cppsym
23086$startsh
23087if $test \$# -gt 0; then
23088 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23089 if $test -s Cppsym.got; then
23090 $rm -f Cppsym.got
23091 exit 0
23092 fi
23093 $rm -f Cppsym.got
23094 exit 1
23095else
23096 $tr " " "$trnl" | ./Cppsym.try
23097 exit 0
23098fi
23099EOSH
23100chmod +x Cppsym
23101$eunicefix Cppsym
23102cat <<EOSH > Cppsym.try
23103$startsh
23104cat <<'EOCP' > try.c
23105#include <stdio.h>
23106#if cpp_stuff == 1
23107#define STRINGIFY(a) "a"
23108#endif
23109#if cpp_stuff == 42
23110#define StGiFy(a) #a
23111#define STRINGIFY(a) StGiFy(a)
23112#endif
23113#if $cpp_stuff != 1 && $cpp_stuff != 42
23114# include "Bletch: How does this C preprocessor stringify macros?"
23115#endif
23116int main() {
23117EOCP
23118$awk \\
23119EOSH
23120cat <<'EOSH' >> Cppsym.try
23121'length($1) > 0 {
23122 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23123 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23124 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23125 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23126}' >> try.c
23127echo 'return 0;}' >> try.c
23128EOSH
23129cat <<EOSH >> Cppsym.try
23130ccflags="$ccflags"
23131case "$osname-$gccversion" in
23132irix-) ccflags="\$ccflags -woff 1178" ;;
23133os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23134esac
23135$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23136EOSH
23137chmod +x Cppsym.try
23138$eunicefix Cppsym.try
23139./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23140: Add in any Linux cpp "predefined macros":
23141case "$osname::$gccversion" in
23142 *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23143 tHdrH=_tmpHdr
23144 rm -f $tHdrH'.h' $tHdrH
23145 touch $tHdrH'.h'
23146 # Filter out macro arguments, such as Linux's __INT8_C(c)
23147 if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23148 sed -e 's/#define[\ \ ]*//;s/[\ \ ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23149 if [ -s $tHdrH'_cppsym.real' ]; then
23150 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23151 fi
23152 fi
23153 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23154 ;;
23155esac
23156: now check the C compiler for additional symbols
23157postprocess_cc_v=''
23158case "$osname" in
23159aix) postprocess_cc_v="|$tr , ' '" ;;
23160esac
23161$cat >ccsym <<EOS
23162$startsh
23163$cat >tmp.c <<EOF
23164extern int foo;
23165EOF
23166for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23167do
23168 case "\$i" in
23169 -D*) echo "\$i" | $sed 's/^-D//';;
23170 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23171 esac
23172done
23173$rm_try
23174EOS
23175postprocess_cc_v=''
23176chmod +x ccsym
23177$eunicefix ccsym
23178./ccsym > ccsym1.raw
23179if $test -s ccsym1.raw; then
23180 $sort ccsym1.raw | $uniq >ccsym.raw
23181else
23182 mv ccsym1.raw ccsym.raw
23183fi
23184
23185$awk '/\=/ { print $0; next }
23186 { print $0"=1" }' ccsym.raw >ccsym.list
23187$comm -13 Cppsym.true ccsym.list >ccsym.own
23188$comm -12 Cppsym.true ccsym.list >ccsym.com
23189$comm -23 Cppsym.true ccsym.list >ccsym.cpp
23190also=''
23191if $test -z ccsym.raw; then
23192 echo "Your C compiler doesn't seem to define any symbols!" >&4
23193 echo " "
23194 echo "However, your C preprocessor defines the following symbols:"
23195 $cat Cppsym.true
23196 ccsymbols=''
23197 cppsymbols=`$cat Cppsym.true`
23198 cppsymbols=`echo $cppsymbols`
23199 cppccsymbols="$cppsymbols"
23200else
23201 if $test -s ccsym.com; then
23202 echo "Your C compiler and pre-processor define these symbols:"
23203 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23204 also='also '
23205 symbols='ones'
23206 cppccsymbols=`$cat ccsym.com`
23207 cppccsymbols=`echo $cppccsymbols`
23208 $test "$silent" || sleep 1
23209 fi
23210 if $test -s ccsym.cpp; then
23211 $test "$also" && echo " "
23212 echo "Your C pre-processor ${also}defines the following symbols:"
23213 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23214 also='further '
23215 cppsymbols=`$cat ccsym.cpp`
23216 cppsymbols=`echo $cppsymbols`
23217 $test "$silent" || sleep 1
23218 fi
23219 if $test -s ccsym.own; then
23220 $test "$also" && echo " "
23221 echo "Your C compiler ${also}defines the following cpp symbols:"
23222 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23223 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23224 ccsymbols=`$cat ccsym.own`
23225 ccsymbols=`echo $ccsymbols`
23226 $test "$silent" || sleep 1
23227 fi
23228fi
23229
23230: add -D_FORTIFY_SOURCE if feasible and not already there
23231case "$gccversion" in
23232[456789].*|[1-9][0-9]*) case "$optimize$ccflags" in
23233 *-O*) case "$ccflags$cppsymbols" in
23234 *_FORTIFY_SOURCE=*) # Don't add it again.
23235 echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23236 ;;
23237 *) echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23238 ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23239 ;;
23240 esac
23241 ;;
23242 *) echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23243 ;;
23244 esac
23245 ;;
23246*) echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23247 ;;
23248esac
23249
23250: script used to emit important warnings
23251cat >warn <<EOS
23252$startsh
23253if test \$# -gt 0; then
23254 echo "\$@" >msg
23255else
23256 cat >msg
23257fi
23258echo "*** WARNING:" >&4
23259sed -e 's/^/*** /' <msg >&4
23260echo "*** " >&4
23261cat msg >>config.msg
23262echo " " >>config.msg
23263rm -f msg
23264EOS
23265chmod +x warn
23266$eunicefix warn
23267
23268: see if this is a termio system
23269val="$undef"
23270val2="$undef"
23271val3="$undef"
23272if $test `./findhdr termios.h`; then
23273 set tcsetattr i_termios
23274 eval $inlibc
23275 val3="$i_termios"
23276fi
23277echo " "
23278case "$val3" in
23279 "$define") echo "You have POSIX termios.h... good!" >&4;;
23280 *) if ./Cppsym pyr; then
23281 case "`$run /bin/universe`" in
23282 ucb) if $test `./findhdr sgtty.h`; then
23283 val2="$define"
23284 echo "<sgtty.h> found." >&4
23285 else
23286 echo "System is pyramid with BSD universe."
23287 ./warn "<sgtty.h> not found--you could have problems."
23288 fi;;
23289 *) if $test `./findhdr termio.h`; then
23290 val="$define"
23291 echo "<termio.h> found." >&4
23292 else
23293 echo "System is pyramid with USG universe."
23294 ./warn "<termio.h> not found--you could have problems."
23295 fi;;
23296 esac
23297 elif ./usg; then
23298 if $test `./findhdr termio.h`; then
23299 echo "<termio.h> found." >&4
23300 val="$define"
23301 elif $test `./findhdr sgtty.h`; then
23302 echo "<sgtty.h> found." >&4
23303 val2="$define"
23304 else
23305 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23306 fi
23307 else
23308 if $test `./findhdr sgtty.h`; then
23309 echo "<sgtty.h> found." >&4
23310 val2="$define"
23311 elif $test `./findhdr termio.h`; then
23312 echo "<termio.h> found." >&4
23313 val="$define"
23314 else
23315 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23316 fi
23317 fi;;
23318esac
23319set i_termio; eval $setvar
23320val=$val2; set i_sgtty; eval $setvar
23321val=$val3; set i_termios; eval $setvar
23322
23323: see if stdbool is available
23324: we want a real compile instead of Inhdr because some Solaris systems
23325: have stdbool.h, but it can only be used if the compiler indicates it
23326: is sufficiently c99-compliant.
23327echo " "
23328$cat >try.c <<EOCP
23329#include <stdio.h>
23330#include <stdbool.h>
23331int func(bool x)
23332{
23333 return x ? 1 : 0;
23334}
23335int main(int argc, char **argv)
23336{
23337 return func(0);
23338}
23339EOCP
23340set try
23341if eval $compile; then
23342 echo "<stdbool.h> found." >&4
23343 val="$define"
23344else
23345 echo "<stdbool.h> NOT found." >&4
23346 val="$undef"
23347fi
23348$rm_try
23349set i_stdbool
23350eval $setvar
23351
23352: see if stdint is available
23353set stdint.h i_stdint
23354eval $inhdr
23355
23356: see if sys/access.h is available
23357set sys/access.h i_sysaccess
23358eval $inhdr
23359
23360: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23361set sys/filio.h i_sysfilio
23362eval $inhdr
23363echo " "
23364if $test `./findhdr sys/ioctl.h`; then
23365 val="$define"
23366 echo '<sys/ioctl.h> found.' >&4
23367else
23368 val="$undef"
23369 if $test $i_sysfilio = "$define"; then
23370 echo '<sys/ioctl.h> NOT found.' >&4
23371 else
23372 $test $i_sgtty = "$define" && xxx="sgtty.h"
23373 $test $i_termio = "$define" && xxx="termio.h"
23374 $test $i_termios = "$define" && xxx="termios.h"
23375echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23376 fi
23377fi
23378set i_sysioctl
23379eval $setvar
23380
23381: see if socket ioctl defs are in sys/sockio.h
23382echo " "
23383xxx=`./findhdr sys/sockio.h`
23384if $test "$xxx"; then
23385 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23386 val="$define"
23387 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23388 else
23389 val="$undef"
23390 echo "No socket ioctls found in <sys/sockio.h>." >&4
23391 fi
23392else
23393 val="$undef"
23394 $cat <<EOM
23395<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23396EOM
23397fi
23398set i_syssockio
23399eval $setvar
23400
23401: see if this is a syslog.h system
23402set syslog.h i_syslog
23403eval $inhdr
23404
23405: see if this is a sys/mode.h system
23406set sys/mode.h i_sysmode
23407eval $inhdr
23408
23409: see if there is a sys/poll.h file
23410set sys/poll.h i_syspoll
23411eval $inhdr
23412
23413: see if sys/resource.h has to be included
23414set sys/resource.h i_sysresrc
23415eval $inhdr
23416
23417: see if sys/security.h is available
23418set sys/security.h i_syssecrt
23419eval $inhdr
23420
23421: see if this is a sys/statvfs.h system
23422set sys/statvfs.h i_sysstatvfs
23423eval $inhdr
23424
23425: see if this is a sys/un.h system
23426set sys/un.h i_sysun
23427eval $inhdr
23428
23429: see if this is a sys/utsname.h system
23430set sys/utsname.h i_sysutsname
23431eval $inhdr
23432
23433: see if this is a syswait system
23434set sys/wait.h i_syswait
23435eval $inhdr
23436
23437: see if this is a ustat.h system
23438set ustat.h i_ustat
23439eval $inhdr
23440
23441: see if this is an utime system
23442set utime.h i_utime
23443eval $inhdr
23444
23445: see if this is a vfork system
23446case "$d_vfork" in
23447"$define")
23448 set vfork.h i_vfork
23449 eval $inhdr
23450 ;;
23451*)
23452 i_vfork="$undef"
23453 ;;
23454esac
23455
23456: see if wchar.h is present
23457set wchar.h i_wchar
23458eval $inhdr
23459
23460: Check extensions
23461echo " "
23462echo "Looking for extensions..." >&4
23463: If we are using the old config.sh, nonxs_extensions and xs_extensions may
23464: contain old or inaccurate or duplicate values.
23465nonxs_extensions=''
23466xs_extensions=''
23467: We do not use find because it might not be available.
23468: We do not just use MANIFEST because the user may have dropped
23469: some additional extensions into the source tree and expect them
23470: to be built.
23471
23472: Function to recursively find available extensions, ignoring DynaLoader
23473: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23474: In 5.10.1 and later, extensions are stored in directories
23475: like File-Glob instead of the older File/Glob/.
23476find_extensions='
23477 for xxx in *; do
23478 case "$xxx" in
23479 DynaLoader|dynaload) ;;
23480 *)
23481 this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23482 case "$this_ext" in
23483 Scalar/List/Utils) this_ext="List/Util" ;;
23484 PathTools) this_ext="Cwd" ;;
23485 esac;
23486 echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23487 if $contains " $this_ext " "$tdir/$$.tmp"; then
23488 echo >&4;
23489 echo "Duplicate directories detected for extension $xxx" >&4;
23490 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23491 case "$knowitall" in
23492 "") dflt=y;;
23493 *) dflt=n;;
23494 esac;
23495 . ../UU/myread;
23496 case "$ans" in
23497 n*|N*) ;;
23498 *) echo >&4;
23499 echo "Ok. Stopping Configure." >&4;
23500 echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23501 exit 1;;
23502 esac;
23503 echo "Ok. You will need to correct config.sh before running make." >&4;
23504 fi;
23505 $ls -1 "$xxx" > "$tdir/$$.tmp";
23506 if $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23507 xs_extensions="$xs_extensions $this_ext";
23508 elif $contains "\.c$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23509 xs_extensions="$xs_extensions $this_ext";
23510 elif $test -d "$xxx"; then
23511 nonxs_extensions="$nonxs_extensions $this_ext";
23512 fi;
23513 $rm -f "$tdir/$$.tmp";
23514 ;;
23515 esac;
23516 done'
23517tdir=`pwd`
23518cd "$rsrc/cpan"
23519set X
23520shift
23521eval $find_extensions
23522cd "$rsrc/dist"
23523set X
23524shift
23525eval $find_extensions
23526cd "$rsrc/ext"
23527set X
23528shift
23529eval $find_extensions
23530set X $xs_extensions
23531shift
23532xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23533set X $nonxs_extensions
23534shift
23535nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23536cd "$tdir"
23537known_extensions=`echo $nonxs_extensions $xs_extensions | tr ' ' $trnl | $sort | tr $trnl ' '`
23538
23539: Now see which are supported on this system.
23540avail_ext=''
23541for xxx in $xs_extensions ; do
23542 case "$xxx" in
23543 Amiga*)
23544 case "$osname" in
23545 amigaos) avail_ext="$avail_ext $xxx" ;;
23546 esac
23547 ;;
23548 DB_File|db_file)
23549 case "$i_db" in
23550 $define) avail_ext="$avail_ext $xxx" ;;
23551 esac
23552 ;;
23553 GDBM_File|gdbm_fil)
23554 case "$i_gdbm" in
23555 $define) avail_ext="$avail_ext $xxx" ;;
23556 esac
23557 ;;
23558 IPC/SysV|ipc/sysv)
23559 : XXX Do we need a useipcsysv variable here
23560 case "${d_msg}${d_sem}${d_shm}" in
23561 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23562 esac
23563 ;;
23564 NDBM_File|ndbm_fil)
23565 case "$d_ndbm" in
23566 $define)
23567 case "$osname-$use64bitint" in
23568 hpux-define)
23569 case "$libs" in
23570 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23571 esac
23572 ;;
23573 *) avail_ext="$avail_ext $xxx" ;;
23574 esac
23575 ;;
23576 esac
23577 ;;
23578 ODBM_File|odbm_fil)
23579 case "${i_dbm}${i_rpcsvcdbm}" in
23580 *"${define}"*)
23581 case "$d_cplusplus" in
23582 define) ;; # delete as a function name will not work
23583 *) case "$osname-$use64bitint" in
23584 hpux-define)
23585 case "$libs" in
23586 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23587 esac
23588 ;;
23589 *) avail_ext="$avail_ext $xxx" ;;
23590 esac
23591 ;;
23592 esac
23593 ;;
23594 esac
23595 ;;
23596 Opcode|opcode)
23597 case "$useopcode" in
23598 true|define|y) avail_ext="$avail_ext $xxx" ;;
23599 esac
23600 ;;
23601 POSIX|posix)
23602 case "$useposix" in
23603 true|define|y) avail_ext="$avail_ext $xxx" ;;
23604 esac
23605 ;;
23606 Socket|socket)
23607 case "$d_socket" in
23608 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23609 esac
23610 ;;
23611 I18N/Langinfo|langinfo)
23612 case "$uselanginfo" in
23613 true|define|y) avail_ext="$avail_ext $xxx" ;;
23614 esac
23615 ;;
23616 Sys/Syslog|sys/syslog)
23617 case $osname in
23618 amigaos) ;; # not really very useful on AmigaOS
23619 *)
23620 : XXX syslog requires socket
23621 case "$d_socket" in
23622 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23623 esac
23624 ;;
23625 esac
23626 ;;
23627 Thread|thread)
23628 case "$usethreads" in
23629 true|$define|y)
23630 case "$use5005threads" in
23631 $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23632 esac
23633 esac
23634 ;;
23635 threads|threads/shared)
23636 # threads and threads::shared are special cases.
23637 # To stop people from asking "Perl 5.8.0 was supposed
23638 # to have this new fancy threads implementation but my
23639 # perl doesn't have it" and from people trying to
23640 # (re)install the threads module using CPAN.pm and
23641 # CPAN.pm then offering to reinstall Perl 5.8.0,
23642 # the threads.pm and threads/shared.pm will always be
23643 # there, croaking informatively ("you need to rebuild
23644 # all of Perl with threads, sorry") when threads haven't
23645 # been compiled in.
23646 # --jhi
23647 avail_ext="$avail_ext $xxx"
23648 ;;
23649 VMS*)
23650 ;;
23651 Win32*)
23652 case "$osname" in
23653 cygwin) avail_ext="$avail_ext $xxx" ;;
23654 esac
23655 ;;
23656 XS/APItest|xs/apitest)
23657 # This is just for testing. Skip it unless we have dynamic loading.
23658
23659 case "$usedl" in
23660 $define) avail_ext="$avail_ext $xxx" ;;
23661 esac
23662 ;;
23663 XS/Typemap|xs/typemap)
23664 # This is just for testing. Skip it unless we have dynamic loading.
23665 case "$usedl" in
23666 $define) avail_ext="$avail_ext $xxx" ;;
23667 esac
23668 ;;
23669 *) avail_ext="$avail_ext $xxx"
23670 ;;
23671 esac
23672done
23673
23674set X $avail_ext
23675shift
23676avail_ext="$*"
23677
23678case "$onlyextensions" in
23679'') ;;
23680*) keepextensions=''
23681 echo "You have requested that only certain extensions be included..." >&4
23682 for i in $onlyextensions; do
23683 case " $avail_ext " in
23684 *" $i "*)
23685 echo "Keeping extension $i."
23686 keepextensions="$keepextensions $i"
23687 ;;
23688 *) echo "Ignoring extension $i." ;;
23689 esac
23690 done
23691 avail_ext="$keepextensions"
23692 ;;
23693esac
23694
23695case "$noextensions" in
23696'') ;;
23697*) keepextensions=''
23698 echo "You have requested that certain extensions be ignored..." >&4
23699 for i in $avail_ext; do
23700 case " $noextensions " in
23701 *" $i "*) echo "Ignoring extension $i." ;;
23702 *) echo "Keeping extension $i.";
23703 keepextensions="$keepextensions $i"
23704 ;;
23705 esac
23706 done
23707 avail_ext="$keepextensions"
23708 ;;
23709esac
23710
23711: Now see which nonxs extensions are supported on this system.
23712: For now assume all are.
23713nonxs_ext=''
23714for xxx in $nonxs_extensions ; do
23715 case "$xxx" in
23716 VMS*)
23717 ;;
23718 *) nonxs_ext="$nonxs_ext $xxx"
23719 ;;
23720 esac
23721done
23722
23723set X $nonxs_ext
23724shift
23725nonxs_ext="$*"
23726
23727case $usedl in
23728$define)
23729 $cat <<EOM
23730A number of extensions are supplied with $package. You may choose to
23731compile these extensions for dynamic loading (the default), compile
23732them into the $package executable (static loading), or not include
23733them at all. Answer "none" to include no extensions.
23734Note that DynaLoader is always built and need not be mentioned here.
23735
23736EOM
23737 case "$dynamic_ext" in
23738 '')
23739 : Exclude those listed in static_ext
23740 dflt=''
23741 for xxx in $avail_ext; do
23742 case " $static_ext " in
23743 *" $xxx "*) ;;
23744 *) dflt="$dflt $xxx" ;;
23745 esac
23746 done
23747 set X $dflt
23748 shift
23749 dflt="$*"
23750 ;;
23751 *) dflt="$dynamic_ext"
23752 # Perhaps we are reusing an old out-of-date config.sh.
23753 case "$hint" in
23754 previous)
23755 if test X"$dynamic_ext" != X"$avail_ext"; then
23756 $cat <<EOM
23757NOTICE: Your previous config.sh list may be incorrect.
23758The extensions now available to you are
23759 ${avail_ext}
23760but the default list from your previous config.sh is
23761 ${dynamic_ext}
23762
23763EOM
23764 fi
23765 ;;
23766 esac
23767 ;;
23768 esac
23769 case "$dflt" in
23770 '') dflt=none;;
23771 esac
23772 rp="What extensions do you wish to load dynamically?"
23773 . ./myread
23774 case "$ans" in
23775 none) dynamic_ext=' ' ;;
23776 *) dynamic_ext="$ans" ;;
23777 esac
23778
23779 case "$static_ext" in
23780 '')
23781 : Exclude those already listed in dynamic linking
23782 dflt=''
23783 for xxx in $avail_ext; do
23784 case " $dynamic_ext " in
23785 *" $xxx "*) ;;
23786 *) dflt="$dflt $xxx" ;;
23787 esac
23788 done
23789 set X $dflt
23790 shift
23791 dflt="$*"
23792 ;;
23793 *) dflt="$static_ext"
23794 ;;
23795 esac
23796
23797 case "$dflt" in
23798 '') dflt=none;;
23799 esac
23800 rp="What extensions do you wish to load statically?"
23801 . ./myread
23802 case "$ans" in
23803 none) static_ext=' ' ;;
23804 *) static_ext="$ans" ;;
23805 esac
23806 ;;
23807*)
23808 $cat <<EOM
23809A number of extensions are supplied with $package. Answer "none"
23810to include no extensions.
23811Note that DynaLoader is always built and need not be mentioned here.
23812
23813EOM
23814 case "$static_ext" in
23815 '') dflt="$avail_ext" ;;
23816 *) dflt="$static_ext"
23817 # Perhaps we are reusing an old out-of-date config.sh.
23818 case "$hint" in
23819 previous)
23820 if test X"$static_ext" != X"$avail_ext"; then
23821 $cat <<EOM
23822NOTICE: Your previous config.sh list may be incorrect.
23823The extensions now available to you are
23824 ${avail_ext}
23825but the default list from your previous config.sh is
23826 ${static_ext}
23827
23828EOM
23829 fi
23830 ;;
23831 esac
23832 ;;
23833 esac
23834 : Exclude those that are not xs extensions
23835 case "$dflt" in
23836 '') dflt=none;;
23837 esac
23838 rp="What extensions do you wish to include?"
23839 . ./myread
23840 case "$ans" in
23841 none) static_ext=' ' ;;
23842 *) static_ext="$ans" ;;
23843 esac
23844 ;;
23845esac
23846#
23847# Encode is a special case. If we are building Encode as a static
23848# extension, we need to explicitly list its subextensions as well.
23849# For other nested extensions, this is handled automatically by
23850# the appropriate Makefile.PL.
23851case " $static_ext " in
23852 *" Encode "*) # Add the subextensions of Encode
23853 cd "$rsrc/cpan"
23854 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23855 static_ext="$static_ext Encode/$xxx"
23856 known_extensions="$known_extensions Encode/$xxx"
23857 done
23858 cd "$tdir"
23859 ;;
23860esac
23861
23862set X $dynamic_ext $static_ext $nonxs_ext
23863shift
23864extensions="$*"
23865
23866# Sanity check: We require an extension suitable for use with
23867# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
23868# should show up as failures in the test suite, but it's helpful to
23869# catch them now.) The 'extensions' list is normally sorted
23870# alphabetically, so we need to accept either
23871# DB_File ... Fcntl ... IO ....
23872# or something like
23873# Fcntl ... NDBM_File ... IO ....
23874case " $extensions" in
23875*"_File "*" Fcntl "*" IO "*) ;; # DB_File
23876*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23877*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23878*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23879 echo "WARNING: The Perl you are building will be quite crippled." >& 4
23880 ;;
23881esac
23882
23883: Remove libraries needed only for extensions
23884: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23885: The exception is SunOS 4.x, which needs them.
23886case "${osname}X${osvers}" in
23887sunos*X4*)
23888 perllibs="$libs"
23889 ;;
23890*) case "$usedl" in
23891 $define|true|[yY]*)
23892 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23893 shift
23894 perllibs="$*"
23895 ;;
23896 *) perllibs="$libs"
23897 ;;
23898 esac
23899 ;;
23900esac
23901
23902: Remove build directory name from cppstdin so it can be used from
23903: either the present location or the final installed location.
23904echo " "
23905: Get out of the UU directory to get correct path name.
23906cd ..
23907case "$cppstdin" in
23908`pwd`/cppstdin)
23909 echo "Stripping down cppstdin path name"
23910 cppstdin=cppstdin
23911 ;;
23912esac
23913cd UU
23914
23915: end of configuration questions
23916echo " "
23917echo "End of configuration questions."
23918echo " "
23919
23920: back to where it started
23921if test -d ../UU; then
23922 cd ..
23923fi
23924
23925: configuration may be unconditionally patched via a 'config.arch' file
23926if $test -f config.arch; then
23927 echo "I see a config.arch file, loading it." >&4
23928 . ./config.arch
23929fi
23930
23931: configuration may be patched via a 'config.over' file
23932if $test -f config.over; then
23933 echo " "
23934 dflt=y
23935 rp='I see a config.over file. Do you wish to load it?'
23936 . UU/myread
23937 case "$ans" in
23938 n*) echo "OK, I'll ignore it.";;
23939 *) . ./config.over
23940 echo "Configuration override changes have been loaded."
23941 ;;
23942 esac
23943fi
23944
23945: in case they want portability, strip down executable paths
23946case "$d_portable" in
23947"$define")
23948 echo " "
23949 echo "Stripping down executable paths..." >&4
23950 for file in $loclist $trylist; do
23951 eval temp=\$$file
23952 eval $file=`basename $temp`
23953 done
23954 ;;
23955esac
23956
23957: create config.sh file
23958echo " "
23959echo "Creating config.sh..." >&4
23960$spitshell <<EOT >config.sh
23961$startsh
23962#
23963# This file was produced by running the Configure script. It holds all the
23964# definitions figured out by Configure. Should you modify one of these values,
23965# do not forget to propagate your changes by running "Configure -der". You may
23966# instead choose to run each of the .SH files by yourself, or "Configure -S".
23967#
23968
23969# Package name : $package
23970# Source directory : $src
23971# Configuration time: $cf_time
23972# Configured by : $cf_by
23973# Target system : $myuname
23974
23975EOT
23976: Add in command line options if available
23977$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23978
23979$spitshell <<EOT >>config.sh
23980
23981Author='$Author'
23982Date='$Date'
23983Header='$Header'
23984Id='$Id'
23985Locker='$Locker'
23986Log='$Log'
23987RCSfile='$RCSfile'
23988Revision='$Revision'
23989Source='$Source'
23990State='$State'
23991_a='$_a'
23992_exe='$_exe'
23993_o='$_o'
23994afs='$afs'
23995afsroot='$afsroot'
23996alignbytes='$alignbytes'
23997aphostname='$aphostname'
23998api_revision='$api_revision'
23999api_subversion='$api_subversion'
24000api_version='$api_version'
24001api_versionstring='$api_versionstring'
24002ar='$ar'
24003archlib='$archlib'
24004archlibexp='$archlibexp'
24005archname64='$archname64'
24006archname='$archname'
24007archobjs='$archobjs'
24008asctime_r_proto='$asctime_r_proto'
24009awk='$awk'
24010baserev='$baserev'
24011bash='$bash'
24012bin='$bin'
24013bin_ELF='$bin_ELF'
24014binexp='$binexp'
24015bison='$bison'
24016byacc='$byacc'
24017byteorder='$byteorder'
24018c='$c'
24019castflags='$castflags'
24020cat='$cat'
24021cc='$cc'
24022cccdlflags='$cccdlflags'
24023ccdlflags='$ccdlflags'
24024ccflags='$ccflags'
24025ccflags_uselargefiles='$ccflags_uselargefiles'
24026ccname='$ccname'
24027ccsymbols='$ccsymbols'
24028ccversion='$ccversion'
24029cf_by='$cf_by'
24030cf_email='$cf_email'
24031cf_time='$cf_time'
24032charbits='$charbits'
24033charsize='$charsize'
24034chgrp='$chgrp'
24035chmod='$chmod'
24036chown='$chown'
24037clocktype='$clocktype'
24038comm='$comm'
24039compress='$compress'
24040contains='$contains'
24041cp='$cp'
24042cpio='$cpio'
24043cpp='$cpp'
24044cpp_stuff='$cpp_stuff'
24045cppccsymbols='$cppccsymbols'
24046cppflags='$cppflags'
24047cpplast='$cpplast'
24048cppminus='$cppminus'
24049cpprun='$cpprun'
24050cppstdin='$cppstdin'
24051cppsymbols='$cppsymbols'
24052crypt_r_proto='$crypt_r_proto'
24053cryptlib='$cryptlib'
24054csh='$csh'
24055ctermid_r_proto='$ctermid_r_proto'
24056ctime_r_proto='$ctime_r_proto'
24057d_Gconvert='$d_Gconvert'
24058d_PRIEUldbl='$d_PRIEUldbl'
24059d_PRIFUldbl='$d_PRIFUldbl'
24060d_PRIGUldbl='$d_PRIGUldbl'
24061d_PRIXU64='$d_PRIXU64'
24062d_PRId64='$d_PRId64'
24063d_PRIeldbl='$d_PRIeldbl'
24064d_PRIfldbl='$d_PRIfldbl'
24065d_PRIgldbl='$d_PRIgldbl'
24066d_PRIi64='$d_PRIi64'
24067d_PRIo64='$d_PRIo64'
24068d_PRIu64='$d_PRIu64'
24069d_PRIx64='$d_PRIx64'
24070d_SCNfldbl='$d_SCNfldbl'
24071d__fwalk='$d__fwalk'
24072d_accept4='$d_accept4'
24073d_access='$d_access'
24074d_accessx='$d_accessx'
24075d_acosh='$d_acosh'
24076d_aintl='$d_aintl'
24077d_alarm='$d_alarm'
24078d_archlib='$d_archlib'
24079d_asctime64='$d_asctime64'
24080d_asctime_r='$d_asctime_r'
24081d_asinh='$d_asinh'
24082d_atanh='$d_atanh'
24083d_atolf='$d_atolf'
24084d_atoll='$d_atoll'
24085d_attribute_always_inline='$d_attribute_always_inline'
24086d_attribute_deprecated='$d_attribute_deprecated'
24087d_attribute_format='$d_attribute_format'
24088d_attribute_malloc='$d_attribute_malloc'
24089d_attribute_nonnull='$d_attribute_nonnull'
24090d_attribute_noreturn='$d_attribute_noreturn'
24091d_attribute_pure='$d_attribute_pure'
24092d_attribute_unused='$d_attribute_unused'
24093d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24094d_backtrace='$d_backtrace'
24095d_bsd='$d_bsd'
24096d_bsdgetpgrp='$d_bsdgetpgrp'
24097d_bsdsetpgrp='$d_bsdsetpgrp'
24098d_builtin_add_overflow='$d_builtin_add_overflow'
24099d_builtin_choose_expr='$d_builtin_choose_expr'
24100d_builtin_expect='$d_builtin_expect'
24101d_builtin_mul_overflow='$d_builtin_mul_overflow'
24102d_builtin_sub_overflow='$d_builtin_sub_overflow'
24103d_c99_variadic_macros='$d_c99_variadic_macros'
24104d_casti32='$d_casti32'
24105d_castneg='$d_castneg'
24106d_cbrt='$d_cbrt'
24107d_chown='$d_chown'
24108d_chroot='$d_chroot'
24109d_chsize='$d_chsize'
24110d_class='$d_class'
24111d_clearenv='$d_clearenv'
24112d_closedir='$d_closedir'
24113d_cmsghdr_s='$d_cmsghdr_s'
24114d_copysign='$d_copysign'
24115d_copysignl='$d_copysignl'
24116d_cplusplus='$d_cplusplus'
24117d_crypt='$d_crypt'
24118d_crypt_r='$d_crypt_r'
24119d_csh='$d_csh'
24120d_ctermid='$d_ctermid'
24121d_ctermid_r='$d_ctermid_r'
24122d_ctime64='$d_ctime64'
24123d_ctime_r='$d_ctime_r'
24124d_cuserid='$d_cuserid'
24125d_dbminitproto='$d_dbminitproto'
24126d_difftime64='$d_difftime64'
24127d_difftime='$d_difftime'
24128d_dir_dd_fd='$d_dir_dd_fd'
24129d_dirfd='$d_dirfd'
24130d_dirnamlen='$d_dirnamlen'
24131d_dladdr='$d_dladdr'
24132d_dlerror='$d_dlerror'
24133d_dlopen='$d_dlopen'
24134d_dlsymun='$d_dlsymun'
24135d_dosuid='$d_dosuid'
24136d_double_has_inf='$d_double_has_inf'
24137d_double_has_nan='$d_double_has_nan'
24138d_double_has_negative_zero='$d_double_has_negative_zero'
24139d_double_has_subnormals='$d_double_has_subnormals'
24140d_double_style_cray='$d_double_style_cray'
24141d_double_style_ibm='$d_double_style_ibm'
24142d_double_style_ieee='$d_double_style_ieee'
24143d_double_style_vax='$d_double_style_vax'
24144d_drand48_r='$d_drand48_r'
24145d_drand48proto='$d_drand48proto'
24146d_dup2='$d_dup2'
24147d_dup3='$d_dup3'
24148d_duplocale='$d_duplocale'
24149d_eaccess='$d_eaccess'
24150d_endgrent='$d_endgrent'
24151d_endgrent_r='$d_endgrent_r'
24152d_endhent='$d_endhent'
24153d_endhostent_r='$d_endhostent_r'
24154d_endnent='$d_endnent'
24155d_endnetent_r='$d_endnetent_r'
24156d_endpent='$d_endpent'
24157d_endprotoent_r='$d_endprotoent_r'
24158d_endpwent='$d_endpwent'
24159d_endpwent_r='$d_endpwent_r'
24160d_endsent='$d_endsent'
24161d_endservent_r='$d_endservent_r'
24162d_eofnblk='$d_eofnblk'
24163d_erf='$d_erf'
24164d_erfc='$d_erfc'
24165d_eunice='$d_eunice'
24166d_exp2='$d_exp2'
24167d_expm1='$d_expm1'
24168d_faststdio='$d_faststdio'
24169d_fchdir='$d_fchdir'
24170d_fchmod='$d_fchmod'
24171d_fchmodat='$d_fchmodat'
24172d_fchown='$d_fchown'
24173d_fcntl='$d_fcntl'
24174d_fcntl_can_lock='$d_fcntl_can_lock'
24175d_fd_macros='$d_fd_macros'
24176d_fd_set='$d_fd_set'
24177d_fdclose='$d_fdclose'
24178d_fdim='$d_fdim'
24179d_fds_bits='$d_fds_bits'
24180d_fegetround='$d_fegetround'
24181d_fgetpos='$d_fgetpos'
24182d_finite='$d_finite'
24183d_finitel='$d_finitel'
24184d_flexfnam='$d_flexfnam'
24185d_flock='$d_flock'
24186d_flockproto='$d_flockproto'
24187d_fma='$d_fma'
24188d_fmax='$d_fmax'
24189d_fmin='$d_fmin'
24190d_fork='$d_fork'
24191d_fp_class='$d_fp_class'
24192d_fp_classify='$d_fp_classify'
24193d_fp_classl='$d_fp_classl'
24194d_fpathconf='$d_fpathconf'
24195d_fpclass='$d_fpclass'
24196d_fpclassify='$d_fpclassify'
24197d_fpclassl='$d_fpclassl'
24198d_fpgetround='$d_fpgetround'
24199d_fpos64_t='$d_fpos64_t'
24200d_freelocale='$d_freelocale'
24201d_frexpl='$d_frexpl'
24202d_fs_data_s='$d_fs_data_s'
24203d_fseeko='$d_fseeko'
24204d_fsetpos='$d_fsetpos'
24205d_fstatfs='$d_fstatfs'
24206d_fstatvfs='$d_fstatvfs'
24207d_fsync='$d_fsync'
24208d_ftello='$d_ftello'
24209d_ftime='$d_ftime'
24210d_futimes='$d_futimes'
24211d_gai_strerror='$d_gai_strerror'
24212d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24213d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24214d_getaddrinfo='$d_getaddrinfo'
24215d_getcwd='$d_getcwd'
24216d_getespwnam='$d_getespwnam'
24217d_getfsstat='$d_getfsstat'
24218d_getgrent='$d_getgrent'
24219d_getgrent_r='$d_getgrent_r'
24220d_getgrgid_r='$d_getgrgid_r'
24221d_getgrnam_r='$d_getgrnam_r'
24222d_getgrps='$d_getgrps'
24223d_gethbyaddr='$d_gethbyaddr'
24224d_gethbyname='$d_gethbyname'
24225d_gethent='$d_gethent'
24226d_gethname='$d_gethname'
24227d_gethostbyaddr_r='$d_gethostbyaddr_r'
24228d_gethostbyname_r='$d_gethostbyname_r'
24229d_gethostent_r='$d_gethostent_r'
24230d_gethostprotos='$d_gethostprotos'
24231d_getitimer='$d_getitimer'
24232d_getlogin='$d_getlogin'
24233d_getlogin_r='$d_getlogin_r'
24234d_getmnt='$d_getmnt'
24235d_getmntent='$d_getmntent'
24236d_getnameinfo='$d_getnameinfo'
24237d_getnbyaddr='$d_getnbyaddr'
24238d_getnbyname='$d_getnbyname'
24239d_getnent='$d_getnent'
24240d_getnetbyaddr_r='$d_getnetbyaddr_r'
24241d_getnetbyname_r='$d_getnetbyname_r'
24242d_getnetent_r='$d_getnetent_r'
24243d_getnetprotos='$d_getnetprotos'
24244d_getpagsz='$d_getpagsz'
24245d_getpbyname='$d_getpbyname'
24246d_getpbynumber='$d_getpbynumber'
24247d_getpent='$d_getpent'
24248d_getpgid='$d_getpgid'
24249d_getpgrp2='$d_getpgrp2'
24250d_getpgrp='$d_getpgrp'
24251d_getppid='$d_getppid'
24252d_getprior='$d_getprior'
24253d_getprotobyname_r='$d_getprotobyname_r'
24254d_getprotobynumber_r='$d_getprotobynumber_r'
24255d_getprotoent_r='$d_getprotoent_r'
24256d_getprotoprotos='$d_getprotoprotos'
24257d_getprpwnam='$d_getprpwnam'
24258d_getpwent='$d_getpwent'
24259d_getpwent_r='$d_getpwent_r'
24260d_getpwnam_r='$d_getpwnam_r'
24261d_getpwuid_r='$d_getpwuid_r'
24262d_getsbyname='$d_getsbyname'
24263d_getsbyport='$d_getsbyport'
24264d_getsent='$d_getsent'
24265d_getservbyname_r='$d_getservbyname_r'
24266d_getservbyport_r='$d_getservbyport_r'
24267d_getservent_r='$d_getservent_r'
24268d_getservprotos='$d_getservprotos'
24269d_getspnam='$d_getspnam'
24270d_getspnam_r='$d_getspnam_r'
24271d_gettimeod='$d_gettimeod'
24272d_gmtime64='$d_gmtime64'
24273d_gmtime_r='$d_gmtime_r'
24274d_gnulibc='$d_gnulibc'
24275d_grpasswd='$d_grpasswd'
24276d_has_C_UTF8='$d_has_C_UTF8'
24277d_hasmntopt='$d_hasmntopt'
24278d_htonl='$d_htonl'
24279d_hypot='$d_hypot'
24280d_ilogb='$d_ilogb'
24281d_ilogbl='$d_ilogbl'
24282d_inc_version_list='$d_inc_version_list'
24283d_inetaton='$d_inetaton'
24284d_inetntop='$d_inetntop'
24285d_inetpton='$d_inetpton'
24286d_int64_t='$d_int64_t'
24287d_ip_mreq='$d_ip_mreq'
24288d_ip_mreq_source='$d_ip_mreq_source'
24289d_ipv6_mreq='$d_ipv6_mreq'
24290d_ipv6_mreq_source='$d_ipv6_mreq_source'
24291d_isascii='$d_isascii'
24292d_isblank='$d_isblank'
24293d_isfinite='$d_isfinite'
24294d_isfinitel='$d_isfinitel'
24295d_isinf='$d_isinf'
24296d_isinfl='$d_isinfl'
24297d_isless='$d_isless'
24298d_isnan='$d_isnan'
24299d_isnanl='$d_isnanl'
24300d_isnormal='$d_isnormal'
24301d_j0='$d_j0'
24302d_j0l='$d_j0l'
24303d_killpg='$d_killpg'
24304d_lc_monetary_2008='$d_lc_monetary_2008'
24305d_lchown='$d_lchown'
24306d_ldbl_dig='$d_ldbl_dig'
24307d_ldexpl='$d_ldexpl'
24308d_lgamma='$d_lgamma'
24309d_lgamma_r='$d_lgamma_r'
24310d_libm_lib_version='$d_libm_lib_version'
24311d_libname_unique='$d_libname_unique'
24312d_link='$d_link'
24313d_linkat='$d_linkat'
24314d_llrint='$d_llrint'
24315d_llrintl='$d_llrintl'
24316d_llround='$d_llround'
24317d_llroundl='$d_llroundl'
24318d_localeconv_l='$d_localeconv_l'
24319d_localtime64='$d_localtime64'
24320d_localtime_r='$d_localtime_r'
24321d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24322d_locconv='$d_locconv'
24323d_lockf='$d_lockf'
24324d_log1p='$d_log1p'
24325d_log2='$d_log2'
24326d_logb='$d_logb'
24327d_long_double_style_ieee='$d_long_double_style_ieee'
24328d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24329d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24330d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24331d_long_double_style_vax='$d_long_double_style_vax'
24332d_longdbl='$d_longdbl'
24333d_longlong='$d_longlong'
24334d_lrint='$d_lrint'
24335d_lrintl='$d_lrintl'
24336d_lround='$d_lround'
24337d_lroundl='$d_lroundl'
24338d_lseekproto='$d_lseekproto'
24339d_lstat='$d_lstat'
24340d_madvise='$d_madvise'
24341d_malloc_good_size='$d_malloc_good_size'
24342d_malloc_size='$d_malloc_size'
24343d_malloc_usable_size='$d_malloc_usable_size'
24344d_mblen='$d_mblen'
24345d_mbrlen='$d_mbrlen'
24346d_mbrtowc='$d_mbrtowc'
24347d_mbstowcs='$d_mbstowcs'
24348d_mbtowc='$d_mbtowc'
24349d_memmem='$d_memmem'
24350d_memrchr='$d_memrchr'
24351d_mkdir='$d_mkdir'
24352d_mkdtemp='$d_mkdtemp'
24353d_mkfifo='$d_mkfifo'
24354d_mkostemp='$d_mkostemp'
24355d_mkstemp='$d_mkstemp'
24356d_mkstemps='$d_mkstemps'
24357d_mktime64='$d_mktime64'
24358d_mktime='$d_mktime'
24359d_mmap='$d_mmap'
24360d_modfl='$d_modfl'
24361d_modflproto='$d_modflproto'
24362d_mprotect='$d_mprotect'
24363d_msg='$d_msg'
24364d_msg_ctrunc='$d_msg_ctrunc'
24365d_msg_dontroute='$d_msg_dontroute'
24366d_msg_oob='$d_msg_oob'
24367d_msg_peek='$d_msg_peek'
24368d_msg_proxy='$d_msg_proxy'
24369d_msgctl='$d_msgctl'
24370d_msgget='$d_msgget'
24371d_msghdr_s='$d_msghdr_s'
24372d_msgrcv='$d_msgrcv'
24373d_msgsnd='$d_msgsnd'
24374d_msync='$d_msync'
24375d_munmap='$d_munmap'
24376d_mymalloc='$d_mymalloc'
24377d_nan='$d_nan'
24378d_nanosleep='$d_nanosleep'
24379d_ndbm='$d_ndbm'
24380d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24381d_nearbyint='$d_nearbyint'
24382d_newlocale='$d_newlocale'
24383d_nextafter='$d_nextafter'
24384d_nexttoward='$d_nexttoward'
24385d_nice='$d_nice'
24386d_nl_langinfo='$d_nl_langinfo'
24387d_nv_preserves_uv='$d_nv_preserves_uv'
24388d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24389d_off64_t='$d_off64_t'
24390d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24391d_oldpthreads='$d_oldpthreads'
24392d_oldsock='$d_oldsock'
24393d_open3='$d_open3'
24394d_openat='$d_openat'
24395d_pathconf='$d_pathconf'
24396d_pause='$d_pause'
24397d_perl_otherlibdirs='$d_perl_otherlibdirs'
24398d_phostname='$d_phostname'
24399d_pipe2='$d_pipe2'
24400d_pipe='$d_pipe'
24401d_poll='$d_poll'
24402d_portable='$d_portable'
24403d_prctl='$d_prctl'
24404d_prctl_set_name='$d_prctl_set_name'
24405d_printf_format_null='$d_printf_format_null'
24406d_procselfexe='$d_procselfexe'
24407d_pseudofork='$d_pseudofork'
24408d_pthread_atfork='$d_pthread_atfork'
24409d_pthread_attr_setscope='$d_pthread_attr_setscope'
24410d_pthread_yield='$d_pthread_yield'
24411d_ptrdiff_t='$d_ptrdiff_t'
24412d_pwage='$d_pwage'
24413d_pwchange='$d_pwchange'
24414d_pwclass='$d_pwclass'
24415d_pwcomment='$d_pwcomment'
24416d_pwexpire='$d_pwexpire'
24417d_pwgecos='$d_pwgecos'
24418d_pwpasswd='$d_pwpasswd'
24419d_pwquota='$d_pwquota'
24420d_qgcvt='$d_qgcvt'
24421d_quad='$d_quad'
24422d_querylocale='$d_querylocale'
24423d_random_r='$d_random_r'
24424d_re_comp='$d_re_comp'
24425d_readdir64_r='$d_readdir64_r'
24426d_readdir='$d_readdir'
24427d_readdir_r='$d_readdir_r'
24428d_readlink='$d_readlink'
24429d_readv='$d_readv'
24430d_recvmsg='$d_recvmsg'
24431d_regcmp='$d_regcmp'
24432d_regcomp='$d_regcomp'
24433d_remainder='$d_remainder'
24434d_remquo='$d_remquo'
24435d_rename='$d_rename'
24436d_renameat='$d_renameat'
24437d_rewinddir='$d_rewinddir'
24438d_rint='$d_rint'
24439d_rmdir='$d_rmdir'
24440d_round='$d_round'
24441d_sbrkproto='$d_sbrkproto'
24442d_scalbn='$d_scalbn'
24443d_scalbnl='$d_scalbnl'
24444d_sched_yield='$d_sched_yield'
24445d_scm_rights='$d_scm_rights'
24446d_seekdir='$d_seekdir'
24447d_select='$d_select'
24448d_sem='$d_sem'
24449d_semctl='$d_semctl'
24450d_semctl_semid_ds='$d_semctl_semid_ds'
24451d_semctl_semun='$d_semctl_semun'
24452d_semget='$d_semget'
24453d_semop='$d_semop'
24454d_sendmsg='$d_sendmsg'
24455d_setegid='$d_setegid'
24456d_seteuid='$d_seteuid'
24457d_setgrent='$d_setgrent'
24458d_setgrent_r='$d_setgrent_r'
24459d_setgrps='$d_setgrps'
24460d_sethent='$d_sethent'
24461d_sethostent_r='$d_sethostent_r'
24462d_setitimer='$d_setitimer'
24463d_setlinebuf='$d_setlinebuf'
24464d_setlocale='$d_setlocale'
24465d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
24466d_setlocale_r='$d_setlocale_r'
24467d_setnent='$d_setnent'
24468d_setnetent_r='$d_setnetent_r'
24469d_setpent='$d_setpent'
24470d_setpgid='$d_setpgid'
24471d_setpgrp2='$d_setpgrp2'
24472d_setpgrp='$d_setpgrp'
24473d_setprior='$d_setprior'
24474d_setproctitle='$d_setproctitle'
24475d_setprotoent_r='$d_setprotoent_r'
24476d_setpwent='$d_setpwent'
24477d_setpwent_r='$d_setpwent_r'
24478d_setregid='$d_setregid'
24479d_setresgid='$d_setresgid'
24480d_setresuid='$d_setresuid'
24481d_setreuid='$d_setreuid'
24482d_setrgid='$d_setrgid'
24483d_setruid='$d_setruid'
24484d_setsent='$d_setsent'
24485d_setservent_r='$d_setservent_r'
24486d_setsid='$d_setsid'
24487d_setvbuf='$d_setvbuf'
24488d_shm='$d_shm'
24489d_shmat='$d_shmat'
24490d_shmatprototype='$d_shmatprototype'
24491d_shmctl='$d_shmctl'
24492d_shmdt='$d_shmdt'
24493d_shmget='$d_shmget'
24494d_sigaction='$d_sigaction'
24495d_siginfo_si_addr='$d_siginfo_si_addr'
24496d_siginfo_si_band='$d_siginfo_si_band'
24497d_siginfo_si_errno='$d_siginfo_si_errno'
24498d_siginfo_si_fd='$d_siginfo_si_fd'
24499d_siginfo_si_pid='$d_siginfo_si_pid'
24500d_siginfo_si_status='$d_siginfo_si_status'
24501d_siginfo_si_uid='$d_siginfo_si_uid'
24502d_siginfo_si_value='$d_siginfo_si_value'
24503d_signbit='$d_signbit'
24504d_sigprocmask='$d_sigprocmask'
24505d_sigsetjmp='$d_sigsetjmp'
24506d_sin6_scope_id='$d_sin6_scope_id'
24507d_sitearch='$d_sitearch'
24508d_snprintf='$d_snprintf'
24509d_sockaddr_in6='$d_sockaddr_in6'
24510d_sockaddr_sa_len='$d_sockaddr_sa_len'
24511d_sockatmark='$d_sockatmark'
24512d_sockatmarkproto='$d_sockatmarkproto'
24513d_socket='$d_socket'
24514d_socklen_t='$d_socklen_t'
24515d_sockpair='$d_sockpair'
24516d_socks5_init='$d_socks5_init'
24517d_sqrtl='$d_sqrtl'
24518d_srand48_r='$d_srand48_r'
24519d_srandom_r='$d_srandom_r'
24520d_sresgproto='$d_sresgproto'
24521d_sresuproto='$d_sresuproto'
24522d_stat='$d_stat'
24523d_statblks='$d_statblks'
24524d_statfs_f_flags='$d_statfs_f_flags'
24525d_statfs_s='$d_statfs_s'
24526d_static_inline='$d_static_inline'
24527d_statvfs='$d_statvfs'
24528d_stdio_cnt_lval='$d_stdio_cnt_lval'
24529d_stdio_ptr_lval='$d_stdio_ptr_lval'
24530d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24531d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24532d_stdio_stream_array='$d_stdio_stream_array'
24533d_stdiobase='$d_stdiobase'
24534d_stdstdio='$d_stdstdio'
24535d_strcoll='$d_strcoll'
24536d_strerror_l='$d_strerror_l'
24537d_strerror_r='$d_strerror_r'
24538d_strftime='$d_strftime'
24539d_strlcat='$d_strlcat'
24540d_strlcpy='$d_strlcpy'
24541d_strnlen='$d_strnlen'
24542d_strtod='$d_strtod'
24543d_strtod_l='$d_strtod_l'
24544d_strtol='$d_strtol'
24545d_strtold='$d_strtold'
24546d_strtold_l='$d_strtold_l'
24547d_strtoll='$d_strtoll'
24548d_strtoq='$d_strtoq'
24549d_strtoul='$d_strtoul'
24550d_strtoull='$d_strtoull'
24551d_strtouq='$d_strtouq'
24552d_strxfrm='$d_strxfrm'
24553d_suidsafe='$d_suidsafe'
24554d_symlink='$d_symlink'
24555d_syscall='$d_syscall'
24556d_syscallproto='$d_syscallproto'
24557d_sysconf='$d_sysconf'
24558d_sysernlst='$d_sysernlst'
24559d_syserrlst='$d_syserrlst'
24560d_system='$d_system'
24561d_tcgetpgrp='$d_tcgetpgrp'
24562d_tcsetpgrp='$d_tcsetpgrp'
24563d_telldir='$d_telldir'
24564d_telldirproto='$d_telldirproto'
24565d_tgamma='$d_tgamma'
24566d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24567d_time='$d_time'
24568d_timegm='$d_timegm'
24569d_times='$d_times'
24570d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24571d_tm_tm_zone='$d_tm_tm_zone'
24572d_tmpnam_r='$d_tmpnam_r'
24573d_towlower='$d_towlower'
24574d_towupper='$d_towupper'
24575d_trunc='$d_trunc'
24576d_truncate='$d_truncate'
24577d_truncl='$d_truncl'
24578d_ttyname_r='$d_ttyname_r'
24579d_tzname='$d_tzname'
24580d_u32align='$d_u32align'
24581d_ualarm='$d_ualarm'
24582d_umask='$d_umask'
24583d_uname='$d_uname'
24584d_union_semun='$d_union_semun'
24585d_unlinkat='$d_unlinkat'
24586d_unordered='$d_unordered'
24587d_unsetenv='$d_unsetenv'
24588d_uselocale='$d_uselocale'
24589d_usleep='$d_usleep'
24590d_usleepproto='$d_usleepproto'
24591d_ustat='$d_ustat'
24592d_vendorarch='$d_vendorarch'
24593d_vendorbin='$d_vendorbin'
24594d_vendorlib='$d_vendorlib'
24595d_vendorscript='$d_vendorscript'
24596d_vfork='$d_vfork'
24597d_void_closedir='$d_void_closedir'
24598d_voidsig='$d_voidsig'
24599d_voidtty='$d_voidtty'
24600d_vsnprintf='$d_vsnprintf'
24601d_wait4='$d_wait4'
24602d_waitpid='$d_waitpid'
24603d_wcrtomb='$d_wcrtomb'
24604d_wcscmp='$d_wcscmp'
24605d_wcstombs='$d_wcstombs'
24606d_wcsxfrm='$d_wcsxfrm'
24607d_wctomb='$d_wctomb'
24608d_writev='$d_writev'
24609d_xenix='$d_xenix'
24610date='$date'
24611db_hashtype='$db_hashtype'
24612db_prefixtype='$db_prefixtype'
24613db_version_major='$db_version_major'
24614db_version_minor='$db_version_minor'
24615db_version_patch='$db_version_patch'
24616default_inc_excludes_dot='$default_inc_excludes_dot'
24617direntrytype='$direntrytype'
24618dlext='$dlext'
24619dlsrc='$dlsrc'
24620doubleinfbytes='$doubleinfbytes'
24621doublekind='$doublekind'
24622doublemantbits='$doublemantbits'
24623doublenanbytes='$doublenanbytes'
24624doublesize='$doublesize'
24625drand01='$drand01'
24626drand48_r_proto='$drand48_r_proto'
24627dtrace='$dtrace'
24628dtraceobject='$dtraceobject'
24629dtracexnolibs='$dtracexnolibs'
24630dynamic_ext='$dynamic_ext'
24631eagain='$eagain'
24632ebcdic='$ebcdic'
24633echo='$echo'
24634egrep='$egrep'
24635emacs='$emacs'
24636endgrent_r_proto='$endgrent_r_proto'
24637endhostent_r_proto='$endhostent_r_proto'
24638endnetent_r_proto='$endnetent_r_proto'
24639endprotoent_r_proto='$endprotoent_r_proto'
24640endpwent_r_proto='$endpwent_r_proto'
24641endservent_r_proto='$endservent_r_proto'
24642eunicefix='$eunicefix'
24643exe_ext='$exe_ext'
24644expr='$expr'
24645extensions='$extensions'
24646extern_C='$extern_C'
24647extras='$extras'
24648fflushNULL='$fflushNULL'
24649fflushall='$fflushall'
24650find='$find'
24651firstmakefile='$firstmakefile'
24652flex='$flex'
24653fpossize='$fpossize'
24654fpostype='$fpostype'
24655freetype='$freetype'
24656from='$from'
24657full_ar='$full_ar'
24658full_csh='$full_csh'
24659full_sed='$full_sed'
24660gccansipedantic='$gccansipedantic'
24661gccosandvers='$gccosandvers'
24662gccversion='$gccversion'
24663getgrent_r_proto='$getgrent_r_proto'
24664getgrgid_r_proto='$getgrgid_r_proto'
24665getgrnam_r_proto='$getgrnam_r_proto'
24666gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24667gethostbyname_r_proto='$gethostbyname_r_proto'
24668gethostent_r_proto='$gethostent_r_proto'
24669getlogin_r_proto='$getlogin_r_proto'
24670getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24671getnetbyname_r_proto='$getnetbyname_r_proto'
24672getnetent_r_proto='$getnetent_r_proto'
24673getprotobyname_r_proto='$getprotobyname_r_proto'
24674getprotobynumber_r_proto='$getprotobynumber_r_proto'
24675getprotoent_r_proto='$getprotoent_r_proto'
24676getpwent_r_proto='$getpwent_r_proto'
24677getpwnam_r_proto='$getpwnam_r_proto'
24678getpwuid_r_proto='$getpwuid_r_proto'
24679getservbyname_r_proto='$getservbyname_r_proto'
24680getservbyport_r_proto='$getservbyport_r_proto'
24681getservent_r_proto='$getservent_r_proto'
24682getspnam_r_proto='$getspnam_r_proto'
24683gidformat='$gidformat'
24684gidsign='$gidsign'
24685gidsize='$gidsize'
24686gidtype='$gidtype'
24687glibpth='$glibpth'
24688gmake='$gmake'
24689gmtime_r_proto='$gmtime_r_proto'
24690gnulibc_version='$gnulibc_version'
24691grep='$grep'
24692groupcat='$groupcat'
24693groupstype='$groupstype'
24694gzip='$gzip'
24695h_fcntl='$h_fcntl'
24696h_sysfile='$h_sysfile'
24697hint='$hint'
24698hostcat='$hostcat'
24699hostgenerate='$hostgenerate'
24700hostosname='$hostosname'
24701hostperl='$hostperl'
24702html1dir='$html1dir'
24703html1direxp='$html1direxp'
24704html3dir='$html3dir'
24705html3direxp='$html3direxp'
24706i16size='$i16size'
24707i16type='$i16type'
24708i32size='$i32size'
24709i32type='$i32type'
24710i64size='$i64size'
24711i64type='$i64type'
24712i8size='$i8size'
24713i8type='$i8type'
24714i_arpainet='$i_arpainet'
24715i_bfd='$i_bfd'
24716i_bsdioctl='$i_bsdioctl'
24717i_crypt='$i_crypt'
24718i_db='$i_db'
24719i_dbm='$i_dbm'
24720i_dirent='$i_dirent'
24721i_dlfcn='$i_dlfcn'
24722i_execinfo='$i_execinfo'
24723i_fcntl='$i_fcntl'
24724i_fenv='$i_fenv'
24725i_fp='$i_fp'
24726i_fp_class='$i_fp_class'
24727i_gdbm='$i_gdbm'
24728i_gdbm_ndbm='$i_gdbm_ndbm'
24729i_gdbmndbm='$i_gdbmndbm'
24730i_grp='$i_grp'
24731i_ieeefp='$i_ieeefp'
24732i_inttypes='$i_inttypes'
24733i_langinfo='$i_langinfo'
24734i_libutil='$i_libutil'
24735i_locale='$i_locale'
24736i_machcthr='$i_machcthr'
24737i_malloc='$i_malloc'
24738i_mallocmalloc='$i_mallocmalloc'
24739i_mntent='$i_mntent'
24740i_ndbm='$i_ndbm'
24741i_netdb='$i_netdb'
24742i_neterrno='$i_neterrno'
24743i_netinettcp='$i_netinettcp'
24744i_niin='$i_niin'
24745i_poll='$i_poll'
24746i_prot='$i_prot'
24747i_pthread='$i_pthread'
24748i_pwd='$i_pwd'
24749i_quadmath='$i_quadmath'
24750i_rpcsvcdbm='$i_rpcsvcdbm'
24751i_sgtty='$i_sgtty'
24752i_shadow='$i_shadow'
24753i_socks='$i_socks'
24754i_stdbool='$i_stdbool'
24755i_stdint='$i_stdint'
24756i_stdlib='$i_stdlib'
24757i_sunmath='$i_sunmath'
24758i_sysaccess='$i_sysaccess'
24759i_sysdir='$i_sysdir'
24760i_sysfile='$i_sysfile'
24761i_sysfilio='$i_sysfilio'
24762i_sysin='$i_sysin'
24763i_sysioctl='$i_sysioctl'
24764i_syslog='$i_syslog'
24765i_sysmman='$i_sysmman'
24766i_sysmode='$i_sysmode'
24767i_sysmount='$i_sysmount'
24768i_sysndir='$i_sysndir'
24769i_sysparam='$i_sysparam'
24770i_syspoll='$i_syspoll'
24771i_sysresrc='$i_sysresrc'
24772i_syssecrt='$i_syssecrt'
24773i_sysselct='$i_sysselct'
24774i_syssockio='$i_syssockio'
24775i_sysstat='$i_sysstat'
24776i_sysstatfs='$i_sysstatfs'
24777i_sysstatvfs='$i_sysstatvfs'
24778i_systime='$i_systime'
24779i_systimek='$i_systimek'
24780i_systimes='$i_systimes'
24781i_systypes='$i_systypes'
24782i_sysuio='$i_sysuio'
24783i_sysun='$i_sysun'
24784i_sysutsname='$i_sysutsname'
24785i_sysvfs='$i_sysvfs'
24786i_syswait='$i_syswait'
24787i_termio='$i_termio'
24788i_termios='$i_termios'
24789i_time='$i_time'
24790i_unistd='$i_unistd'
24791i_ustat='$i_ustat'
24792i_utime='$i_utime'
24793i_vfork='$i_vfork'
24794i_wchar='$i_wchar'
24795i_wctype='$i_wctype'
24796i_xlocale='$i_xlocale'
24797ignore_versioned_solibs='$ignore_versioned_solibs'
24798inc_version_list='$inc_version_list'
24799inc_version_list_init='$inc_version_list_init'
24800incpath='$incpath'
24801incpth='$incpth'
24802inews='$inews'
24803initialinstalllocation='$initialinstalllocation'
24804installarchlib='$installarchlib'
24805installbin='$installbin'
24806installhtml1dir='$installhtml1dir'
24807installhtml3dir='$installhtml3dir'
24808installman1dir='$installman1dir'
24809installman3dir='$installman3dir'
24810installprefix='$installprefix'
24811installprefixexp='$installprefixexp'
24812installprivlib='$installprivlib'
24813installscript='$installscript'
24814installsitearch='$installsitearch'
24815installsitebin='$installsitebin'
24816installsitehtml1dir='$installsitehtml1dir'
24817installsitehtml3dir='$installsitehtml3dir'
24818installsitelib='$installsitelib'
24819installsiteman1dir='$installsiteman1dir'
24820installsiteman3dir='$installsiteman3dir'
24821installsitescript='$installsitescript'
24822installstyle='$installstyle'
24823installusrbinperl='$installusrbinperl'
24824installvendorarch='$installvendorarch'
24825installvendorbin='$installvendorbin'
24826installvendorhtml1dir='$installvendorhtml1dir'
24827installvendorhtml3dir='$installvendorhtml3dir'
24828installvendorlib='$installvendorlib'
24829installvendorman1dir='$installvendorman1dir'
24830installvendorman3dir='$installvendorman3dir'
24831installvendorscript='$installvendorscript'
24832intsize='$intsize'
24833issymlink='$issymlink'
24834ivdformat='$ivdformat'
24835ivsize='$ivsize'
24836ivtype='$ivtype'
24837known_extensions='$known_extensions'
24838ksh='$ksh'
24839ld='$ld'
24840ld_can_script='$ld_can_script'
24841lddlflags='$lddlflags'
24842ldflags='$ldflags'
24843ldflags_uselargefiles='$ldflags_uselargefiles'
24844ldlibpthname='$ldlibpthname'
24845less='$less'
24846lib_ext='$lib_ext'
24847libc='$libc'
24848libperl='$libperl'
24849libpth='$libpth'
24850libs='$libs'
24851libsdirs='$libsdirs'
24852libsfiles='$libsfiles'
24853libsfound='$libsfound'
24854libspath='$libspath'
24855libswanted='$libswanted'
24856libswanted_uselargefiles='$libswanted_uselargefiles'
24857line='$line'
24858lint='$lint'
24859lkflags='$lkflags'
24860ln='$ln'
24861lns='$lns'
24862localtime_r_proto='$localtime_r_proto'
24863locincpth='$locincpth'
24864loclibpth='$loclibpth'
24865longdblinfbytes='$longdblinfbytes'
24866longdblkind='$longdblkind'
24867longdblmantbits='$longdblmantbits'
24868longdblnanbytes='$longdblnanbytes'
24869longdblsize='$longdblsize'
24870longlongsize='$longlongsize'
24871longsize='$longsize'
24872lp='$lp'
24873lpr='$lpr'
24874ls='$ls'
24875lseeksize='$lseeksize'
24876lseektype='$lseektype'
24877mail='$mail'
24878mailx='$mailx'
24879make='$make'
24880make_set_make='$make_set_make'
24881mallocobj='$mallocobj'
24882mallocsrc='$mallocsrc'
24883malloctype='$malloctype'
24884man1dir='$man1dir'
24885man1direxp='$man1direxp'
24886man1ext='$man1ext'
24887man3dir='$man3dir'
24888man3direxp='$man3direxp'
24889man3ext='$man3ext'
24890mips_type='$mips_type'
24891mistrustnm='$mistrustnm'
24892mkdir='$mkdir'
24893mmaptype='$mmaptype'
24894modetype='$modetype'
24895more='$more'
24896multiarch='$multiarch'
24897mv='$mv'
24898myarchname='$myarchname'
24899mydomain='$mydomain'
24900myhostname='$myhostname'
24901myuname='$myuname'
24902n='$n'
24903need_va_copy='$need_va_copy'
24904netdb_hlen_type='$netdb_hlen_type'
24905netdb_host_type='$netdb_host_type'
24906netdb_name_type='$netdb_name_type'
24907netdb_net_type='$netdb_net_type'
24908nm='$nm'
24909nm_opt='$nm_opt'
24910nm_so_opt='$nm_so_opt'
24911nonxs_ext='$nonxs_ext'
24912nroff='$nroff'
24913nvEUformat='$nvEUformat'
24914nvFUformat='$nvFUformat'
24915nvGUformat='$nvGUformat'
24916nv_overflows_integers_at='$nv_overflows_integers_at'
24917nv_preserves_uv_bits='$nv_preserves_uv_bits'
24918nveformat='$nveformat'
24919nvfformat='$nvfformat'
24920nvgformat='$nvgformat'
24921nvmantbits='$nvmantbits'
24922nvsize='$nvsize'
24923nvtype='$nvtype'
24924o_nonblock='$o_nonblock'
24925obj_ext='$obj_ext'
24926old_pthread_create_joinable='$old_pthread_create_joinable'
24927optimize='$optimize'
24928orderlib='$orderlib'
24929osname='$osname'
24930osvers='$osvers'
24931otherlibdirs='$otherlibdirs'
24932package='$package'
24933pager='$pager'
24934passcat='$passcat'
24935patchlevel='$patchlevel'
24936path_sep='$path_sep'
24937perl5='$perl5'
24938perl='$perl'
24939perl_patchlevel='$perl_patchlevel'
24940perl_static_inline='$perl_static_inline'
24941perladmin='$perladmin'
24942perllibs='$perllibs'
24943perlpath='$perlpath'
24944pg='$pg'
24945phostname='$phostname'
24946pidtype='$pidtype'
24947plibpth='$plibpth'
24948pmake='$pmake'
24949pr='$pr'
24950prefix='$prefix'
24951prefixexp='$prefixexp'
24952privlib='$privlib'
24953privlibexp='$privlibexp'
24954procselfexe='$procselfexe'
24955ptrsize='$ptrsize'
24956quadkind='$quadkind'
24957quadtype='$quadtype'
24958randbits='$randbits'
24959randfunc='$randfunc'
24960random_r_proto='$random_r_proto'
24961randseedtype='$randseedtype'
24962ranlib='$ranlib'
24963rd_nodata='$rd_nodata'
24964readdir64_r_proto='$readdir64_r_proto'
24965readdir_r_proto='$readdir_r_proto'
24966revision='$revision'
24967rm='$rm'
24968rm_try='$rm_try'
24969rmail='$rmail'
24970run='$run'
24971runnm='$runnm'
24972sGMTIME_max='$sGMTIME_max'
24973sGMTIME_min='$sGMTIME_min'
24974sLOCALTIME_max='$sLOCALTIME_max'
24975sLOCALTIME_min='$sLOCALTIME_min'
24976sPRIEUldbl='$sPRIEUldbl'
24977sPRIFUldbl='$sPRIFUldbl'
24978sPRIGUldbl='$sPRIGUldbl'
24979sPRIXU64='$sPRIXU64'
24980sPRId64='$sPRId64'
24981sPRIeldbl='$sPRIeldbl'
24982sPRIfldbl='$sPRIfldbl'
24983sPRIgldbl='$sPRIgldbl'
24984sPRIi64='$sPRIi64'
24985sPRIo64='$sPRIo64'
24986sPRIu64='$sPRIu64'
24987sPRIx64='$sPRIx64'
24988sSCNfldbl='$sSCNfldbl'
24989sched_yield='$sched_yield'
24990scriptdir='$scriptdir'
24991scriptdirexp='$scriptdirexp'
24992sed='$sed'
24993seedfunc='$seedfunc'
24994selectminbits='$selectminbits'
24995selecttype='$selecttype'
24996sendmail='$sendmail'
24997setgrent_r_proto='$setgrent_r_proto'
24998sethostent_r_proto='$sethostent_r_proto'
24999setlocale_r_proto='$setlocale_r_proto'
25000setnetent_r_proto='$setnetent_r_proto'
25001setprotoent_r_proto='$setprotoent_r_proto'
25002setpwent_r_proto='$setpwent_r_proto'
25003setservent_r_proto='$setservent_r_proto'
25004sh='$sh'
25005shar='$shar'
25006sharpbang='$sharpbang'
25007shmattype='$shmattype'
25008shortsize='$shortsize'
25009shrpenv='$shrpenv'
25010shsharp='$shsharp'
25011sig_count='$sig_count'
25012sig_name='$sig_name'
25013sig_name_init='$sig_name_init'
25014sig_num='$sig_num'
25015sig_num_init='$sig_num_init'
25016sig_size='$sig_size'
25017signal_t='$signal_t'
25018sitearch='$sitearch'
25019sitearchexp='$sitearchexp'
25020sitebin='$sitebin'
25021sitebinexp='$sitebinexp'
25022sitehtml1dir='$sitehtml1dir'
25023sitehtml1direxp='$sitehtml1direxp'
25024sitehtml3dir='$sitehtml3dir'
25025sitehtml3direxp='$sitehtml3direxp'
25026sitelib='$sitelib'
25027sitelib_stem='$sitelib_stem'
25028sitelibexp='$sitelibexp'
25029siteman1dir='$siteman1dir'
25030siteman1direxp='$siteman1direxp'
25031siteman3dir='$siteman3dir'
25032siteman3direxp='$siteman3direxp'
25033siteprefix='$siteprefix'
25034siteprefixexp='$siteprefixexp'
25035sitescript='$sitescript'
25036sitescriptexp='$sitescriptexp'
25037sizesize='$sizesize'
25038sizetype='$sizetype'
25039sleep='$sleep'
25040smail='$smail'
25041so='$so'
25042sockethdr='$sockethdr'
25043socketlib='$socketlib'
25044socksizetype='$socksizetype'
25045sort='$sort'
25046spackage='$spackage'
25047spitshell='$spitshell'
25048srand48_r_proto='$srand48_r_proto'
25049srandom_r_proto='$srandom_r_proto'
25050src='$src'
25051ssizetype='$ssizetype'
25052st_ino_sign='$st_ino_sign'
25053st_ino_size='$st_ino_size'
25054startperl='$startperl'
25055startsh='$startsh'
25056static_ext='$static_ext'
25057stdchar='$stdchar'
25058stdio_base='$stdio_base'
25059stdio_bufsiz='$stdio_bufsiz'
25060stdio_cnt='$stdio_cnt'
25061stdio_filbuf='$stdio_filbuf'
25062stdio_ptr='$stdio_ptr'
25063stdio_stream_array='$stdio_stream_array'
25064strerror_r_proto='$strerror_r_proto'
25065submit='$submit'
25066subversion='$subversion'
25067sysman='$sysman'
25068sysroot='$sysroot'
25069tail='$tail'
25070tar='$tar'
25071targetarch='$targetarch'
25072targetdir='$targetdir'
25073targetenv='$targetenv'
25074targethost='$targethost'
25075targetmkdir='$targetmkdir'
25076targetport='$targetport'
25077targetsh='$targetsh'
25078tbl='$tbl'
25079tee='$tee'
25080test='$test'
25081timeincl='$timeincl'
25082timetype='$timetype'
25083tmpnam_r_proto='$tmpnam_r_proto'
25084to='$to'
25085touch='$touch'
25086tr='$tr'
25087trnl='$trnl'
25088troff='$troff'
25089ttyname_r_proto='$ttyname_r_proto'
25090u16size='$u16size'
25091u16type='$u16type'
25092u32size='$u32size'
25093u32type='$u32type'
25094u64size='$u64size'
25095u64type='$u64type'
25096u8size='$u8size'
25097u8type='$u8type'
25098uidformat='$uidformat'
25099uidsign='$uidsign'
25100uidsize='$uidsize'
25101uidtype='$uidtype'
25102uname='$uname'
25103uniq='$uniq'
25104uquadtype='$uquadtype'
25105use5005threads='$use5005threads'
25106use64bitall='$use64bitall'
25107use64bitint='$use64bitint'
25108usecbacktrace='$usecbacktrace'
25109usecrosscompile='$usecrosscompile'
25110usedevel='$usedevel'
25111usedl='$usedl'
25112usedtrace='$usedtrace'
25113usefaststdio='$usefaststdio'
25114useithreads='$useithreads'
25115usekernprocpathname='$usekernprocpathname'
25116uselanginfo='$uselanginfo'
25117uselargefiles='$uselargefiles'
25118uselongdouble='$uselongdouble'
25119usemallocwrap='$usemallocwrap'
25120usemorebits='$usemorebits'
25121usemultiplicity='$usemultiplicity'
25122usemymalloc='$usemymalloc'
25123usenm='$usenm'
25124usensgetexecutablepath='$usensgetexecutablepath'
25125useopcode='$useopcode'
25126useperlio='$useperlio'
25127useposix='$useposix'
25128usequadmath='$usequadmath'
25129usereentrant='$usereentrant'
25130userelocatableinc='$userelocatableinc'
25131useshrplib='$useshrplib'
25132usesitecustomize='$usesitecustomize'
25133usesocks='$usesocks'
25134usethreads='$usethreads'
25135usevendorprefix='$usevendorprefix'
25136useversionedarchname='$useversionedarchname'
25137usevfork='$usevfork'
25138usrinc='$usrinc'
25139uuname='$uuname'
25140uvXUformat='$uvXUformat'
25141uvoformat='$uvoformat'
25142uvsize='$uvsize'
25143uvtype='$uvtype'
25144uvuformat='$uvuformat'
25145uvxformat='$uvxformat'
25146vendorarch='$vendorarch'
25147vendorarchexp='$vendorarchexp'
25148vendorbin='$vendorbin'
25149vendorbinexp='$vendorbinexp'
25150vendorhtml1dir='$vendorhtml1dir'
25151vendorhtml1direxp='$vendorhtml1direxp'
25152vendorhtml3dir='$vendorhtml3dir'
25153vendorhtml3direxp='$vendorhtml3direxp'
25154vendorlib='$vendorlib'
25155vendorlib_stem='$vendorlib_stem'
25156vendorlibexp='$vendorlibexp'
25157vendorman1dir='$vendorman1dir'
25158vendorman1direxp='$vendorman1direxp'
25159vendorman3dir='$vendorman3dir'
25160vendorman3direxp='$vendorman3direxp'
25161vendorprefix='$vendorprefix'
25162vendorprefixexp='$vendorprefixexp'
25163vendorscript='$vendorscript'
25164vendorscriptexp='$vendorscriptexp'
25165version='$version'
25166version_patchlevel_string='$version_patchlevel_string'
25167versiononly='$versiononly'
25168vi='$vi'
25169xlibpth='$xlibpth'
25170yacc='$yacc'
25171yaccflags='$yaccflags'
25172zcat='$zcat'
25173zip='$zip'
25174EOT
25175
25176: add special variables
25177$test -f $src/patchlevel.h && \
25178awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25179echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25180echo "PERL_CONFIG_SH=true" >>config.sh
25181
25182: propagate old symbols
25183if $test -f UU/config.sh; then
25184 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25185 $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25186 config.sh config.sh UU/oldconfig.sh |\
25187 $sort | $uniq -u >UU/oldsyms
25188 set X `$cat UU/oldsyms`
25189 shift
25190 case $# in
25191 0) ;;
25192 *)
25193 $cat <<EOM
25194Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25195EOM
25196 echo ": Variables propagated from previous config.sh file." >>config.sh
25197 for sym in `$cat UU/oldsyms`; do
25198 echo " Propagating $hint variable "'$'"$sym..."
25199 eval 'tmp="$'"${sym}"'"'
25200 echo "$tmp" | \
25201 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25202 done
25203 ;;
25204 esac
25205fi
25206
25207: preserve RCS keywords in files with variable substitution, grrr
25208Id='$Id'
25209
25210: Finish up by extracting the .SH files
25211case "$alldone" in
25212exit)
25213 echo "Stopping at your request, leaving temporary files around."
25214 exit 0
25215 ;;
25216cont)
25217 ;;
25218'')
25219 dflt=''
25220 nostick=true
25221 $cat <<EOM
25222
25223If you'd like to make any changes to the config.sh file before I begin
25224to configure things, do it as a shell escape now (e.g. !vi config.sh).
25225
25226EOM
25227 rp="Press return or use a shell escape to edit config.sh:"
25228 . UU/myread
25229 nostick=''
25230 case "$ans" in
25231 '') ;;
25232 *) : in case they cannot read
25233 sh 1>&4 -c "$ans";;
25234 esac
25235 ;;
25236esac
25237
25238: if this fails, just run all the .SH files by hand
25239. ./config.sh
25240
25241echo " "
25242exec 1>&4
25243pwd=`pwd`
25244. ./UU/extract
25245cd "$pwd"
25246
25247if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25248 dflt=y
25249 case "$silent" in
25250 true) ;;
25251 *)
25252 $cat <<EOM
25253
25254Now you need to generate make dependencies by running "$make depend".
25255You might prefer to run it in background: "$make depend > makedepend.out &"
25256It can take a while, so you might not want to run it right now.
25257
25258EOM
25259 ;;
25260 esac
25261 rp="Run $make depend now?"
25262 . UU/myread
25263 case "$ans" in
25264 y*)
25265 $make depend && echo "Now you must run '$make'."
25266 ;;
25267 *)
25268 echo "You must run '$make depend' then '$make'."
25269 ;;
25270 esac
25271elif test -f [Mm]akefile; then
25272 echo " "
25273 echo "Now you must run a $make."
25274else
25275 echo "Configure done."
25276fi
25277
25278if $test -f Policy.sh; then
25279 $cat <<EOM
25280
25281If you compile $package on a different machine or from a different object
25282directory, copy the Policy.sh file from this object directory to the
25283new one before you run Configure -- this will help you with most of
25284the policy defaults.
25285
25286EOM
25287fi
25288if $test -f UU/config.msg; then
25289 echo "Hmm. I also noted the following information while running:"
25290 echo " "
25291 $cat UU/config.msg >&4
25292fi
25293$rm -f kit*isdone ark*isdone
25294$rm -rf UU
25295
25296: End of Configure
25297