Debian Codegraph @

Configure

raw ◀ ▶
Source reconstructed at patch state 1 of 3 — not the installed (fully patched) source.
3 Debian patches touch this file
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/Perl/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
33 cat >c1$$ <<EOF
34 ARGGGHHHH!!!!!
35
36 SCO csh still thinks true is false. Write to SCO today and tell them that next
37 year 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
40 we'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...]
43 EOF
44 cat >c2$$ <<EOF
45
46 OOPS! You naughty creature! You didn't run Configure with sh!
47 I will attempt to remedy the situation by running sh for you...
48 EOF
49
50 true || cat c1$$ c2$$
51 true || exec sh $0 $argv:q
52
53 (exit $?0) || cat c2$$
54 (exit $?0) || exec sh $0 $argv:q
55 rm -f c1$$ c2$$
56
57 if 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 ***
65 EOF
66 exit 1
67 fi
68
69 if test -f /sys/utilities/MultiView ; then
70 # AmigaOS, test -c for /dev/null is not useful
71 :
72 elif 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 ***
80 EOF
81 exit 1
82 fi
83
84 : compute my invocation name
85 me=$0
86 case "$0" in
87 */*)
88 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89 test "$me" || me=$0
90 ;;
91 esac
92
93 : Proper separator for the PATH environment variable
94 p_=:
95 : On OS/2 this directory should exist if this is not floppy only system ":-]"
96 if 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
108 fi
109
110 : Proper PATH setting
111 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118 paths="$paths /sbin /usr/sbin /usr/libexec"
119 paths="$paths /system/gnu_library/bin"
120
121 for p in $paths
122 do
123 case "$p_$PATH$p_" in
124 *$p_$p$p_*) ;;
125 *) test -d $p && PATH=$PATH$p_$p ;;
126 esac
127 done
128
129 PATH=.$p_$PATH
130 export PATH
131
132 : shall we be using ksh?
133 inksh=''
134 needksh=''
135 avoidksh=''
136 newsh=/bin/ksh
137 changesh=''
138 if (PATH=.; alias -x) >/dev/null 2>&1; then
139 inksh=true
140 fi
141 if test -f /hp-ux -a -f /bin/ksh; then
142 needksh='to avoid sh bug in "here document" expansion'
143 fi
144 if 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
149 fi
150 if 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
156 fi
157 case "$inksh/$needksh" in
158 /[a-z]*)
159 ENV=''
160 changesh=true
161 reason="$needksh"
162 ;;
163 esac
164 case "$inksh/$avoidksh" in
165 true/[a-z]*)
166 changesh=true
167 reason="$avoidksh"
168 ;;
169 esac
170 case "$inksh/$needksh-$avoidksh-" in
171 true/--)
172 cat <<EOM
173 (I see you are using the Korn shell. Some ksh's blow up on $me,
174 mainly on older exotic systems. If yours does, try the Bourne shell instead.)
175 EOM
176 ;;
177 esac
178 case "$changesh" in
179 true)
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 ;;
187 esac
188 test -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.
192 case "$CDPATH" in
193 '') ;;
194 *) case "$SHELL" in
195 *bash*) CDPATH='.' ;;
196 *) CDPATH='' ;;
197 esac
198 ;;
199 esac
200
201 : Configure runs within the UU subdirectory
202 test -d UU || mkdir UU
203 cd UU && rm -f ./*
204
205 ccname=''
206 ccversion=''
207 ccsymbols=''
208 cppccsymbols=''
209 cppsymbols=''
210 from=''
211 hostgenerate=''
212 hostosname=''
213 hostperl=''
214 run=''
215 targetarch=''
216 targetdir=''
217 targetenv=''
218 targethost=''
219 targetmkdir=''
220 targetport=''
221 to=''
222 usecrosscompile=''
223 extern_C=''
224 mistrustnm=''
225 usedevel=''
226 perllibs=''
227 dynamic_ext=''
228 extensions=''
229 known_extensions=''
230 nonxs_ext=''
231 static_ext=''
232 uselanginfo=''
233 useopcode=''
234 useposix=''
235 extras=''
236 d_bsd=''
237 d_eunice=''
238 d_xenix=''
239 eunicefix=''
240 ar=''
241 awk=''
242 bash=''
243 bison=''
244 byacc=''
245 cat=''
246 chgrp=''
247 chmod=''
248 chown=''
249 comm=''
250 compress=''
251 cp=''
252 cpio=''
253 cpp=''
254 csh=''
255 date=''
256 echo=''
257 egrep=''
258 emacs=''
259 expr=''
260 find=''
261 flex=''
262 gmake=''
263 grep=''
264 gzip=''
265 inews=''
266 ksh=''
267 less=''
268 line=''
269 lint=''
270 ln=''
271 lp=''
272 lpr=''
273 ls=''
274 mail=''
275 mailx=''
276 make=''
277 mkdir=''
278 more=''
279 mv=''
280 nm=''
281 nroff=''
282 perl=''
283 pg=''
284 pmake=''
285 pr=''
286 rm=''
287 rmail=''
288 sed=''
289 sendmail=''
290 shar=''
291 sleep=''
292 smail=''
293 sort=''
294 submit=''
295 tail=''
296 tar=''
297 tbl=''
298 tee=''
299 test=''
300 touch=''
301 tr=''
302 troff=''
303 uname=''
304 uniq=''
305 uuname=''
306 vi=''
307 zcat=''
308 zip=''
309 full_ar=''
310 full_sed=''
311 libswanted=''
312 hint=''
313 myuname=''
314 osname=''
315 osvers=''
316 Author=''
317 Date=''
318 Header=''
319 Id=''
320 Locker=''
321 Log=''
322 RCSfile=''
323 Revision=''
324 Source=''
325 State=''
326 sysroot=''
327 _a=''
328 _exe=''
329 _o=''
330 archobjs=''
331 exe_ext=''
332 firstmakefile=''
333 lib_ext=''
334 obj_ext=''
335 path_sep=''
336 rm_try=''
337 afs=''
338 afsroot=''
339 alignbytes=''
340 archlib=''
341 archlibexp=''
342 d_archlib=''
343 installarchlib=''
344 archname=''
345 myarchname=''
346 useversionedarchname=''
347 d_atolf=''
348 d_atoll=''
349 baserev=''
350 bin=''
351 binexp=''
352 initialinstalllocation=''
353 installbin=''
354 userelocatableinc=''
355 byteorder=''
356 cc=''
357 ccflags=''
358 cppflags=''
359 ldflags=''
360 lkflags=''
361 locincpth=''
362 optimize=''
363 cf_email=''
364 cf_by=''
365 cf_time=''
366 charbits=''
367 charsize=''
368 compiler_warning=''
369 contains=''
370 cpp_stuff=''
371 cpplast=''
372 cppminus=''
373 cpprun=''
374 cppstdin=''
375 d__fwalk=''
376 d_accept4=''
377 d_access=''
378 d_accessx=''
379 d_acosh=''
380 d_aintl=''
381 d_alarm=''
382 asctime_r_proto=''
383 d_asctime_r=''
384 d_asinh=''
385 d_atanh=''
386 d_attribute_always_inline=''
387 d_attribute_deprecated=''
388 d_attribute_format=''
389 d_attribute_malloc=''
390 d_attribute_nonnull=''
391 d_attribute_noreturn=''
392 d_attribute_pure=''
393 d_attribute_unused=''
394 d_attribute_visibility=''
395 d_attribute_warn_unused_result=''
396 d_printf_format_null=''
397 d_backtrace=''
398 d_non_int_bitfields=''
399 d_builtin_choose_expr=''
400 d_builtin_expect=''
401 d_builtin_add_overflow=''
402 d_builtin_mul_overflow=''
403 d_builtin_sub_overflow=''
404 d_c99_variadic_macros=''
405 d_casti32=''
406 castflags=''
407 d_castneg=''
408 d_cbrt=''
409 d_chown=''
410 d_chroot=''
411 d_chsize=''
412 d_class=''
413 d_clearenv=''
414 d_closedir=''
415 d_void_closedir=''
416 d_cmsghdr_s=''
417 d_copysign=''
418 d_copysignl=''
419 d_cplusplus=''
420 cryptlib=''
421 d_crypt=''
422 crypt_r_proto=''
423 d_crypt_r=''
424 d_csh=''
425 full_csh=''
426 d_ctermid=''
427 ctermid_r_proto=''
428 d_ctermid_r=''
429 ctime_r_proto=''
430 d_ctime_r=''
431 d_cuserid=''
432 d_dbminitproto=''
433 d_difftime=''
434 d_dir_dd_fd=''
435 d_dirfd=''
436 d_dladdr=''
437 d_dlerror=''
438 d_dlopen=''
439 d_dlsymun=''
440 d_dosuid=''
441 d_suidsafe=''
442 d_drand48_r=''
443 drand48_r_proto=''
444 d_drand48proto=''
445 d_dup2=''
446 d_dup3=''
447 d_eaccess=''
448 d_endgrent=''
449 d_endgrent_r=''
450 endgrent_r_proto=''
451 d_endhent=''
452 d_endhostent_r=''
453 endhostent_r_proto=''
454 d_endnent=''
455 d_endnetent_r=''
456 endnetent_r_proto=''
457 d_endpent=''
458 d_endprotoent_r=''
459 endprotoent_r_proto=''
460 d_endpwent=''
461 d_endpwent_r=''
462 endpwent_r_proto=''
463 d_endsent=''
464 d_endservent_r=''
465 endservent_r_proto=''
466 d_erf=''
467 d_erfc=''
468 d_exp2=''
469 d_expm1=''
470 d_faststdio=''
471 d_fchdir=''
472 d_fchmod=''
473 d_fchown=''
474 d_fcntl=''
475 d_fcntl_can_lock=''
476 d_fd_macros=''
477 d_fd_set=''
478 d_fds_bits=''
479 d_fdclose=''
480 d_fdim=''
481 d_fegetround=''
482 d_ffs=''
483 d_ffsl=''
484 d_fgetpos=''
485 d_finite=''
486 d_finitel=''
487 d_flexfnam=''
488 d_flock=''
489 d_flockproto=''
490 d_fma=''
491 d_fmax=''
492 d_fmin=''
493 d_fork=''
494 d_fp_class=''
495 d_fp_classl=''
496 d_fpclass=''
497 d_fp_classify=''
498 d_fpclassify=''
499 d_fpclassl=''
500 d_fpgetround=''
501 d_fpos64_t=''
502 d_frexpl=''
503 d_fs_data_s=''
504 d_fchmodat=''
505 d_linkat=''
506 d_openat=''
507 d_renameat=''
508 d_unlinkat=''
509 d_fseeko=''
510 d_fsetpos=''
511 d_fstatfs=''
512 d_fsync=''
513 d_ftello=''
514 d_ftime=''
515 d_gettimeod=''
516 d_futimes=''
517 d_gai_strerror=''
518 d_Gconvert=''
519 d_getaddrinfo=''
520 d_getcwd=''
521 d_getenv_preserves_other_thread=''
522 d_getespwnam=''
523 d_getfsstat=''
524 d_getgrent=''
525 d_getgrent_r=''
526 getgrent_r_proto=''
527 d_getgrgid_r=''
528 getgrgid_r_proto=''
529 d_getgrnam_r=''
530 getgrnam_r_proto=''
531 d_getgrps=''
532 d_gethbyaddr=''
533 d_gethbyname=''
534 d_gethent=''
535 aphostname=''
536 d_gethname=''
537 d_phostname=''
538 d_uname=''
539 d_gethostbyaddr_r=''
540 gethostbyaddr_r_proto=''
541 d_gethostbyname_r=''
542 gethostbyname_r_proto=''
543 d_gethostent_r=''
544 gethostent_r_proto=''
545 d_gethostprotos=''
546 d_getitimer=''
547 d_getlogin=''
548 d_getlogin_r=''
549 getlogin_r_proto=''
550 d_getmnt=''
551 d_getmntent=''
552 d_getnameinfo=''
553 d_getnbyaddr=''
554 d_getnbyname=''
555 d_getnent=''
556 d_getnetbyaddr_r=''
557 getnetbyaddr_r_proto=''
558 d_getnetbyname_r=''
559 getnetbyname_r_proto=''
560 d_getnetent_r=''
561 getnetent_r_proto=''
562 d_getnetprotos=''
563 d_getpagsz=''
564 d_getpent=''
565 d_getpgid=''
566 d_getpgrp2=''
567 d_bsdgetpgrp=''
568 d_getpgrp=''
569 d_getppid=''
570 d_getprior=''
571 d_getpbyname=''
572 d_getpbynumber=''
573 d_getprotobyname_r=''
574 getprotobyname_r_proto=''
575 d_getprotobynumber_r=''
576 getprotobynumber_r_proto=''
577 d_getprotoent_r=''
578 getprotoent_r_proto=''
579 d_getprotoprotos=''
580 d_getprpwnam=''
581 d_getpwent=''
582 d_getpwent_r=''
583 getpwent_r_proto=''
584 d_getpwnam_r=''
585 getpwnam_r_proto=''
586 d_getpwuid_r=''
587 getpwuid_r_proto=''
588 d_getsent=''
589 d_getservbyname_r=''
590 getservbyname_r_proto=''
591 d_getservbyport_r=''
592 getservbyport_r_proto=''
593 d_getservent_r=''
594 getservent_r_proto=''
595 d_getservprotos=''
596 d_getspnam=''
597 d_getspnam_r=''
598 getspnam_r_proto=''
599 d_getsbyname=''
600 d_getsbyport=''
601 d_gmtime_r=''
602 gmtime_r_proto=''
603 d_gnulibc=''
604 gnulibc_version=''
605 d_hasmntopt=''
606 d_htonl=''
607 d_hypot=''
608 d_ilogb=''
609 d_ilogbl=''
610 d_inetaton=''
611 d_inetntop=''
612 d_inetpton=''
613 d_int64_t=''
614 d_isascii=''
615 d_isblank=''
616 d_isfinite=''
617 d_isfinitel=''
618 d_isinf=''
619 d_isinfl=''
620 d_isless=''
621 d_isnan=''
622 d_isnanl=''
623 d_isnormal=''
624 d_j0=''
625 d_j0l=''
626 d_killpg=''
627 d_lc_monetary_2008=''
628 d_lchown=''
629 d_ldbl_dig=''
630 d_lgamma=''
631 d_lgamma_r=''
632 d_libm_lib_version=''
633 d_link=''
634 d_llrint=''
635 d_llrintl=''
636 d_llround=''
637 d_llroundl=''
638 d_localeconv_l=''
639 d_localtime_r=''
640 d_localtime_r_needs_tzset=''
641 localtime_r_proto=''
642 d_locconv=''
643 d_lockf=''
644 d_log1p=''
645 d_log2=''
646 d_logb=''
647 d_ldexpl=''
648 d_long_double_style_ieee=''
649 d_long_double_style_ieee_doubledouble=''
650 d_long_double_style_ieee_extended=''
651 d_long_double_style_ieee_std=''
652 d_long_double_style_vax=''
653 d_longdbl=''
654 longdblkind=''
655 longdblsize=''
656 d_longlong=''
657 longlongsize=''
658 d_lrint=''
659 d_lrintl=''
660 d_lround=''
661 d_lroundl=''
662 d_lseekproto=''
663 d_lstat=''
664 d_madvise=''
665 d_malloc_good_size=''
666 d_malloc_size=''
667 d_malloc_usable_size=''
668 d_mblen=''
669 d_mbrlen=''
670 d_mbrtowc=''
671 d_mbstowcs=''
672 d_mbtowc=''
673 d_memmem=''
674 d_memrchr=''
675 d_mkdir=''
676 d_mkdtemp=''
677 d_mkfifo=''
678 d_mkostemp=''
679 d_mkstemp=''
680 d_mkstemps=''
681 d_mktime=''
682 d_mmap=''
683 mmaptype=''
684 d_modfl=''
685 d_modflproto=''
686 d_mprotect=''
687 d_msg=''
688 d_msgctl=''
689 d_msgget=''
690 d_msghdr_s=''
691 d_msgrcv=''
692 d_msgsnd=''
693 d_msync=''
694 d_munmap=''
695 d_nan=''
696 d_nanosleep=''
697 d_nearbyint=''
698 d_duplocale=''
699 d_freelocale=''
700 d_newlocale=''
701 d_querylocale=''
702 d_uselocale=''
703 i_xlocale=''
704 xlocale_needed=''
705 d_nextafter=''
706 d_nexttoward=''
707 d_nice=''
708 d_nl_langinfo=''
709 d_nl_langinfo_l=''
710 d_off64_t=''
711 d_open3=''
712 d_fpathconf=''
713 d_pathconf=''
714 d_pause=''
715 d_pipe2=''
716 d_pipe=''
717 d_poll=''
718 d_portable=''
719 d_prctl=''
720 d_prctl_set_name=''
721 d_procselfexe=''
722 procselfexe=''
723 d_old_pthread_create_joinable=''
724 old_pthread_create_joinable=''
725 d_pthread_atfork=''
726 d_pthread_attr_setscope=''
727 d_pthread_yield=''
728 d_sched_yield=''
729 sched_yield=''
730 d_ptrdiff_t=''
731 d_qgcvt=''
732 d_random_r=''
733 random_r_proto=''
734 d_readdir64_r=''
735 readdir64_r_proto=''
736 d_readdir=''
737 d_rewinddir=''
738 d_seekdir=''
739 d_telldir=''
740 d_readdir_r=''
741 readdir_r_proto=''
742 d_readlink=''
743 d_readv=''
744 d_recvmsg=''
745 d_re_comp=''
746 d_regcmp=''
747 d_regcomp=''
748 d_remainder=''
749 d_remquo=''
750 d_rename=''
751 d_rint=''
752 d_rmdir=''
753 d_round=''
754 d_sbrkproto=''
755 d_scalbn=''
756 d_scalbnl=''
757 d_select=''
758 d_sem=''
759 d_semctl=''
760 d_semget=''
761 d_semop=''
762 d_sendmsg=''
763 d_setegid=''
764 d_setenv=''
765 d_seteuid=''
766 d_setgrent=''
767 d_setgrent_r=''
768 setgrent_r_proto=''
769 d_setgrps=''
770 d_sethent=''
771 d_sethostent_r=''
772 sethostent_r_proto=''
773 d_setitimer=''
774 d_setlinebuf=''
775 d_has_C_UTF8=''
776 d_setlocale=''
777 d_setlocale_accepts_any_locale_name=''
778 d_setlocale_r=''
779 setlocale_r_proto=''
780 d_setnent=''
781 d_setnetent_r=''
782 setnetent_r_proto=''
783 d_setpent=''
784 d_setpgid=''
785 d_setpgrp2=''
786 d_bsdsetpgrp=''
787 d_setpgrp=''
788 d_setprior=''
789 d_setproctitle=''
790 d_setprotoent_r=''
791 setprotoent_r_proto=''
792 d_setpwent=''
793 d_setpwent_r=''
794 setpwent_r_proto=''
795 d_setregid=''
796 d_setresgid=''
797 d_setresuid=''
798 d_setreuid=''
799 d_setrgid=''
800 d_setruid=''
801 d_setsent=''
802 d_setservent_r=''
803 setservent_r_proto=''
804 d_setsid=''
805 d_setvbuf=''
806 d_shm=''
807 d_shmat=''
808 d_shmatprototype=''
809 shmattype=''
810 d_shmctl=''
811 d_shmdt=''
812 d_shmget=''
813 d_sigaction=''
814 d_siginfo_si_addr=''
815 d_siginfo_si_band=''
816 d_siginfo_si_errno=''
817 d_siginfo_si_fd=''
818 d_siginfo_si_pid=''
819 d_siginfo_si_status=''
820 d_siginfo_si_uid=''
821 d_siginfo_si_value=''
822 d_signbit=''
823 d_sigprocmask=''
824 d_sigsetjmp=''
825 usesitecustomize=''
826 d_snprintf=''
827 d_vsnprintf=''
828 d_sockatmark=''
829 d_sockatmarkproto=''
830 d_ip_mreq=''
831 d_ip_mreq_source=''
832 d_ipv6_mreq=''
833 d_ipv6_mreq_source=''
834 d_msg_ctrunc=''
835 d_msg_dontroute=''
836 d_msg_oob=''
837 d_msg_peek=''
838 d_msg_proxy=''
839 d_oldsock=''
840 d_scm_rights=''
841 d_sin6_scope_id=''
842 d_sockaddr_in6=''
843 d_sockaddr_sa_len=''
844 d_sockaddr_storage=''
845 d_socket=''
846 d_sockpair=''
847 sockethdr=''
848 socketlib=''
849 d_socklen_t=''
850 d_socks5_init=''
851 d_sqrtl=''
852 d_srand48_r=''
853 srand48_r_proto=''
854 d_srandom_r=''
855 srandom_r_proto=''
856 d_sresgproto=''
857 d_sresuproto=''
858 d_stat=''
859 d_statblks=''
860 d_statfs_f_flags=''
861 d_statfs_s=''
862 d_static_inline=''
863 perl_static_inline=''
864 d_fstatvfs=''
865 d_statvfs=''
866 d_stdio_cnt_lval=''
867 d_stdio_ptr_lval=''
868 d_stdio_ptr_lval_nochange_cnt=''
869 d_stdio_ptr_lval_sets_cnt=''
870 d_stdiobase=''
871 d_stdstdio=''
872 stdio_base=''
873 stdio_bufsiz=''
874 stdio_cnt=''
875 stdio_filbuf=''
876 stdio_ptr=''
877 d_strcoll=''
878 d_sysernlst=''
879 d_syserrlst=''
880 d_strerror_l=''
881 d_strerror_r=''
882 strerror_r_proto=''
883 d_strftime=''
884 d_strlcat=''
885 d_strlcpy=''
886 d_strnlen=''
887 d_strtod=''
888 d_strtod_l=''
889 d_strtol=''
890 d_strtold=''
891 d_strtold_l=''
892 d_strtoll=''
893 d_strtoq=''
894 d_strtoul=''
895 d_strtoull=''
896 d_strtouq=''
897 d_strxfrm=''
898 d_strxfrm_l=''
899 d_symlink=''
900 d_syscall=''
901 d_syscallproto=''
902 d_sysconf=''
903 d_system=''
904 d_tcgetpgrp=''
905 d_tcsetpgrp=''
906 d_telldirproto=''
907 d_tgamma=''
908 d_thread_local=''
909 perl_thread_local=''
910 d_time=''
911 timetype=''
912 d_asctime64=''
913 d_ctime64=''
914 d_difftime64=''
915 d_gmtime64=''
916 d_localtime64=''
917 d_mktime64=''
918 d_timegm=''
919 clocktype=''
920 d_times=''
921 d_tmpnam_r=''
922 tmpnam_r_proto=''
923 d_towlower=''
924 d_towupper=''
925 d_trunc=''
926 d_truncate=''
927 d_truncl=''
928 d_ttyname_r=''
929 ttyname_r_proto=''
930 d_tzname=''
931 d_u32align=''
932 d_ualarm=''
933 d_umask=''
934 d_semctl_semid_ds=''
935 d_semctl_semun=''
936 d_union_semun=''
937 d_unordered=''
938 d_unsetenv=''
939 d_usleep=''
940 d_usleepproto=''
941 d_ustat=''
942 d_pseudofork=''
943 d_vfork=''
944 usevfork=''
945 d_voidsig=''
946 signal_t=''
947 d_wait4=''
948 d_waitpid=''
949 d_wcrtomb=''
950 d_wcscmp=''
951 d_wcstombs=''
952 d_wcsxfrm=''
953 d_wctomb=''
954 d_writev=''
955 default_inc_excludes_dot=''
956 d_perl_lc_all_category_positions_init=''
957 d_perl_lc_all_separator=''
958 d_perl_lc_all_uses_name_value_pairs=''
959 perl_lc_all_category_positions_init=''
960 perl_lc_all_separator=''
961 dlext=''
962 bin_ELF=''
963 cccdlflags=''
964 ccdlflags=''
965 dlsrc=''
966 ld=''
967 ld_can_script=''
968 lddlflags=''
969 usedl=''
970 doublesize=''
971 dtraceobject=''
972 dtracexnolibs=''
973 ebcdic=''
974 fflushNULL=''
975 fflushall=''
976 fpossize=''
977 fpostype=''
978 gccansipedantic=''
979 gccosandvers=''
980 gccversion=''
981 gidformat=''
982 gidsign=''
983 gidsize=''
984 gidtype=''
985 groupstype=''
986 h_fcntl=''
987 h_sysfile=''
988 html1dir=''
989 html1direxp=''
990 installhtml1dir=''
991 html3dir=''
992 html3direxp=''
993 installhtml3dir=''
994 i_arpainet=''
995 i_bfd=''
996 i_crypt=''
997 db_hashtype=''
998 db_prefixtype=''
999 db_version_major=''
1000 db_version_minor=''
1001 db_version_patch=''
1002 i_db=''
1003 i_dbm=''
1004 i_rpcsvcdbm=''
1005 d_dirnamlen=''
1006 direntrytype=''
1007 i_dirent=''
1008 i_dlfcn=''
1009 i_execinfo=''
1010 i_fcntl=''
1011 i_fenv=''
1012 i_fp=''
1013 i_fp_class=''
1014 i_gdbm=''
1015 d_grpasswd=''
1016 i_grp=''
1017 i_ieeefp=''
1018 i_inttypes=''
1019 i_langinfo=''
1020 i_libutil=''
1021 i_locale=''
1022 i_machcthr=''
1023 i_malloc=''
1024 i_mallocmalloc=''
1025 i_mntent=''
1026 d_gdbm_ndbm_h_uses_prototypes=''
1027 d_gdbmndbm_h_uses_prototypes=''
1028 d_ndbm=''
1029 d_ndbm_h_uses_prototypes=''
1030 i_gdbm_ndbm=''
1031 i_gdbmndbm=''
1032 i_ndbm=''
1033 i_netdb=''
1034 i_neterrno=''
1035 i_netinettcp=''
1036 i_niin=''
1037 i_sysin=''
1038 i_poll=''
1039 i_prot=''
1040 i_pthread=''
1041 d_pwage=''
1042 d_pwchange=''
1043 d_pwclass=''
1044 d_pwcomment=''
1045 d_pwexpire=''
1046 d_pwgecos=''
1047 d_pwpasswd=''
1048 d_pwquota=''
1049 i_pwd=''
1050 i_quadmath=''
1051 i_shadow=''
1052 i_socks=''
1053 i_stdbool=''
1054 i_stdint=''
1055 i_stdlib=''
1056 i_sunmath=''
1057 i_sysaccess=''
1058 i_sysdir=''
1059 i_sysfile=''
1060 d_voidtty=''
1061 i_bsdioctl=''
1062 i_sysfilio=''
1063 i_sysioctl=''
1064 i_syssockio=''
1065 i_syslog=''
1066 i_sysmman=''
1067 i_sysmode=''
1068 i_sysmount=''
1069 i_sysndir=''
1070 i_sysparam=''
1071 i_syspoll=''
1072 i_sysresrc=''
1073 i_syssecrt=''
1074 i_sysselct=''
1075 i_sysstat=''
1076 i_sysstatfs=''
1077 i_sysstatvfs=''
1078 i_syssyscall=''
1079 i_systimes=''
1080 i_systypes=''
1081 i_sysuio=''
1082 i_sysun=''
1083 i_sysutsname=''
1084 i_sysvfs=''
1085 i_syswait=''
1086 i_sgtty=''
1087 i_termio=''
1088 i_termios=''
1089 d_tm_tm_gmtoff=''
1090 d_tm_tm_zone=''
1091 i_systime=''
1092 i_systimek=''
1093 i_time=''
1094 timeincl=''
1095 i_unistd=''
1096 i_ustat=''
1097 i_utime=''
1098 i_vfork=''
1099 i_wchar=''
1100 i_wctype=''
1101 d_inc_version_list=''
1102 inc_version_list=''
1103 inc_version_list_init=''
1104 doubleinfbytes=''
1105 doublenanbytes=''
1106 longdblinfbytes=''
1107 longdblnanbytes=''
1108 installprefix=''
1109 installprefixexp=''
1110 installstyle=''
1111 installusrbinperl=''
1112 intsize=''
1113 longsize=''
1114 shortsize=''
1115 issymlink=''
1116 libc=''
1117 ldlibpthname=''
1118 libperl=''
1119 shrpenv=''
1120 useshrplib=''
1121 glibpth=''
1122 incpth=''
1123 libpth=''
1124 loclibpth=''
1125 plibpth=''
1126 xlibpth=''
1127 ignore_versioned_solibs=''
1128 libs=''
1129 libsdirs=''
1130 libsfiles=''
1131 libsfound=''
1132 libspath=''
1133 lns=''
1134 d_PRIEUldbl=''
1135 d_PRIFUldbl=''
1136 d_PRIGUldbl=''
1137 d_PRIeldbl=''
1138 d_PRIfldbl=''
1139 d_PRIgldbl=''
1140 d_SCNfldbl=''
1141 d_double_has_inf=''
1142 d_double_has_nan=''
1143 d_double_has_negative_zero=''
1144 d_double_has_subnormals=''
1145 d_double_style_cray=''
1146 d_double_style_ibm=''
1147 d_double_style_ieee=''
1148 d_double_style_vax=''
1149 doublekind=''
1150 sPRIEUldbl=''
1151 sPRIFUldbl=''
1152 sPRIGUldbl=''
1153 sPRIeldbl=''
1154 sPRIfldbl=''
1155 sPRIgldbl=''
1156 sSCNfldbl=''
1157 lseeksize=''
1158 lseektype=''
1159 make_set_make=''
1160 d_mymalloc=''
1161 freetype=''
1162 mallocobj=''
1163 mallocsrc=''
1164 malloctype=''
1165 usemallocwrap=''
1166 usemymalloc=''
1167 installman1dir=''
1168 man1dir=''
1169 man1direxp=''
1170 man1ext=''
1171 installman3dir=''
1172 man3dir=''
1173 man3direxp=''
1174 man3ext=''
1175 doublemantbits=''
1176 longdblmantbits=''
1177 nvmantbits=''
1178 modetype=''
1179 multiarch=''
1180 mydomain=''
1181 myhostname=''
1182 phostname=''
1183 c=''
1184 n=''
1185 d_eofnblk=''
1186 eagain=''
1187 o_nonblock=''
1188 rd_nodata=''
1189 need_va_copy=''
1190 netdb_hlen_type=''
1191 netdb_host_type=''
1192 netdb_name_type=''
1193 netdb_net_type=''
1194 groupcat=''
1195 hostcat=''
1196 passcat=''
1197 orderlib=''
1198 ranlib=''
1199 d_perl_otherlibdirs=''
1200 otherlibdirs=''
1201 package=''
1202 spackage=''
1203 pager=''
1204 api_revision=''
1205 api_subversion=''
1206 api_version=''
1207 api_versionstring=''
1208 patchlevel=''
1209 perl_patchlevel=''
1210 revision=''
1211 subversion=''
1212 version=''
1213 version_patchlevel_string=''
1214 perl5=''
1215 perladmin=''
1216 perlpath=''
1217 i32dformat=''
1218 u32XUformat=''
1219 u32oformat=''
1220 u32uformat=''
1221 u32xformat=''
1222 d_nv_preserves_uv=''
1223 d_nv_zero_is_allbits_zero=''
1224 i16size=''
1225 i16type=''
1226 i32size=''
1227 i32type=''
1228 i64size=''
1229 i64type=''
1230 i8size=''
1231 i8type=''
1232 ivsize=''
1233 ivtype=''
1234 nv_overflows_integers_at=''
1235 nv_preserves_uv_bits=''
1236 nvsize=''
1237 nvtype=''
1238 u16size=''
1239 u16type=''
1240 u32size=''
1241 u32type=''
1242 u64size=''
1243 u64type=''
1244 u8size=''
1245 u8type=''
1246 uvsize=''
1247 uvtype=''
1248 ivdformat=''
1249 nvEUformat=''
1250 nvFUformat=''
1251 nvGUformat=''
1252 nveformat=''
1253 nvfformat=''
1254 nvgformat=''
1255 uvXUformat=''
1256 uvoformat=''
1257 uvuformat=''
1258 uvxformat=''
1259 pidtype=''
1260 prefix=''
1261 prefixexp=''
1262 installprivlib=''
1263 privlib=''
1264 privlibexp=''
1265 ptrsize=''
1266 d_PRIXU64=''
1267 d_PRId64=''
1268 d_PRIi64=''
1269 d_PRIo64=''
1270 d_PRIu64=''
1271 d_PRIx64=''
1272 sPRIXU64=''
1273 sPRId64=''
1274 sPRIi64=''
1275 sPRIo64=''
1276 sPRIu64=''
1277 sPRIx64=''
1278 d_quad=''
1279 quadkind=''
1280 quadtype=''
1281 uquadtype=''
1282 drand01=''
1283 randbits=''
1284 randfunc=''
1285 randseedtype=''
1286 seedfunc=''
1287 installscript=''
1288 scriptdir=''
1289 scriptdirexp=''
1290 selectminbits=''
1291 selecttype=''
1292 sh=''
1293 targetsh=''
1294 sig_count=''
1295 sig_name=''
1296 sig_name_init=''
1297 sig_num=''
1298 sig_num_init=''
1299 sig_size=''
1300 d_sitearch=''
1301 installsitearch=''
1302 sitearch=''
1303 sitearchexp=''
1304 installsitebin=''
1305 sitebin=''
1306 sitebinexp=''
1307 installsitehtml1dir=''
1308 sitehtml1dir=''
1309 sitehtml1direxp=''
1310 installsitehtml3dir=''
1311 sitehtml3dir=''
1312 sitehtml3direxp=''
1313 installsitelib=''
1314 sitelib=''
1315 sitelib_stem=''
1316 sitelibexp=''
1317 installsiteman1dir=''
1318 siteman1dir=''
1319 siteman1direxp=''
1320 installsiteman3dir=''
1321 siteman3dir=''
1322 siteman3direxp=''
1323 siteprefix=''
1324 siteprefixexp=''
1325 installsitescript=''
1326 sitescript=''
1327 sitescriptexp=''
1328 sizesize=''
1329 sizetype=''
1330 d_libname_unique=''
1331 so=''
1332 socksizetype=''
1333 sharpbang=''
1334 shsharp=''
1335 spitshell=''
1336 src=''
1337 ssizetype=''
1338 st_dev_sign=''
1339 st_dev_size=''
1340 st_ino_sign=''
1341 st_ino_size=''
1342 startperl=''
1343 startsh=''
1344 stdchar=''
1345 d_stdio_stream_array=''
1346 stdio_stream_array=''
1347 sysman=''
1348 sGMTIME_max=''
1349 sGMTIME_min=''
1350 sLOCALTIME_max=''
1351 sLOCALTIME_min=''
1352 trnl=''
1353 uidformat=''
1354 uidsign=''
1355 uidsize=''
1356 uidtype=''
1357 archname64=''
1358 use64bitall=''
1359 use64bitint=''
1360 usecbacktrace=''
1361 usedefaultstrict=''
1362 dtrace=''
1363 usedtrace=''
1364 usefaststdio=''
1365 usekernprocpathname=''
1366 ccflags_uselargefiles=''
1367 ldflags_uselargefiles=''
1368 libswanted_uselargefiles=''
1369 uselargefiles=''
1370 uselongdouble=''
1371 usemorebits=''
1372 usemultiplicity=''
1373 nm_opt=''
1374 nm_so_opt=''
1375 runnm=''
1376 usenm=''
1377 usensgetexecutablepath=''
1378 useperlio=''
1379 usequadmath=''
1380 usesocks=''
1381 d_oldpthreads=''
1382 useithreads=''
1383 usereentrant=''
1384 usethreads=''
1385 incpath=''
1386 mips_type=''
1387 usrinc=''
1388 d_vendorarch=''
1389 installvendorarch=''
1390 vendorarch=''
1391 vendorarchexp=''
1392 d_vendorbin=''
1393 installvendorbin=''
1394 vendorbin=''
1395 vendorbinexp=''
1396 installvendorhtml1dir=''
1397 vendorhtml1dir=''
1398 vendorhtml1direxp=''
1399 installvendorhtml3dir=''
1400 vendorhtml3dir=''
1401 vendorhtml3direxp=''
1402 d_vendorlib=''
1403 installvendorlib=''
1404 vendorlib=''
1405 vendorlib_stem=''
1406 vendorlibexp=''
1407 installvendorman1dir=''
1408 vendorman1dir=''
1409 vendorman1direxp=''
1410 installvendorman3dir=''
1411 vendorman3dir=''
1412 vendorman3direxp=''
1413 usevendorprefix=''
1414 vendorprefix=''
1415 vendorprefixexp=''
1416 d_vendorscript=''
1417 installvendorscript=''
1418 vendorscript=''
1419 vendorscriptexp=''
1420 versiononly=''
1421 yacc=''
1422 yaccflags=''
1423 CONFIG=''
1424
1425 : Detect odd OSs
1426 define='define'
1427 undef='undef'
1428 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1429 rmlist=''
1430
1431 : We must find out about Eunice early
1432 eunicefix=':'
1433 if test -f /etc/unixtovms; then
1434 eunicefix=/etc/unixtovms
1435 fi
1436 if test -f /etc/unixtovms.exe; then
1437 eunicefix=/etc/unixtovms.exe
1438 fi
1439
1440 : Set executable suffix now -- needed before hints available
1441 if test -f "/libs/version.library"; then
1442 : Amiga OS
1443 _exe=""
1444 elif test -f "/system/gnu_library/bin/ar.pm"; then
1445 : Stratus VOS
1446 _exe=".pm"
1447 elif test -n "$DJGPP"; then
1448 : DOS DJGPP
1449 _exe=".exe"
1450 elif test -f /kern/cookiejar; then
1451 : MiNT
1452 _exe=""
1453 elif test -d c:/. -o -n "$is_os2" ; then
1454 : OS/2 or cygwin
1455 _exe=".exe"
1456 fi
1457
1458 groupstype=''
1459 i_whoami=''
1460 : Possible local include directories to search.
1461 : Set locincpth to "" in a hint file to defeat local include searches.
1462 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1463 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1464 :
1465 : no include file wanted by default
1466 inclwanted=''
1467
1468 : Enable -DEBUGGING and -DDEBUGGING from the command line
1469 EBUGGING=''
1470 DEBUGGING=''
1471
1472 : Trailing extension. Override this in a hint file, if needed.
1473 : Extra object files, if any, needed on this platform.
1474 archobjs=''
1475 libnames=''
1476 : change the next line if compiling for Xenix/286 on Xenix/386
1477 xlibpth='/usr/lib/386 /lib/386'
1478 : Possible local library directories to search.
1479 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1480 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1481
1482 : general looking path for locating libraries
1483 glibpth="/lib /usr/lib $xlibpth"
1484 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1485 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1486 test -f /shlib/libc.so && glibpth="/shlib $glibpth"
1487
1488 : Private path used by Configure to find libraries. Its value
1489 : is prepended to libpth. This variable takes care of special
1490 : machines, like the mips. Usually, it should be empty.
1491 plibpth=''
1492
1493 : default library list
1494 libswanted=''
1495 : some systems want to use only the non-versioned libso:s
1496 ignore_versioned_solibs=''
1497 ccname=''
1498 ccversion=''
1499 perllibs=''
1500 : set useposix=false in your hint file to disable the POSIX extension.
1501 useposix=true
1502 : set useopcode=false in your hint file to disable the Opcode extension.
1503 useopcode=true
1504 : set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
1505 uselanginfo=true
1506 archname64=''
1507 ccflags_uselargefiles=''
1508 ldflags_uselargefiles=''
1509 libswanted_uselargefiles=''
1510 : set usemultiplicity on the Configure command line to enable multiplicity.
1511 : set usesocks on the Configure command line to enable socks.
1512 archname=''
1513 : set usethreads on the Configure command line to enable threads.
1514 usereentrant='undef'
1515 : List of libraries we want.
1516 : If anyone needs extra -lxxx, put those in a hint file.
1517 libswanted='gdbm gdbm_compat db dl m c crypt'
1518 : We probably want to search /usr/shlib before most other libraries.
1519 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1520 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1521 glibpth="/usr/shlib $glibpth"
1522 : Do not use vfork unless overridden by a hint file.
1523 usevfork=false
1524
1525 : Find the basic shell for Bourne shell scripts
1526 case "$sh" in
1527 '')
1528 case "$SYSTYPE" in
1529 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1530 *) xxx='/bin/sh';;
1531 esac
1532 if test -f "$xxx"; then
1533 sh="$xxx"
1534 else
1535 : Build up a list and do a single loop so we can 'break' out.
1536 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1537 for xxx in sh bash ksh pdksh ash; do
1538 for p in $pth; do
1539 try="$try ${p}/${xxx}"
1540 done
1541 done
1542 for xxx in $try; do
1543 if test -f "$xxx"; then
1544 sh="$xxx";
1545 break
1546 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1547 sh="$xxx";
1548 break
1549 elif test -f "$xxx.exe"; then
1550 sh="$xxx";
1551 break
1552 fi
1553 done
1554 fi
1555 ;;
1556 esac
1557
1558 case "$sh" in
1559 '') cat >&2 <<EOM
1560 $me: Fatal Error: I can't find a Bourne Shell anywhere.
1561
1562 Usually it's in /bin/sh. How did you even get this far?
1563 Please report this issue at https://github.com/Perl/perl5/issues
1564 and we'll try to straighten this all out.
1565 EOM
1566 exit 1
1567 ;;
1568 esac
1569
1570 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1571 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1572 targetsh=$sh
1573
1574 : see if sh knows # comments
1575 if `$sh -c '#' >/dev/null 2>&1`; then
1576 shsharp=true
1577 spitshell=cat
1578 xcat=/bin/cat
1579 test -f $xcat$_exe || xcat=/usr/bin/cat
1580 if test ! -f $xcat$_exe; then
1581 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1582 if test -f $p/cat$_exe; then
1583 xcat=$p/cat
1584 break
1585 fi
1586 done
1587 if test ! -f $xcat$_exe; then
1588 echo "Can't find cat anywhere!"
1589 exit 1
1590 fi
1591 fi
1592 echo "#!$xcat" >sharp
1593 $eunicefix sharp
1594 chmod +x sharp
1595 ./sharp > today 2>/dev/null
1596 if test -s today; then
1597 sharpbang='#!'
1598 else
1599 echo "#! $xcat" > sharp
1600 $eunicefix sharp
1601 chmod +x sharp
1602 ./sharp > today 2>/dev/null
1603 if test -s today; then
1604 sharpbang='#! '
1605 else
1606 sharpbang=': use '
1607 fi
1608 fi
1609 else
1610 echo " "
1611 echo "Your $sh doesn't grok # comments--I will strip them later on."
1612 shsharp=false
1613 cd ..
1614 echo "exec grep -v '^[ ]*#'" >spitshell
1615 chmod +x spitshell
1616 $eunicefix spitshell
1617 spitshell=`pwd`/spitshell
1618 cd UU
1619 echo "I presume that if # doesn't work, #! won't work either!"
1620 sharpbang=': use '
1621 fi
1622 rm -f sharp today
1623
1624 : figure out how to guarantee sh startup
1625 case "$startsh" in
1626 '') startsh=${sharpbang}${sh} ;;
1627 *)
1628 esac
1629 cat >sharp <<EOSS
1630 $startsh
1631 set abc
1632 test "$?abc" != 1
1633 EOSS
1634
1635 chmod +x sharp
1636 $eunicefix sharp
1637 if ./sharp; then
1638 : echo "Yup, it does."
1639 else
1640 echo "Hmm... '$startsh' does not guarantee sh startup..."
1641 echo "You may have to fix up the shell scripts to make sure $sh runs them."
1642 fi
1643 rm -f sharp
1644
1645 : Save command line options in file UU/cmdline.opt for later use in
1646 : generating config.sh.
1647 cat > cmdline.opt <<EOSH
1648 : Configure command line arguments.
1649 config_arg0='$0'
1650 config_args='$*'
1651 config_argc=$#
1652 EOSH
1653 argn=1
1654 args_exp=''
1655 args_sep=''
1656 for arg in "$@"; do
1657 cat >>cmdline.opt <<EOSH
1658 config_arg$argn='$arg'
1659 EOSH
1660 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1661 $arg
1662 EOC
1663 arg_exp=`cat cmdl.opt`
1664 args_exp="$args_exp$args_sep'$arg_exp'"
1665 argn=`expr $argn + 1`
1666 args_sep=' '
1667 done
1668 rm -f cmdl.opt
1669
1670 : produce awk script to parse command line options
1671 cat >options.awk <<'EOF'
1672 BEGIN {
1673 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
1674
1675 len = length(optstr);
1676 for (i = 1; i <= len; i++) {
1677 c = substr(optstr, i, 1);
1678 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1679 if (a == ":") {
1680 arg[c] = 1;
1681 i++;
1682 }
1683 opt[c] = 1;
1684 }
1685 }
1686 {
1687 expect = 0;
1688 str = $0;
1689 if (substr(str, 1, 1) != "-") {
1690 printf("'%s'\n", str);
1691 next;
1692 }
1693 len = length($0);
1694 for (i = 2; i <= len; i++) {
1695 c = substr(str, i, 1);
1696 if (!opt[c]) {
1697 printf("-%s\n", substr(str, i));
1698 next;
1699 }
1700 printf("-%s\n", c);
1701 if (arg[c]) {
1702 if (i < len)
1703 printf("'%s'\n", substr(str, i + 1));
1704 else
1705 expect = 1;
1706 next;
1707 }
1708 }
1709 }
1710 END {
1711 if (expect)
1712 print "?";
1713 }
1714 EOF
1715
1716 : process the command line options
1717 set X `for arg in "$@"; do echo "X$arg"; done |
1718 sed -e s/X// | awk -f options.awk`
1719 eval "set $*"
1720 shift
1721 rm -f options.awk
1722
1723 : set up default values
1724 fastread=''
1725 reuseval=false
1726 config_sh=''
1727 alldone=''
1728 error=''
1729 silent=''
1730 extractsh=''
1731 knowitall=''
1732 rm -f optdef.sh posthint.sh
1733 cat >optdef.sh <<EOS
1734 $startsh
1735 EOS
1736
1737
1738 : option parsing
1739 while test $# -gt 0; do
1740 case "$1" in
1741 -d) shift; fastread=yes;;
1742 -e) shift; alldone=cont;;
1743 -f)
1744 shift
1745 cd ..
1746 if test -r "$1"; then
1747 config_sh="$1"
1748 else
1749 echo "$me: cannot read config file $1." >&2
1750 error=true
1751 fi
1752 cd UU
1753 shift;;
1754 --help|\
1755 -h) shift; error=true;;
1756 -r) shift; reuseval=true;;
1757 -s) shift; silent=true; realsilent=true;;
1758 -E) shift; alldone=exit;;
1759 -K) shift; knowitall=true;;
1760 -O) shift;;
1761 -S) shift; silent=true; extractsh=true;;
1762 -D)
1763 shift
1764 case "$1" in
1765 *=)
1766 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1767 echo "$me: ignoring -D $1" >&2
1768 ;;
1769 *=*) echo "$1" | \
1770 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1771 *) echo "$1='define'" >> optdef.sh;;
1772 esac
1773 shift
1774 ;;
1775 -U)
1776 shift
1777 case "$1" in
1778 *=) echo "$1" >> optdef.sh;;
1779 *=*)
1780 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1781 echo "$me: ignoring -U $1" >&2
1782 ;;
1783 *) echo "$1='undef'" >> optdef.sh;;
1784 esac
1785 shift
1786 ;;
1787 -A)
1788 shift
1789 xxx=''
1790 yyy="$1"
1791 zzz=''
1792 uuu=undef
1793 case "$yyy" in
1794 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1795 case "$zzz" in
1796 *:*) zzz='' ;;
1797 *) xxx=append
1798 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1799 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1800 esac
1801 ;;
1802 esac
1803 case "$xxx" in
1804 '') case "$yyy" in
1805 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1806 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1807 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1808 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1809 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1810 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1811 esac
1812 ;;
1813 esac
1814 case "$xxx" in
1815 append)
1816 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
1817 clear)
1818 echo "$yyy=''" >> posthint.sh ;;
1819 define)
1820 case "$zzz" in
1821 '') zzz=define ;;
1822 esac
1823 echo "$yyy='$zzz'" >> posthint.sh ;;
1824 eval)
1825 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
1826 prepend)
1827 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
1828 undef)
1829 case "$zzz" in
1830 '') zzz="$uuu" ;;
1831 esac
1832 echo "$yyy=$zzz" >> posthint.sh ;;
1833 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1834 esac
1835 shift
1836 ;;
1837 -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1838 exit 0;;
1839 --) break;;
1840 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1841 *) break;;
1842 esac
1843 done
1844
1845 case "$error" in
1846 true)
1847 cat >&2 <<EOM
1848 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1849 [-U symbol] [-U symbol=] [-A command:symbol...]
1850 -d : use defaults for all answers.
1851 -e : go on without questioning past the production of config.sh.
1852 -f : specify an alternate default configuration file.
1853 -h : print this help message and exit (with an error status).
1854 -r : reuse C symbols value if possible (skips costly nm extraction).
1855 -s : silent mode, only echoes questions and essential information.
1856 -D : define symbol to have some value:
1857 -D symbol symbol gets the value 'define'
1858 -D symbol='some value' symbol is set to 'some value'
1859 common used examples (see INSTALL for more info):
1860 -Duse64bitint use 64bit integers
1861 -Duse64bitall use 64bit integers and pointers
1862 -Dusethreads use thread support
1863 -Dinc_version_list=none do not include older perl trees in @INC
1864 -DEBUGGING=none DEBUGGING options
1865 -Dcc=gcc choose your compiler
1866 -Dprefix=/opt/perl5 choose your destination
1867 -E : stop at the end of questions, after having produced config.sh.
1868 -K : do not use unless you know what you are doing.
1869 -O : ignored for backward compatibility
1870 -S : perform variable substitutions on all .SH files (can mix with -f)
1871 -U : undefine symbol:
1872 -U symbol symbol gets the value 'undef'
1873 -U symbol= symbol gets completely empty
1874 e.g.: -Uversiononly
1875 -A : manipulate symbol after the platform specific hints have been applied:
1876 -A append:symbol=value append value to symbol
1877 -A symbol=value like append:, but with a separating space
1878 -A define:symbol=value define symbol to have value
1879 -A clear:symbol define symbol to be ''
1880 -A define:symbol define symbol to be 'define'
1881 -A eval:symbol=value define symbol to be eval of value
1882 -A prepend:symbol=value prepend value to symbol
1883 -A undef:symbol define symbol to be 'undef'
1884 -A undef:symbol= define symbol to be ''
1885 e.g.: -A prepend:libswanted='cl pthread '
1886 -A ccflags=-DSOME_MACRO
1887 -V : print version number and exit (with a zero status).
1888 EOM
1889 exit 1
1890 ;;
1891 esac
1892
1893 : Sanity checks
1894 case "$fastread$alldone" in
1895 yescont|yesexit) ;;
1896 *)
1897 case "$extractsh" in
1898 true) ;;
1899 *)
1900 if test ! -t 0; then
1901 echo "Say 'sh Configure', not 'sh <Configure'"
1902 exit 1
1903 fi
1904 ;;
1905 esac
1906 ;;
1907 esac
1908
1909 exec 4>&1
1910 case "$silent" in
1911 true) exec 1>/dev/null;;
1912 esac
1913
1914 : run the defines and the undefines, if any, but leave the file out there...
1915 touch optdef.sh
1916 grep '\\' optdef.sh >/dev/null 2>&1
1917 if test $? = 0; then
1918 echo "Configure does not support \\ in -D arguments"
1919 exit 1
1920 fi
1921 . ./optdef.sh
1922 : create the posthint manipulation script and leave the file out there...
1923 touch posthint.sh
1924
1925 : set package name
1926 package='perl5'
1927 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1928 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1929 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1930 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1931 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1932 esac
1933
1934 : Some greps do not return status, grrr.
1935 echo "grimblepritz" >grimble
1936 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1937 contains=contains
1938 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1939 contains=grep
1940 else
1941 contains=contains
1942 fi
1943 rm -f grimble
1944 : the following should work in any shell
1945 case "$contains" in
1946 contains*)
1947 echo " " >&4
1948 echo "AGH! Grep doesn't return a status. Attempting remedial action." >&4
1949 cat >contains <<'EOSS'
1950 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1951 EOSS
1952 contains=./contains
1953 chmod +x $contains
1954 esac
1955
1956 : Find the path to the source tree
1957 case "$src" in
1958 '') case "$0" in
1959 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1960 case "$src" in
1961 /*) ;;
1962 .) ;;
1963 *) src=`cd ../$src && pwd` ;;
1964 esac
1965 ;;
1966 *) src='.';;
1967 esac;;
1968 esac
1969 case "$src" in
1970 '') src=/
1971 rsrc=/
1972 ;;
1973 /*) rsrc="$src";;
1974 *) rsrc="../$src";;
1975 esac
1976 if test -f $rsrc/Configure && \
1977 $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1978 then
1979 : found it, so we are ok.
1980 else
1981 rsrc=''
1982 for src in . .. ../.. ../../.. ../../../..; do
1983 if test -f ../$src/Configure && \
1984 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1985 then
1986 rsrc=../$src
1987 break
1988 fi
1989 done
1990 fi
1991 case "$rsrc" in
1992 '')
1993 cat <<EOM >&4
1994
1995 Sorry, I can't seem to locate the source dir for $package. Please start
1996 Configure with an explicit path -- i.e. /some/path/Configure.
1997
1998 EOM
1999 exit 1
2000 ;;
2001 ../.) rsrc='..';;
2002 *)
2003 echo " "
2004 echo "Sources for $package found in \"$src\"." >&4
2005 ;;
2006 esac
2007
2008 : script used to extract .SH files with variable substitutions
2009 cat >extract <<'EOS'
2010 PERL_CONFIG_SH=true
2011 echo "Doing variable substitutions on .SH files..."
2012 if test -f MANIFEST; then
2013 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
2014 else
2015 echo "(Looking for .SH files under the source directory.)"
2016 set x `(cd "$src"; find . -name "*.SH" -print)`
2017 fi
2018 shift
2019 case $# in
2020 0) set x `(cd "$src"; echo *.SH)`; shift;;
2021 esac
2022 if test ! -f "$src/$1"; then
2023 shift
2024 fi
2025 mkdir_p='
2026 name=$1;
2027 create="";
2028 while test $name; do
2029 if test ! -d "$name"; then
2030 create="$name $create";
2031 name=`echo $name | sed -e "s|^[^/]*$||"`;
2032 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2033 else
2034 name="";
2035 fi;
2036 done;
2037 for file in $create; do
2038 mkdir $file;
2039 done
2040 '
2041 for file in $*; do
2042 case "$src" in
2043 ".")
2044 case "$file" in
2045 */*)
2046 dir=`expr X$file : 'X\(.*\)/'`
2047 file=`expr X$file : 'X.*/\(.*\)'`
2048 (cd "$dir" && . ./$file)
2049 ;;
2050 *)
2051 . ./$file
2052 ;;
2053 esac
2054 ;;
2055 *)
2056 case "$file" in
2057 */*)
2058 dir=`expr X$file : 'X\(.*\)/'`
2059 file=`expr X$file : 'X.*/\(.*\)'`
2060 (set x $dir; shift; eval $mkdir_p)
2061 sh <"$src/$dir/$file"
2062 ;;
2063 *)
2064 sh <"$src/$file"
2065 ;;
2066 esac
2067 ;;
2068 esac
2069 done
2070 if test -f "$src/config_h.SH"; then
2071 if test ! -f config.h; then
2072 : oops, they left it out of MANIFEST, probably, so do it anyway.
2073 . "$src/config_h.SH"
2074 fi
2075 fi
2076 EOS
2077
2078 : extract files and exit if asked to do so
2079 case "$extractsh" in
2080 true)
2081 case "$realsilent" in
2082 true) ;;
2083 *) exec 1>&4;;
2084 esac
2085 case "$config_sh" in
2086 '') config_sh='config.sh';;
2087 esac
2088 echo " "
2089 echo "Fetching answers from $config_sh..."
2090 cd ..
2091 . $config_sh
2092 . UU/optdef.sh
2093 echo " "
2094 . UU/extract
2095 rm -rf UU
2096 echo "Extraction done."
2097 exit 0
2098 ;;
2099 esac
2100
2101 : Eunice requires " " instead of "", can you believe it
2102 echo " "
2103 : Here we go...
2104 echo "Beginning of configuration questions for $package."
2105
2106 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2107
2108 : first determine how to suppress newline on echo command
2109 echo " "
2110 echo "Checking echo to see how to suppress newlines..."
2111 (echo "hi there\c" ; echo " ") >.echotmp
2112 if $contains c .echotmp >/dev/null 2>&1 ; then
2113 echo "...using -n."
2114 n='-n'
2115 c=''
2116 else
2117 cat <<'EOM'
2118 ...using \c
2119 EOM
2120 n=''
2121 c='\c'
2122 fi
2123 echo $n "The star should be here-->$c"
2124 echo '*'
2125 rm -f .echotmp
2126
2127 : Now test for existence of everything in MANIFEST
2128 echo " "
2129 if test -f "$rsrc/MANIFEST"; then
2130 echo "First let's make sure your kit is complete. Checking..." >&4
2131 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2132 (split -l 50 2>/dev/null || split -50)
2133 rm -f missing
2134 tmppwd=`pwd`
2135 for filelist in x??; do
2136 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2137 >/dev/null 2>>"$tmppwd/missing")
2138 done
2139 if test -s missing; then
2140 cat missing >&4
2141 cat >&4 <<'EOM'
2142
2143 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2144
2145 You have the option of continuing the configuration process, despite the
2146 distinct possibility that your kit is damaged, by typing 'y'es. If you
2147 do, don't blame me if something goes wrong. I advise you to type 'n'o
2148 and contact the author (https://github.com/Perl/perl5/issues).
2149
2150 EOM
2151 echo $n "Continue? [n] $c" >&4
2152 read ans
2153 case "$ans" in
2154 y*)
2155 echo "Continuing..." >&4
2156 rm -f missing
2157 ;;
2158 *)
2159 echo "ABORTING..." >&4
2160 kill $$
2161 ;;
2162 esac
2163 else
2164 echo "Looks good..."
2165 fi
2166 else
2167 echo "There is no MANIFEST file. I hope your kit is complete !"
2168 fi
2169 rm -f missing x??
2170
2171 : Find the appropriate value for a newline for tr
2172 if test -n "$DJGPP"; then
2173 trnl='\012'
2174 fi
2175 if test X"$trnl" = X; then
2176 case "`echo foo | tr '\n' x 2>/dev/null`" in
2177 foox) trnl='\n' ;;
2178 esac
2179 fi
2180 if test X"$trnl" = X; then
2181 case "`echo foo | tr '\012' x 2>/dev/null`" in
2182 foox) trnl='\012' ;;
2183 esac
2184 fi
2185 if test X"$trnl" = X; then
2186 case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2187 fooxy) trnl='\n\r' ;;
2188 esac
2189 fi
2190 if test X"$trnl" = X; then
2191 cat <<EOM >&2
2192
2193 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2194
2195 EOM
2196 exit 1
2197 fi
2198
2199 : compute the number of columns on the terminal for proper question formatting
2200 case "$COLUMNS" in
2201 '') COLUMNS='80';;
2202 esac
2203
2204 : set up the echo used in my read
2205 myecho="case \"\$xxxm\" in
2206 '') echo $n \"\$rp $c\" >&4;;
2207 *) case \"\$rp\" in
2208 '') echo $n \"[\$xxxm] $c\";;
2209 *)
2210 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2211 echo \"\$rp\" >&4
2212 echo $n \"[\$xxxm] $c\" >&4
2213 else
2214 echo $n \"\$rp [\$xxxm] $c\" >&4
2215 fi
2216 ;;
2217 esac;;
2218 esac"
2219
2220 : now set up to do reads with possible shell escape and default assignment
2221 cat <<EOSC >myread
2222 $startsh
2223 xxxm=\$dflt
2224 $myecho
2225 ans='!'
2226 counter=42
2227 case "\$fastread" in
2228 yes) case "\$dflt" in
2229 '') ;;
2230 *) ans='';
2231 case "\$silent-\$rp" in
2232 true-) ;;
2233 *) echo " " >&4;;
2234 esac;;
2235 esac;;
2236 *) case "\$silent" in
2237 true) case "\$rp" in
2238 '') ans='';;
2239 esac;;
2240 esac;;
2241 esac
2242 while expr "X\$ans" : "X!" >/dev/null; do
2243 read answ
2244 set x \$xxxm
2245 shift
2246 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2247 case "\$answ" in
2248 "!")
2249 sh 1>&4
2250 echo " "
2251 $myecho
2252 ;;
2253 !*)
2254 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2255 shift
2256 sh 1>&4 -c "\$*"
2257 echo " "
2258 $myecho
2259 ;;
2260 "\$ans")
2261 case "\$ans" in
2262 \\&*)
2263 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2264 shift
2265 case "\$1" in
2266 -d)
2267 fastread=yes
2268 echo "(OK, I'll run with -d after this question.)" >&4
2269 ;;
2270 -*)
2271 echo "*** Sorry, \$1 not supported yet." >&4
2272 ;;
2273 esac
2274 $myecho
2275 ans=!
2276 ;;
2277 esac;;
2278 *)
2279 case "\$aok" in
2280 y)
2281 echo "*** Substitution done -- please confirm."
2282 xxxm="\$ans"
2283 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2284 xxxm="\$ans"
2285 ans=!
2286 ;;
2287 *)
2288 echo "*** Error -- try again."
2289 ans=!
2290 ;;
2291 esac
2292 $myecho
2293 ;;
2294 esac
2295 case "\$ans\$xxxm\$nostick" in
2296 '')
2297 ans=!
2298 $myecho
2299 ;;
2300 esac
2301 counter=\`echo \$counter | awk '{ print --\$0 }'\`
2302 if [ \$counter = 0 ]; then
2303 echo >&4
2304 echo >&4 Too many attempts asking the same question. Giving up.
2305 exit 1
2306 fi
2307 done
2308 case "\$ans" in
2309 '') ans="\$xxxm";;
2310 esac
2311 EOSC
2312
2313 : create .config dir to save info across Configure sessions
2314 test -d ../.config || mkdir ../.config
2315 cat >../.config/README <<EOF
2316 This directory created by Configure to save information that should
2317 persist across sessions for $package.
2318
2319 You may safely delete it if you wish.
2320 EOF
2321
2322 : See if we are using a devel version and want that
2323 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2324 case "$usedevel" in
2325 $define|true|[yY]*)
2326 usedevel="$define" ;;
2327 *) case "$xversion" in
2328 *[13579])
2329 cat >&4 <<EOH
2330 *** WHOA THERE!!! ***
2331
2332 This is an UNSTABLE DEVELOPMENT release.
2333 The version of this $package distribution is $xversion, that is, odd,
2334 (as opposed to even) and that signifies a development release.
2335 If you want a maintenance release, you want an even-numbered version.
2336
2337 Do ***NOT*** install this into production use.
2338 Data corruption and crashes are possible.
2339
2340 It is most seriously suggested that you do not continue any further
2341 unless you want to help in developing and debugging Perl.
2342
2343 If you *still* want to build perl, you can answer 'y' now,
2344 or pass -Dusedevel to Configure.
2345
2346 EOH
2347 rp='Do you really want to continue?'
2348 dflt='n'
2349 . ./myread
2350 case "$ans" in
2351 [yY]) echo >&4 "Okay, continuing."
2352 usedevel="$define" ;;
2353 *) echo >&4 "Okay, bye."
2354 exit 1
2355 ;;
2356 esac
2357 ;;
2358 esac
2359 usedevel="$undef"
2360 ;;
2361 esac
2362 case "$usedevel" in
2363 $define|true|[yY]*)
2364 case "$versiononly" in
2365 '') versiononly="$define" ;;
2366 esac
2367 case "$installusrbinperl" in
2368 '') installusrbinperl="$undef" ;;
2369 esac
2370 ;;
2371 esac
2372
2373 : general instructions
2374 needman=true
2375 firsttime=true
2376 user=`(logname) 2>/dev/null`
2377 case "$user" in
2378 '') user=`whoami 2>&1`;;
2379 esac
2380 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2381 firsttime=false
2382 echo " "
2383 rp='Would you like to see the instructions?'
2384 dflt=n
2385 . ./myread
2386 case "$ans" in
2387 [yY]*) ;;
2388 *) needman=false;;
2389 esac
2390 fi
2391 if $needman; then
2392 cat <<EOH
2393
2394 This installation shell script will examine your system and ask you questions
2395 to determine how the perl5 package should be installed. If you get
2396 stuck on a question, you may use a ! shell escape to start a subshell or
2397 execute a command. Many of the questions will have default answers in square
2398 brackets; typing carriage return will give you the default.
2399
2400 On some of the questions which ask for file or directory names you are allowed
2401 to use the ~name construct to specify the login directory belonging to "name",
2402 even if you don't have a shell which knows about that. Questions where this is
2403 allowed will be marked "(~name ok)".
2404
2405 EOH
2406 rp=''
2407 dflt='Type carriage return to continue'
2408 . ./myread
2409 cat <<'EOH'
2410
2411 The prompter used in this script allows you to use shell variables and
2412 backticks in your answers. You may use $1, $2, etc... to refer to the words
2413 in the default answer, as if the default line was a set of arguments given to a
2414 script shell. This means you may also use $* to repeat the whole default line,
2415 so you do not have to re-type everything to add something to the default.
2416
2417 Every time there is a substitution, you will have to confirm. If there is an
2418 error (e.g. an unmatched backtick), the default answer will remain unchanged
2419 and you will be prompted again.
2420
2421 If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2422 the questions and use the computed defaults (or the previous answers if there
2423 was already a config.sh file). Type 'Configure -h' for a list of options.
2424 You may also start interactively and then answer '& -d' at any prompt to turn
2425 on the non-interactive behaviour for the remainder of the execution.
2426
2427 EOH
2428 . ./myread
2429 cat <<EOH
2430
2431 Much effort has been expended to ensure that this shell script will run on any
2432 Unix system. If despite that it blows up on yours, your best bet is to edit
2433 Configure and run it again. If you can't run Configure for some reason,
2434 you'll have to generate a config.sh file by hand. Whatever problems you
2435 have, let me (https://github.com/Perl/perl5/issues) know how I blew it.
2436
2437 This installation script affects things in two ways:
2438
2439 1) it may do direct variable substitutions on some of the files included
2440 in this kit.
2441 2) it builds a config.h file for inclusion in C programs. You may edit
2442 any of these files as the need arises after running this script.
2443
2444 If you make a mistake on a question, there is no easy way to back up to it
2445 currently. The easiest thing to do is to edit config.sh and rerun all the SH
2446 files. Configure will offer to let you do this before it runs the SH files.
2447
2448 EOH
2449 dflt='Type carriage return to continue'
2450 . ./myread
2451 case "$firsttime" in
2452 true) echo $user >>../.config/instruct;;
2453 esac
2454 fi
2455
2456 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2457 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2458 if test "X$sysroot" = X; then
2459 sysroot=""
2460 else
2461 case "$cc" in
2462 *gcc*|*g++*)
2463 echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2464 # _sysroot is used in places where we need --sysroot=foo
2465 # but using the rest of the flags could cause issues.
2466 _sysroot="--sysroot=$sysroot";
2467 case "$ccflags" in
2468 *sysroot*) ;;
2469 'undef'|*)
2470 ccflags="$ccflags $_sysroot"
2471 esac
2472 case "$ldflags" in
2473 *sysroot*) ;;
2474 'undef'|*)
2475 ldflags="$ldflags $_sysroot"
2476 esac
2477 case "$cppflags" in
2478 *sysroot*) ;;
2479 'undef'|*)
2480 cppflags="$cppflags $_sysroot"
2481 esac
2482 # lddlflags updated below in lddlflags section;
2483 # same with cccdlflags
2484 ;;
2485 esac
2486
2487 # Adjust some defaults to also use $sysroot
2488 for var in xlibpth loclibpth locincpth glibpth; do
2489 eval xxx=\$$var
2490 eval $var=''
2491 for path in $xxx; do
2492 eval $var=\"\$$var $sysroot$path\"
2493 done
2494 done
2495
2496 fi
2497
2498 : find out where common programs are
2499 echo " "
2500 echo "Locating common programs..." >&4
2501 cat <<EOSC >loc
2502 $startsh
2503 case \$# in
2504 0) exit 1;;
2505 esac
2506 thing=\$1
2507 shift
2508 dflt=\$1
2509 shift
2510 for dir in \$*; do
2511 case "\$thing" in
2512 .)
2513 if test -d \$dir/\$thing; then
2514 echo \$dir
2515 exit 0
2516 fi
2517 ;;
2518 *)
2519 for thisthing in \$dir/\$thing; do
2520 : just loop through to pick last item
2521 done
2522 if test -f \$thisthing; then
2523 echo \$thisthing
2524 exit 0
2525 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2526 echo \$thisthing
2527 exit 0
2528 elif test -f \$dir/\$thing.exe; then
2529 if test -n "$DJGPP"; then
2530 echo \$dir/\$thing.exe
2531 elif test "$eunicefix" != ":"; then
2532 : on Eunice apparently
2533 echo \$dir/\$thing
2534 fi
2535 exit 0
2536 fi
2537 ;;
2538 esac
2539 done
2540 echo \$dflt
2541 exit 1
2542 EOSC
2543 chmod +x loc
2544 $eunicefix loc
2545 loclist="
2546 awk
2547 cat
2548 chmod
2549 comm
2550 cp
2551 echo
2552 expr
2553 grep
2554 ls
2555 mkdir
2556 rm
2557 sed
2558 sort
2559 touch
2560 tr
2561 uniq
2562 "
2563 trylist="
2564 ar
2565 bison
2566 byacc
2567 cpp
2568 csh
2569 date
2570 egrep
2571 gmake
2572 gzip
2573 less
2574 ln
2575 make
2576 more
2577 nm
2578 nroff
2579 perl
2580 pg
2581 test
2582 uname
2583 zip
2584 "
2585 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2586 pth="$pth $sysroot/lib $sysroot/usr/lib"
2587 for file in $loclist; do
2588 eval xxx=\$$file
2589 case "$xxx" in
2590 /*|?:[\\/]*)
2591 if test -f "$xxx"; then
2592 : ok
2593 else
2594 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2595 xxx=`./loc $file $file $pth`
2596 fi
2597 ;;
2598 '') xxx=`./loc $file $file $pth`;;
2599 *) xxx=`./loc $xxx $xxx $pth`;;
2600 esac
2601 eval $file=$xxx$_exe
2602 eval _$file=$xxx
2603 case "$xxx" in
2604 /*)
2605 echo $file is in $xxx.
2606 ;;
2607 ?:[\\/]*)
2608 echo $file is in $xxx.
2609 ;;
2610 *)
2611 echo "I don't know where '$file' is, and my life depends on it." >&4
2612 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2613
2614 test -f /etc/debian_version && echo "Run \"apt install build-essential\" to install make and friends" >&4
2615 test -f /etc/SUSE-brand && echo "Run \"zypper install 'pattern:devel_C_C++'\" to install make and friends" >&4
2616 test -f /etc/redhat-release && echo "Run \"yum groupinstall 'Development Tools'\" to install make and friends" >&4
2617 test -f /etc/fedora-release && echo "Run \"dnf group install 'Development Tools'\" to install make and friends" >&4
2618 exit 1
2619 ;;
2620 esac
2621 done
2622 echo " "
2623 echo "Don't worry if any of the following aren't found..."
2624 say=offhand
2625 for file in $trylist; do
2626 eval xxx=\$$file
2627 case "$xxx" in
2628 /*|?:[\\/]*)
2629 if test -f "$xxx"; then
2630 : ok
2631 else
2632 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2633 xxx=`./loc $file $file $pth`
2634 fi
2635 ;;
2636 '') xxx=`./loc $file $file $pth`;;
2637 *) xxx=`./loc $xxx $xxx $pth`;;
2638 esac
2639 eval $file=$xxx$_exe
2640 eval _$file=$xxx
2641 case "$xxx" in
2642 /*)
2643 echo $file is in $xxx.
2644 ;;
2645 ?:[\\/]*)
2646 echo $file is in $xxx.
2647 ;;
2648 *)
2649 echo "I don't see $file out there, $say."
2650 say=either
2651 ;;
2652 esac
2653 done
2654 case "$egrep" in
2655 egrep)
2656 echo "Substituting grep for egrep."
2657 egrep=$grep
2658 _egrep=$grep
2659 ;;
2660 esac
2661 case "$less" in
2662 '') ;;
2663 *) if $less -R </dev/null >/dev/null 2>&1; then
2664 echo "Substituting less -R for less."
2665 less="$less -R"
2666 _less=$less
2667 fi
2668 ;;
2669 esac
2670 case "$ln" in
2671 ln)
2672 echo "Substituting cp for ln."
2673 ln=$cp
2674 _ln=$cp
2675 ;;
2676 esac
2677 case "$make" in
2678 make)
2679 case "$gmake" in
2680 gmake)
2681 echo "I can't find make or gmake, and my life depends on it." >&4
2682 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2683 exit 1
2684 ;;
2685 esac
2686 ;;
2687 esac
2688 case "$gmake" in
2689 gmake) ;;
2690 *) # We can't have osname yet.
2691 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2692 # Assume that gmake, if found, is definitely GNU make
2693 # and prefer it over the system make.
2694 echo "Substituting gmake for make."
2695 make=$gmake
2696 _make=$gmake
2697 fi
2698 ;;
2699 esac
2700 case "$test" in
2701 test)
2702 echo "Hopefully test is built into your sh."
2703 ;;
2704 *)
2705 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2706 echo "Using the test built into your sh."
2707 test=test
2708 _test=test
2709 fi
2710 ;;
2711 esac
2712 case "$echo" in
2713 echo)
2714 echo "Hopefully echo is built into your sh."
2715 ;;
2716 '') ;;
2717 *)
2718 echo " "
2719 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2720 $echo $n "hi there$c" >foo1
2721 echo $n "hi there$c" >foo2
2722 if cmp foo1 foo2 >/dev/null 2>&1; then
2723 echo "They are compatible. In fact, they may be identical."
2724 else
2725 case "$n" in
2726 '-n') n='' c='\c';;
2727 *) n='-n' c='';;
2728 esac
2729 cat <<FOO
2730 They are not compatible! You are probably running ksh on a non-USG system.
2731 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2732 have echo built in and we may have to run some Bourne shell scripts. That
2733 means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2734
2735 FOO
2736 $echo $n "The star should be here-->$c"
2737 $echo "*"
2738 fi
2739 $rm -f foo1 foo2
2740 ;;
2741 esac
2742
2743 # This question was auctioned at YAPC::Europe-2007 in Vienna
2744 # I never promised you could answer it. I only auctioned the question.
2745 cat <<FOO
2746 The following message is sponsored by
2747
2748 Dresden.pm<--The stars should be here.
2749
2750 Dear Perl user, system administrator or package
2751 maintainer, the Perl community sends greetings to
2752 you. Do you (emblematical) greet back [Y/n]? n
2753
2754 FOO
2755
2756 : Check what type of C compiler we use
2757 cat <<EOS >trygcc
2758 $startsh
2759 EOS
2760 cat <<'EOSC' >>trygcc
2761 case "$cc" in
2762 '') ;;
2763 *) $rm -f try try.*
2764 $cat >try.c <<EOM
2765 int main(int argc, char *argv[]) {
2766 return 0;
2767 }
2768 EOM
2769 if $cc -o try $ccflags $ldflags try.c; then
2770 :
2771 else
2772 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2773 despair=yes
2774 trygcc=yes
2775 case "$cc" in
2776 *gcc*) trygcc=no ;;
2777 esac
2778 # Skip this test because it gives a false match on output like:
2779 # ./trygcc: line 23: cc: command not found
2780 # case "`$cc -v -c try.c 2>&1`" in
2781 # *gcc*) trygcc=no ;;
2782 # esac
2783 if $test X"$trygcc" = Xyes; then
2784 if gcc -o try -c try.c; then
2785 echo " "
2786 echo "You seem to have a working gcc, though." >&4
2787 # Switching compilers may undo the work of hints files.
2788 # The most common problem is -D_REENTRANT for threads.
2789 # This heuristic catches that case, but gets false positives
2790 # if -Dusethreads was not actually specified. Better to
2791 # bail out here with a useful message than fail
2792 # mysteriously later. Should we perhaps just try to
2793 # re-invoke Configure -Dcc=gcc config_args ?
2794 if $test -f usethreads.cbu; then
2795 $cat >&4 <<EOM
2796
2797 *** However, any setting of the C compiler flags (e.g. for thread support)
2798 *** will be lost. It may be necessary for you to restart Configure and
2799 *** add -Dcc=gcc to your Configure command line.
2800
2801 EOM
2802 rp="Would you like to go ahead and try gcc anyway?"
2803 dflt=n
2804 else
2805 rp="Would you like to use it?"
2806 dflt=y
2807 fi
2808 if $test -f myread; then
2809 . ./myread
2810 else
2811 if $test -f UU/myread; then
2812 . ./UU/myread
2813 else
2814 echo "Cannot find myread, sorry. Aborting." >&4
2815 exit 1
2816 fi
2817 fi
2818 case "$ans" in
2819 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2820 esac
2821 fi
2822 fi
2823 fi
2824 $rm -f try try.*
2825 ;;
2826 esac
2827 EOSC
2828
2829 cat <<EOS >checkcc
2830 $startsh
2831 EOS
2832 cat <<'EOSC' >>checkcc
2833 case "$cc" in
2834 '') ;;
2835 *) $rm -f try try.*
2836 $cat >try.c <<EOM
2837 int main(int argc, char *argv[]) {
2838 return 0;
2839 }
2840 EOM
2841 if $cc -o try $ccflags $ldflags try.c; then
2842 :
2843 else
2844 if $test X"$despair" = Xyes; then
2845 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2846 fi
2847 $cat >&4 <<EOM
2848 You need to find a working C compiler.
2849 Either (purchase and) install the C compiler supplied by your OS vendor,
2850 or for a free C compiler try http://gcc.gnu.org/
2851 I cannot continue any further, aborting.
2852 EOM
2853 exit 1
2854 fi
2855 $rm -f try try.*
2856 ;;
2857 esac
2858 EOSC
2859
2860 : determine whether symbolic links are supported
2861 echo " "
2862 $touch blurfl
2863 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2864 echo "Symbolic links are supported." >&4
2865 lns="$ln -s"
2866 else
2867 echo "Symbolic links are NOT supported." >&4
2868 lns="$ln"
2869 fi
2870 $rm -f blurfl sym
2871
2872 : determine whether symbolic links are supported
2873 echo " "
2874 case "$lns" in
2875 *"ln"*" -s")
2876 echo "Checking how to test for symbolic links..." >&4
2877 $lns blurfl sym
2878 if $test "X$issymlink" = X; then
2879 case "$newsh" in
2880 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2881 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2882 esac
2883 if test $? = 0; then
2884 issymlink="test -h"
2885 else
2886 echo "Your builtin 'test -h' may be broken." >&4
2887 case "$test" in
2888 /*) ;;
2889 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2890 for p in $pth
2891 do
2892 if test -f "$p/$test"; then
2893 test="$p/$test"
2894 break
2895 fi
2896 done
2897 ;;
2898 esac
2899 case "$test" in
2900 /*)
2901 echo "Trying external '$test -h'." >&4
2902 issymlink="$test -h"
2903 if $test ! -h sym >/dev/null 2>&1; then
2904 echo "External '$test -h' is broken, too." >&4
2905 issymlink=''
2906 fi
2907 ;;
2908 *) issymlink='' ;;
2909 esac
2910 fi
2911 fi
2912 if $test "X$issymlink" = X; then
2913 if $test -L sym 2>/dev/null; then
2914 issymlink="$test -L"
2915 echo "The builtin '$test -L' worked." >&4
2916 fi
2917 fi
2918 if $test "X$issymlink" != X; then
2919 echo "You can test for symbolic links with '$issymlink'." >&4
2920 else
2921 echo "I do not know how you can test for symbolic links." >&4
2922 fi
2923 $rm -f blurfl sym
2924 ;;
2925 *) echo "No symbolic links, so not testing for their testing..." >&4
2926 ;;
2927 esac
2928
2929 : Make symlinks util
2930 case "$mksymlinks" in
2931 $define|true|[yY]*)
2932 case "$src" in
2933 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2934 exit 1
2935 ;;
2936 *) case "$lns:$issymlink" in
2937 *"ln"*" -s:"*"test -"?)
2938 echo "Creating the symbolic links..." >&4
2939 cd ..
2940 awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2941 awk 'NF == 1 {
2942 dir=".";
2943 file=$1 "";
2944 }
2945 NF == 2 {
2946 dir=$1 "";
2947 file=$2 "";
2948 }
2949 {
2950 print "# dir = ", dir, "file = ", file
2951 mf[dir] = mf[dir]" "source"/"dir"/"file;
2952 } END {
2953 for (d in mf) {
2954 if (d != ".") { print("mkdir -p "d) }
2955 print("ln -sf "mf[d]" "d);
2956 }
2957 }' source="$src" > UU/mksymlinks.$$
2958 sh UU/mksymlinks.$$
2959 rm UU/mksymlinks.$$
2960 # Sanity check 1.
2961 if test ! -d t/base; then
2962 echo "Failed to create the subdirectories. Aborting." >&4
2963 exit 1
2964 fi
2965 # Sanity check 2.
2966 if test ! -f t/base/lex.t; then
2967 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
2968 exit 1
2969 fi
2970 if test ! -f win32/win32.c; then
2971 echo "Failed to create the symlinks (win32/win32.c missing). Aborting." >&4
2972 exit 1
2973 fi
2974 cd UU
2975 ;;
2976 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2977 ;;
2978 esac
2979 ;;
2980 esac
2981 ;;
2982 esac
2983
2984 : Check for Cross-Compilation
2985 if $test "X$targethost" = "X"; then
2986 targethost=""
2987 fi
2988 if $test "X$targetenv" = "X"; then
2989 targetenv=""
2990 fi
2991 case "$usecrosscompile" in
2992 $define|true|[yY]*)
2993 $echo "Cross-compiling..."
2994 croak=''
2995 case "$cc" in
2996 *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2997 # arm-linux-androideabi-gcc -> arm-linux-androideabi
2998 # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2999 targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
3000 ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
3001 # leave out ld, choosing it is more complex
3002 nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
3003 ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
3004 # We are in a weird spot. Just before us, some values
3005 # were 'saved', to be restored after the hints are
3006 # run. This means that the changes we made to ar,
3007 # nm and ranlib will get reverted.
3008 # To avoid that, we hijack the saving mechanism and
3009 # have it save our new values.
3010 for file in ar nm ranlib; do
3011 eval xxx=\$$file
3012 eval $file=$xxx$_exe
3013 eval _$file=$xxx
3014 done
3015 ;;
3016 esac
3017 case "$targetarch" in
3018 '') echo "Targetarch not defined." >&4; croak=y ;;
3019 *) echo "Using targetarch $targetarch." >&4 ;;
3020 esac
3021 case "$targethost" in
3022 '') echo "Targethost not defined." >&4; croak=n ;;
3023 *) echo "Using targethost $targethost." >&4
3024 esac
3025 locincpth=' '
3026 loclibpth=' '
3027 case "$croak" in
3028 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
3029 esac
3030 : compile a host miniperl and generate_uudmap, unless we got passed them
3031 if $test "X$hostperl" = X; then
3032 echo "Building host miniperl and generate_uudmap binaries" >&4
3033 before_host=`pwd`
3034 cd ..
3035 cd $src
3036 src=`pwd`
3037 rm -rf $src/host
3038 mkdir $src/host
3039 cd $src/host
3040 $src/Configure -des -Dusedevel -Dmksymlinks
3041 $make miniperl
3042 case "$hostgenerate" in
3043 '') $make generate_uudmap
3044 hostgenerate=$src/host/generate_uudmap
3045 ;;
3046 "$undef") hostgenerate=''
3047 ;;
3048 esac
3049 hostperl=$src/host/miniperl
3050 cd $before_host
3051 fi
3052 hostosname=`$hostperl -le 'print $^O'`
3053 ;;
3054 *)
3055 usecrosscompile="$undef"
3056 ;;
3057 esac
3058
3059 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3060 case "$targethost" in
3061 '') echo "Checking for cross-compile" >&4
3062 case "$usecrosscompile$multiarch" in
3063 *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3064 if [ -f Makefile ]; then
3065 echo " "
3066 echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3067 else
3068 echo "Configure done."
3069 fi
3070 exit 0
3071 ;;
3072 *) echo "No targethost for running compiler tests against defined, running locally" >&4
3073 run=''
3074 to=:
3075 from=:
3076 ;;
3077 esac
3078 ;;
3079 *) echo "Using targethost $targethost." >&4
3080 case "$src" in
3081 /*) run=$src/Cross/run
3082 targetmkdir=$src/Cross/mkdir
3083 to=$src/Cross/to
3084 from=$src/Cross/from
3085 ;;
3086 *) pwd=`$test -f ../Configure & cd ..; pwd`
3087 run=$pwd/Cross/run
3088 targetmkdir=$pwd/Cross/mkdir
3089 to=$pwd/Cross/to
3090 from=$pwd/Cross/from
3091 ;;
3092 esac
3093 case "$targetrun" in
3094 '') targetrun=ssh ;;
3095 esac
3096 case "$targetto" in
3097 '') targetto=scp ;;
3098 esac
3099 case "$targetfrom" in
3100 '') targetfrom=scp ;;
3101 esac
3102 run=$run-$targetrun
3103 to=$to-$targetto
3104 from=$from-$targetfrom
3105 case "$targetdir" in
3106 '') targetdir=/tmp
3107 echo "Guessing targetdir $targetdir." >&4
3108 ;;
3109 esac
3110 case "$targetuser" in
3111 '') targetuser=root
3112 echo "Guessing targetuser $targetuser." >&4
3113 ;;
3114 esac
3115 case "$targetport" in
3116 '') targetport=22
3117 echo "Guessing targetport $targetport." >&4
3118 ;;
3119 esac
3120 case "$targetfrom" in
3121 scp) q=-q ;;
3122 *) q='' ;;
3123 esac
3124 case "$targetrun" in
3125 ssh|rsh)
3126 cat >$run <<EOF
3127 #!/bin/sh
3128 env=''
3129 case "\$1" in
3130 -cwd)
3131 shift
3132 cwd=\$1
3133 shift
3134 ;;
3135 esac
3136 case "\$1" in
3137 -env)
3138 shift
3139 env=\$1
3140 shift
3141 ;;
3142 esac
3143 case "\$cwd" in
3144 '') cwd=$targetdir ;;
3145 esac
3146 exe=\$1
3147 shift
3148 $to \$exe
3149 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3150 EOF
3151 ;;
3152 adb)
3153 $touch $run
3154 ;;
3155 *) echo "Unknown targetrun '$targetrun'" >&4
3156 exit 1
3157 ;;
3158 esac
3159 case "$targetmkdir" in
3160 */Cross/mkdir)
3161 cat >$targetmkdir <<EOF
3162 #!/bin/sh
3163 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3164 EOF
3165 $chmod a+rx $targetmkdir
3166 ;;
3167 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
3168 exit 1
3169 ;;
3170 esac
3171 case "$targetto" in
3172 scp|rcp)
3173 cat >$to <<EOF
3174 #!/bin/sh
3175 for f in \$@
3176 do
3177 case "\$f" in
3178 /*)
3179 $targetmkdir \`dirname \$f\`
3180 $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f 2>/dev/null || exit 1
3181 ;;
3182 *)
3183 $targetmkdir $targetdir/\`dirname \$f\`
3184 $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3185 ;;
3186 esac
3187 done
3188 exit 0
3189 EOF
3190 ;;
3191 cp) cat >$to <<EOF
3192 #!/bin/sh
3193 for f in \$@
3194 do
3195 case "\$f" in
3196 /*)
3197 $mkdir -p $targetdir/\`dirname \$f\`
3198 $cp \$f $targetdir/\$f || exit 1
3199 ;;
3200 *)
3201 $targetmkdir $targetdir/\`dirname \$f\`
3202 $cp \$f $targetdir/\$f || exit 1
3203 ;;
3204 esac
3205 done
3206 exit 0
3207 EOF
3208 ;;
3209 *) echo "Unknown targetto '$targetto'" >&4
3210 exit 1
3211 ;;
3212 esac
3213 case "$targetfrom" in
3214 scp|rcp)
3215 cat >$from <<EOF
3216 #!/bin/sh
3217 for f in \$@
3218 do
3219 $rm -f \$f
3220 $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3221 done
3222 exit 0
3223 EOF
3224 ;;
3225 cp) cat >$from <<EOF
3226 #!/bin/sh
3227 for f in \$@
3228 do
3229 $rm -f \$f
3230 cp $targetdir/\$f . || exit 1
3231 done
3232 exit 0
3233 EOF
3234 ;;
3235 *) echo "Unknown targetfrom '$targetfrom'" >&4
3236 exit 1
3237 ;;
3238 esac
3239 if $test ! -f $run; then
3240 echo "Target 'run' script '$run' not found." >&4
3241 else
3242 $chmod a+rx $run
3243 fi
3244 if $test ! -f $to; then
3245 echo "Target 'to' script '$to' not found." >&4
3246 else
3247 $chmod a+rx $to
3248 fi
3249 if $test ! -f $from; then
3250 echo "Target 'from' script '$from' not found." >&4
3251 else
3252 $chmod a+rx $from
3253 fi
3254 if $test ! -f $run -o ! -f $to -o ! -f $from; then
3255 exit 1
3256 fi
3257 cat >&4 <<EOF
3258 Using '$run' for remote execution,
3259 and '$from' and '$to'
3260 for remote file transfer.
3261 EOF
3262 ;;
3263 *) run=''
3264 to=:
3265 from=:
3266 usecrosscompile="$undef"
3267 targetarch=''
3268 ;;
3269 esac
3270
3271 : see whether [:lower:] and [:upper:] are supported character classes
3272 echo " "
3273 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3274 ABYZ-abyz)
3275 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3276 up='[:upper:]'
3277 low='[:lower:]'
3278 ;;
3279 *) # There is a discontinuity in EBCDIC between 'R' and 'S'
3280 # (0xd9 and 0xe2), therefore that is a nice testing point.
3281 if test "X$up" = X -o "X$low" = X; then
3282 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3283 rs) up='[A-Z]'
3284 low='[a-z]'
3285 ;;
3286 esac
3287 fi
3288 if test "X$up" = X -o "X$low" = X; then
3289 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3290 rs) up='A-Z'
3291 low='a-z'
3292 ;;
3293 esac
3294 fi
3295 if test "X$up" = X -o "X$low" = X; then
3296 case "`echo RS | od -x 2>/dev/null`" in
3297 *D9E2*|*d9e2*)
3298 echo "Hey, this might be EBCDIC." >&4
3299 if test "X$up" = X -o "X$low" = X; then
3300 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3301 rs) up='[A-IJ-RS-Z]'
3302 low='[a-ij-rs-z]'
3303 ;;
3304 esac
3305 fi
3306 if test "X$up" = X -o "X$low" = X; then
3307 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3308 rs) up='A-IJ-RS-Z'
3309 low='a-ij-rs-z'
3310 ;;
3311 esac
3312 fi
3313 ;;
3314 esac
3315 fi
3316 esac
3317 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3318 rs)
3319 echo "Using $up and $low to convert case." >&4
3320 ;;
3321 *)
3322 echo "I don't know how to translate letters from upper to lower case." >&4
3323 echo "Your tr is not acting any way I know of." >&4
3324 exit 1
3325 ;;
3326 esac
3327 : set up the translation script tr, must be called with ./tr of course
3328 cat >tr <<EOSC
3329 $startsh
3330 case "\$1\$2" in
3331 '[A-Z][a-z]') exec $tr '$up' '$low';;
3332 '[a-z][A-Z]') exec $tr '$low' '$up';;
3333 esac
3334 exec $tr "\$@"
3335 EOSC
3336 chmod +x tr
3337 $eunicefix tr
3338
3339 : Try to determine whether config.sh was made on this system
3340 case "$config_sh" in
3341 '')
3342 myuname=`$uname -a 2>/dev/null`
3343 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3344 # Downcase everything to avoid ambiguity.
3345 # Remove slashes and single quotes so we can use parts of this in
3346 # directory and file names.
3347 # Remove newlines so myuname is sane to use elsewhere.
3348 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3349 # because the A-Z/a-z are not consecutive.
3350 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3351 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3352 newmyuname="$myuname"
3353 dflt=n
3354 case "$knowitall" in
3355 '')
3356 if test -f ../config.sh; then
3357 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3358 eval "`grep myuname= ../config.sh`"
3359 fi
3360 if test "X$myuname" = "X$newmyuname"; then
3361 dflt=y
3362 fi
3363 fi
3364 ;;
3365 *) dflt=y;;
3366 esac
3367
3368 : Get old answers from old config file if Configure was run on the
3369 : same system, otherwise use the hints.
3370 hint=default
3371 cd ..
3372 if test -f config.sh; then
3373 echo " "
3374 rp="I see a config.sh file. Shall I use it to set the defaults?"
3375 . UU/myread
3376 case "$ans" in
3377 n*|N*) echo "OK, I'll ignore it."
3378 mv config.sh config.sh.old
3379 myuname="$newmyuname"
3380 ;;
3381 *) echo "Fetching default answers from your old config.sh file..." >&4
3382 tmp_n="$n"
3383 tmp_c="$c"
3384 tmp_sh="$sh"
3385 . ./config.sh
3386 cp config.sh UU
3387 n="$tmp_n"
3388 c="$tmp_c"
3389 : Older versions did not always set $sh. Catch re-use of such
3390 : an old config.sh.
3391 case "$sh" in
3392 '') sh="$tmp_sh" ;;
3393 esac
3394 hint=previous
3395 ;;
3396 esac
3397 fi
3398 . ./UU/checkcc
3399 if test ! -f config.sh; then
3400 $cat <<EOM
3401
3402 First time through, eh? I have some defaults handy for some systems
3403 that need some extra help getting the Configure answers right:
3404
3405 EOM
3406 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
3407 dflt=''
3408 : Half the following guesses are probably wrong... If you have better
3409 : tests or hints, please send them to https://github.com/Perl/perl5/issues
3410 : The metaconfig authors would also appreciate a copy...
3411 $test -f /irix && osname=irix
3412 $test -f /xenix && osname=sco_xenix
3413 $test -f /dynix && osname=dynix
3414 $test -f /dnix && osname=dnix
3415 $test -f /lynx.os && osname=lynxos
3416 $test -f /unicos && osname=unicos && osvers=`$uname -r`
3417 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3418 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3419 $test -f /bin/mips && /bin/mips && osname=mips
3420 $test -d /usr/apollo/bin && osname=apollo
3421 $test -f /etc/saf/_sactab && osname=svr4
3422 $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3423 $test -f /system/gnu_library/bin/ar.pm && osname=vos
3424 $test -f /sys/utilities/MultiView && osname=amigaos
3425 if $test -d /MachTen -o -d /MachTen_Folder; then
3426 osname=machten
3427 if $test -x /sbin/version; then
3428 osvers=`/sbin/version | $awk '{print $2}' |
3429 $sed -e 's/[A-Za-z]$//'`
3430 elif $test -x /usr/etc/version; then
3431 osvers=`/usr/etc/version | $awk '{print $2}' |
3432 $sed -e 's/[A-Za-z]$//'`
3433 else
3434 osvers="$2.$3"
3435 fi
3436 fi
3437
3438 $test -f /sys/posix.dll &&
3439 $test -f /usr/bin/what &&
3440 set X `/usr/bin/what /sys/posix.dll` &&
3441 $test "$3" = UWIN &&
3442 osname=uwin &&
3443 osvers="$5"
3444
3445 if $test -f $uname; then
3446 set X $myuname
3447 shift
3448
3449 case "$5" in
3450 fps*) osname=fps ;;
3451 mips*)
3452 case "$4" in
3453 umips) osname=umips ;;
3454 *) osname=mips ;;
3455 esac;;
3456 [23]100) osname=mips ;;
3457 i386*)
3458 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3459 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3460 osname='sco'
3461 osvers=$tmp
3462 elif $test -f /etc/kconfig; then
3463 osname=isc
3464 if test "$lns" = "$ln -s"; then
3465 osvers=4
3466 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3467 osvers=3
3468 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3469 osvers=2
3470 fi
3471 fi
3472 tmp=''
3473 ;;
3474 pc*)
3475 if test -n "$DJGPP"; then
3476 osname=dos
3477 osvers=djgpp
3478 fi
3479 ;;
3480 esac
3481
3482 case "$1" in
3483 aix) osname=aix
3484 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3485 case "$tmp" in
3486 # oslevel can fail with:
3487 # oslevel: Unable to acquire lock.
3488 *not\ found) osvers="$4"."$3" ;;
3489 '<3240'|'<>3240') osvers=3.2.0 ;;
3490 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3491 '=3250'|'>3250') osvers=3.2.5 ;;
3492 *) osvers=$tmp;;
3493 esac
3494 ;;
3495 bitrig) osname=bitrig
3496 osvers="$3"
3497 ;;
3498 bsd386) osname=bsd386
3499 osvers=`$uname -r`
3500 ;;
3501 cygwin*) osname=cygwin
3502 osvers="$3"
3503 ;;
3504 *dc.osx) osname=dcosx
3505 osvers="$3"
3506 ;;
3507 dnix) osname=dnix
3508 osvers="$3"
3509 ;;
3510 domainos) osname=apollo
3511 osvers="$3"
3512 ;;
3513 dgux) osname=dgux
3514 osvers="$3"
3515 ;;
3516 dragonfly) osname=dragonfly
3517 case "$3" in
3518 [0-9]*) osvers="$3" ;;
3519 *) osvers="$2" ;;
3520 esac
3521 ;;
3522 dynixptx*) osname=dynixptx
3523 osvers=`echo "$4"|sed 's/^v//'`
3524 ;;
3525 freebsd) osname=freebsd
3526 osvers="$3" ;;
3527 genix) osname=genix ;;
3528 gnu) osname=gnu
3529 osvers="$3" ;;
3530 hp*) osname=hpux
3531 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3532 ;;
3533 irix*) osname=irix
3534 case "$3" in
3535 4*) osvers=4 ;;
3536 5*) osvers=5 ;;
3537 *) osvers="$3" ;;
3538 esac
3539 ;;
3540 linux) osname=linux
3541 case "$3" in
3542 *) osvers="$3" ;;
3543 esac
3544 $test -f /system/lib/libandroid.so && osname=linux-android
3545 ;;
3546 MiNT) osname=mint
3547 ;;
3548 minix) osname=minix
3549 osvers=`$uname -r`
3550 ;;
3551 netbsd*) osname=netbsd
3552 osvers="$3"
3553 ;;
3554 news-os) osvers="$3"
3555 case "$3" in
3556 4*) osname=newsos4 ;;
3557 *) osname=newsos ;;
3558 esac
3559 ;;
3560 nonstop-ux) osname=nonstopux ;;
3561 openbsd) osname=openbsd
3562 osvers="$3"
3563 ;;
3564 os2) osname=os2
3565 osvers="$4"
3566 ;;
3567 POSIX-BC | posix-bc ) osname=posix-bc
3568 osvers="$3"
3569 ;;
3570 powerux | power_ux | powermax_os | powermaxos | \
3571 powerunix | power_unix) osname=powerux
3572 osvers="$3"
3573 ;;
3574 qnx) osname=qnx
3575 osvers="$4"
3576 ;;
3577 solaris) osname=solaris
3578 case "$3" in
3579 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3580 *) osvers="$3" ;;
3581 esac
3582 ;;
3583 sunos) osname=sunos
3584 case "$3" in
3585 5*) osname=solaris
3586 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3587 *) osvers="$3" ;;
3588 esac
3589 ;;
3590 titanos) osname=titanos
3591 case "$3" in
3592 1*) osvers=1 ;;
3593 2*) osvers=2 ;;
3594 3*) osvers=3 ;;
3595 4*) osvers=4 ;;
3596 *) osvers="$3" ;;
3597 esac
3598 ;;
3599 ultrix) osname=ultrix
3600 osvers="$3"
3601 ;;
3602 osf1|mls+) case "$5" in
3603 alpha)
3604 osname=dec_osf
3605 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3606 case "$osvers" in
3607 [1-9].[0-9]*) ;;
3608 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3609 esac
3610 ;;
3611 hp*) osname=hp_osf1 ;;
3612 mips) osname=mips_osf1 ;;
3613 esac
3614 ;;
3615 # UnixWare 7.1.2 is known as Open UNIX 8
3616 openunix|unixware) osname=svr5
3617 osvers="$4"
3618 ;;
3619 uts) osname=uts
3620 osvers="$3"
3621 ;;
3622 vos) osvers="$3"
3623 ;;
3624 $2) case "$osname" in
3625 *isc*) ;;
3626 *freebsd*) ;;
3627 svr*)
3628 : svr4.x or possibly later
3629 case "svr$3" in
3630 ${osname}*)
3631 osname=svr$3
3632 osvers=$4
3633 ;;
3634 esac
3635 case "$osname" in
3636 svr4.0)
3637 : Check for ESIX
3638 if test -f /stand/boot ; then
3639 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3640 if test -n "$INITPROG" -a -f "$INITPROG"; then
3641 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3642 if test -n "$isesix"; then
3643 osname=esix4
3644 fi
3645 fi
3646 fi
3647 ;;
3648 esac
3649 ;;
3650 *) if test -f /etc/systemid; then
3651 osname=sco
3652 set `echo $3 | $sed 's/\./ /g'` $4
3653 if $test -f $src/hints/sco_$1_$2_$3.sh; then
3654 osvers=$1.$2.$3
3655 elif $test -f $src/hints/sco_$1_$2.sh; then
3656 osvers=$1.$2
3657 elif $test -f $src/hints/sco_$1.sh; then
3658 osvers=$1
3659 fi
3660 else
3661 case "$osname" in
3662 '') : Still unknown. Probably a generic Sys V.
3663 osname="sysv"
3664 osvers="$3"
3665 ;;
3666 esac
3667 fi
3668 ;;
3669 esac
3670 ;;
3671 *) case "$osname" in
3672 '') : Still unknown. Probably a generic BSD.
3673 osname="$1"
3674 osvers="$3"
3675 ;;
3676 esac
3677 ;;
3678 esac
3679 else
3680 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3681 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3682 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3683 osname=news_os
3684 fi
3685 $rm -f UU/kernel.what
3686 elif test -d c:/. -o -n "$is_os2" ; then
3687 set X $myuname
3688 osname=os2
3689 osvers="$5"
3690 fi
3691 fi
3692
3693 case "$targetarch" in
3694 '') ;;
3695 *) hostarch=$osname
3696 case "$targetarch" in
3697 nto*|*-nto-*)
3698 # Will load qnx.sh, which should change osname to nto
3699 osname=qnx
3700 osvers=''
3701 ;;
3702 *linux-android*)
3703 # Catch arm-linux-androideabi, mipsel-linux-android,
3704 # and i686-linux-android
3705 osname=linux-android
3706 osvers=''
3707 ;;
3708 *linux*)
3709 # Something like arm-linux-gnueabihf is really just
3710 # plain linux.
3711 osname=linux
3712 osvers=''
3713 ;;
3714 *solaris*|*sunos*)
3715 osname=solaris
3716 # XXX perhaps we should just assume
3717 # osvers to be 2, or maybe take the value
3718 # from targetarch. Using $run before the
3719 # hints are run is somewhat icky.
3720 set X `$run $uname -a 2>/dev/null`
3721 shift
3722 case "$3" in
3723 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3724 *) osvers="$3" ;;
3725 esac
3726 ;;
3727 *)
3728 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3729 osvers=''
3730 ;;
3731 esac
3732 ;;
3733 esac
3734
3735 : Now look for a hint file osname_osvers, unless one has been
3736 : specified already.
3737 case "$hintfile" in
3738 ''|' ')
3739 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3740 : Also try without trailing minor version numbers.
3741 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3742 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3743 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3744 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3745 case "$file" in
3746 '') dflt=none ;;
3747 *) case "$osvers" in
3748 '') dflt=$file
3749 ;;
3750 *) if $test -f $src/hints/$file.sh ; then
3751 dflt=$file
3752 elif $test -f $src/hints/$xfile.sh ; then
3753 dflt=$xfile
3754 elif $test -f $src/hints/$xxfile.sh ; then
3755 dflt=$xxfile
3756 elif $test -f $src/hints/$xxxfile.sh ; then
3757 dflt=$xxxfile
3758 elif $test -f $src/hints/$xxxxfile.sh ; then
3759 dflt=$xxxxfile
3760 elif $test -f "$src/hints/${osname}.sh" ; then
3761 dflt="${osname}"
3762 else
3763 dflt=none
3764 fi
3765 ;;
3766 esac
3767 ;;
3768 esac
3769 if $test -f Policy.sh ; then
3770 case "$dflt" in
3771 *Policy*) ;;
3772 none) dflt="Policy" ;;
3773 *) dflt="Policy $dflt" ;;
3774 esac
3775 fi
3776 ;;
3777 *)
3778 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3779 ;;
3780 esac
3781
3782 if $test -f Policy.sh ; then
3783 $cat <<EOM
3784
3785 There's also a Policy hint file available, which should make the
3786 site-specific (policy) questions easier to answer.
3787 EOM
3788
3789 fi
3790
3791 $cat <<EOM
3792
3793 You may give one or more space-separated answers, or "none" if appropriate.
3794 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3795 previous run of Configure, you may specify it as well as or instead of
3796 OS-specific hints. If hints are provided for your OS, you should use them:
3797 although Perl can probably be built without hints on many platforms, using
3798 hints often improve performance and may enable features that Configure can't
3799 set up on its own. If there are no hints that match your OS, specify "none";
3800 DO NOT give a wrong version or a wrong OS.
3801
3802 EOM
3803
3804 rp="Which of these apply, if any?"
3805 . UU/myread
3806 tans=$ans
3807 for file in $tans; do
3808 if $test X$file = XPolicy -a -f Policy.sh; then
3809 . Policy.sh
3810 $cat Policy.sh >> UU/config.sh
3811 elif $test -f $src/hints/$file.sh; then
3812 . $src/hints/$file.sh
3813 $cat $src/hints/$file.sh >> UU/config.sh
3814 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3815 : nothing
3816 else
3817 : Give one chance to correct a possible typo.
3818 echo "$file.sh does not exist"
3819 dflt=$file
3820 rp="hint to use instead?"
3821 . UU/myread
3822 for file in $ans; do
3823 if $test -f "$src/hints/$file.sh"; then
3824 . $src/hints/$file.sh
3825 $cat $src/hints/$file.sh >> UU/config.sh
3826 elif $test X$ans = X -o X$ans = Xnone ; then
3827 : nothing
3828 else
3829 echo "$file.sh does not exist -- ignored."
3830 fi
3831 done
3832 fi
3833 done
3834
3835 hint=recommended
3836 : Remember our hint file for later.
3837 if $test -f "$src/hints/$file.sh" ; then
3838 hintfile="$file"
3839 else
3840 hintfile=''
3841 fi
3842 fi
3843 cd UU
3844 ;;
3845 *)
3846 echo " "
3847 echo "Fetching default answers from $config_sh..." >&4
3848 tmp_n="$n"
3849 tmp_c="$c"
3850 cd ..
3851 cp $config_sh config.sh 2>/dev/null
3852 chmod +w config.sh
3853 . ./config.sh
3854 cd UU
3855 cp ../config.sh .
3856 n="$tmp_n"
3857 c="$tmp_c"
3858 hint=previous
3859 ;;
3860 esac
3861 . ./optdef.sh
3862
3863 : Restore computed paths
3864 for file in $loclist $trylist; do
3865 eval $file="\$_$file"
3866 done
3867
3868 cat << EOM
3869
3870 Configure uses the operating system name and version to set some defaults.
3871 The default value is probably right if the name rings a bell. Otherwise,
3872 since spelling matters for me, either accept the default or answer "none"
3873 to leave it blank.
3874
3875 EOM
3876 case "$osname" in
3877 ''|' ')
3878 case "$hintfile" in
3879 ''|' '|none) dflt=none ;;
3880 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3881 esac
3882 ;;
3883 *) dflt="$osname" ;;
3884 esac
3885 rp="Operating system name?"
3886 . ./myread
3887 case "$ans" in
3888 none) osname='' ;;
3889 *) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3890 esac
3891 echo " "
3892 case "$osvers" in
3893 ''|' ')
3894 case "$hintfile" in
3895 ''|' '|none) dflt=none ;;
3896 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3897 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3898 case "$dflt" in
3899 ''|' ') dflt=none ;;
3900 esac
3901 ;;
3902 esac
3903 ;;
3904 *) dflt="$osvers" ;;
3905 esac
3906 rp="Operating system version?"
3907 . ./myread
3908 case "$ans" in
3909 none) osvers='' ;;
3910 *) osvers="$ans" ;;
3911 esac
3912
3913
3914 . ./posthint.sh
3915
3916 : who configured the system
3917 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3918 case "$cf_by" in
3919 "")
3920 cf_by=`(logname) 2>/dev/null`
3921 case "$cf_by" in
3922 "")
3923 cf_by=`(whoami) 2>/dev/null`
3924 case "$cf_by" in
3925 "") cf_by=unknown ;;
3926 esac ;;
3927 esac ;;
3928 esac
3929
3930 : decide how portable to be. Allow command line overrides.
3931 case "$d_portable" in
3932 "$undef") ;;
3933 *) d_portable="$define" ;;
3934 esac
3935
3936 : set up shell script to do ~ expansion
3937 cat >filexp <<EOSS
3938 $startsh
3939 : expand filename
3940 case "\$1" in
3941 \~/*|\~)
3942 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3943 ;;
3944 \~*)
3945 if $test -f /bin/csh; then
3946 /bin/csh -f -c "glob \$1"
3947 failed=\$?
3948 echo ""
3949 exit \$failed
3950 else
3951 name=\`$expr x\$1 : '..\([^/]*\)'\`
3952 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3953 if $test ! -d "\$dir"; then
3954 me=\`basename \$0\`
3955 echo "\$me: can't locate home directory for: \$name" >&2
3956 exit 1
3957 fi
3958 case "\$1" in
3959 */*)
3960 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3961 ;;
3962 *)
3963 echo \$dir
3964 ;;
3965 esac
3966 fi
3967 ;;
3968 *)
3969 echo \$1
3970 ;;
3971 esac
3972 EOSS
3973 chmod +x filexp
3974 $eunicefix filexp
3975
3976 : now set up to get a file name
3977 cat <<EOS >getfile
3978 $startsh
3979 EOS
3980 cat <<'EOSC' >>getfile
3981 tilde=''
3982 fullpath=''
3983 already=''
3984 skip=''
3985 none_ok=''
3986 exp_file=''
3987 nopath_ok=''
3988 orig_rp="$rp"
3989 orig_dflt="$dflt"
3990 case "$gfpth" in
3991 '') gfpth='.' ;;
3992 esac
3993
3994 case "$fn" in
3995 *\(*)
3996 : getfile will accept an answer from the comma-separated list
3997 : enclosed in parentheses even if it does not meet other criteria.
3998 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3999 fn=`echo $fn | sed 's/(.*)//'`
4000 ;;
4001 esac
4002
4003 case "$fn" in
4004 *:*)
4005 loc_file=`expr $fn : '.*:\(.*\)'`
4006 fn=`expr $fn : '\(.*\):.*'`
4007 ;;
4008 esac
4009
4010 case "$fn" in
4011 *~*) tilde=true;;
4012 esac
4013 case "$fn" in
4014 */*) fullpath=true;;
4015 esac
4016 case "$fn" in
4017 *+*) skip=true;;
4018 esac
4019 case "$fn" in
4020 *n*) none_ok=true;;
4021 esac
4022 case "$fn" in
4023 *e*) exp_file=true;;
4024 esac
4025 case "$fn" in
4026 *p*) nopath_ok=true;;
4027 esac
4028
4029 case "$fn" in
4030 *f*) type='File';;
4031 *d*) type='Directory';;
4032 *l*) type='Locate';;
4033 esac
4034
4035 what="$type"
4036 case "$what" in
4037 Locate) what='File';;
4038 esac
4039
4040 case "$exp_file" in
4041 '')
4042 case "$d_portable" in
4043 "$define") ;;
4044 *) exp_file=true;;
4045 esac
4046 ;;
4047 esac
4048
4049 cd ..
4050 while test "$type"; do
4051 redo=''
4052 rp="$orig_rp"
4053 dflt="$orig_dflt"
4054 case "$tilde" in
4055 true) rp="$rp (~name ok)";;
4056 esac
4057 . UU/myread
4058 if test -f UU/getfile.ok && \
4059 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4060 then
4061 value="$ans"
4062 ansexp="$ans"
4063 break
4064 fi
4065 case "$ans" in
4066 none)
4067 value=''
4068 ansexp=''
4069 case "$none_ok" in
4070 true) type='';;
4071 esac
4072 ;;
4073 *)
4074 case "$tilde" in
4075 '') value="$ans"
4076 ansexp="$ans";;
4077 *)
4078 value=`UU/filexp $ans`
4079 case $? in
4080 0)
4081 if test "$ans" != "$value"; then
4082 echo "(That expands to $value on this system.)"
4083 fi
4084 ;;
4085 *) value="$ans";;
4086 esac
4087 ansexp="$value"
4088 case "$exp_file" in
4089 '') value="$ans";;
4090 esac
4091 ;;
4092 esac
4093 case "$fullpath" in
4094 true)
4095 case "$ansexp" in
4096 /*) value="$ansexp" ;;
4097 [a-zA-Z]:/*) value="$ansexp" ;;
4098 *)
4099 redo=true
4100 case "$already" in
4101 true)
4102 echo "I shall only accept a full path name, as in /bin/ls." >&4
4103 echo "Use a ! shell escape if you wish to check pathnames." >&4
4104 ;;
4105 *)
4106 echo "Please give a full path name, starting with slash." >&4
4107 case "$tilde" in
4108 true)
4109 echo "Note that using ~name is ok provided it expands well." >&4
4110 already=true
4111 ;;
4112 esac
4113 esac
4114 ;;
4115 esac
4116 ;;
4117 esac
4118 case "$redo" in
4119 '')
4120 case "$type" in
4121 File)
4122 for fp in $gfpth; do
4123 if test "X$fp" = X.; then
4124 pf="$ansexp"
4125 else
4126 pf="$fp/$ansexp"
4127 fi
4128 if test -f "$pf"; then
4129 type=''
4130 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4131 then
4132 echo "($value is not a plain file, but that's ok.)"
4133 type=''
4134 fi
4135 if test X"$type" = X; then
4136 value="$pf"
4137 break
4138 fi
4139 done
4140 ;;
4141 Directory)
4142 for fp in $gfpth; do
4143 if test "X$fp" = X.; then
4144 dir="$ans"
4145 direxp="$ansexp"
4146 else
4147 dir="$fp/$ansexp"
4148 direxp="$fp/$ansexp"
4149 fi
4150 if test -d "$direxp"; then
4151 type=''
4152 value="$dir"
4153 break
4154 fi
4155 done
4156 ;;
4157 Locate)
4158 if test -d "$ansexp"; then
4159 echo "(Looking for $loc_file in directory $value.)"
4160 value="$value/$loc_file"
4161 ansexp="$ansexp/$loc_file"
4162 fi
4163 if test -f "$ansexp"; then
4164 type=''
4165 fi
4166 case "$nopath_ok" in
4167 true) case "$value" in
4168 */*) ;;
4169 *) echo "Assuming $value will be in people's path."
4170 type=''
4171 ;;
4172 esac
4173 ;;
4174 esac
4175 ;;
4176 esac
4177
4178 case "$skip" in
4179 true) type='';
4180 esac
4181
4182 case "$type" in
4183 '') ;;
4184 *)
4185 if test "$fastread" = yes; then
4186 dflt=y
4187 else
4188 dflt=n
4189 fi
4190 rp="$what $value doesn't exist. Use that name anyway?"
4191 . UU/myread
4192 dflt=''
4193 case "$ans" in
4194 y*) type='';;
4195 *) echo " ";;
4196 esac
4197 ;;
4198 esac
4199 ;;
4200 esac
4201 ;;
4202 esac
4203 done
4204 cd UU
4205 ans="$value"
4206 rp="$orig_rp"
4207 dflt="$orig_dflt"
4208 rm -f getfile.ok
4209 test "X$gfpthkeep" != Xy && gfpth=""
4210 EOSC
4211
4212 : determine root of directory hierarchy where package will be installed.
4213 case "$prefix" in
4214 '') dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4215 ;;
4216 *) dflt="$prefix"
4217 ;;
4218 esac
4219 $cat <<EOM
4220
4221 By default, $package will be installed in $dflt/bin, manual pages
4222 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4223 installation directories. Typically this is something like /usr/local.
4224 If you wish to have binaries under /usr/bin but other parts of the
4225 installation under /usr/local, that's ok: you will be prompted
4226 separately for each of the installation directories, the prefix being
4227 only used to set the defaults.
4228
4229 EOM
4230 fn=d~
4231 rp='Installation prefix to use?'
4232 . ./getfile
4233 oldprefix=''
4234 case "$prefix" in
4235 '') ;;
4236 *) case "$ans" in
4237 "$prefix") ;;
4238 *) oldprefix="$prefix";;
4239 esac
4240 ;;
4241 esac
4242
4243 case "$ans" in
4244 *?/) prefix=`echo "$ans" | sed 's/.$//'`
4245 ;;
4246 *) prefix="$ans"
4247 esac
4248
4249 case "$ansexp" in
4250 *?/) prefixexp=`echo "$ansexp" | sed 's/.$//'`
4251 ;;
4252 *) prefixexp="$ansexp"
4253 esac
4254
4255 : allow them to override the AFS root
4256 case "$afsroot" in
4257 '') afsroot=/afs ;;
4258 *) afsroot=$afsroot ;;
4259 esac
4260
4261 : is AFS running?
4262 echo " "
4263 case "$afs" in
4264 $define|true) afs=true ;;
4265 $undef|false) afs=false ;;
4266 *) if $test -d $afsroot; then
4267 afs=true
4268 else
4269 afs=false
4270 fi
4271 ;;
4272 esac
4273 if $afs; then
4274 echo "AFS may be running... I'll be extra cautious then..." >&4
4275 else
4276 echo "AFS does not seem to be running..." >&4
4277 fi
4278
4279 : determine installation prefix for where package is to be installed.
4280 if $afs; then
4281 $cat <<EOM
4282
4283 Since you are running AFS, I need to distinguish the directory in which
4284 files will reside from the directory in which they are installed (and from
4285 which they are presumably copied to the former directory by occult means).
4286
4287 EOM
4288 case "$installprefix" in
4289 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4290 *) dflt="$installprefix";;
4291 esac
4292 else
4293 $cat <<EOM
4294
4295 In some special cases, particularly when building $package for distribution,
4296 it is convenient to distinguish the directory in which files should be
4297 installed from the directory ($prefix) in which they will
4298 eventually reside. For most users, these two directories are the same.
4299
4300 EOM
4301 case "$installprefix" in
4302 '') dflt=$prefix ;;
4303 *) dflt=$installprefix;;
4304 esac
4305 fi
4306 fn=d~
4307 rp='What installation prefix should I use for installing files?'
4308 . ./getfile
4309 installprefix="$ans"
4310 installprefixexp="$ansexp"
4311
4312 : Perform the prefixexp/installprefixexp correction if necessary
4313 cat <<EOS >installprefix
4314 $startsh
4315 EOS
4316 cat <<'EOSC' >>installprefix
4317 : Change installation prefix, if necessary.
4318 if $test X"$prefix" != X"$installprefix"; then
4319 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4320 else
4321 eval "install${prefixvar}=\"\$${prefixvar}exp\""
4322 fi
4323 EOSC
4324 chmod +x installprefix
4325 $eunicefix installprefix
4326
4327 : Set variables such as privlib and privlibexp from the output of ./getfile
4328 : performing the prefixexp/installprefixexp correction if necessary.
4329 cat <<EOS >setprefixvar
4330 $startsh
4331 EOS
4332 cat <<'EOSC' >>setprefixvar
4333 eval "${prefixvar}=\"\$ans\""
4334 eval "${prefixvar}exp=\"\$ansexp\""
4335 . ./installprefix
4336 EOSC
4337 chmod +x setprefixvar
4338 $eunicefix setprefixvar
4339
4340 : set up the script used to warn in case of inconsistency
4341 cat <<EOS >whoa
4342 $startsh
4343 EOS
4344 cat <<'EOSC' >>whoa
4345 dflt=y
4346 case "$hint" in
4347 recommended)
4348 case "$hintfile" in
4349 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4350 ;;
4351 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
4352 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4353 ;;
4354 esac
4355 ;;
4356 *) echo " "
4357 echo "*** WHOA THERE!!! ***" >&4
4358 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
4359 ;;
4360 esac
4361 rp=" Keep the $hint value?"
4362 . ./myread
4363 case "$ans" in
4364 y) td=$was; tu=$was;;
4365 esac
4366 EOSC
4367
4368 : function used to set '$1' to '$val'
4369 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4370 case "$val$was" in
4371 $define$undef) . ./whoa; eval "$var=\$td";;
4372 $undef$define) . ./whoa; eval "$var=\$tu";;
4373 *) eval "$var=$val";;
4374 esac'
4375
4376 : Do we want threads support and if so, what type
4377 case "$usethreads" in
4378 $define|true|[yY]*) dflt='y';;
4379 *) # Catch case where user specified ithreads but
4380 # forgot -Dusethreads (A.D. 4/2002)
4381 case "$useithreads" in
4382 *$define*) dflt='y';;
4383 *) dflt='n';;
4384 esac
4385 ;;
4386 esac
4387 cat <<EOM
4388
4389 Perl can be built to offer a form of threading support on some systems
4390 To do so, Configure can be run with -Dusethreads.
4391
4392 Note that Perl built with threading support runs slightly slower
4393 and uses slightly more memory than plain Perl.
4394
4395 If this doesn't make any sense to you, just accept the default '$dflt'.
4396 EOM
4397 rp='Build a threading Perl?'
4398 . ./myread
4399 case "$ans" in
4400 y|Y) val="$define" ;;
4401 *) val="$undef" ;;
4402 esac
4403 set usethreads
4404 eval $setvar
4405
4406 useithreads="$usethreads"
4407
4408 case "$d_oldpthreads" in
4409 '') : Configure tests would be welcome here. For now, assume undef.
4410 val="$undef" ;;
4411 *) val="$d_oldpthreads" ;;
4412 esac
4413 set d_oldpthreads
4414 eval $setvar
4415
4416
4417 : Look for a hint-file generated 'call-back-unit'. If the
4418 : user has specified that a threading perl is to be built,
4419 : we may need to set or change some other defaults.
4420 if $test -f usethreads.cbu; then
4421 echo "Your platform has some specific hints regarding threaded builds, using them..."
4422 . ./usethreads.cbu
4423 else
4424 case "$usethreads" in
4425 "$define"|true|[yY]*)
4426 $cat <<EOM
4427 (Your platform does not have any specific hints for threaded builds.
4428 Assuming POSIX threads, then.)
4429 EOM
4430 ;;
4431 esac
4432 fi
4433
4434 : Check if multiplicity is required
4435 cat <<EOM
4436
4437 Perl can be built so that multiple Perl interpreters can coexist
4438 within the same Perl executable.
4439 EOM
4440
4441 case "$useithreads" in
4442 $define)
4443 cat <<EOM
4444 This multiple interpreter support is required for interpreter-based threads.
4445 EOM
4446 val="$define"
4447 ;;
4448 *) case "$usemultiplicity" in
4449 $define|true|[yY]*) dflt='y';;
4450 *) dflt='n';;
4451 esac
4452 echo " "
4453 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4454 rp='Build Perl for multiplicity?'
4455 . ./myread
4456 case "$ans" in
4457 y|Y) val="$define" ;;
4458 *) val="$undef" ;;
4459 esac
4460 ;;
4461 esac
4462 set usemultiplicity
4463 eval $setvar
4464
4465 : Check if morebits is requested
4466 case "$usemorebits" in
4467 "$define"|true|[yY]*)
4468 use64bitint="$define"
4469 uselongdouble="$define"
4470 usemorebits="$define"
4471 ;;
4472 *) usemorebits="$undef"
4473 ;;
4474 esac
4475
4476 : Determine the C compiler to be used
4477 echo " "
4478 case "$cc" in
4479 '') dflt=cc;;
4480 *) dflt="$cc";;
4481 esac
4482 rp="Use which C compiler?"
4483 . ./myread
4484 cc="$ans"
4485
4486 : See whether they have no cc but they do have gcc
4487 . ./trygcc
4488 if $test -f cc.cbu; then
4489 . ./cc.cbu
4490 fi
4491 . ./checkcc
4492
4493 : make some quick guesses about what we are up against
4494 echo " "
4495 $echo $n "Hmm... $c"
4496 echo exit 1 >bsd
4497 echo exit 1 >usg
4498 echo exit 1 >v7
4499 echo exit 1 >osf1
4500 echo exit 1 >eunice
4501 echo exit 1 >xenix
4502 echo exit 1 >venix
4503 echo exit 1 >os2
4504 d_bsd="$undef"
4505 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4506 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4507 then
4508 echo "Looks kind of like an OSF/1 system, but we'll see..."
4509 echo exit 0 >osf1
4510 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4511 xxx=`./loc addbib blurfl $pth`
4512 if $test -f $xxx; then
4513 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4514 echo exit 0 >bsd
4515 echo exit 0 >usg
4516 else
4517 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4518 echo "Looks kind of like an extended USG system, but we'll see..."
4519 else
4520 echo "Looks kind of like a USG system, but we'll see..."
4521 fi
4522 echo exit 0 >usg
4523 fi
4524 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4525 echo "Looks kind of like a BSD system, but we'll see..."
4526 d_bsd="$define"
4527 echo exit 0 >bsd
4528 else
4529 echo "Looks kind of like a Version 7 system, but we'll see..."
4530 echo exit 0 >v7
4531 fi
4532 case "$eunicefix" in
4533 *unixtovms*)
4534 $cat <<'EOI'
4535 There is, however, a strange, musty smell in the air that reminds me of
4536 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4537 EOI
4538 echo exit 0 >eunice
4539 d_eunice="$define"
4540 : it so happens the Eunice I know will not run shell scripts in Unix format
4541 ;;
4542 *)
4543 echo " "
4544 echo "Congratulations. You aren't running Eunice."
4545 d_eunice="$undef"
4546 ;;
4547 esac
4548 : Detect OS2. The p_ variable is set above in the Head.U unit.
4549 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4550 : semicolon as a patch separator
4551 case "$p_" in
4552 :) ;;
4553 *)
4554 $cat <<'EOI'
4555 I have the feeling something is not exactly right, however...don't tell me...
4556 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4557 (Or you may be running DOS with DJGPP.)
4558 EOI
4559 echo exit 0 >os2
4560 ;;
4561 esac
4562 if test -f /xenix; then
4563 echo "Actually, this looks more like a XENIX system..."
4564 echo exit 0 >xenix
4565 d_xenix="$define"
4566 else
4567 echo " "
4568 echo "It's not Xenix..."
4569 d_xenix="$undef"
4570 fi
4571 chmod +x xenix
4572 $eunicefix xenix
4573 if test -f /venix; then
4574 echo "Actually, this looks more like a VENIX system..."
4575 echo exit 0 >venix
4576 else
4577 echo " "
4578 if ./xenix; then
4579 : null
4580 else
4581 echo "Nor is it Venix..."
4582 fi
4583 fi
4584 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4585 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4586 $rm -f foo
4587
4588 : Check if we are using GNU gcc and what its version is
4589 echo " "
4590 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4591 $cat >try.c <<EOM
4592 #include <stdio.h>
4593 int main() {
4594 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4595 #ifdef __VERSION__
4596 printf("%s\n", __VERSION__);
4597 #else
4598 printf("%s\n", "1");
4599 #endif
4600 #endif
4601 return(0);
4602 }
4603 EOM
4604 if $cc -o try $ccflags $ldflags try.c; then
4605 gccversion=`$run ./try`
4606 case "$gccversion" in
4607 '') echo "You are not using GNU cc." ;;
4608 *) echo "You are using GNU cc $gccversion."
4609 ccname=gcc
4610 ;;
4611 esac
4612 else
4613 echo " "
4614 echo "*** WHOA THERE!!! ***" >&4
4615 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4616 case "$knowitall" in
4617 '')
4618 echo " You'd better start hunting for one and let me know about it." >&4
4619 exit 1
4620 ;;
4621 esac
4622 fi
4623 $rm -f try try.*
4624 case "$gccversion" in
4625 1.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4626 esac
4627 case "$gccversion" in
4628 '') gccosandvers='' ;;
4629 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4630 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4631 gccshortvers=''
4632 case "$gccosandvers" in
4633 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4634 $osname$osvers) ;; # looking good
4635 $osname*) cat <<EOM >&4
4636
4637 *** WHOA THERE!!! ***
4638
4639 Your gcc has not been compiled for the exact release of
4640 your operating system ($gccosandvers versus $osname$osvers).
4641
4642 In general it is a good idea to keep gcc synchronized with
4643 the operating system because otherwise serious problems
4644 may ensue when trying to compile software, like Perl.
4645
4646 I'm trying to be optimistic here, though, and will continue.
4647 If later during the configuration and build icky compilation
4648 problems appear (headerfile conflicts being the most common
4649 manifestation), I suggest reinstalling the gcc to match
4650 your operating system release.
4651
4652 EOM
4653 ;;
4654 *) gccosandvers='' ;; # failed to parse, better be silent
4655 esac
4656 ;;
4657 esac
4658 case "$ccname" in
4659 '') ccname="$cc" ;;
4660 esac
4661
4662 # gcc 3.* complain about adding -Idirectories that they already know about,
4663 # so we will take those off from locincpth.
4664 case "$gccversion" in
4665 3.*)
4666 echo "int main(){}">try.c
4667 for incdir in $locincpth; do
4668 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4669 grep '^c[cp]p*[01]: warning: changing search order '`
4670 if test "X$warn" != X; then
4671 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4672 fi
4673 done
4674 $rm -f try try.*
4675 esac
4676
4677 # gcc 4.9 by default does some optimizations that break perl.
4678 # see ticket 121505.
4679 #
4680 # The -fwrapv disables those optimizations (and probably others,) so
4681 # for gcc 4.9 (and later, since the optimizations probably won't go
4682 # away), add -fwrapv unless the user requests -fno-wrapv, which
4683 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4684 # which turns the overflows -fwrapv ignores into runtime errors.
4685 case "$gccversion" in
4686 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4687 case "$ccflags" in
4688 *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4689 *) ccflags="$ccflags -fwrapv" ;;
4690 esac
4691 esac
4692
4693 # Really old versions of gcc default to C89 and will error for this code.
4694 # See if the compiler (gcc or otherwise) needs a flag to compile C99 code
4695 # Initialisations in for loops seem to be the particular problem
4696 # (Does this syntax conflict with something else that was valid C89?)
4697 # We also add a declaration after a statement to detect whether the compiler
4698 # (or the user supplied -Accflags) consider such declarations to be errors.
4699 # This causes 'Configure with -Accflags="-Werror=declaration-after-statement"'
4700 # to fail hard and early.
4701 #
4702 # Annoyingly -std=c99 will cause gcc to tell glibc not to define prototypes for
4703 # syscall, drand48 etc when including <unistd.h>, which messes up our build.
4704 # I guess we *could* loop round trying -std=c99 first with checks both for the
4705 # prototype found and the code compiling (because -std=gnu99 might do other
4706 # things we don't want, particularly on non-GCC compilers) but
4707 # 1) We would need to check for the prototype first (without any flags)
4708 # 2) We would still end up with most Linux systems either being -std=gnu99
4709 # or "" (no flag), and so both common options would not rigorously check our
4710 # portability to other platforms.
4711 # So it doesn't seem worth the complexity and chance of different failure.
4712 $cat >try.c <<'EOCP'
4713 int main(int argc, char **argv) {
4714 argc = argc + 1;
4715 /* This is deliberately a declaration after a statement. */
4716 unsigned long long count = 0;
4717 for (char **p = argv; *p; ++p) {
4718 ++count;
4719 }
4720 return count == 1 ? 0 : argc;
4721 }
4722 EOCP
4723 c99_for=no
4724 for flag in '' '-std=gnu99' '-std=c99'; do
4725 if $cc -o try $flag $ccflags $ldflags try.c 2>/dev/null && ./try; then
4726 c99_for="$flag"
4727 break;
4728 fi
4729 done
4730 case "$c99_for" in
4731 '') echo "Your C compiler doesn't need any special flags to compile C99 code"
4732 ;;
4733 no) echo >&4 "Your C compiler doesn't seem to be able to compile C99 code"
4734 rp='Do you really want to continue?'
4735 dflt='n'
4736 . ./myread
4737 case "$ans" in
4738 [yY]) echo >&4 "Okay, continuing." ;;
4739 *) exit 1 ;;
4740 esac
4741 ;;
4742 *) echo "Your C compiler needs $c99_for to compile C99 code"
4743 ccflags="$c99_for $ccflags"
4744 ;;
4745 esac
4746 $rm -f try try.*
4747
4748 : What should the include directory be ?
4749 : Use sysroot if set, so findhdr looks in the right place.
4750 echo " "
4751 $echo $n "Hmm... $c"
4752 dflt="$sysroot/usr/include"
4753 incpath=''
4754 mips_type=''
4755 if $test -f /bin/mips && /bin/mips; then
4756 echo "Looks like a MIPS system..."
4757 $cat >usr.c <<'EOCP'
4758 #ifdef SYSTYPE_BSD43
4759 /bsd43
4760 #endif
4761 EOCP
4762 if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4763 dflt='/bsd43/usr/include'
4764 incpath='/bsd43'
4765 mips_type='BSD 4.3'
4766 else
4767 mips_type='System V'
4768 fi
4769 $rm -f usr.c usr.out
4770 echo "and you're compiling with the $mips_type compiler and libraries."
4771 xxx_prompt=y
4772 echo "exit 0" >mips
4773 else
4774 echo "Doesn't look like a MIPS system."
4775 xxx_prompt=n
4776 echo "exit 1" >mips
4777 fi
4778 chmod +x mips
4779 $eunicefix mips
4780 case "$usrinc" in
4781 '') ;;
4782 *) dflt="$usrinc";;
4783 esac
4784 case "$xxx_prompt" in
4785 y) fn=d/
4786 echo " "
4787 rp='Where are the include files you want to use?'
4788 . ./getfile
4789 usrinc="$ans"
4790 ;;
4791 *) usrinc="$dflt"
4792 ;;
4793 esac
4794
4795 : see how we invoke the C preprocessor
4796 echo " "
4797 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4798 cat <<'EOT' >testcpp.c
4799 #define ABC abc
4800 #define XYZ xyz
4801 ABC.XYZ
4802 EOT
4803 cd ..
4804 if test ! -f cppstdin; then
4805 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4806 # AIX cc -E doesn't show the absolute headerfile
4807 # locations but we'll cheat by using the -M flag.
4808 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
4809 else
4810 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4811 fi
4812 else
4813 echo "Keeping your $hint cppstdin wrapper."
4814 fi
4815 chmod 755 cppstdin
4816 wrapper=`pwd`/cppstdin
4817 ok='false'
4818 cd UU
4819
4820 if $test "X$cppstdin" != "X" && \
4821 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4822 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4823 then
4824 echo "You used to use $cppstdin $cppminus so we'll use that again."
4825 case "$cpprun" in
4826 '') echo "But let's see if we can live without a wrapper..." ;;
4827 *)
4828 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4829 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4830 then
4831 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4832 ok='true'
4833 else
4834 echo "(However, $cpprun $cpplast does not work, let's see...)"
4835 fi
4836 ;;
4837 esac
4838 else
4839 case "$cppstdin" in
4840 '') ;;
4841 *)
4842 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4843 ;;
4844 esac
4845 fi
4846
4847 if $ok; then
4848 : nothing
4849 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4850 $cc -E <testcpp.c >testcpp.out 2>&1; \
4851 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4852 echo "Yup, it does."
4853 x_cpp="$cc $cppflags -E"
4854 x_minus='';
4855 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4856 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4857 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4858 echo "Yup, it does."
4859 x_cpp="$cc $cppflags -E"
4860 x_minus='-';
4861 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4862 $cc -P <testcpp.c >testcpp.out 2>&1; \
4863 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4864 echo "Yipee, that works!"
4865 x_cpp="$cc $cppflags -P"
4866 x_minus='';
4867 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4868 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4869 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4870 echo "At long last!"
4871 x_cpp="$cc $cppflags -P"
4872 x_minus='-';
4873 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4874 $cpp <testcpp.c >testcpp.out 2>&1; \
4875 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4876 echo "It works!"
4877 x_cpp="$cpp $cppflags"
4878 x_minus='';
4879 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4880 $cpp - <testcpp.c >testcpp.out 2>&1; \
4881 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4882 echo "Hooray, it works! I was beginning to wonder."
4883 x_cpp="$cpp $cppflags"
4884 x_minus='-';
4885 elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4886 $wrapper <testcpp.c >testcpp.out 2>&1; \
4887 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4888 x_cpp="$wrapper"
4889 x_minus=''
4890 echo "Eureka!"
4891 else
4892 dflt=''
4893 rp="No dice. I can't find a C preprocessor. Name one:"
4894 . ./myread
4895 x_cpp="$ans"
4896 x_minus=''
4897 $x_cpp <testcpp.c >testcpp.out 2>&1
4898 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4899 echo "OK, that will do." >&4
4900 else
4901 echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4902 exit 1
4903 fi
4904 fi
4905
4906 case "$ok" in
4907 false)
4908 cppstdin="$x_cpp"
4909 cppminus="$x_minus"
4910 cpprun="$x_cpp"
4911 cpplast="$x_minus"
4912 set X $x_cpp
4913 shift
4914 case "$1" in
4915 "$cpp")
4916 echo "Perhaps can we force $cc -E using a wrapper..."
4917 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4918 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4919 then
4920 echo "Yup, we can."
4921 cppstdin="$wrapper"
4922 cppminus='';
4923 else
4924 echo "Nope, we'll have to live without it..."
4925 fi
4926 ;;
4927 esac
4928 case "$cpprun" in
4929 "$wrapper")
4930 cpprun=''
4931 cpplast=''
4932 ;;
4933 esac
4934 ;;
4935 esac
4936
4937 case "$cppstdin" in
4938 "$wrapper"|'cppstdin') ;;
4939 *) $rm -f $wrapper;;
4940 esac
4941 $rm -f testcpp.c testcpp.out
4942
4943 : Adjust cppfilter for path component separator
4944 case "$osname" in
4945 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4946 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4947 *) cppfilter='' ;;
4948 esac
4949
4950 : Use gcc to determine libpth and incpth
4951 # If using gcc or clang, we can get better values for libpth, incpth
4952 # and usrinc directly from the compiler.
4953 # Note that ccname for clang is also gcc.
4954 case "$ccname" in
4955 gcc)
4956 realpath=`which realpath 2>/dev/null | sed 's/no realpath in.*//'`
4957 $echo 'extern int foo;' > try.c
4958 set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4959 shift
4960 inclibpth=""
4961 if $test $# -gt 0; then
4962 for i in $*; do
4963 case $realpath in
4964 */realpath) i=`$realpath --no-symlinks $i` ;;
4965 esac
4966 incpth="$incpth $i"
4967 j="`$echo $i | $sed 's,/include[^/]*,/lib,'`"
4968 if $test -d $j; then
4969 inclibpth="$inclibpth $j"
4970 fi
4971 done
4972 incpth="`$echo $incpth | $sed 's/^ //'`"
4973 for xxx in $inclibpth $loclibpth $plibpth $glibpth; do
4974 if $test -d $xxx; then
4975 case $realpath in
4976 */realpath) xxx=`$realpath --no-symlinks $xxx` ;;
4977 esac
4978 case " $libpth " in
4979 *" $xxx "*) ;;
4980 *) libpth="$libpth $xxx";;
4981 esac
4982 fi
4983 done
4984 libpth="`$echo $libpth | $sed 's/^ //'`"
4985 fi
4986 $rm -f try.c
4987 case "$usrinc" in
4988 '') for i in $incpth; do
4989 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4990 usrinc="$i"
4991 break
4992 fi
4993 done
4994 ;;
4995 esac
4996
4997 case "$usecrosscompile" in
4998 $define|true|[yY]*)
4999 case "$incpth" in
5000 '') echo "Incpth not defined." >&4; croak=y ;;
5001 *) echo "Using incpth '$incpth'." >&4 ;;
5002 esac
5003 case "$libpth" in
5004 '') echo "Libpth not defined." >&4; croak=y ;;
5005 *) echo "Using libpth '$libpth'." >&4 ;;
5006 esac
5007 case "$usrinc" in
5008 '') echo "Usrinc not defined." >&4; croak=y ;;
5009 *) echo "Using usrinc $usrinc." >&4 ;;
5010 esac
5011 case "$croak" in
5012 y)
5013 if test "X$sysroot" = X; then
5014 echo "Cannot continue, aborting." >&4; exit 1
5015 else
5016 echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5017 fi
5018 ;;
5019 esac
5020 ;;
5021 esac
5022 ;;
5023 esac
5024
5025 : Default value for incpth is just usrinc
5026 case "$incpth" in
5027 '') incpth="$usrinc";;
5028 esac
5029
5030 : Set private lib path
5031 case "$plibpth" in
5032 '') if ./mips; then
5033 plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5034 fi;;
5035 esac
5036 case "$libpth" in
5037 ' ') dlist='';;
5038 '') dlist="$loclibpth $plibpth $glibpth";;
5039 *) dlist="$libpth";;
5040 esac
5041
5042 : Now check and see which directories actually exist, avoiding duplicates
5043 for xxx in $dlist
5044 do
5045 if $test -d $xxx; then
5046 case " $libpth " in
5047 *" $xxx "*) ;;
5048 *) libpth="$libpth $xxx";;
5049 esac
5050 fi
5051 done
5052 $cat <<'EOM'
5053
5054 Some systems have incompatible or broken versions of libraries. Among
5055 the directories listed in the question below, please remove any you
5056 know not to be holding relevant libraries, and add any that are needed.
5057 Say "none" for none.
5058
5059 EOM
5060
5061 if test "X$sysroot" != X; then
5062 $cat <<EOM
5063 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5064
5065 EOM
5066 fi
5067
5068 case "$libpth" in
5069 '') dflt='none';;
5070 *)
5071 set X $libpth
5072 shift
5073 dflt=${1+"$@"}
5074 ;;
5075 esac
5076 rp="Directories to use for library searches?"
5077 . ./myread
5078 case "$ans" in
5079 none) libpth=' ';;
5080 *) libpth="$ans";;
5081 esac
5082
5083 : compute shared library extension
5084 case "$so" in
5085 '')
5086 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5087 dflt='sl'
5088 else
5089 dflt='so'
5090 fi
5091 ;;
5092 *) dflt="$so";;
5093 esac
5094 $cat <<EOM
5095
5096 On some systems, shared libraries may be available. Answer 'none' if
5097 you want to suppress searching of shared libraries for the remainder
5098 of this configuration.
5099
5100 EOM
5101 rp='What is the file extension used for shared libraries?'
5102 . ./myread
5103 so="$ans"
5104
5105 : Does target system insist that shared library basenames are unique
5106 $cat << EOM
5107
5108 Some dynamic loaders assume that the *basename* of shared library filenames
5109 are globally unique. We'll default this to undef as we assume your system
5110 is not this weird. Set to defined if you're on one of them.
5111
5112 EOM
5113
5114 dflt='n'
5115 rp='Make shared library basenames unique?'
5116 . ./myread
5117 case "$ans" in
5118 y|Y) val="$define" ;;
5119 *) val="$undef" ;;
5120 esac
5121 set d_libname_unique
5122 eval $setvar
5123
5124 : Define several unixisms.
5125 : Hints files or command line option can be used to override them.
5126 : The convoluted testing is in case hints files set either the old
5127 : or the new name.
5128 case "$_exe" in
5129 '') case "$exe_ext" in
5130 '') ;;
5131 *) _exe="$exe_ext" ;;
5132 esac
5133 ;;
5134 esac
5135 case "$_a" in
5136 '') case "$lib_ext" in
5137 '') _a='.a';;
5138 *) _a="$lib_ext" ;;
5139 esac
5140 ;;
5141 esac
5142 case "$_o" in
5143 '') case "$obj_ext" in
5144 '') _o='.o';;
5145 *) _o="$obj_ext";;
5146 esac
5147 ;;
5148 esac
5149 case "$p_" in
5150 '') case "$path_sep" in
5151 '') p_=':';;
5152 *) p_="$path_sep";;
5153 esac
5154 ;;
5155 esac
5156 exe_ext=$_exe
5157 lib_ext=$_a
5158 obj_ext=$_o
5159 path_sep=$p_
5160
5161 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5162
5163 : Which makefile gets called first. This is used by make depend.
5164 case "$firstmakefile" in
5165 '') firstmakefile='makefile';;
5166 esac
5167
5168 : Check is we will use socks
5169 case "$usesocks" in
5170 $define|true|[yY]*) dflt='y';;
5171 *) dflt='n';;
5172 esac
5173 cat <<EOM
5174
5175 Perl can be built to use the SOCKS proxy protocol library. To do so,
5176 Configure must be run with -Dusesocks. If you use SOCKS you also need
5177 to use the PerlIO abstraction layer, this will be implicitly selected.
5178
5179 If this doesn't make any sense to you, just accept the default '$dflt'.
5180 EOM
5181 rp='Build Perl for SOCKS?'
5182 . ./myread
5183 case "$ans" in
5184 y|Y) val="$define" ;;
5185 *) val="$undef" ;;
5186 esac
5187 set usesocks
5188 eval $setvar
5189
5190 : Check for uselongdouble support
5191 case "$ccflags" in
5192 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5193 esac
5194
5195 case "$uselongdouble" in
5196 $define|true|[yY]*) dflt='y';;
5197 *) dflt='n';;
5198 esac
5199 cat <<EOM
5200
5201 Perl can be built to take advantage of long doubles which
5202 (if available) may give more accuracy and range for floating point numbers.
5203
5204 If this doesn't make any sense to you, just accept the default '$dflt'.
5205 EOM
5206 rp='Try to use long doubles if available?'
5207 . ./myread
5208 case "$ans" in
5209 y|Y) val="$define" ;;
5210 *) val="$undef" ;;
5211 esac
5212 set uselongdouble
5213 eval $setvar
5214
5215 case "$uselongdouble" in
5216 true|[yY]*) uselongdouble="$define" ;;
5217 esac
5218
5219 : Look for a hint-file generated 'call-back-unit'. If the
5220 : user has specified that long doubles should be used,
5221 : we may need to set or change some other defaults.
5222 if $test -f uselongdouble.cbu; then
5223 echo "Your platform has some specific hints regarding long doubles, using them..."
5224 . ./uselongdouble.cbu
5225 else
5226 case "$uselongdouble" in
5227 $define)
5228 $cat <<EOM
5229 (Your platform does not have any specific hints for long doubles.)
5230 EOM
5231 ;;
5232 esac
5233 fi
5234
5235 : Looking for optional libraries
5236 echo " "
5237 echo "Checking for optional libraries..." >&4
5238 case "$libs" in
5239 ' '|'') dflt='';;
5240 *) dflt="$libs";;
5241 esac
5242 case "$libswanted" in
5243 '') libswanted='c_s';;
5244 esac
5245 case "$usesocks" in
5246 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5247 esac
5248 case "$usecbacktrace" in
5249 "$define") libswanted="$libswanted bfd" ;;
5250 esac
5251 libsfound=''
5252 libsfiles=''
5253 libsdirs=''
5254 libspath=''
5255 for thisdir in $libpth $xlibpth; do
5256 test -d $thisdir && libspath="$libspath $thisdir"
5257 done
5258 for thislib in $libswanted; do
5259 for thisdir in $libspath; do
5260 xxx=''
5261 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5262 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5263 $test -f "$xxx" && eval $libscheck
5264 $test -f "$xxx" && libstyle=shared
5265 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5266 $test -f "$xxx" && eval $libscheck
5267 $test -f "$xxx" && libstyle=shared
5268 fi
5269 if test ! -f "$xxx"; then
5270 xxx=$thisdir/lib$thislib.$so$_a
5271 $test -f "$xxx" && eval $libscheck
5272 $test -f "$xxx" && libstyle="import"
5273 fi
5274 if test ! -f "$xxx"; then
5275 xxx=$thisdir/$thislib.$so$_a
5276 $test -f "$xxx" && eval $libscheck
5277 $test -f "$xxx" && libstyle="import"
5278 fi
5279 if test ! -f "$xxx"; then
5280 xxx=$thisdir/lib$thislib.$so
5281 $test -f "$xxx" && eval $libscheck
5282 $test -f "$xxx" && libstyle=shared
5283 fi
5284 if test ! -f "$xxx"; then
5285 xxx=$thisdir/lib$thislib$_a
5286 $test -f "$xxx" && eval $libscheck
5287 $test -f "$xxx" && libstyle=static
5288 fi
5289 if test ! -f "$xxx"; then
5290 xxx=$thisdir/$thislib$_a
5291 $test -f "$xxx" && eval $libscheck
5292 $test -f "$xxx" && libstyle=static
5293 fi
5294 if test ! -f "$xxx"; then
5295 xxx=$thisdir/lib${thislib}_s$_a
5296 $test -f "$xxx" && eval $libscheck
5297 $test -f "$xxx" && libstyle=static
5298 $test -f "$xxx" && thislib=${thislib}_s
5299 fi
5300 if test ! -f "$xxx"; then
5301 xxx=$thisdir/Slib$thislib$_a
5302 $test -f "$xxx" && eval $libscheck
5303 $test -f "$xxx" && libstyle=static
5304 fi
5305 if $test -f "$xxx"; then
5306 case "$libstyle" in
5307 shared) echo "Found -l$thislib (shared)." ;;
5308 static) echo "Found -l$thislib." ;;
5309 *) echo "Found -l$thislib ($libstyle)." ;;
5310 esac
5311 case " $dflt " in
5312 *"-l$thislib "*);;
5313 *) dflt="$dflt -l$thislib"
5314 libsfound="$libsfound $xxx"
5315 yyy=`basename $xxx`
5316 libsfiles="$libsfiles $yyy"
5317 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5318 case " $libsdirs " in
5319 *" $yyy "*) ;;
5320 *) libsdirs="$libsdirs $yyy" ;;
5321 esac
5322 ;;
5323 esac
5324 break
5325 fi
5326 done
5327 if $test ! -f "$xxx"; then
5328 echo "No -l$thislib."
5329 fi
5330 done
5331 set X $dflt
5332 shift
5333 dflt="$*"
5334 case "$libs" in
5335 '') dflt="$dflt";;
5336 *) dflt="$libs";;
5337 esac
5338 case "$dflt" in
5339 ' '|'') dflt='none';;
5340 esac
5341
5342 $cat <<EOM
5343
5344 In order to compile $package on your machine, a number of libraries
5345 are usually needed. Include any other special libraries here as well.
5346 Say "none" for none. The default list is almost always right.
5347 EOM
5348
5349 echo " "
5350 rp="What libraries to use?"
5351 . ./myread
5352 case "$ans" in
5353 none) libs=' ';;
5354 *) libs="$ans";;
5355 esac
5356
5357 : determine optimization, if desired, or use for debug flag also
5358 case "$optimize" in
5359 ' '|$undef) dflt='none';;
5360 '') dflt='-O';;
5361 *) dflt="$optimize";;
5362 esac
5363 $cat <<EOH
5364
5365 By default, $package compiles with the -O flag to use the optimizer.
5366 Alternately, you might want to use the symbolic debugger, which uses
5367 the -g flag (on traditional Unix systems). Either flag can be
5368 specified here. To use neither flag, specify the word "none".
5369
5370 EOH
5371 rp="What optimizer/debugger flag should be used?"
5372 . ./myread
5373 optimize="$ans"
5374 case "$optimize" in
5375 'none') optimize=" ";;
5376 esac
5377
5378 : Check what DEBUGGING is required from the command line
5379 : -DEBUGGING or -DDEBUGGING or
5380 : -DEBUGGING=both = -g + -DDEBUGGING
5381 : -DEBUGGING=-g or -Doptimize=-g = -g
5382 : -DEBUGGING=none or -UDEBUGGING =
5383 : -DEBUGGING=old or -DEBUGGING=default = ? $optimize
5384 case "$EBUGGING" in
5385 '') ;;
5386 *) DEBUGGING=$EBUGGING ;;
5387 esac
5388
5389 case "$DEBUGGING" in
5390 -g|both|$define)
5391 case "$optimize" in
5392 *-g*) ;;
5393 *) optimize="$optimize -g" ;;
5394 esac ;;
5395 none|$undef)
5396 case "$optimize" in
5397 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5398 shift
5399 optimize="$*"
5400 ;;
5401 esac ;;
5402 esac
5403
5404 dflt=''
5405 case "$DEBUGGING" in
5406 both|$define) dflt='-DDEBUGGING'
5407 esac
5408
5409 : argument order is deliberate, as the flag will start with - which set could
5410 : think is an option
5411 checkccflag='check=$1; flag=$2; callback=$3;
5412 echo " ";
5413 echo "Checking if your compiler accepts $flag" >&4;
5414 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5415 echo "int main(void) { return 0; }" > gcctest.c;
5416 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5417 echo "Yes, it does." >&4;
5418 if $test -s gcctest.out ; then
5419 echo "But your platform does not like it:";
5420 cat gcctest.out;
5421 else
5422 case "$ccflags" in
5423 *$check*)
5424 echo "Leaving current flags $ccflags alone." >&4
5425 ;;
5426 *) dflt="$dflt $flag";
5427 eval $callback
5428 ;;
5429 esac
5430 fi
5431 else
5432 echo "Nope, it does not, but that is ok." >&4;
5433 fi
5434 '
5435
5436 : We will not override a previous value, but we might want to
5437 : augment a hint file
5438 case "$hint" in
5439 default|recommended)
5440 case "$gccversion" in
5441 1.*) dflt="$dflt -fpcc-struct-return" ;;
5442 esac
5443 case "$optimize:$DEBUGGING" in
5444 *-g*:old) dflt="$dflt -DDEBUGGING";;
5445 esac
5446 case "$gccversion" in
5447 2.*) if $test -d /etc/conf/kconfig.d &&
5448 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5449 then
5450 # Interactive Systems (ISC) POSIX mode.
5451 dflt="$dflt -posix"
5452 fi
5453 ;;
5454 esac
5455 case "$gccversion" in
5456 1.*) ;;
5457 2.[0-8]*) ;;
5458 ?*) set strict-aliasing -fno-strict-aliasing
5459 eval $checkccflag
5460 ;;
5461 esac
5462 # For gcc, adding -pipe speeds up compilations for some, but apparently
5463 # some assemblers can't read from stdin. (It also slows down compilations
5464 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5465 case "$gccversion" in
5466 ?*) set pipe -pipe
5467 eval $checkccflag
5468 ;;
5469 esac
5470
5471 # on x86_64 (at least) we require an extra library (libssp) in the
5472 # link command line. This library is not named, so I infer that it is
5473 # an implementation detail that may change. Hence the safest approach
5474 # is to add the flag to the flags passed to the compiler at link time,
5475 # as that way the compiler can do the right implementation dependant
5476 # thing. (NWC)
5477 case "$ccflags" in
5478 *-fno-stack-protector*)
5479 echo "Do not add -fstack-protector nor -fstack-protector-strong" 2>&1
5480 ;;
5481 *) case "$gccversion" in
5482 ?*) set stack-protector-strong -fstack-protector-strong
5483 eval $checkccflag
5484 case "$dflt" in
5485 *-fstack-protector-strong*) ;; # It got added.
5486 *) # Try the plain/older -fstack-protector.
5487 set stack-protector -fstack-protector
5488 eval $checkccflag
5489 ;;
5490 esac
5491 ;;
5492 esac
5493 ;;
5494 esac
5495 esac
5496
5497 case "$mips_type" in
5498 *BSD*|'') inclwanted="$locincpth $usrinc";;
5499 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5500 esac
5501 for thisincl in $inclwanted; do
5502 if $test -d $thisincl; then
5503 if $test x$thisincl != x$usrinc; then
5504 case "$dflt" in
5505 *" -I$thisincl "*);;
5506 *) dflt="$dflt -I$thisincl ";;
5507 esac
5508 fi
5509 fi
5510 done
5511
5512 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5513 xxx=true;
5514 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5515 xxx=true;
5516 else
5517 xxx=false;
5518 fi;
5519 if $xxx; then
5520 case "$dflt" in
5521 *$2*);;
5522 *) dflt="$dflt -D$2";;
5523 esac;
5524 fi'
5525
5526 set signal.h LANGUAGE_C; eval $inctest
5527
5528 case "$usesocks" in
5529 $define)
5530 ccflags="$ccflags -DSOCKS"
5531 ;;
5532 esac
5533
5534 case "$hint" in
5535 default|recommended) dflt="$ccflags $dflt" ;;
5536 *) dflt="$ccflags";;
5537 esac
5538
5539 case "$dflt" in
5540 ''|' ') dflt=none;;
5541 esac
5542
5543 $cat <<EOH
5544
5545 Your C compiler may want other flags. For this question you should include
5546 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5547 but you should NOT include libraries or ld flags like -lwhatever. If you
5548 want $package to honor its debug switch, you should include -DDEBUGGING here.
5549 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5550
5551 To use no flags, specify the word "none".
5552
5553 EOH
5554 set X $dflt
5555 shift
5556 dflt=${1+"$@"}
5557 rp="Any additional cc flags?"
5558 . ./myread
5559 case "$ans" in
5560 none) ccflags='';;
5561 *) ccflags="$ans";;
5562 esac
5563
5564 : the following weeds options from ccflags that are of no interest to cpp
5565 case "$cppflags" in
5566 '') cppflags="$ccflags" ;;
5567 *) set X $ccflags; shift
5568 case " $cppflags " in
5569 *" $1 "*) ;; # Try to avoid doubling the cppflags.
5570 *) cppflags="$cppflags $ccflags" ;;
5571 esac
5572 ;;
5573 esac
5574 case "$gccversion" in
5575 1.*) cppflags="$cppflags -D__GNUC__"
5576 esac
5577 case "$mips_type" in
5578 '');;
5579 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5580 esac
5581 case "$cppflags" in
5582 '');;
5583 *)
5584 echo " "
5585 echo "Let me guess what the preprocessor flags are..." >&4
5586 set X $cppflags
5587 shift
5588 cppflags=''
5589 $cat >cpp.c <<'EOM'
5590 #define BLURFL foo
5591
5592 BLURFL xx LFRULB
5593 EOM
5594 previous=''
5595 for flag in $*
5596 do
5597 case "$flag" in
5598 -*) ftry="$flag";;
5599 *) ftry="$previous $flag";;
5600 esac
5601 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5602 >cpp1.out 2>/dev/null && \
5603 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5604 >cpp2.out 2>/dev/null && \
5605 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5606 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5607 then
5608 cppflags="$cppflags $ftry"
5609 previous=''
5610 else
5611 previous="$flag"
5612 fi
5613 done
5614 set X $cppflags
5615 shift
5616 cppflags=${1+"$@"}
5617 case "$cppflags" in
5618 *-*) echo "They appear to be: $cppflags";;
5619 esac
5620 $rm -f cpp.c cpp?.out
5621 ;;
5622 esac
5623
5624 : flags used in final linking phase
5625 case "$ldflags" in
5626 '') if ./venix; then
5627 dflt='-i -z'
5628 else
5629 dflt=''
5630 fi
5631 case "$ccflags" in
5632 *-posix*) dflt="$dflt -posix" ;;
5633 esac
5634 ;;
5635 *) dflt="$ldflags";;
5636 esac
5637 # See note above about -fstack-protector
5638 case "$ccflags" in
5639 *-fstack-protector-strong*)
5640 case "$dflt" in
5641 *-fstack-protector-strong*) ;; # Don't add it again
5642 *) dflt="$dflt -fstack-protector-strong" ;;
5643 esac
5644 ;;
5645 *-fstack-protector*)
5646 case "$dflt" in
5647 *-fstack-protector*) ;; # Don't add it again
5648 *) dflt="$dflt -fstack-protector" ;;
5649 esac
5650 ;;
5651 esac
5652
5653 : Try to guess additional flags to pick up local libraries.
5654 for thislibdir in $libpth; do
5655 case " $loclibpth " in
5656 *" $thislibdir "*)
5657 case "$dflt " in
5658 *"-L$thislibdir "*) ;;
5659 *) dflt="$dflt -L$thislibdir" ;;
5660 esac
5661 ;;
5662 esac
5663 done
5664
5665 case "$dflt" in
5666 '') dflt='none' ;;
5667 esac
5668
5669 $cat <<EOH
5670
5671 Your C linker may need flags. For this question you should
5672 include -L/whatever and any other flags used by the C linker, but you
5673 should NOT include libraries like -lwhatever.
5674
5675 Make sure you include the appropriate -L/path flags if your C linker
5676 does not normally search all of the directories you specified above,
5677 namely
5678 $libpth
5679 To use no flags, specify the word "none".
5680
5681 EOH
5682
5683 rp="Any additional ld flags (NOT including libraries)?"
5684 . ./myread
5685 case "$ans" in
5686 none) ldflags='';;
5687 *) ldflags="$ans";;
5688 esac
5689 rmlist="$rmlist pdp11"
5690
5691 : coherency check
5692 echo " "
5693 echo "Checking your choice of C compiler and flags for coherency..." >&4
5694 $cat > try.c <<'EOF'
5695 #include <stdio.h>
5696 int main() { printf("Ok\n"); return(0); }
5697 EOF
5698 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5699 shift
5700 $cat >try.msg <<'EOM'
5701 I've tried to compile and run the following simple program:
5702
5703 EOM
5704 $cat try.c >> try.msg
5705
5706 $cat >> try.msg <<EOM
5707
5708 I used the command:
5709
5710 $*
5711 $run ./try
5712
5713 and I got the following output:
5714
5715 EOM
5716 dflt=y
5717 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5718 if $sh -c "$run ./try " >>try.msg 2>&1; then
5719 xxx=`$run ./try`
5720 case "$xxx" in
5721 "Ok") dflt=n ;;
5722 *) echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5723 esac
5724 else
5725 echo "The program compiled OK, but exited with status $?." >>try.msg
5726 rp="You have a problem. Shall I abort Configure"
5727 dflt=y
5728 fi
5729 else
5730 echo "I can't compile the test program." >>try.msg
5731 rp="You have a BIG problem. Shall I abort Configure"
5732 dflt=y
5733 fi
5734 case "$dflt" in
5735 y)
5736 $cat try.msg >&4
5737 case "$knowitall" in
5738 '')
5739 echo "(The supplied flags or libraries might be incorrect.)"
5740 ;;
5741 *) dflt=n;;
5742 esac
5743 echo " "
5744 . ./myread
5745 case "$ans" in
5746 n*|N*) ;;
5747 *) echo "Ok. Stopping Configure." >&4
5748 exit 1
5749 ;;
5750 esac
5751 ;;
5752 n) echo "OK, that should do.";;
5753 esac
5754 $rm_try gcctest gcctest.out
5755
5756 : define a shorthand compile call
5757 compile='
5758 mc_file=$1;
5759 shift;
5760 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5761 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to https://github.com/Perl/perl5/issues" >&4;
5762 exit 1;
5763 fi;
5764 esac;
5765 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5766 : define a shorthand compile call for compilations that should be ok.
5767 compile_ok='
5768 mc_file=$1;
5769 shift;
5770 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5771
5772 : stub, used only to satisfy other units
5773 i_stdlib='define'
5774
5775 : check for lengths of integral types
5776 echo " "
5777 case "$intsize" in
5778 '')
5779 echo "Checking to see how big your integers are..." >&4
5780 $cat >try.c <<EOCP
5781 #include <stdio.h>
5782 #$i_stdlib I_STDLIB
5783 #ifdef I_STDLIB
5784 #include <stdlib.h>
5785 #endif
5786 #include <stdio.h>
5787 int main()
5788 {
5789 printf("intsize=%d;\n", (int)sizeof(int));
5790 printf("longsize=%d;\n", (int)sizeof(long));
5791 printf("shortsize=%d;\n", (int)sizeof(short));
5792 exit(0);
5793 }
5794 EOCP
5795 set try
5796 if eval $compile_ok && $run ./try > /dev/null; then
5797 eval `$run ./try`
5798 echo "Your integers are $intsize bytes long."
5799 echo "Your long integers are $longsize bytes long."
5800 echo "Your short integers are $shortsize bytes long."
5801 else
5802 $cat >&4 <<EOM
5803 !
5804 Help! I can't compile and run the intsize test program: please enlighten me!
5805 (This is probably a misconfiguration in your system or libraries, and
5806 you really ought to fix it. Still, I'll try anyway.)
5807 !
5808 EOM
5809 dflt=4
5810 rp="What is the size of an integer (in bytes)?"
5811 . ./myread
5812 intsize="$ans"
5813 dflt=$intsize
5814 rp="What is the size of a long integer (in bytes)?"
5815 . ./myread
5816 longsize="$ans"
5817 dflt=2
5818 rp="What is the size of a short integer (in bytes)?"
5819 . ./myread
5820 shortsize="$ans"
5821 fi
5822 ;;
5823 esac
5824 $rm_try
5825
5826 : check for long long
5827 echo " "
5828 echo "Checking to see if you have long long..." >&4
5829 echo 'int main() { long long x = 7; return 0; }' > try.c
5830 set try
5831 if eval $compile; then
5832 val="$define"
5833 echo "You have long long."
5834 else
5835 val="$undef"
5836 echo "You do not have long long."
5837 fi
5838 $rm_try
5839 set d_longlong
5840 eval $setvar
5841
5842 : check for length of long long
5843 case "${d_longlong}${longlongsize}" in
5844 $define)
5845 echo " "
5846 echo "Checking to see how big your long longs are..." >&4
5847 $cat >try.c <<'EOCP'
5848 #include <stdio.h>
5849 int main()
5850 {
5851 printf("%d\n", (int)sizeof(long long));
5852 return(0);
5853 }
5854 EOCP
5855 set try
5856 if eval $compile_ok; then
5857 longlongsize=`$run ./try`
5858 echo "Your long longs are $longlongsize bytes long."
5859 else
5860 dflt='8'
5861 echo " "
5862 echo "(I can't seem to compile the test program. Guessing...)"
5863 rp="What is the size of a long long (in bytes)?"
5864 . ./myread
5865 longlongsize="$ans"
5866 fi
5867 if $test "X$longsize" = "X$longlongsize"; then
5868 echo "(That isn't any different from an ordinary long.)"
5869 fi
5870 ;;
5871 esac
5872 $rm_try
5873
5874 : determine filename position in cpp output
5875 echo " "
5876 echo "Computing filename position in cpp output for #include directives..." >&4
5877 case "$osname" in
5878 amigaos) fieldn=3 ;; # Workaround for a bug in abc (pdksh).
5879 esac
5880 case "$fieldn" in
5881 '')
5882 case "$osname" in
5883 vos) testaccess=-e ;;
5884 *) testaccess=-r ;;
5885 esac
5886 echo '#include <stdio.h>' > foo.c
5887 $cat >fieldn <<EOF
5888 $startsh
5889 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5890 $grep '^[ ]*#.*stdio\.h' | \
5891 while read cline; do
5892 pos=1
5893 set \$cline
5894 while $test \$# -gt 0; do
5895 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5896 echo "\$pos"
5897 exit 0
5898 fi
5899 shift
5900 pos=\`expr \$pos + 1\`
5901 done
5902 done
5903 EOF
5904 chmod +x fieldn
5905 fieldn=`./fieldn`
5906 $rm -f foo.c fieldn
5907 ;;
5908 esac
5909 case $fieldn in
5910 '') pos='???';;
5911 1) pos=first;;
5912 2) pos=second;;
5913 3) pos=third;;
5914 *) pos="${fieldn}th";;
5915 esac
5916 echo "Your cpp writes the filename in the $pos field of the line."
5917
5918 : locate header file
5919 $cat >findhdr <<EOF
5920 $startsh
5921 wanted=\$1
5922 name=''
5923 for usrincdir in $incpth
5924 do
5925 if test -f \$usrincdir/\$wanted; then
5926 echo "\$usrincdir/\$wanted"
5927 exit 0
5928 fi
5929 done
5930 awkprg='{ print \$$fieldn }'
5931 echo "#include <\$wanted>" > foo\$\$.c
5932 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5933 $cppfilter $grep "^[ ]*#.*\$wanted" | \
5934 while read cline; do
5935 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5936 case "\$name" in
5937 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5938 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5939 *) exit 2;;
5940 esac;
5941 done;
5942 #
5943 # status = 0: grep returned 0 lines, case statement not executed
5944 # status = 1: headerfile found
5945 # status = 2: while loop executed, no headerfile found
5946 #
5947 status=\$?
5948 $rm -f foo\$\$.c;
5949 if test \$status -eq 1; then
5950 exit 0;
5951 fi
5952 exit 1
5953 EOF
5954 chmod +x findhdr
5955
5956 : define an alternate in-header-list? function
5957 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5958 cont=true; xxf="echo \"<\$1> found.\" >&4";
5959 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5960 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5961 esac;
5962 case $# in 4) instead=instead;; *) instead="at last";; esac;
5963 while $test "$cont"; do
5964 xxx=`./findhdr $1`
5965 var=$2; eval "was=\$$2";
5966 if $test "$xxx" && $test -r "$xxx";
5967 then eval $xxf;
5968 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5969 cont="";
5970 else eval $xxnf;
5971 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5972 set $yyy; shift; shift; yyy=$@;
5973 case $# in 0) cont="";;
5974 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5975 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5976 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5977 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5978 esac;
5979 done;
5980 while $test "$yyy";
5981 do set $yyy; var=$2; eval "was=\$$2";
5982 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5983 set $yyy; shift; shift; yyy=$@;
5984 done'
5985
5986 : see if inttypes.h is available
5987 : we want a real compile instead of Inhdr because some systems
5988 : have an inttypes.h which includes non-existent headers
5989 echo " "
5990 $cat >try.c <<EOCP
5991 #include <inttypes.h>
5992 int main() {
5993 static int32_t foo32 = 0x12345678;
5994 }
5995 EOCP
5996 set try
5997 if eval $compile; then
5998 echo "<inttypes.h> found." >&4
5999 val="$define"
6000 else
6001 echo "<inttypes.h> NOT found." >&4
6002 val="$undef"
6003 fi
6004 $rm_try
6005 set i_inttypes
6006 eval $setvar
6007
6008 : check for int64_t
6009 echo " "
6010 echo "Checking to see if you have int64_t..." >&4
6011 $cat >try.c <<EOCP
6012 #include <sys/types.h>
6013 #$i_inttypes I_INTTYPES
6014 #ifdef I_INTTYPES
6015 #include <inttypes.h>
6016 #endif
6017 int main() { int64_t x = 7; }
6018 EOCP
6019 set try
6020 if eval $compile; then
6021 val="$define"
6022 echo "You have int64_t."
6023 else
6024 val="$undef"
6025 echo "You do not have int64_t."
6026 fi
6027 $rm_try
6028 set d_int64_t
6029 eval $setvar
6030
6031 : Check if 64bit ints have a quad type
6032 echo " "
6033 echo "Checking which 64-bit integer type we could use..." >&4
6034
6035 case "$intsize" in
6036 8) val=int
6037 set quadtype
6038 eval $setvar
6039 val='"unsigned int"'
6040 set uquadtype
6041 eval $setvar
6042 quadkind=1
6043 ;;
6044 *) case "$longsize" in
6045 8) val=long
6046 set quadtype
6047 eval $setvar
6048 val='"unsigned long"'
6049 set uquadtype
6050 eval $setvar
6051 quadkind=2
6052 ;;
6053 *) case "$d_longlong:$longlongsize" in
6054 define:8)
6055 val='"long long"'
6056 set quadtype
6057 eval $setvar
6058 val='"unsigned long long"'
6059 set uquadtype
6060 eval $setvar
6061 quadkind=3
6062 ;;
6063 *) case "$d_int64_t" in
6064 define)
6065 val=int64_t
6066 set quadtype
6067 eval $setvar
6068 val=uint64_t
6069 set uquadtype
6070 eval $setvar
6071 quadkind=4
6072 ;;
6073 esac
6074 ;;
6075 esac
6076 ;;
6077 esac
6078 ;;
6079 esac
6080
6081 case "$quadtype" in
6082 '') echo "Alas, no 64-bit integer types in sight." >&4
6083 d_quad="$undef"
6084 ;;
6085 *) echo "We could use '$quadtype' for 64-bit integers." >&4
6086 d_quad="$define"
6087 ;;
6088 esac
6089
6090 : Do we want 64bit support
6091 case "$uselonglong" in
6092 "$define"|true|[yY]*)
6093 cat <<EOM >&4
6094
6095 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6096 EOM
6097 use64bitint="$define"
6098 ;;
6099 esac
6100 case "$use64bits" in
6101 "$define"|true|[yY]*)
6102 cat <<EOM >&4
6103
6104 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6105 EOM
6106 use64bitint="$define"
6107 ;;
6108 esac
6109 case "$use64bitints" in
6110 "$define"|true|[yY]*)
6111 cat <<EOM >&4
6112
6113 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6114 EOM
6115 use64bitint="$define"
6116 ;;
6117 esac
6118 case "$use64bitsint" in
6119 "$define"|true|[yY]*)
6120 cat <<EOM >&4
6121
6122 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6123 EOM
6124 use64bitint="$define"
6125 ;;
6126 esac
6127 case "$uselonglongs" in
6128 "$define"|true|[yY]*)
6129 cat <<EOM >&4
6130
6131 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6132 EOM
6133 use64bitint="$define"
6134 ;;
6135 esac
6136 case "$use64bitsall" in
6137 "$define"|true|[yY]*)
6138 cat <<EOM >&4
6139
6140 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6141 EOM
6142 use64bitall="$define"
6143 ;;
6144 esac
6145
6146 case "$ccflags" in
6147 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6148 esac
6149 case "$use64bitall" in
6150 "$define"|true|[yY]*) use64bitint="$define" ;;
6151 esac
6152
6153 case "$longsize" in
6154 8) cat <<EOM
6155
6156 You have natively 64-bit long integers.
6157 EOM
6158 val="$define"
6159 ;;
6160 *) case "$use64bitint" in
6161 "$define"|true|[yY]*) dflt='y';;
6162 *) dflt='n';;
6163 esac
6164 case "$d_quad" in
6165 "$define") ;;
6166 *) dflt='n' ;;
6167 esac
6168 cat <<EOM
6169
6170 Perl can be built to take advantage of 64-bit integer types
6171 on some systems. To do so, Configure can be run with -Duse64bitint.
6172 Choosing this option will most probably introduce binary incompatibilities.
6173
6174 If this doesn't make any sense to you, just accept the default '$dflt'.
6175 (The default has been chosen based on your configuration.)
6176 EOM
6177 rp='Try to use 64-bit integers, if available?'
6178 . ./myread
6179 case "$ans" in
6180 [yY]*) val="$define" ;;
6181 *) val="$undef" ;;
6182 esac
6183 ;;
6184 esac
6185 set use64bitint
6186 eval $setvar
6187
6188 case "$use64bitall" in
6189 "$define"|true|[yY]*) dflt='y' ;;
6190 *) case "$longsize" in
6191 8) dflt='y' ;;
6192 *) dflt='n' ;;
6193 esac
6194 ;;
6195 esac
6196 cat <<EOM
6197
6198 You may also choose to try maximal 64-bitness. It means using as much
6199 64-bitness as possible on the platform. This in turn means even more
6200 binary incompatibilities. On the other hand, your platform may not
6201 have any more 64-bitness available than what you already have chosen.
6202
6203 If this doesn't make any sense to you, just accept the default '$dflt'.
6204 (The default has been chosen based on your configuration.)
6205 EOM
6206 rp='Try to use maximal 64-bit support, if available?'
6207 . ./myread
6208 case "$ans" in
6209 [yY]*) val="$define" ;;
6210 *) val="$undef" ;;
6211 esac
6212 set use64bitall
6213 eval $setvar
6214 case "$use64bitall" in
6215 "$define")
6216 case "$use64bitint" in
6217 "$undef")
6218 cat <<EOM
6219
6220 Since you have chosen a maximally 64-bit build, I'm also turning on
6221 the use of 64-bit integers.
6222 EOM
6223 use64bitint="$define" ;;
6224 esac
6225 ;;
6226 esac
6227
6228 : Look for a hint-file generated 'call-back-unit'. If the
6229 : user has specified that a 64-bit perl is to be built,
6230 : we may need to set or change some other defaults.
6231 if $test -f use64bitint.cbu; then
6232 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6233 . ./use64bitint.cbu
6234 fi
6235 case "$use64bitint" in
6236 "$define"|true|[yY]*)
6237 : This test was common to all the OpenBSD forks, and seems harmless for
6238 : other platforms:
6239 echo " "
6240 echo "Checking if your C library has broken 64-bit functions..." >&4
6241 cat >try.c <<EOCP
6242 #include <stdio.h>
6243 typedef $uquadtype myULL;
6244 int main (void)
6245 {
6246 struct {
6247 double d;
6248 myULL u;
6249 } *p, test[] = {
6250 {4294967303.15, 4294967303ULL},
6251 {4294967294.2, 4294967294ULL},
6252 {4294967295.7, 4294967295ULL},
6253 {0.0, 0ULL}
6254 };
6255 for (p = test; p->u; p++) {
6256 myULL x = (myULL)p->d;
6257 if (x != p->u) {
6258 printf("buggy\n");
6259 return 0;
6260 }
6261 }
6262 printf("ok\n");
6263 return 0;
6264 }
6265 EOCP
6266 set try
6267 if eval $compile_ok; then
6268 libcquad=`$run ./try`
6269 echo "Your C library's 64-bit functions are $libcquad."
6270 else
6271 echo "(I can't seem to compile the test program.)"
6272 echo "Assuming that your C library's 64-bit functions are ok."
6273 libcquad="ok"
6274 fi
6275 $rm_try
6276
6277 case "$libcquad" in
6278 buggy*)
6279 cat >&4 <<EOM
6280
6281 *** You have a C library with broken 64-bit functions.
6282 *** 64-bit support does not work reliably in this configuration.
6283 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6284 *** Cannot continue, aborting.
6285
6286 EOM
6287 exit 1
6288 ;;
6289 esac
6290 case "$longsize" in
6291 4) case "$archname64" in
6292 '') archname64=64int ;;
6293 esac
6294 ;;
6295 esac
6296 ;;
6297 esac
6298
6299 : Look for a hint-file generated 'call-back-unit'. If the
6300 : user has specified that a maximally 64-bit perl is to be built,
6301 : we may need to set or change some other defaults.
6302 if $test -f use64bitall.cbu; then
6303 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6304 . ./use64bitall.cbu
6305 fi
6306 case "$use64bitall" in
6307 "$define"|true|[yY]*)
6308 case "$longsize" in
6309 4) case "$archname64" in
6310 ''|64int) archname64=64all ;;
6311 esac
6312 ;;
6313 esac
6314 ;;
6315 esac
6316
6317 case "$d_quad:$use64bitint" in
6318 $undef:$define)
6319 cat >&4 <<EOF
6320
6321 *** You have chosen to use 64-bit integers,
6322 *** but none can be found.
6323 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6324 *** Cannot continue, aborting.
6325
6326 EOF
6327 exit 1
6328 ;;
6329 esac
6330
6331 : Check if we are using the GNU C library
6332 echo " "
6333 echo "Checking for GNU C Library..." >&4
6334 cat >try.c <<'EOCP'
6335 /* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
6336 alone are insufficient to distinguish different versions, such as
6337 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
6338 libc version 2.1.0. A. Dougherty, June 3, 2002.
6339 */
6340 #include <stdio.h>
6341 int main(void)
6342 {
6343 #ifdef __GLIBC__
6344 # ifdef __GLIBC_MINOR__
6345 # if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6346 # include <gnu/libc-version.h>
6347 printf("%s\n", gnu_get_libc_version());
6348 # else
6349 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
6350 # endif
6351 # else
6352 printf("%d\n", __GLIBC__);
6353 # endif
6354 return 0;
6355 #else
6356 return 1;
6357 #endif
6358 }
6359 EOCP
6360 set try
6361 if eval $compile_ok && $run ./try > glibc.ver; then
6362 val="$define"
6363 gnulibc_version=`$cat glibc.ver`
6364 echo "You are using the GNU C Library version $gnulibc_version"
6365 else
6366 val="$undef"
6367 gnulibc_version=''
6368 echo "You are not using the GNU C Library"
6369 fi
6370 $rm_try glibc.ver
6371 set d_gnulibc
6372 eval $setvar
6373
6374 : see if nm is to be used to determine whether a symbol is defined or not
6375 case "$usenm" in
6376 '')
6377 dflt=''
6378 case "$d_gnulibc" in
6379 "$define")
6380 echo " "
6381 echo "nm probably won't work on the GNU C Library." >&4
6382 dflt=n
6383 ;;
6384 esac
6385 case "$dflt" in
6386 '')
6387 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6388 echo " "
6389 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
6390 echo "'nm' won't be sufficient on this system." >&4
6391 dflt=n
6392 fi
6393 ;;
6394 esac
6395 case "$dflt" in
6396 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6397 if $test $dflt -gt 20; then
6398 dflt=y
6399 else
6400 dflt=n
6401 fi
6402 ;;
6403 esac
6404 ;;
6405 *)
6406 case "$usenm" in
6407 true|$define) dflt=y;;
6408 *) dflt=n;;
6409 esac
6410 ;;
6411 esac
6412 $cat <<EOM
6413
6414 I can use $nm to extract the symbols from your C libraries. This
6415 is a time consuming task which may generate huge output on the disk (up
6416 to 3 megabytes) but that should make the symbols extraction faster. The
6417 alternative is to skip the 'nm' extraction part and to compile a small
6418 test program instead to determine whether each symbol is present. If
6419 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6420 this may be the best solution.
6421
6422 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6423
6424 EOM
6425 rp="Shall I use $nm to extract C symbols from the libraries?"
6426 . ./myread
6427 case "$ans" in
6428 [Nn]*) usenm=false;;
6429 *) usenm=true;;
6430 esac
6431
6432 runnm=$usenm
6433 case "$reuseval" in
6434 true) runnm=false;;
6435 esac
6436
6437 : nm options which may be necessary
6438 case "$nm_opt" in
6439 '') if $test -f /mach_boot; then
6440 nm_opt='' # Mach
6441 elif $test -d /usr/ccs/lib; then
6442 nm_opt='-p' # Solaris (and SunOS?)
6443 elif $test -f /dgux; then
6444 nm_opt='-p' # DG-UX
6445 elif $test -f /lib64/rld; then
6446 nm_opt='-p' # 64-bit Irix
6447 else
6448 nm_opt=''
6449 fi;;
6450 esac
6451
6452 : nm options which may be necessary for shared libraries but illegal
6453 : for archive libraries. Thank you, Linux.
6454 case "$nm_so_opt" in
6455 '') case "$myuname" in
6456 *linux*|gnu*)
6457 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6458 nm_so_opt='--dynamic'
6459 fi
6460 ;;
6461 esac
6462 ;;
6463 esac
6464
6465 : Figure out where the libc is located
6466 case "$runnm" in
6467 true)
6468 : get list of predefined functions in a handy place
6469 echo " "
6470 case "$libc" in
6471 '') libc=unknown
6472 case "$libs" in
6473 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6474 esac
6475 ;;
6476 esac
6477 case "$libs" in
6478 '') ;;
6479 *) for thislib in $libs; do
6480 case "$thislib" in
6481 -lc|-lc_s)
6482 : Handle C library specially below.
6483 ;;
6484 -l*)
6485 thislib=`echo $thislib | $sed -e 's/^-l//'`
6486 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6487 :
6488 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6489 :
6490 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6491 :
6492 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6493 :
6494 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6495 :
6496 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6497 :
6498 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6499 :
6500 else
6501 try=''
6502 fi
6503 libnames="$libnames $try"
6504 ;;
6505 *) libnames="$libnames $thislib" ;;
6506 esac
6507 done
6508 ;;
6509 esac
6510 xxx=normal
6511 case "$libc" in
6512 unknown)
6513 set /lib/libc.$so
6514 for xxx in $libpth; do
6515 $test -r $1 || set $xxx/libc.$so
6516 : The messy sed command sorts on library version numbers.
6517 $test -r $1 || \
6518 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6519 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6520 h
6521 s/[0-9][0-9]*/0000&/g
6522 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6523 G
6524 s/\n/ /' | \
6525 $sort | $sed -e 's/^.* //'`
6526 eval set \$$#
6527 done
6528 $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6529 $test -r $1 || set $sysroot/lib/libsys_s$_a
6530 ;;
6531 *)
6532 set blurfl
6533 ;;
6534 esac
6535 if $test -r "$1"; then
6536 echo "Your (shared) C library seems to be in $1."
6537 libc="$1"
6538 elif $test -r /lib/libc && $test -r /lib/clib; then
6539 echo "Your C library seems to be in both /lib/clib and /lib/libc."
6540 xxx=apollo
6541 libc='/lib/clib /lib/libc'
6542 if $test -r /lib/syslib; then
6543 echo "(Your math library is in /lib/syslib.)"
6544 libc="$libc /lib/syslib"
6545 fi
6546 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6547 echo "Your C library seems to be in $libc, as you said before."
6548 elif $test -r $incpath/usr/lib/libc$_a; then
6549 libc=$incpath/usr/lib/libc$_a;
6550 echo "Your C library seems to be in $libc. That's fine."
6551 elif $test -r /lib/libc$_a; then
6552 libc=/lib/libc$_a;
6553 echo "Your C library seems to be in $libc. You're normal."
6554 else
6555 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6556 :
6557 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6558 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6559 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6560 :
6561 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6562 :
6563 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6564 :
6565 else
6566 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6567 fi
6568 if $test -r "$tans"; then
6569 echo "Your C library seems to be in $tans, of all places."
6570 libc=$tans
6571 else
6572 libc='blurfl'
6573 fi
6574 fi
6575 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6576 dflt="$libc"
6577 cat <<EOM
6578
6579 If the guess above is wrong (which it might be if you're using a strange
6580 compiler, or your machine supports multiple models), you can override it here.
6581
6582 EOM
6583 else
6584 dflt=''
6585 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6586 cat >&4 <<EOM
6587 I can't seem to find your C library. I've looked in the following places:
6588
6589 EOM
6590 $sed 's/^/ /' libpath
6591 cat <<EOM
6592
6593 None of these seems to contain your C library. I need to get its name...
6594
6595 EOM
6596 fi
6597 fn=f
6598 rp='Where is your C library?'
6599 . ./getfile
6600 libc="$ans"
6601
6602 echo " "
6603 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6604 set X `cat libnames`
6605 shift
6606 xxx=files
6607 case $# in 1) xxx=file; esac
6608 echo "Extracting names from the following $xxx for later perusal:" >&4
6609 echo " "
6610 $sed 's/^/ /' libnames >&4
6611 echo " "
6612 $echo $n "This may take a while...$c" >&4
6613
6614 for file in $*; do
6615 case $file in
6616 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6617 *) $nm $nm_opt $file 2>/dev/null;;
6618 esac
6619 done >libc.tmp
6620
6621 $echo $n ".$c"
6622 $grep fprintf libc.tmp > libc.ptf
6623 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6624 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6625 xxx='[ADTSIWi]'
6626 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
6627 eval $xscan;\
6628 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6629 eval $xrun
6630 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6631 eval $xscan;\
6632 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6633 eval $xrun
6634 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6635 eval $xscan;\
6636 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6637 eval $xrun
6638 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6639 eval $xscan;\
6640 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6641 eval $xrun
6642 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6643 eval $xscan;\
6644 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6645 eval $xrun
6646 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6647 eval $xscan;\
6648 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6649 eval $xrun
6650 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6651 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
6652 eval $xscan;\
6653 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6654 eval $xrun
6655 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6656 eval $xscan;\
6657 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6658 eval $xrun
6659 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6660 eval $xscan;\
6661 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6662 eval $xrun
6663 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6664 eval $xscan;\
6665 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6666 eval $xrun
6667 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6668 eval $xscan;\
6669 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6670 eval $xrun
6671 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6672 eval $xscan;\
6673 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6674 eval $xrun
6675 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6676 eval $xscan;\
6677 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6678 eval $xrun
6679 elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
6680 eval $xscan;\
6681 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6682 eval $xrun
6683 else
6684 $nm -p $* 2>/dev/null >libc.tmp
6685 $grep fprintf libc.tmp > libc.ptf
6686 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6687 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6688 then
6689 nm_opt='-p'
6690 eval $xrun
6691 else
6692 echo " "
6693 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6694 com=''
6695 if $ar t $libc > libc.tmp && \
6696 $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6697 then
6698 for thisname in $libnames $libc; do
6699 $ar t $thisname >>libc.tmp
6700 done
6701 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6702 echo "Ok." >&4
6703 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6704 for thisname in $libnames $libc; do
6705 $ar tv $thisname >>libc.tmp
6706 emximp -o tmp.imp $thisname \
6707 2>/dev/null && \
6708 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6709 < tmp.imp >>libc.tmp
6710 $rm -f tmp.imp
6711 done
6712 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6713 echo "Ok." >&4
6714 else
6715 echo "$ar didn't seem to work right." >&4
6716 echo "Maybe this is a Cray...trying bld instead..." >&4
6717 if bld t $libc | \
6718 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6719 $test -s libc.list
6720 then
6721 for thisname in $libnames; do
6722 bld t $libnames | \
6723 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6724 $ar t $thisname >>libc.tmp
6725 done
6726 echo "Ok." >&4
6727 else
6728 echo "That didn't work either. Giving up." >&4
6729 exit 1
6730 fi
6731 fi
6732 fi
6733 fi
6734 nm_extract="$com"
6735 case "$PASE" in
6736 define)
6737 echo " "
6738 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6739 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6740 ;;
6741 *) if $test -f /lib/syscalls.exp; then
6742 echo " "
6743 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6744 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \
6745 /lib/syscalls.exp >>libc.list
6746 fi
6747 ;;
6748 esac
6749 ;;
6750 esac
6751 $rm -f libnames libpath
6752
6753 : Check if we are using C++
6754 echo " "
6755 echo "Checking for C++..." >&4
6756 $cat >try.c <<'EOCP'
6757 #include <stdio.h>
6758 int main(void)
6759 {
6760 #ifdef __cplusplus
6761 return 0;
6762 #else
6763 return 1;
6764 #endif
6765 }
6766 EOCP
6767 set try
6768 if eval $compile_ok && $run ./try; then
6769 val="$define"
6770 echo "You are using a C++ compiler."
6771 else
6772 val="$undef"
6773 echo "You are not using a C++ compiler."
6774 fi
6775 $rm_try cplusplus$$
6776 set d_cplusplus
6777 eval $setvar
6778
6779 : is a C symbol defined?
6780 csym='tlook=$1;
6781 case "$3" in
6782 -v) tf=libc.tmp; tdc="";;
6783 -a) tf=libc.tmp; tdc="[]";;
6784 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6785 esac;
6786 case "$d_cplusplus" in
6787 $define) extern_C="extern \"C\"" ;;
6788 *) extern_C="extern" ;;
6789 esac;
6790 tx=yes;
6791 case "$reuseval-$4" in
6792 true-) ;;
6793 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6794 esac;
6795 case "$tx" in
6796 yes)
6797 tval=false;
6798 if $test "$runnm" = true; then
6799 if $contains $tlook $tf >/dev/null 2>&1; then
6800 tval=true;
6801 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6802 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;
6803 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6804 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6805 $rm_try;
6806 fi;
6807 else
6808 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;
6809 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6810 $rm_try;
6811 fi;
6812 ;;
6813 *)
6814 case "$tval" in
6815 $define) tval=true;;
6816 *) tval=false;;
6817 esac;
6818 ;;
6819 esac;
6820 eval "$2=$tval"'
6821
6822 : define an is-in-libc? function
6823 inlibc='echo " "; td=$define; tu=$undef;
6824 sym=$1; var=$2; eval "was=\$$2";
6825 tx=yes;
6826 case "$reuseval$was" in
6827 true) ;;
6828 true*) tx=no;;
6829 esac;
6830 case "$tx" in
6831 yes)
6832 set $sym tres -f;
6833 eval $csym;
6834 case "$tres" in
6835 true)
6836 echo "$sym() found." >&4;
6837 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6838 *)
6839 echo "$sym() NOT found." >&4;
6840 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6841 esac;;
6842 *)
6843 case "$was" in
6844 $define) echo "$sym() found." >&4;;
6845 *) echo "$sym() NOT found." >&4;;
6846 esac;;
6847 esac'
6848
6849 : check for length of double
6850 echo " "
6851 case "$doublesize" in
6852 '')
6853 echo "Checking to see how big your double precision numbers are..." >&4
6854 $cat >try.c <<EOCP
6855 #include <stdio.h>
6856 #$i_stdlib I_STDLIB
6857 #ifdef I_STDLIB
6858 #include <stdlib.h>
6859 #endif
6860 #include <stdio.h>
6861 int main()
6862 {
6863 printf("%d\n", (int)sizeof(double));
6864 exit(0);
6865 }
6866 EOCP
6867 set try
6868 if eval $compile_ok; then
6869 doublesize=`$run ./try`
6870 echo "Your double is $doublesize bytes long."
6871 else
6872 dflt='8'
6873 echo "(I can't seem to compile the test program. Guessing...)"
6874 rp="What is the size of a double precision number (in bytes)?"
6875 . ./myread
6876 doublesize="$ans"
6877 fi
6878 ;;
6879 esac
6880 $rm_try
6881
6882 : check for long doubles
6883 echo " " >&4
6884 echo "Checking to see if you have long double..." >&4
6885 echo 'int main() { long double x = 7.0; }' > try.c
6886 set try
6887 if eval $compile; then
6888 val="$define"
6889 echo "You have long double." >&4
6890 else
6891 val="$undef"
6892 echo "You do not have long double." >&4
6893 fi
6894 $rm_try
6895 set d_longdbl
6896 eval $setvar
6897
6898 : see if ldexpl exists
6899 set ldexpl d_ldexpl
6900 eval $inlibc
6901
6902 : check for length of long double
6903 case "${d_longdbl}${longdblsize}" in
6904 $define)
6905 echo " " >&4
6906 echo "Checking to see how big your long doubles are..." >&4
6907 $cat >try.c <<'EOCP'
6908 #include <stdio.h>
6909 int main()
6910 {
6911 printf("%d\n", sizeof(long double));
6912 }
6913 EOCP
6914 set try
6915 set try
6916 if eval $compile; then
6917 longdblsize=`$run ./try`
6918 echo "Your long doubles are $longdblsize bytes long." >&4
6919 else
6920 dflt='8'
6921 echo " " >&4
6922 echo "(I can't seem to compile the test program. Guessing...)" >&4
6923 rp="What is the size of a long double (in bytes)?"
6924 . ./myread
6925 longdblsize="$ans"
6926 fi
6927 if $test "X$doublesize" = "X$longdblsize"; then
6928 echo "That isn't any different from an ordinary double." >&4
6929 echo "I'll keep your setting anyway, but you may see some" >&4
6930 echo "harmless compilation warnings." >&4
6931 fi
6932 ;;
6933 esac
6934 $rm_try
6935
6936 $echo "Checking the kind of long doubles you have..." >&4
6937 case "$d_longdbl" in
6938 define)
6939 $cat <<EOP >try.c
6940 #$i_stdlib I_STDLIB
6941 #define LONGDBLSIZE $longdblsize
6942 #define DOUBLESIZE $doublesize
6943 #include <float.h>
6944 #ifdef I_STDLIB
6945 #include <stdlib.h>
6946 #endif
6947 #include <stdio.h>
6948 static const long double d = -0.1L;
6949 int main() {
6950 unsigned const char* b = (unsigned const char*)(&d);
6951 #if DOUBLESIZE == LONGDBLSIZE
6952 printf("0\n"); /* if it floats like double */
6953 exit(0);
6954 #endif
6955 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6956 if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6957 /* IEEE 754 128-bit little-endian */
6958 printf("1\n");
6959 exit(0);
6960 }
6961 if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6962 /* IEEE 128-bit big-endian, e.g. solaris sparc */
6963 printf("2\n");
6964 exit(0);
6965 }
6966 #endif
6967 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6968 * while 64-bits platforms have it in 16 bytes. The trailing bytes
6969 * cannot be trusted. */
6970 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6971 if (b[0] == 0xCD && b[9] == 0xBF) {
6972 /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6973 * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6974 * Also known as "extended precision". */
6975 printf("3\n");
6976 exit(0);
6977 }
6978 if (b[0] == 0xBF && b[9] == 0xCD) {
6979 /* Is there ever big-endian 80-bit, really?
6980 *
6981 * The Motorola 68881 had another "extended precision" format:
6982 * sign:1 exp:15 zero:16 integer:1 mantissa:63
6983 * for total of 96 bits of bytes. The zero bits were unused.
6984 * See "M68000 FAMILY PROGRAMMER'S REFERENCE MANUAL" for more details.
6985 * If it ever becomes relevant, this format should be allocated a
6986 * new doublekind code since it is quite different from the Intel x87.
6987 */
6988 printf("4\n");
6989 exit(0);
6990 }
6991 #endif
6992 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6993 /* software "double double", the 106 is 53+53.
6994 * but irix thinks it is 107. */
6995 if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6996 /* double double 128-bit fully little-endian,
6997 * little-endian doubles in little-endian order,
6998 * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
6999 printf("5\n");
7000 exit(0);
7001 }
7002 if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7003 /* double double 128-bit fully big-endian,
7004 * big-endian doubles in big-endian order,
7005 * e.g. PPC/Power and MIPS:
7006 * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7007 printf("6\n");
7008 exit(0);
7009 }
7010 if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7011 /* double double 128-bit mixed endian.
7012 * little-endian doubles in big-endian order,
7013 * e.g. ppc64el,
7014 * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7015 printf("7\n");
7016 exit(0);
7017 }
7018 if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7019 /* double double 128-bit mixed endian,
7020 * big-endian doubles in little-endian order,
7021 * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7022 printf("8\n");
7023 exit(0);
7024 }
7025 #endif
7026 /* We are largely making this up because it may well be
7027 * that the VAX format H was never made available to C,
7028 * only to Fortran. */
7029 #if LONGDBLSIZE == 16 && defined(__vax__)
7030 if (b[0] == 0xFD && b[15] == 0x99) {
7031 /* VAX format H, PDP-11 mixed endian. */
7032 printf("9\n");
7033 exit(0);
7034 }
7035 #endif
7036 printf("-1\n"); /* unknown */
7037 exit(0);
7038 }
7039 EOP
7040 set try
7041 if eval $compile; then
7042 longdblkind=`$run ./try`
7043 else
7044 longdblkind=-1
7045 fi
7046 ;;
7047 *) longdblkind=0 ;;
7048 esac
7049 case "$longdblkind" in
7050 0) echo "Your long doubles are doubles." >&4 ;;
7051 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7052 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7053 3) echo "You have x86 80-bit little endian long doubles." >&4 ;;
7054 4) echo "You have x86 80-bit big endian long doubles." >&4 ;;
7055 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >&4 ;;
7056 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >&4 ;;
7057 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >&4 ;;
7058 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >&4 ;;
7059 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >&4 ;;
7060 *) echo "Cannot figure out your long double." >&4 ;;
7061 esac
7062 d_long_double_style_ieee=$undef
7063 d_long_double_style_ieee_std=$undef
7064 d_long_double_style_ieee_extended=$undef
7065 d_long_double_style_ieee_doubledouble=$undef
7066 d_long_double_style_vax=$undef
7067 case "$longdblkind" in
7068 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7069 esac
7070 case "$longdblkind" in
7071 1|2) d_long_double_style_ieee_std=$define ;;
7072 esac
7073 case "$longdblkind" in
7074 3|4) d_long_double_style_ieee_extended=$define ;;
7075 esac
7076 case "$longdblkind" in
7077 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7078 esac
7079 case "$longdblkind" in
7080 9) d_long_double_style_vax=$define ;;
7081 esac
7082 $rm_try
7083
7084 : get the patchlevel
7085 echo " "
7086 echo "Getting the current patchlevel..." >&4
7087 if $test -r $rsrc/patchlevel.h;then
7088 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
7089 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
7090 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
7091 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
7092 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
7093 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
7094 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
7095 else
7096 revision=0
7097 patchlevel=0
7098 subversion=0
7099 api_revision=0
7100 api_version=0
7101 api_subversion=0
7102 perl_patchlevel=0
7103 $echo "(You do not have patchlevel.h. Eek.)"
7104 fi
7105 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
7106 version_patchlevel_string="version $patchlevel subversion $subversion"
7107 case "$perl_patchlevel" in
7108 0|'') ;;
7109 *) perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
7110 version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
7111 ;;
7112 esac
7113
7114 $echo "(You have $package $version_patchlevel_string.)"
7115
7116 case "$osname" in
7117 dos|vms)
7118 : XXX Should be a Configure test for double-dots in filenames.
7119 version=`echo $revision $patchlevel $subversion | \
7120 $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
7121 api_versionstring=`echo $api_revision $api_version $api_subversion | \
7122 $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
7123 ;;
7124 *)
7125 version=`echo $revision $patchlevel $subversion | \
7126 $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
7127 api_versionstring=`echo $api_revision $api_version $api_subversion | \
7128 $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
7129 ;;
7130 esac
7131 : Special case the 5.005_xx maintenance series, which used 5.005
7132 : without any subversion label as a subdirectory in $sitelib
7133 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
7134 api_versionstring='5.005'
7135 fi
7136
7137 : Check if quadmath is requested
7138 case "$usequadmath" in
7139 "$define"|true|[yY]*) usequadmath="$define" ;;
7140 *) usequadmath="$undef" ;;
7141 esac
7142
7143 : Fail if both uselongdouble and usequadmath are requested
7144 case "$usequadmath:$uselongdouble" in
7145 define:define)
7146 $cat <<EOM >&4
7147
7148 *** You requested the use of the quadmath library and use
7149 *** of long doubles.
7150 ***
7151 *** Please select one or the other.
7152 EOM
7153 exit 1
7154 ;;
7155 esac
7156
7157 : determine the architecture name
7158 echo " "
7159 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7160 tarch=`arch`"-$osname"
7161 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7162 if uname -m > tmparch 2>&1 ; then
7163 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7164 -e 's/$/'"-$osname/" tmparch`
7165 else
7166 tarch="$osname"
7167 fi
7168 $rm -f tmparch
7169 else
7170 tarch="$osname"
7171 fi
7172 case "$myarchname" in
7173 ''|"$tarch") ;;
7174 *)
7175 echo "(Your architecture name used to be $myarchname.)"
7176 archname=''
7177 ;;
7178 esac
7179 case "$targetarch" in
7180 '') ;;
7181 *) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7182 esac
7183 myarchname="$tarch"
7184 case "$archname" in
7185 '') dflt="$tarch";;
7186 *) dflt="$archname";;
7187 esac
7188 rp='What is your architecture name'
7189 . ./myread
7190 archname="$ans"
7191
7192 : optionally add API version to the architecture for versioned archlibs
7193 case "$useversionedarchname" in
7194 $define|true|[yY]*) dflt='y';;
7195 *) dflt='n';;
7196 esac
7197 rp='Add the Perl API version to your archname?'
7198 . ./myread
7199 case "$ans" in
7200 y|Y) useversionedarchname="$define" ;;
7201 *) useversionedarchname="$undef" ;;
7202 esac
7203 case "$useversionedarchname" in
7204 $define)
7205 case "$archname" in
7206 *-$api_versionstring)
7207 echo "...and architecture name already has -$api_versionstring" >&4
7208 ;;
7209 *)
7210 archname="$archname-$api_versionstring"
7211 echo "...setting architecture name to $archname." >&4
7212 ;;
7213 esac
7214 ;;
7215 esac
7216
7217 case "$usethreads" in
7218 $define)
7219 echo "Threads selected." >&4
7220 case "$archname" in
7221 *-thread*) echo "...and architecture name already has -thread." >&4
7222 ;;
7223 *) archname="$archname-thread"
7224 echo "...setting architecture name to $archname." >&4
7225 ;;
7226 esac
7227 ;;
7228 esac
7229 case "$usemultiplicity" in
7230 $define)
7231 echo "Multiplicity selected." >&4
7232 case "$archname" in
7233 *-multi*) echo "...and architecture name already has -multi." >&4
7234 ;;
7235 *) archname="$archname-multi"
7236 echo "...setting architecture name to $archname." >&4
7237 ;;
7238 esac
7239 ;;
7240 esac
7241 case "$use64bitint$use64bitall" in
7242 *"$define"*)
7243 case "$archname64" in
7244 '')
7245 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7246 ;;
7247 *)
7248 case "$use64bitint" in
7249 "$define") echo "64 bit integers selected." >&4 ;;
7250 esac
7251 case "$use64bitall" in
7252 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7253 esac
7254 case "$archname" in
7255 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7256 ;;
7257 *) archname="$archname-$archname64"
7258 echo "...setting architecture name to $archname." >&4
7259 ;;
7260 esac
7261 ;;
7262 esac
7263 esac
7264 case "$uselongdouble" in
7265 $define)
7266 echo "Long doubles selected." >&4
7267 case "$longdblsize" in
7268 $doublesize)
7269 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7270 ;;
7271 *)
7272 case "$archname" in
7273 *-ld*) echo "...and architecture name already has -ld." >&4
7274 ;;
7275 *) archname="$archname-ld"
7276 echo "...setting architecture name to $archname." >&4
7277 ;;
7278 esac
7279 ;;
7280 esac
7281 ;;
7282 esac
7283 case "$usequadmath" in
7284 $define)
7285 echo "quadmath selected." >&4
7286 case "$archname" in
7287 *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7288 ;;
7289 *) archname="$archname-quadmath"
7290 echo "...setting architecture name to $archname." >&4
7291 ;;
7292 esac
7293 ;;
7294 esac
7295 if $test -f archname.cbu; then
7296 echo "Your platform has some specific hints for architecture name, using them..."
7297 . ./archname.cbu
7298 fi
7299
7300 : set the prefixit variable, to compute a suitable default value
7301 prefixit='case "$3" in
7302 ""|none)
7303 case "$oldprefix" in
7304 "") eval "$1=\"\$$2\"";;
7305 *)
7306 case "$3" in
7307 "") eval "$1=";;
7308 none)
7309 eval "tp=\"\$$2\"";
7310 case "$tp" in
7311 ""|" "|none) eval "$1=\"\$$2\"";;
7312 *) eval "$1=";;
7313 esac;;
7314 esac;;
7315 esac;;
7316 *)
7317 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7318 case "$tp" in
7319 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7320 /*-$oldprefix/*|\~*-$oldprefix/*)
7321 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7322 *) eval "$1=\"\$$2\"";;
7323 esac;;
7324 esac'
7325
7326 : determine installation style
7327 : For now, try to deduce it from prefix unless it is already set.
7328 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7329 case "$installstyle" in
7330 '') case "$prefix" in
7331 *perl*) dflt='lib';;
7332 *) dflt='lib/perl5' ;;
7333 esac
7334 ;;
7335 *) dflt="$installstyle" ;;
7336 esac
7337 : Probably not worth prompting for this since we prompt for all
7338 : the directories individually, and the prompt would be too long and
7339 : confusing anyway.
7340 installstyle=$dflt
7341
7342 : determine where public executables go
7343 echo " "
7344 set dflt bin bin
7345 eval $prefixit
7346 fn=d~
7347 rp='Pathname where the public executables will reside?'
7348 . ./getfile
7349 if $test "X$ansexp" != "X$binexp"; then
7350 installbin=''
7351 fi
7352 prefixvar=bin
7353 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7354 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7355 : this via initialinstalllocation
7356 . ./setprefixvar
7357
7358 case "$userelocatableinc" in
7359 $define|true|[yY]*) dflt='y' ;;
7360 *) dflt='n' ;;
7361 esac
7362 cat <<EOM
7363
7364 Would you like to build Perl so that the installation is relocatable, so that
7365 library paths in @INC are determined relative to the path of the perl binary?
7366 This is not advised for system Perl installs, or if you need to run setid
7367 scripts or scripts under taint mode.
7368
7369 If this doesn't make any sense to you, just accept the default '$dflt'.
7370 EOM
7371 rp='Use relocatable @INC?'
7372 . ./myread
7373 case "$ans" in
7374 y|Y) val="$define" ;;
7375 *) val="$undef" ;;
7376 esac
7377 set userelocatableinc
7378 eval $setvar
7379
7380 initialinstalllocation="$binexp"
7381 : Default prefix is now "up one level from where the binaries are"
7382 case "$userelocatableinc" in
7383 $define|true|[yY]*)
7384 bin=".../"
7385 binexp=".../"
7386 prefix=".../.."
7387 prefixexp=".../.."
7388 installprefixexp=".../.."
7389 ;;
7390 esac
7391
7392 : determine where private library files go
7393 : Usual default is /usr/local/lib/perl5/$version.
7394 : Also allow things like /opt/perl/lib/$version, since
7395 : /opt/perl/lib/perl5... would be redundant.
7396 : The default "style" setting is made in installstyle.U
7397 case "$installstyle" in
7398 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7399 *) set dflt privlib lib/$version ;;
7400 esac
7401 eval $prefixit
7402 $cat <<EOM
7403
7404 There are some auxiliary files for $package that need to be put into a
7405 private library directory that is accessible by everyone.
7406
7407 EOM
7408 fn=$binexp
7409 fn=d~+
7410 rp='Pathname where the private library files will reside?'
7411 . ./getfile
7412 prefixvar=privlib
7413 . ./setprefixvar
7414
7415 : set the prefixup variable, to restore leading tilda escape
7416 prefixup='case "$prefixexp" in
7417 "$prefix") ;;
7418 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7419 esac'
7420
7421 : determine where public architecture dependent libraries go
7422 set archlib archlib
7423 eval $prefixit
7424 : privlib default is /usr/local/lib/$package/$version
7425 : archlib default is /usr/local/lib/$package/$version/$archname
7426 : privlib may have an optional trailing /share.
7427 tdflt=`echo $privlib | $sed 's,/share$,,'`
7428 tdflt=$tdflt/$archname
7429 case "$archlib" in
7430 '') dflt=$tdflt
7431 ;;
7432 *) dflt="$archlib"
7433 ;;
7434 esac
7435 $cat <<EOM
7436
7437 $spackage contains architecture-dependent library files. If you are
7438 sharing libraries in a heterogeneous environment, you might store
7439 these files in a separate location. Otherwise, you can just include
7440 them with the rest of the public library files.
7441
7442 EOM
7443 fn=$binexp
7444 fn=d+~
7445 rp='Where do you want to put the public architecture-dependent libraries?'
7446 . ./getfile
7447 prefixvar=archlib
7448 . ./setprefixvar
7449 if $test X"$archlib" = X"$privlib"; then
7450 d_archlib="$undef"
7451 else
7452 d_archlib="$define"
7453 fi
7454
7455 : see if setuid scripts can be secure
7456 $cat <<EOM
7457
7458 Some kernels have a bug that prevents setuid #! scripts from being
7459 secure. Some sites have disabled setuid #! scripts because of this.
7460
7461 First let's decide if your kernel supports secure setuid #! scripts.
7462 (If setuid #! scripts would be secure but have been disabled anyway,
7463 don't say that they are secure if asked.)
7464
7465 EOM
7466
7467 val="$undef"
7468 if $test -d /dev/fd; then
7469 echo "#!$ls" >reflect
7470 chmod +x,u+s reflect
7471 ./reflect >flect 2>&1
7472 if $contains "/dev/fd" flect >/dev/null; then
7473 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7474 val="$define"
7475 else
7476 $cat <<EOM
7477 If you are not sure if they are secure, I can check but I'll need a
7478 username and password different from the one you are using right now.
7479 If you don't have such a username or don't want me to test, simply
7480 enter 'none'.
7481
7482 EOM
7483 rp='Other username to test security of setuid scripts with?'
7484 dflt='none'
7485 . ./myread
7486 case "$ans" in
7487 n|none)
7488 case "$d_suidsafe" in
7489 '') echo "I'll assume setuid scripts are *not* secure." >&4
7490 dflt=n;;
7491 "$undef")
7492 echo "Well, the $hint value is *not* secure." >&4
7493 dflt=n;;
7494 *) echo "Well, the $hint value *is* secure." >&4
7495 dflt=y;;
7496 esac
7497 ;;
7498 *)
7499 $rm -f reflect flect
7500 echo "#!$ls" >reflect
7501 chmod +x,u+s reflect
7502 echo >flect
7503 chmod a+w flect
7504 echo '"su" will (probably) prompt you for '"$ans's password."
7505 su $ans -c './reflect >flect'
7506 if $contains "/dev/fd" flect >/dev/null; then
7507 echo "Okay, it looks like setuid scripts are secure." >&4
7508 dflt=y
7509 else
7510 echo "I don't think setuid scripts are secure." >&4
7511 dflt=n
7512 fi
7513 ;;
7514 esac
7515 rp='Does your kernel have *secure* setuid scripts?'
7516 . ./myread
7517 case "$ans" in
7518 [yY]*) val="$define";;
7519 *) val="$undef";;
7520 esac
7521 fi
7522 else
7523 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7524 echo "(That's for file descriptors, not floppy disks.)"
7525 val="$undef"
7526 fi
7527 set d_suidsafe
7528 eval $setvar
7529
7530 $rm -f reflect flect
7531
7532 : now see if they want to do setuid emulation
7533 if $test $patchlevel -lt 11; then
7534 echo " "
7535 val="$undef"
7536 case "$d_suidsafe" in
7537 "$define")
7538 val="$undef"
7539 echo "No need to emulate SUID scripts since they are secure here." >&4
7540 ;;
7541 *)
7542 $cat <<EOM
7543 Some systems have disabled setuid scripts, especially systems where
7544 setuid scripts cannot be secure. On systems where setuid scripts have
7545 been disabled, the setuid/setgid bits on scripts are currently
7546 useless. It is possible for $package to detect those bits and emulate
7547 setuid/setgid in a secure fashion. This emulation will only work if
7548 setuid scripts have been disabled in your kernel.
7549
7550 EOM
7551 case "$d_dosuid" in
7552 "$define") dflt=y ;;
7553 *) dflt=n ;;
7554 esac
7555 rp="Do you want to do setuid/setgid emulation?"
7556 . ./myread
7557 case "$ans" in
7558 [yY]*) val="$define";;
7559 *) val="$undef";;
7560 esac
7561 ;;
7562 esac
7563 set d_dosuid
7564 eval $setvar
7565 else
7566 case "$d_dosuid" in
7567 "$define")
7568 cat >&4 <<EOH
7569
7570 SUID emulation has been removed for 5.12
7571 Please re-run Configure without -Dd_dosuid
7572
7573 EOH
7574 exit 1;
7575 ;;
7576 esac
7577 d_dosuid=undef
7578 fi
7579
7580 : Find perl5.005 or later.
7581 echo "Looking for a previously installed perl5.005 or later... "
7582 case "$perl5" in
7583 '') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7584 : Check if this perl is recent and can load a simple module
7585 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7586 perl5=$tdir/perl
7587 break;
7588 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7589 perl5=$tdir/perl5
7590 break;
7591 fi
7592 done
7593 ;;
7594 *) perl5="$perl5"
7595 ;;
7596 esac
7597 case "$perl5" in
7598 '') echo "None found. That's ok.";;
7599 *) echo "Using $perl5." ;;
7600 esac
7601
7602 : Set the siteprefix variables
7603 $cat <<EOM
7604
7605 After $package is installed, you may wish to install various
7606 add-on modules and utilities. Typically, these add-ons will
7607 be installed under $prefix with the rest
7608 of this package. However, you may wish to install such add-ons
7609 elsewhere under a different prefix.
7610
7611 If you do not wish to put everything under a single prefix, that's
7612 ok. You will be prompted for the individual locations; this siteprefix
7613 is only used to suggest the defaults.
7614
7615 The default should be fine for most people.
7616
7617 EOM
7618 fn=d~+
7619 rp='Installation prefix to use for add-on modules and utilities?'
7620 : XXX Here might be another good place for an installstyle setting.
7621 case "$siteprefix" in
7622 '') dflt=$prefix ;;
7623 *) dflt=$siteprefix ;;
7624 esac
7625 . ./getfile
7626 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7627 oldsiteprefix=''
7628 case "$siteprefix" in
7629 '') ;;
7630 *) case "$ans" in
7631 "$prefix") ;;
7632 *) oldsiteprefix="$prefix";;
7633 esac
7634 ;;
7635 esac
7636 siteprefix="$ans"
7637 siteprefixexp="$ansexp"
7638
7639 : determine where site specific libraries go.
7640 : Usual default is /usr/local/lib/perl5/site_perl/$version
7641 : The default "style" setting is made in installstyle.U
7642 : XXX No longer works with Prefixit stuff.
7643 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7644 case "$sitelib" in
7645 '') case "$installstyle" in
7646 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7647 *) dflt=$siteprefix/lib/site_$prog/$version ;;
7648 esac
7649 ;;
7650 *) dflt="$sitelib"
7651 ;;
7652 esac
7653 $cat <<EOM
7654
7655 The installation process will create a directory for
7656 site-specific extensions and modules. Most users find it convenient
7657 to place all site-specific files in this directory rather than in the
7658 main distribution directory.
7659
7660 EOM
7661 fn=d~+
7662 rp='Pathname for the site-specific library files?'
7663 . ./getfile
7664 prefixvar=sitelib
7665 . ./setprefixvar
7666 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7667
7668 : Determine list of previous versions to include in @INC
7669 $cat > getverlist <<EOPL
7670 #!$perl5
7671 use strict;
7672 use warnings;
7673 use File::Basename;
7674 my \$api_versionstring = "$api_versionstring";
7675 my \$version = "$version";
7676 my \$stem = "$sitelib_stem";
7677 my \$archname = "$archname";
7678 EOPL
7679 $cat >> getverlist <<'EOPL'
7680 # The list found is stored twice for each entry: the original name, and
7681 # the binary broken down version into pack "s>s>s>", so sorting is easy
7682 # and unambiguous. This will work for all versions that have a maximum
7683 # of three digit per group separate by '.'s or '_'s. Names are extended
7684 # with ".0.0" to ensure at least three elements for the pack.
7685 # -- H.Merijn Brand (m)'06 23-10-2006
7686
7687 my @inc_version_list;
7688 my @candidates;
7689 # XXX Redo to do opendir/readdir?
7690 if (-d $stem) {
7691 chdir($stem);
7692 ;@candidates = map {
7693 [ $_, pack "s>s>s>", split m/[._]/, "$_.0.0" ] } glob("5.*");
7694 ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7695 }
7696 else {
7697 ;@candidates = ();
7698 }
7699
7700 my ($pversion, $aversion, $vsn5005) = map {
7701 pack "s>s>s>", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7702 foreach my $d (@candidates) {
7703 if ($d->[1] lt $pversion) {
7704 if ($d->[1] ge $aversion) {
7705 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7706 }
7707 elsif ($d->[1] ge $vsn5005) {
7708 unshift(@inc_version_list, grep { -d } $d->[0]);
7709 }
7710 }
7711 else {
7712 # Skip newer version. I.e. don't look in
7713 # 5.7.0 if we're installing 5.6.1.
7714 }
7715 }
7716
7717 if (@inc_version_list) {
7718 print join(' ', @inc_version_list);
7719 }
7720 else {
7721 # Blank space to preserve value for next Configure run.
7722 print " ";
7723 }
7724 EOPL
7725 chmod +x getverlist
7726 case "$inc_version_list" in
7727 '') if test -x "$perl5$exe_ext"; then
7728 dflt=`$perl5 getverlist`
7729 else
7730 dflt='none'
7731 fi
7732 ;;
7733 $undef) dflt='none' ;;
7734 *) eval dflt=\"$inc_version_list\" ;;
7735 esac
7736 case "$dflt" in
7737 ''|' ') dflt=none ;;
7738 esac
7739 case "$dflt" in
7740 5.005) dflt=none ;;
7741 esac
7742 $cat <<EOM
7743
7744 In order to ease the process of upgrading, this version of perl
7745 can be configured to use modules built and installed with earlier
7746 versions of perl that were installed under $prefix. Specify here
7747 the list of earlier versions that this version of perl should check.
7748 If Configure detected no earlier versions of perl installed under
7749 $prefix, then the list will be empty. Answer 'none' to tell perl
7750 to not search earlier versions.
7751
7752 The default should almost always be sensible, so if you're not sure,
7753 just accept the default.
7754 EOM
7755
7756 rp='List of earlier versions to include in @INC?'
7757 . ./myread
7758 case "$ans" in
7759 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7760 *) inc_version_list="$ans" ;;
7761 esac
7762 case "$inc_version_list" in
7763 ''|' ')
7764 inc_version_list_init='0'
7765 d_inc_version_list="$undef"
7766 ;;
7767 *) inc_version_list_init=`echo $inc_version_list |
7768 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7769 d_inc_version_list="$define"
7770 ;;
7771 esac
7772 $rm -f getverlist
7773
7774 : check for length of pointer
7775 echo " "
7776 case "$ptrsize" in
7777 '')
7778 echo "Checking to see how big your pointers are..." >&4
7779 $cat >try.c <<EOCP
7780 #include <stdio.h>
7781 #$i_stdlib I_STDLIB
7782 #ifdef I_STDLIB
7783 #include <stdlib.h>
7784 #endif
7785 int main()
7786 {
7787 printf("%d\n", (int)sizeof(void *));
7788 exit(0);
7789 }
7790 EOCP
7791 set try
7792 if eval $compile_ok; then
7793 ptrsize=`$run ./try`
7794 echo "Your pointers are $ptrsize bytes long."
7795 else
7796 dflt='4'
7797 echo "(I can't seem to compile the test program. Guessing...)" >&4
7798 rp="What is the size of a pointer (in bytes)?"
7799 . ./myread
7800 ptrsize="$ans"
7801 fi
7802 ;;
7803 esac
7804 $rm_try
7805 case "$use64bitall" in
7806 "$define"|true|[yY]*)
7807 case "$ptrsize" in
7808 4) cat <<EOM >&4
7809
7810 *** You have chosen a maximally 64-bit build,
7811 *** but your pointers are only 4 bytes wide.
7812 *** Please rerun Configure without -Duse64bitall.
7813 EOM
7814 case "$d_quad" in
7815 define)
7816 cat <<EOM >&4
7817 *** Since you have quads, you could possibly try with -Duse64bitint.
7818 EOM
7819 ;;
7820 esac
7821 cat <<EOM >&4
7822 *** Cannot continue, aborting.
7823
7824 EOM
7825
7826 exit 1
7827 ;;
7828 esac
7829 ;;
7830 esac
7831
7832 : determine whether to use malloc wrapping
7833 echo " "
7834 case "$usemallocwrap" in
7835 [yY]*|true|$define) dflt='y' ;;
7836 [nN]*|false|$undef) dflt='n' ;;
7837 *) case "$usedevel" in
7838 [yY]*|true|$define) dflt='y' ;;
7839 *) dflt='n' ;;
7840 esac
7841 ;;
7842 esac
7843 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7844 . ./myread
7845 usemallocwrap="$ans"
7846 case "$ans" in
7847 y*|true)
7848 usemallocwrap="$define" ;;
7849 *)
7850 usemallocwrap="$undef" ;;
7851 esac
7852
7853 : determine which malloc to compile in
7854 echo " "
7855 case "$usemymalloc" in
7856 [yY]*|true|$define) dflt='y' ;;
7857 [nN]*|false|$undef) dflt='n' ;;
7858 *) case "$ptrsize" in
7859 4) dflt='y' ;;
7860 *) dflt='n' ;;
7861 esac
7862 if test "$useithreads" = "$define"; then dflt='n'; fi
7863 ;;
7864 esac
7865 rp="Do you wish to attempt to use the malloc that comes with $package?"
7866 . ./myread
7867 usemymalloc="$ans"
7868 case "$ans" in
7869 y*|true)
7870 usemymalloc='y'
7871 mallocsrc='malloc.c'
7872 mallocobj="malloc$_o"
7873 d_mymalloc="$define"
7874 case "$libs" in
7875 *-lmalloc*)
7876 : Remove malloc from list of libraries to use
7877 echo "Removing unneeded -lmalloc from library list" >&4
7878 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7879 shift
7880 libs="$*"
7881 echo "libs = $libs" >&4
7882 ;;
7883 esac
7884 ;;
7885 *)
7886 usemymalloc='n'
7887 mallocsrc=''
7888 mallocobj=''
7889 d_mymalloc="$undef"
7890 ;;
7891 esac
7892
7893 : compute the return types of malloc and free
7894 echo " "
7895 case "$malloctype" in
7896 '')
7897 malloctype='void *'
7898 ;;
7899 esac
7900 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7901
7902 case "$freetype" in
7903 '')
7904 freetype='void'
7905 ;;
7906 esac
7907 echo "Your system uses $freetype free(), it would seem." >&4
7908
7909 : determine where site specific architecture-dependent libraries go.
7910 : sitelib default is /usr/local/lib/perl5/site_perl/$version
7911 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7912 : sitelib may have an optional trailing /share.
7913 case "$sitearch" in
7914 '') dflt=`echo $sitelib | $sed 's,/share$,,'`
7915 dflt="$dflt/$archname"
7916 ;;
7917 *) dflt="$sitearch"
7918 ;;
7919 esac
7920 set sitearch sitearch none
7921 eval $prefixit
7922 $cat <<EOM
7923
7924 The installation process will also create a directory for
7925 architecture-dependent site-specific extensions and modules.
7926
7927 EOM
7928 fn=d~+
7929 rp='Pathname for the site-specific architecture-dependent library files?'
7930 . ./getfile
7931 prefixvar=sitearch
7932 . ./setprefixvar
7933 if $test X"$sitearch" = X"$sitelib"; then
7934 d_sitearch="$undef"
7935 else
7936 d_sitearch="$define"
7937 fi
7938
7939 : Set the vendorprefix variables
7940 $cat <<EOM
7941
7942 The installation process will also create a directory for
7943 vendor-supplied add-ons. Vendors who supply perl with their system
7944 may find it convenient to place all vendor-supplied files in this
7945 directory rather than in the main distribution directory. This will
7946 ease upgrades between binary-compatible maintenance versions of perl.
7947
7948 Of course you may also use these directories in whatever way you see
7949 fit. For example, you might use them to access modules shared over a
7950 company-wide network.
7951
7952 The default answer should be fine for most people.
7953 This causes further questions about vendor add-ons to be skipped
7954 and no vendor-specific directories will be configured for perl.
7955
7956 EOM
7957 rp='Do you want to configure vendor-specific add-on directories?'
7958 case "$usevendorprefix" in
7959 define|true|[yY]*) dflt=y ;;
7960 *) : User may have set vendorprefix directly on Configure command line.
7961 case "$vendorprefix" in
7962 ''|' ') dflt=n ;;
7963 *) dflt=y ;;
7964 esac
7965 ;;
7966 esac
7967 . ./myread
7968 case "$ans" in
7969 [yY]*) fn=d~+
7970 rp='Installation prefix to use for vendor-supplied add-ons?'
7971 case "$vendorprefix" in
7972 '') dflt="$prefix" ;;
7973 *) dflt=$vendorprefix ;;
7974 esac
7975 . ./getfile
7976 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7977 oldvendorprefix=''
7978 case "$vendorprefix" in
7979 '') ;;
7980 *) case "$ans" in
7981 "$prefix") ;;
7982 *) oldvendorprefix="$prefix";;
7983 esac
7984 ;;
7985 esac
7986 usevendorprefix="$define"
7987 vendorprefix="$ans"
7988 vendorprefixexp="$ansexp"
7989 ;;
7990 *) usevendorprefix="$undef"
7991 vendorprefix=''
7992 vendorprefixexp=''
7993 ;;
7994 esac
7995
7996 : Set the vendorlib variables
7997 case "$vendorprefix" in
7998 '') d_vendorlib="$undef"
7999 vendorlib=''
8000 vendorlibexp=''
8001 ;;
8002 *) d_vendorlib="$define"
8003 : determine where vendor-supplied modules go.
8004 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8005 case "$vendorlib" in
8006 '')
8007 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8008 case "$installstyle" in
8009 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8010 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8011 esac
8012 ;;
8013 *) dflt="$vendorlib"
8014 ;;
8015 esac
8016 fn=d~+
8017 rp='Pathname for the vendor-supplied library files?'
8018 . ./getfile
8019 vendorlib="$ans"
8020 vendorlibexp="$ansexp"
8021 ;;
8022 esac
8023 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8024 prefixvar=vendorlib
8025 . ./installprefix
8026
8027 : Set the vendorarch variables
8028 case "$vendorprefix" in
8029 '') d_vendorarch="$undef"
8030 vendorarch=''
8031 vendorarchexp=''
8032 ;;
8033 *) d_vendorarch="$define"
8034 : determine where vendor-supplied architecture-dependent libraries go.
8035 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
8036 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8037 : vendorlib may have an optional trailing /share.
8038 case "$vendorarch" in
8039 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
8040 dflt="$dflt/$archname"
8041 ;;
8042 *) dflt="$vendorarch" ;;
8043 esac
8044 fn=d~+
8045 rp='Pathname for vendor-supplied architecture-dependent files?'
8046 . ./getfile
8047 vendorarch="$ans"
8048 vendorarchexp="$ansexp"
8049 ;;
8050 esac
8051 prefixvar=vendorarch
8052 . ./installprefix
8053 if $test X"$vendorarch" = X"$vendorlib"; then
8054 d_vendorarch="$undef"
8055 else
8056 d_vendorarch="$define"
8057 fi
8058
8059 : Final catch-all directories to search
8060 $cat <<EOM
8061
8062 Lastly, you can have perl look in other directories for extensions and
8063 modules in addition to those already specified.
8064 These directories will be searched after
8065 $sitearch
8066 $sitelib
8067 EOM
8068 test X"$vendorlib" != "X" && echo ' ' $vendorlib
8069 test X"$vendorarch" != "X" && echo ' ' $vendorarch
8070 echo ' '
8071 case "$otherlibdirs" in
8072 ''|' ') dflt='none' ;;
8073 *) dflt="$otherlibdirs" ;;
8074 esac
8075 $cat <<EOM
8076 Enter a colon-separated set of extra paths to include in perl's @INC
8077 search path, or enter 'none' for no extra paths.
8078
8079 EOM
8080
8081 rp='Colon-separated list of additional directories for perl to search?'
8082 . ./myread
8083 case "$ans" in
8084 ' '|''|none) otherlibdirs=' ' ;;
8085 *) otherlibdirs="$ans" ;;
8086 esac
8087 case "$otherlibdirs" in
8088 ' ') val=$undef ;;
8089 *) val=$define ;;
8090 esac
8091 set d_perl_otherlibdirs
8092 eval $setvar
8093
8094 : DTrace support
8095 dflt_dtrace='/usr/sbin/dtrace'
8096 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8097
8098 cat <<EOM
8099
8100 Perl can be built to support DTrace on platforms that support it.
8101 DTrace is a diagnosis and performance analysis tool from Sun.
8102
8103 If this doesn't make any sense to you, just accept the default.
8104 EOM
8105
8106 while $test 1 ; do
8107 case "$usedtrace" in
8108 $define|true|[yY]*)
8109 dflt='y'
8110 ;;
8111 $undef|false|[nN]*)
8112 dflt='n'
8113 dflt_dtrace=""
8114 ;;
8115 ?*)
8116 dflt='y'
8117 dflt_dtrace=$usedtrace
8118 ;;
8119 *)
8120 dflt='n'
8121 ;;
8122 esac
8123
8124 rp='Support DTrace if available?'
8125 . ./myread
8126 case "$ans" in
8127 y|Y) val="$define" ;;
8128 *) val="$undef" ;;
8129 esac
8130 set usedtrace
8131 eval $setvar
8132
8133 test "X$usedtrace" != "X$define" && break
8134
8135 echo " "
8136 rp='Where is the dtrace executable?'
8137 dflt=$dflt_dtrace
8138 . ./getfile
8139 val="$ans"
8140 set dtrace
8141 eval $setvar
8142
8143 if $test -f $dtrace
8144 then
8145 if $dtrace -h -s ../perldtrace.d \
8146 -o perldtrace.tmp >/dev/null 2>&1 \
8147 && rm -f perldtrace.tmp
8148 then
8149 echo " "
8150 echo "Good: your $dtrace knows about the -h flag."
8151 else
8152 cat >&2 <<EOM
8153
8154 *** $me: Fatal Error: $dtrace doesn't support -h flag
8155 ***
8156 *** Your installed dtrace doesn't support the -h switch to compile a D
8157 *** program into a C header. Can't continue.
8158
8159 EOM
8160 exit 1
8161 fi
8162 break;
8163 fi
8164
8165 case "$fastread" in
8166 yes)
8167 cat >&2 <<EOM
8168
8169 *** $me: Fatal Error: $dtrace not found.
8170 *** Can't continue.
8171
8172 EOM
8173 exit 1
8174 ;;
8175 *)
8176 echo "*** $dtrace was not found."
8177 echo " "
8178 ;;
8179 esac
8180 done
8181
8182 : See if we want extra modules installed
8183 echo " "
8184 case "$extras" in
8185 '') dflt='n';;
8186 *) dflt='y';;
8187 esac
8188 cat <<EOM
8189 Perl can be built with extra modules or bundles of modules which
8190 will be fetched from the CPAN and installed alongside Perl.
8191
8192 Notice that you will need access to the CPAN; either via the Internet,
8193 or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
8194 be asked later to configure the CPAN.pm module which will in turn do
8195 the installation of the rest of the extra modules or bundles.)
8196
8197 Notice also that if the modules require any external software such as
8198 libraries and headers (the libz library and the zlib.h header for the
8199 Compress::Zlib module, for example) you MUST have any such software
8200 already installed, this configuration process will NOT install such
8201 things for you.
8202
8203 If this doesn't make any sense to you, just accept the default '$dflt'.
8204 EOM
8205 rp='Install any extra modules (y or n)?'
8206 . ./myread
8207 case "$ans" in
8208 y|Y)
8209 cat <<EOM
8210
8211 Please list any extra modules or bundles to be installed from CPAN,
8212 with spaces between the names. The names can be in any format the
8213 'install' command of CPAN.pm will understand. (Answer 'none',
8214 without the quotes, to install no extra modules or bundles.)
8215 EOM
8216 rp='Extras?'
8217 dflt="$extras"
8218 . ./myread
8219 extras="$ans"
8220 esac
8221 case "$extras" in
8222 ''|'none')
8223 val=''
8224 $rm -f ../extras.lst
8225 ;;
8226 *) echo "(Saving the list of extras for later...)"
8227 echo "$extras" > ../extras.lst
8228 val="'$extras'"
8229 ;;
8230 esac
8231 set extras
8232 eval $setvar
8233 echo " "
8234
8235 : determine where html pages for programs go
8236 set html1dir html1dir none
8237 eval $prefixit
8238 $cat <<EOM
8239
8240 If you wish to install html files for programs in $spackage, indicate
8241 the appropriate directory here. To skip installing html files,
8242 answer "none".
8243 EOM
8244 case "$html1dir" in
8245 ''|none|$undef|' ') dflt=none ;;
8246 *) dflt=$html1dir ;;
8247 esac
8248 fn=dn+~
8249 rp="Directory for the main $spackage html pages?"
8250 . ./getfile
8251 prefixvar=html1dir
8252 . ./setprefixvar
8253 : Use ' ' for none so value is preserved next time through Configure
8254 $test X"$html1dir" = "X" && html1dir=' '
8255
8256 : determine where html pages for libraries and modules go
8257 set html3dir html3dir none
8258 eval $prefixit
8259 $cat <<EOM
8260
8261 If you wish to install html files for modules associated with $spackage,
8262 indicate the appropriate directory here. To skip installing html files,
8263 answer "none".
8264 EOM
8265 : There is no obvious default. If they have specified html1dir, then
8266 : try to key off that, possibly changing .../html1 into .../html3.
8267 case "$html3dir" in
8268 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8269 *) dflt=$html3dir ;;
8270 esac
8271 fn=dn+~
8272 rp="Directory for the $spackage module html pages?"
8273 . ./getfile
8274 prefixvar=html3dir
8275 . ./setprefixvar
8276 : Use ' ' for none so value is preserved next time through Configure
8277 $test X"$html3dir" = "X" && html3dir=' '
8278
8279 : determine whether to install perl also as /usr/bin/perl
8280
8281 echo " "
8282 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8283 $cat <<EOM
8284 Many scripts expect perl to be installed as /usr/bin/perl.
8285
8286 If you want to, I can install the perl you are about to compile
8287 as /usr/bin/perl (in addition to $bin/perl).
8288 EOM
8289 if test -f /usr/bin/perl; then
8290 $cat <<EOM
8291
8292 However, please note that because you already have a /usr/bin/perl,
8293 overwriting that with a new Perl would very probably cause problems.
8294 Therefore I'm assuming you don't want to do that (unless you insist).
8295
8296 EOM
8297 case "$installusrbinperl" in
8298 "$define"|[yY]*) dflt='y';;
8299 *) dflt='n';;
8300 esac
8301 else
8302 $cat <<EOM
8303
8304 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8305
8306 EOM
8307 case "$installusrbinperl" in
8308 "$undef"|[nN]*) dflt='n';;
8309 *) dflt='y';;
8310 esac
8311 fi
8312 rp="Do you want to install perl as /usr/bin/perl?"
8313 . ./myread
8314 case "$ans" in
8315 [yY]*) val="$define";;
8316 *) val="$undef" ;;
8317 esac
8318 else
8319 val="$undef"
8320 fi
8321 set installusrbinperl
8322 eval $setvar
8323
8324 : see if dlopen exists
8325 xxx_runnm="$runnm"
8326 xxx_ccflags="$ccflags"
8327 runnm=false
8328 : with g++ one needs -shared to get is-in-libc to work for dlopen
8329 case "$gccversion" in
8330 '') ;;
8331 *Clang*) ;;
8332 *) case "$d_cplusplus" in
8333 "$define") ccflags="$ccflags -shared" ;;
8334 esac
8335 ;;
8336 esac
8337 set dlopen d_dlopen
8338 eval $inlibc
8339 runnm="$xxx_runnm"
8340 ccflags="$xxx_ccflags"
8341
8342 : see if this is a unistd.h system
8343 set unistd.h i_unistd
8344 eval $inhdr
8345
8346 : determine which dynamic loading, if any, to compile in
8347 echo " "
8348 dldir="ext/DynaLoader"
8349 case "$usedl" in
8350 $define|y|true)
8351 dflt='y'
8352 usedl="$define"
8353 ;;
8354 $undef|n|false)
8355 dflt='n'
8356 usedl="$undef"
8357 ;;
8358 *)
8359 dflt='n'
8360 case "$d_dlopen" in
8361 $define) dflt='y' ;;
8362 esac
8363 : Does a dl_xxx.xs file exist for this operating system
8364 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8365 ;;
8366 esac
8367 rp="Do you wish to use dynamic loading?"
8368 . ./myread
8369 usedl="$ans"
8370 bin_ELF="$undef"
8371 case "$ans" in
8372 y*) usedl="$define"
8373 case "$dlsrc" in
8374 '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8375 dflt="$dldir/dl_${osname}.xs"
8376 elif $test "$d_dlopen" = "$define" ; then
8377 dflt="$dldir/dl_dlopen.xs"
8378 else
8379 dflt=''
8380 fi
8381 ;;
8382 *) dflt="$dldir/$dlsrc"
8383 ;;
8384 esac
8385 echo "The following dynamic loading files are available:"
8386 : Can not go over to $dldir because getfile has path hard-coded in.
8387 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8388 rp="Source file to use for dynamic loading"
8389 fn="fne"
8390 gfpth="$src"
8391 . ./getfile
8392 usedl="$define"
8393 : emulate basename
8394 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8395
8396 $cat << EOM
8397
8398 Some systems may require passing special flags to $cc -c to
8399 compile modules that will be used to create a shared library.
8400 To use no flags, say "none".
8401
8402 EOM
8403 case "$cccdlflags" in
8404 '') case "$gccversion" in
8405 '') case "$osname" in
8406 hpux) dflt='+z' ;;
8407 irix*) dflt='-KPIC' ;;
8408 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8409 sunos) dflt='-pic' ;;
8410 *) dflt='none' ;;
8411 esac
8412 ;;
8413 *) case "$osname" in
8414 darwin) dflt='none' ;;
8415 *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8416 *) dflt='-fpic' ;;
8417 esac ;;
8418 esac ;;
8419 ' ') dflt='none' ;;
8420 *) dflt="$cccdlflags" ;;
8421 esac
8422
8423 case "$dflt" in
8424 none) dflt='' ;;
8425 esac
8426
8427 # If -Dsysroot was specified, now's the time to add it
8428 # to cccdlflags
8429 if test "X$sysroot" != X; then
8430 case "$gccversion" in
8431 '') ;;
8432 *) case "$dflt" in
8433 *sysroot*) ;;
8434 'undef'|*)
8435 dflt="$dflt --sysroot=$sysroot" ;;
8436 esac
8437 ;;
8438 esac
8439 fi
8440
8441 case "$dflt" in
8442 '') dflt='none';;
8443 esac
8444
8445 rp="Any special flags to pass to $cc -c to compile shared library modules?"
8446 . ./myread
8447 case "$ans" in
8448 none) cccdlflags=' ' ;;
8449 *) cccdlflags="$ans" ;;
8450 esac
8451
8452 cat << EOM
8453
8454 Some systems use ld to create libraries that can be dynamically loaded,
8455 while other systems (such as those using ELF) use $cc.
8456
8457 EOM
8458
8459 : Determine if this is ELF
8460 $cat >try.c <<EOM
8461 /* Test for whether ELF binaries are produced */
8462 #include <fcntl.h>
8463 #$i_stdlib I_STDLIB
8464 #ifdef I_STDLIB
8465 #include <stdlib.h>
8466 #endif
8467 #$i_unistd I_UNISTD
8468 #ifdef I_UNISTD
8469 #include <unistd.h>
8470 #endif
8471 int main() {
8472 char b[4];
8473 int i = open("a.out",O_RDONLY);
8474 if(i == -1)
8475 exit(1); /* fail */
8476 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8477 exit(0); /* succeed (yes, it is ELF) */
8478 exit(1); /* fail */
8479 }
8480 EOM
8481 if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8482 bin_ELF="$define"
8483 fi
8484 $rm_try
8485
8486 case "$ld" in
8487 '') if $test $bin_ELF = "$define"; then
8488 cat <<EOM
8489 You appear to have ELF support. I'll use $cc to build dynamic libraries.
8490 EOM
8491 dflt="$cc"
8492 else
8493 echo "I'll use ld to build dynamic libraries."
8494 dflt='ld'
8495 fi
8496 ;;
8497 *) dflt="$ld"
8498 ;;
8499 esac
8500
8501 rp="What command should be used to create dynamic libraries?"
8502 . ./myread
8503 ld="$ans"
8504
8505 cat << EOM
8506
8507 Some systems may require passing special flags to $ld to create a
8508 library that can be dynamically loaded. If your ld flags include
8509 -L/other/path options to locate libraries outside your loader's normal
8510 search path, you may need to specify those -L options here as well. To
8511 use no flags, say "none".
8512
8513 EOM
8514 case "$lddlflags" in
8515 '') case "$osname" in
8516 haiku) dflt='-shared' ;;
8517 hpux) dflt='-b';
8518 case "$gccversion" in
8519 '') dflt="$dflt +vnocompatwarnings" ;;
8520 esac
8521 ;;
8522 *linux*|irix*|gnu*) dflt="-shared $optimize" ;;
8523 solaris) # See [perl #66604].
8524 # On Solaris 11, gcc -m64 on amd64
8525 # appears not to understand -G. gcc versions at
8526 # least as old as 3.4.3 support -shared, so just
8527 # use that with Solaris 11 and later, but keep
8528 # the old behavior for older Solaris versions.
8529 case "$gccversion" in
8530 '') dflt='-G' ;;
8531 *) case "$osvers" in
8532 2.?|2.10) dflt='-G' ;;
8533 *) dflt='-shared' ;;
8534 esac
8535 ;;
8536 esac
8537 ;;
8538 sunos) dflt='-assert nodefinitions' ;;
8539 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8540 *) dflt='none' ;;
8541 esac
8542 ;;
8543 *) dflt="$lddlflags" ;;
8544 esac
8545
8546 : Only do this for gcc, since, for example, qcc has no concept
8547 : of --sysroot.
8548 if $test "X$sysroot" != X; then
8549 case "$gccversion" in
8550 '') ;;
8551 *) dflt="$dflt --sysroot=$sysroot" ;;
8552 esac
8553 fi
8554
8555 : Try to guess additional flags to pick up local libraries.
8556 : Be careful not to append to a plain 'none'
8557 case "$dflt" in
8558 none) dflt='' ;;
8559 esac
8560 for thisflag in $ldflags; do
8561 case "$thisflag" in
8562 -L*|-R*|-Wl,-R*)
8563 case " $dflt " in
8564 *" $thisflag "*) ;;
8565 *) dflt="$dflt $thisflag" ;;
8566 esac
8567 ;;
8568 esac
8569 done
8570
8571 case "$dflt" in
8572 ''|' ') dflt='none' ;;
8573 esac
8574
8575 case "$ldflags" in
8576 *-fstack-protector-strong*)
8577 case "$dflt" in
8578 *-fstack-protector-strong*) ;; # Don't add it again
8579 *) dflt="$dflt -fstack-protector-strong" ;;
8580 esac
8581 ;;
8582 *-fstack-protector*)
8583 case "$dflt" in
8584 *-fstack-protector*) ;; # Don't add it again
8585 *) dflt="$dflt -fstack-protector" ;;
8586 esac
8587 ;;
8588 esac
8589
8590 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8591 . ./myread
8592 case "$ans" in
8593 none) lddlflags=' ' ;;
8594 *) lddlflags="$ans" ;;
8595 esac
8596
8597 cat <<EOM
8598
8599 Some systems may require passing special flags to $cc to indicate that
8600 the resulting executable will use dynamic linking. To use no flags,
8601 say "none".
8602
8603 EOM
8604 case "$ccdlflags" in
8605 '') case "$osname" in
8606 *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8607 sunos) dflt='none' ;;
8608 *) dflt='none' ;;
8609 esac ;;
8610 ' ') dflt='none' ;;
8611 *) dflt="$ccdlflags" ;;
8612 esac
8613 rp="Any special flags to pass to $cc to use dynamic linking?"
8614 . ./myread
8615 case "$ans" in
8616 none) ccdlflags=' ' ;;
8617 *) ccdlflags="$ans" ;;
8618 esac
8619 ;;
8620
8621 *) usedl="$undef"
8622 ld='ld'
8623 dlsrc='dl_none.xs'
8624 lddlflags=''
8625 ccdlflags=''
8626 ;;
8627 esac
8628
8629 ld_can_script="$undef"
8630 case "$bin_ELF$usedl" in
8631 $define$define)
8632 # Abuse try.h and a.out names for neat cleanup
8633 $cat >try.c <<EOM
8634 void foo() {}
8635 void bar() {}
8636 EOM
8637 $cat >try.h <<EOM
8638 LIBTEST_42 {
8639 global:
8640 foo;
8641 local: *;
8642 };
8643 EOM
8644 if $cc $cccdlflags $ccdlflags $ccflags \
8645 $ldflags $lddlflags -o a.out try.c \
8646 -Wl,--version-script=try.h >/dev/null 2>&1 \
8647 && $test -s a.out ; then
8648 echo "ld supports scripting" >&4
8649 ld_can_script="$define"
8650 else
8651 echo "ld does not support scripting" >&4
8652 fi
8653 $rm_try
8654 ;;
8655 esac
8656
8657 : Do we want a shared libperl?
8658 also=''
8659 case "$usedl" in
8660 $undef)
8661 # No dynamic loading being used, so don't bother even to prompt.
8662 useshrplib='false'
8663 ;;
8664 *) case "$useshrplib" in
8665 '') case "$osname" in
8666 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8667 dflt=y
8668 also='Building a shared libperl is required for dynamic loading to work on your system.'
8669 ;;
8670 *) dflt=n
8671 ;;
8672 esac
8673 ;;
8674 $define|true|[Yy]*)
8675 dflt=y
8676 ;;
8677 *) dflt=n
8678 ;;
8679 esac
8680 $cat << EOM
8681
8682 The perl executable is normally obtained by linking perlmain.c with
8683 libperl${_a}, any static extensions (usually just DynaLoader), and
8684 any other libraries needed on this system (such as -lm, etc.). Since
8685 your system supports dynamic loading, it is probably possible to build
8686 a shared libperl.$so. If you will have more than one executable linked
8687 to libperl.$so, this will significantly reduce the size of each
8688 executable, but it may have a noticeable effect on performance. The
8689 default is probably sensible for your system.
8690 $also
8691
8692 EOM
8693 rp="Build a shared libperl.$so (y/n)"
8694 . ./myread
8695 case "$ans" in
8696 true|$define|[Yy]*)
8697 useshrplib='true' ;;
8698 *) useshrplib='false' ;;
8699 esac
8700 ;;
8701 esac
8702
8703 case "$useshrplib" in
8704 true)
8705 case "$userelocatableinc" in
8706 true|define)
8707 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8708 echo "See INSTALL for an explanation why that won't work." >&4
8709 exit 4
8710 ;;
8711 esac
8712 case "$libperl" in
8713 '')
8714 # Figure out a good name for libperl.so. Since it gets stored in
8715 # a version-specific architecture-dependent library, the version
8716 # number isn't really that important, except for making cc/ld happy.
8717 #
8718 # A name such as libperl.so.10.1
8719 majmin="libperl.$so.$patchlevel.$subversion"
8720 # A name such as libperl.so.100
8721 majonly=`echo $patchlevel $subversion |
8722 $awk '{printf "%d%02d", $1, $2}'`
8723 majonly=libperl.$so.$majonly
8724 # I'd prefer to keep the os-specific stuff here to a minimum, and
8725 # rely on figuring it out from the naming of libc.
8726 case "${osname}${osvers}" in
8727 *linux*|gnu*) # ld won't link with a bare -lperl otherwise.
8728 dflt=libperl.$so
8729 ;;
8730 cygwin*) # ld links now against the dll directly
8731 majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8732 majonly=`echo $patchlevel $subversion |
8733 $awk '{printf "%03d%03d", $1, $2}'`
8734 majonly=cygperl5.$majonly.$so
8735 dflt=$majmin
8736 ;;
8737 *) # Try to guess based on whether libc has major.minor.
8738 case "$libc" in
8739 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8740 *libc.$so.[0-9]*) dflt=$majonly ;;
8741 *) dflt=libperl.$so ;;
8742 esac
8743 ;;
8744 esac
8745 ;;
8746 *) dflt=$libperl
8747 ;;
8748 esac
8749 cat << EOM
8750
8751 I need to select a good name for the shared libperl. If your system uses
8752 library names with major and minor numbers, then you might want something
8753 like $majmin. Alternatively, if your system uses a single version
8754 number for shared libraries, then you might want to use $majonly.
8755 Or, your system might be quite happy with a simple libperl.$so.
8756
8757 Since the shared libperl will get installed into a version-specific
8758 architecture-dependent directory, the version number of the shared perl
8759 library probably isn't important, so the default should be o.k.
8760
8761 EOM
8762 rp='What name do you want to give to the shared libperl?'
8763 . ./myread
8764 libperl=$ans
8765 echo "Ok, I'll use $libperl"
8766 ;;
8767 *)
8768 libperl="libperl${_a}"
8769 ;;
8770 esac
8771
8772 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8773 case "$shrpdir" in
8774 '') ;;
8775 *) $cat >&4 <<EOM
8776 WARNING: Use of the shrpdir variable for the installation location of
8777 the shared $libperl is not supported. It was never documented and
8778 will not work in this version. Let me (https://github.com/Perl/perl5/issues)
8779 know of any problems this may cause.
8780
8781 EOM
8782 case "$shrpdir" in
8783 "$archlibexp/CORE")
8784 $cat >&4 <<EOM
8785 But your current setting of $shrpdir is
8786 the default anyway, so it's harmless.
8787 EOM
8788 ;;
8789 *)
8790 $cat >&4 <<EOM
8791 Further, your current attempted setting of $shrpdir
8792 conflicts with the value of $archlibexp/CORE
8793 that installperl will use.
8794 EOM
8795 ;;
8796 esac
8797 ;;
8798 esac
8799
8800 # How will the perl executable find the installed shared $libperl?
8801 # Add $xxx to ccdlflags.
8802 # If we can't figure out a command-line option, use $shrpenv to
8803 # set env LD_RUN_PATH. The main perl makefile uses this.
8804 shrpdir=$archlibexp/CORE
8805 xxx=''
8806 tmp_shrpenv=''
8807 if "$useshrplib"; then
8808 case "$osname" in
8809 aix)
8810 # We'll set it in Makefile.SH...
8811 ;;
8812 solaris)
8813 xxx="-R $shrpdir"
8814 ;;
8815 freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8816 xxx="-Wl,-R$shrpdir"
8817 ;;
8818 bsdos|linux|irix*|dec_osf|gnu*|haiku)
8819 xxx="-Wl,-rpath,$shrpdir"
8820 ;;
8821 hpux*)
8822 # hpux doesn't like the default, either.
8823 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8824 ;;
8825 cygwin)
8826 # cygwin needs only ldlibpth
8827 ;;
8828 *)
8829 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8830 ;;
8831 esac
8832 case "$xxx" in
8833 '') ;;
8834 *)
8835 # Only add $xxx if it isn't already in ccdlflags.
8836 case " $ccdlflags " in
8837 *" $xxx "*) ;;
8838 *) ccdlflags="$ccdlflags $xxx"
8839 cat <<EOM >&4
8840
8841 Adding $xxx to the flags
8842 passed to $ld so that the perl executable will find the
8843 installed shared $libperl.
8844
8845 EOM
8846 ;;
8847 esac
8848 ;;
8849 esac
8850 fi
8851 # Fix ccdlflags in AIX for building external extensions.
8852 # (For building Perl itself bare -bE:perl.exp is needed,
8853 # Makefile.SH takes care of this.)
8854 case "$osname" in
8855 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8856 esac
8857 # Respect a hint or command-line value.
8858 case "$shrpenv" in
8859 '') shrpenv="$tmp_shrpenv" ;;
8860 esac
8861 case "$ldlibpthname" in
8862 '') ldlibpthname=LD_LIBRARY_PATH ;;
8863 none) ldlibpthname='' ;;
8864 esac
8865
8866 : determine where manual pages are on this system
8867 echo " "
8868 case "$sysman" in
8869 '')
8870 syspath='/usr/share/man/man1 /usr/man/man1'
8871 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8872 syspath="$syspath /usr/man/u_man/man1"
8873 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8874 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8875 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8876 sysman=`./loc . /usr/man/man1 $syspath`
8877 ;;
8878 esac
8879 if $test -d "$sysman"; then
8880 echo "System manual is in $sysman." >&4
8881 else
8882 echo "Could not find manual pages in source form." >&4
8883 fi
8884
8885 : determine where manual pages go
8886 set man1dir man1dir none
8887 eval $prefixit
8888 $cat <<EOM
8889
8890 $spackage has manual pages available in source form.
8891 EOM
8892 case "$nroff" in
8893 nroff)
8894 echo "However, you don't have nroff, so they're probably useless to you."
8895 case "$man1dir" in
8896 '') man1dir="none";;
8897 esac;;
8898 esac
8899 echo "If you don't want the manual sources installed, answer 'none'."
8900 case "$man1dir" in
8901 ' ') dflt=none
8902 ;;
8903 '')
8904 lookpath="$prefixexp/share/man/man1"
8905 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8906 lookpath="$lookpath $prefixexp/man/p_man/man1"
8907 lookpath="$lookpath $prefixexp/man/u_man/man1"
8908 lookpath="$lookpath $prefixexp/man/man.1"
8909 case "$sysman" in
8910 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8911 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8912 esac
8913 set dflt
8914 eval $prefixup
8915 ;;
8916 *) dflt="$man1dir"
8917 ;;
8918 esac
8919 echo " "
8920 fn=dn+~
8921 rp="Where do the main $spackage manual pages (source) go?"
8922 . ./getfile
8923 if $test "X$man1direxp" != "X$ansexp"; then
8924 installman1dir=''
8925 fi
8926 prefixvar=man1dir
8927 . ./setprefixvar
8928
8929 case "$man1dir" in
8930 '') man1dir=' '
8931 installman1dir='';;
8932 esac
8933
8934 : What suffix to use on installed man pages
8935
8936 case "$man1dir" in
8937 ' ')
8938 man1ext='0'
8939 ;;
8940 *)
8941 rp="What suffix should be used for the main $spackage man pages?"
8942 case "$man1ext" in
8943 '') case "$man1dir" in
8944 *1) dflt=1 ;;
8945 *1p) dflt=1p ;;
8946 *1pm) dflt=1pm ;;
8947 *l) dflt=l;;
8948 *n) dflt=n;;
8949 *o) dflt=o;;
8950 *p) dflt=p;;
8951 *C) dflt=C;;
8952 *L) dflt=L;;
8953 *L1) dflt=L1;;
8954 *) dflt=1;;
8955 esac
8956 ;;
8957 *) dflt="$man1ext";;
8958 esac
8959 . ./myread
8960 man1ext="$ans"
8961 ;;
8962 esac
8963
8964 : see if we can have long filenames
8965 echo " "
8966 first=123456789abcdef
8967 $rm -f $first
8968 if (echo hi >$first) 2>/dev/null; then
8969 if $test -f 123456789abcde; then
8970 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8971 val="$undef"
8972 else
8973 echo 'You can have filenames longer than 14 characters.'>&4
8974 val="$define"
8975 fi
8976 else
8977 $cat <<'EOM'
8978 You can't have filenames longer than 14 chars.
8979 You can't even think about them!
8980 EOM
8981 val="$undef"
8982 fi
8983 set d_flexfnam
8984 eval $setvar
8985 $rm -rf 123456789abcde*
8986
8987 : determine where library module manual pages go
8988 set man3dir man3dir none
8989 eval $prefixit
8990 $cat <<EOM
8991
8992 $spackage has manual pages for many of the library modules.
8993 EOM
8994
8995 case "$nroff" in
8996 nroff)
8997 $cat <<'EOM'
8998 However, you don't have nroff, so they're probably useless to you.
8999 EOM
9000 case "$man3dir" in
9001 '') man3dir="none";;
9002 esac;;
9003 esac
9004
9005 case "$d_flexfnam" in
9006 undef)
9007 $cat <<'EOM'
9008 However, your system can't handle the long file names like File::Basename.3.
9009 EOM
9010 case "$man3dir" in
9011 '') man3dir="none";;
9012 esac;;
9013 esac
9014
9015 echo "If you don't want the manual sources installed, answer 'none'."
9016 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9017 case "$man3dir" in
9018 '') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9019 if $test -d "$privlib/man/man3"; then
9020 cat <<EOM >&4
9021
9022 WARNING: Previous versions of perl installed man3 pages into
9023 $privlib/man/man3. This version will suggest a
9024 new default of $dflt.
9025 EOM
9026 tdflt=$dflt
9027 dflt='n'
9028 rp='Do you wish to preserve the old behavior?(y/n)'
9029 . ./myread
9030 case "$ans" in
9031 y*) dflt="$privlib/man/man3" ;;
9032 *) dflt=$tdflt ;;
9033 esac
9034 fi
9035 ;;
9036 *) dflt="$man3dir" ;;
9037 esac
9038 case "$dflt" in
9039 ' ') dflt=none ;;
9040 esac
9041 echo " "
9042 fn=dn+~
9043 rp="Where do the $package library man pages (source) go?"
9044 . ./getfile
9045 prefixvar=man3dir
9046 . ./setprefixvar
9047
9048 case "$man3dir" in
9049 '') man3dir=' '
9050 installman3dir='';;
9051 esac
9052
9053 : What suffix to use on installed man pages
9054 case "$man3dir" in
9055 ' ')
9056 man3ext='0'
9057 ;;
9058 *)
9059 rp="What suffix should be used for the $package library man pages?"
9060 case "$man3ext" in
9061 '') case "$man3dir" in
9062 *3) dflt=3 ;;
9063 *3p) dflt=3p ;;
9064 *3pm) dflt=3pm ;;
9065 *l) dflt=l;;
9066 *n) dflt=n;;
9067 *o) dflt=o;;
9068 *p) dflt=p;;
9069 *C) dflt=C;;
9070 *L) dflt=L;;
9071 *L3) dflt=L3;;
9072 *) dflt=3;;
9073 esac
9074 ;;
9075 *) dflt="$man3ext";;
9076 esac
9077 . ./myread
9078 man3ext="$ans"
9079 ;;
9080 esac
9081
9082 : see if we have to deal with yellow pages, now NIS.
9083 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9084 case "$hostcat" in
9085 nidump*) ;;
9086 *)
9087 case "$hostcat" in
9088 *ypcat*) dflt=y;;
9089 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9090 dflt=y
9091 else
9092 dflt=n
9093 fi;;
9094 *) dflt=n;;
9095 esac
9096 echo " "
9097 rp='Are you getting the hosts file via yellow pages?'
9098 . ./myread
9099 case "$ans" in
9100 y*) hostcat='ypcat hosts';;
9101 *) hostcat='cat /etc/hosts';;
9102 esac
9103 ;;
9104 esac
9105 fi
9106 case "$hostcat" in
9107 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9108 esac
9109 case "$groupcat" in
9110 '') test -f /etc/group && groupcat='cat /etc/group';;
9111 esac
9112 case "$passcat" in
9113 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9114 esac
9115
9116 : now get the host name
9117 echo " "
9118 echo "Figuring out host name..." >&4
9119 case "$myhostname" in
9120 '') cont=true
9121 echo 'Maybe "hostname" will work...'
9122 if tans=`sh -c hostname 2>&1` ; then
9123 myhostname=$tans
9124 phostname=hostname
9125 cont=''
9126 fi
9127 ;;
9128 *) cont='';;
9129 esac
9130 if $test "$cont"; then
9131 if ./xenix; then
9132 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
9133 if tans=`cat /etc/systemid 2>&1` ; then
9134 myhostname=$tans
9135 phostname='cat /etc/systemid'
9136 echo "Whadyaknow. Xenix always was a bit strange..."
9137 cont=''
9138 fi
9139 elif $test -r /etc/systemid; then
9140 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9141 fi
9142 fi
9143 if $test "$cont"; then
9144 echo 'No, maybe "uuname -l" will work...'
9145 if tans=`sh -c 'uuname -l' 2>&1` ; then
9146 myhostname=$tans
9147 phostname='uuname -l'
9148 else
9149 echo 'Strange. Maybe "uname -n" will work...'
9150 if tans=`sh -c 'uname -n' 2>&1` ; then
9151 myhostname=$tans
9152 phostname='uname -n'
9153 else
9154 echo 'Oh well, maybe I can mine it out of whoami.h...'
9155 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9156 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9157 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9158 else
9159 case "$myhostname" in
9160 '') echo "Does this machine have an identity crisis or something?"
9161 phostname='';;
9162 *)
9163 echo "Well, you said $myhostname before..."
9164 phostname='echo $myhostname';;
9165 esac
9166 fi
9167 fi
9168 fi
9169 fi
9170 case "$myhostname" in
9171 '') myhostname=noname ;;
9172 esac
9173 : you do not want to know about this
9174 set $myhostname
9175 myhostname=$1
9176
9177 : verify guess
9178 if $test "$myhostname" ; then
9179 dflt=y
9180 rp='Your host name appears to be "'$myhostname'".'" Right?"
9181 . ./myread
9182 case "$ans" in
9183 y*) ;;
9184 *) myhostname='';;
9185 esac
9186 fi
9187
9188 : bad guess or no guess
9189 while $test "X$myhostname" = X ; do
9190 dflt=''
9191 rp="Please type the (one word) name of your host:"
9192 . ./myread
9193 myhostname="$ans"
9194 done
9195
9196 : translate upper to lower if necessary
9197 case "$myhostname" in
9198 *[A-Z]*)
9199 echo "(Normalizing case in your host name)"
9200 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9201 ;;
9202 esac
9203
9204 case "$myhostname" in
9205 *.*)
9206 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9207 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9208 echo "(Trimming domain name from host name--host name is now $myhostname)"
9209 ;;
9210 *) case "$mydomain" in
9211 '')
9212 {
9213 test "X$hostcat" = "Xypcat hosts" &&
9214 ypmatch "$myhostname" hosts 2>/dev/null |\
9215 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
9216 $test -s hosts
9217 } || {
9218 test "X$hostcat" != "X" &&
9219 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
9220 /[ ]$myhostname[ . ]/p" > hosts
9221 }
9222 tmp_re="[ . ]"
9223 if $test -f hosts; then
9224 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
9225 END { print sum }" hosts` = x1 || tmp_re="[ ]"
9226 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9227 hosts | $sort | $uniq | \
9228 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9229 case `$echo X$dflt` in
9230 X*\ *) echo "(Several hosts in the database matched hostname)"
9231 dflt=.
9232 ;;
9233 X.) echo "(You do not have fully-qualified names in the hosts database)"
9234 ;;
9235 esac
9236 else
9237 echo "(I cannot locate a hosts database anywhere)"
9238 dflt=.
9239 fi
9240 case "$dflt" in
9241 .)
9242 tans=`./loc resolv.conf X /etc /usr/etc`
9243 if $test -f "$tans"; then
9244 echo "(Attempting domain name extraction from $tans)"
9245 dflt=.`$sed -n -e 's/ / /g' \
9246 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
9247 -e 1q 2>/dev/null`
9248 case "$dflt" in
9249 .) dflt=.`$sed -n -e 's/ / /g' \
9250 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
9251 -e 1q 2>/dev/null`
9252 ;;
9253 esac
9254 fi
9255 ;;
9256 esac
9257 case "$dflt" in
9258 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9259 dflt=.`sh -c domainname 2>/dev/null`
9260 case "$dflt" in
9261 '') dflt='.';;
9262 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9263 esac
9264 ;;
9265 esac
9266 case "$dflt$osname" in
9267 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9268 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9269 ;;
9270 esac
9271 case "$dflt" in
9272 .) echo "(Lost all hope -- silly guess then)"
9273 dflt='.nonet'
9274 ;;
9275 esac
9276 $rm -f hosts
9277 ;;
9278 *) dflt="$mydomain";;
9279 esac;;
9280 esac
9281 echo " "
9282 rp="What is your domain name?"
9283 . ./myread
9284 tans="$ans"
9285 case "$ans" in
9286 '') ;;
9287 .*) ;;
9288 *) tans=".$tans";;
9289 esac
9290 mydomain="$tans"
9291
9292 : translate upper to lower if necessary
9293 case "$mydomain" in
9294 *[A-Z]*)
9295 echo "(Normalizing case in your domain name)"
9296 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9297 ;;
9298 esac
9299
9300 : a little sanity check here
9301 case "$phostname" in
9302 '') ;;
9303 *)
9304 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9305 $myhostname$mydomain|$myhostname) ;;
9306 *)
9307 case "$phostname" in
9308 sed*)
9309 echo "(That doesn't agree with your whoami.h file, by the way.)"
9310 ;;
9311 *)
9312 echo "(That doesn't agree with your $phostname command, by the way.)"
9313 ;;
9314 esac
9315 ;;
9316 esac
9317 ;;
9318 esac
9319
9320 : determine the e-mail address of the user who is running us
9321 $cat <<EOM
9322
9323 I need to get your e-mail address in Internet format if possible, i.e.
9324 something like [email protected]. Please answer accurately since I have
9325 no easy means to double check it. The default value provided below
9326 is most probably close to reality but may not be valid from outside
9327 your organization...
9328
9329 EOM
9330 cont=x
9331 while test "$cont"; do
9332 case "$MAILDOMAIN" in
9333 '')
9334 if $test -s /etc/mailname; then
9335 maildomain=`$cat /etc/mailname`
9336 else
9337 maildomain="$myhostname$mydomain"
9338 fi
9339 ;;
9340 *) maildomain="$MAILDOMAIN";;
9341 esac
9342 case "$cf_email" in
9343 '') dflt="$cf_by@$maildomain";;
9344 *) dflt="$cf_email";;
9345 esac
9346 rp='What is your e-mail address?'
9347 . ./myread
9348 cf_email="$ans"
9349 case "$cf_email" in
9350 *@*.*) cont='' ;;
9351 *)
9352 rp='Address does not look like an Internet one. Use it anyway?'
9353 case "$fastread" in
9354 yes) dflt=y ;;
9355 *) dflt=n ;;
9356 esac
9357 . ./myread
9358 case "$ans" in
9359 y*) cont='' ;;
9360 *) echo " " ;;
9361 esac
9362 ;;
9363 esac
9364 done
9365
9366 : Ask e-mail of administrator
9367 $cat <<EOM
9368
9369 If you or somebody else will be maintaining perl at your site, please
9370 fill in the correct e-mail address here so that they may be contacted
9371 if necessary. You may enter "none" for no administrator.
9372
9373 EOM
9374 case "$perladmin" in
9375 '') dflt="$cf_email";;
9376 *) dflt="$perladmin";;
9377 esac
9378 rp='Perl administrator e-mail address'
9379 . ./myread
9380 perladmin="$ans"
9381
9382 : determine whether to use a version number suffix for installed binaries
9383 echo " "
9384 $cat <<EOM
9385 Do you want to use a version number suffix for installed binaries? This
9386 will install 'perl$version' instead of 'perl', and likewise for other
9387 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9388 to be installed side-by-side. Unless you are a developer, you probably
9389 do *not* want to do this.
9390 EOM
9391 case "$versiononly" in
9392 "$define"|[Yy]*|true) dflt='y' ;;
9393 *) dflt='n';
9394 esac
9395 rp="Do you want to use a version number suffix for installed binaries?"
9396 . ./myread
9397 case "$ans" in
9398 [yY]*) val="$define";;
9399 *) val="$undef" ;;
9400 esac
9401 set versiononly
9402 eval $setvar
9403
9404 case "$versiononly" in
9405 "$define") inc_version_list=''
9406 inc_version_list_init=0
9407 ;;
9408 esac
9409
9410 : figure out how to guarantee perl startup
9411 : XXX Note that this currently takes advantage of the bug that binexp ignores
9412 : the Configure -Dinstallprefix setting, which in turn means that under
9413 : relocatable @INC, initialinstalllocation is what binexp started as.
9414 case "$startperl" in
9415 '')
9416 case "$sharpbang" in
9417 *!)
9418 $cat <<EOH
9419
9420 I can use the #! construct to start perl on your system. This will
9421 make startup of perl scripts faster, but may cause problems if you
9422 want to share those scripts and perl is not in a standard place
9423 ($initialinstalllocation/perl) on all your platforms. The alternative
9424 is to force a shell by starting the script with a single ':' character.
9425
9426 EOH
9427 case "$versiononly" in
9428 "$define") dflt="$initialinstalllocation/perl$version";;
9429 *) dflt="$initialinstalllocation/perl";;
9430 esac
9431 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9432 . ./myread
9433 case "$ans" in
9434 none) startperl=": # use perl";;
9435 *) startperl="#!$ans"
9436 if $test 30 -lt `echo "$ans" | wc -c`; then
9437 $cat >&4 <<EOM
9438
9439 WARNING: Some systems limit the #! command to 32 characters.
9440 If you experience difficulty running Perl scripts with #!, try
9441 installing Perl in a directory with a shorter pathname.
9442
9443 EOM
9444 fi ;;
9445 esac
9446 ;;
9447 *) startperl=": # use perl"
9448 ;;
9449 esac
9450 ;;
9451 esac
9452 echo "I'll use $startperl to start perl scripts."
9453
9454 : figure best path for perl in scripts
9455 case "$perlpath" in
9456 '')
9457 case "$versiononly" in
9458 "$define") perlpath="$initialinstalllocation/perl$version";;
9459 *) perlpath="$initialinstalllocation/perl";;
9460 esac
9461 case "$startperl" in
9462 *!*) ;;
9463 *)
9464 $cat <<EOH
9465
9466 I will use the "eval 'exec'" idiom to start Perl on your system.
9467 I can use the full path of your Perl binary for this purpose, but
9468 doing so may cause problems if you want to share those scripts and
9469 Perl is not always in a standard place ($initialinstalllocation/perl).
9470
9471 EOH
9472 dflt="$initialinstalllocation/perl"
9473 rp="What path shall I use in \"eval 'exec'\"?"
9474 . ./myread
9475 perlpath="$ans"
9476 ;;
9477 esac
9478 ;;
9479 esac
9480 case "$startperl" in
9481 *!*) ;;
9482 *) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9483 esac
9484
9485 : determine where public executable scripts go
9486 set scriptdir scriptdir
9487 eval $prefixit
9488 case "$scriptdir" in
9489 '')
9490 dflt="$bin"
9491 : guess some guesses
9492 $test -d /usr/share/scripts && dflt=/usr/share/scripts
9493 $test -d /usr/share/bin && dflt=/usr/share/bin
9494 $test -d /usr/local/script && dflt=/usr/local/script
9495 $test -d /usr/local/scripts && dflt=/usr/local/scripts
9496 $test -d $prefixexp/script && dflt=$prefixexp/script
9497 set dflt
9498 eval $prefixup
9499 ;;
9500 *) dflt="$scriptdir"
9501 ;;
9502 esac
9503 $cat <<EOM
9504
9505 Some installations have a separate directory just for executable scripts so
9506 that they can mount it across multiple architectures but keep the scripts in
9507 one spot. You might, for example, have a subdirectory of /usr/share for this.
9508 Or you might just lump your scripts in with all your other executables.
9509
9510 EOM
9511 fn=d~
9512 rp='Where do you keep publicly executable scripts?'
9513 . ./getfile
9514 if $test "X$ansexp" != "X$scriptdirexp"; then
9515 installscript=''
9516 fi
9517 installscriptdir=''
9518 prefixvar=scriptdir
9519 . ./setprefixvar
9520 : A little fix up for an irregularly named variable.
9521 installscript="$installscriptdir"
9522
9523 : determine where add-on public executables go
9524 case "$sitebin" in
9525 '') dflt=$siteprefix/bin ;;
9526 *) dflt=$sitebin ;;
9527 esac
9528 fn=d~
9529 rp='Pathname where the add-on public executables should be installed?'
9530 . ./getfile
9531 prefixvar=sitebin
9532 . ./setprefixvar
9533
9534 : determine where add-on html pages go
9535 : There is no standard location, so try to copy the previously-selected
9536 : directory structure for the core html pages.
9537 case "$sitehtml1dir" in
9538 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9539 *) dflt=$sitehtml1dir ;;
9540 esac
9541 case "$dflt" in
9542 ''|' ') dflt=none ;;
9543 esac
9544 fn=dn+~
9545 rp='Pathname where the site-specific html pages should be installed?'
9546 . ./getfile
9547 prefixvar=sitehtml1dir
9548 . ./setprefixvar
9549
9550 : determine where add-on library html pages go
9551 : There is no standard location, so try to copy the previously-selected
9552 : directory structure for the core html pages.
9553 case "$sitehtml3dir" in
9554 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9555 *) dflt=$sitehtml3dir ;;
9556 esac
9557 case "$dflt" in
9558 ''|' ') dflt=none ;;
9559 esac
9560 fn=dn+~
9561 rp='Pathname where the site-specific library html pages should be installed?'
9562 . ./getfile
9563 prefixvar=sitehtml3dir
9564 . ./setprefixvar
9565
9566 : determine where add-on manual pages go
9567 case "$siteman1dir" in
9568 '') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9569 *) dflt=$siteman1dir ;;
9570 esac
9571 case "$dflt" in
9572 ''|' ') dflt=none ;;
9573 esac
9574 fn=dn+~
9575 rp='Pathname where the site-specific manual pages should be installed?'
9576 . ./getfile
9577 prefixvar=siteman1dir
9578 . ./setprefixvar
9579
9580 : determine where add-on library man pages go
9581 case "$siteman3dir" in
9582 '') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9583 *) dflt=$siteman3dir ;;
9584 esac
9585 case "$dflt" in
9586 ''|' ') dflt=none ;;
9587 esac
9588 fn=dn+~
9589 rp='Pathname where the site-specific library manual pages should be installed?'
9590 . ./getfile
9591 prefixvar=siteman3dir
9592 . ./setprefixvar
9593
9594 : determine where add-on public executable scripts go
9595 case "$sitescript" in
9596 '') dflt=$siteprefix/script
9597 $test -d $dflt || dflt=$sitebin ;;
9598 *) dflt="$sitescript" ;;
9599 esac
9600 fn=d~+
9601 rp='Pathname where add-on public executable scripts should be installed?'
9602 . ./getfile
9603 prefixvar=sitescript
9604 . ./setprefixvar
9605
9606 : see if backtrace exists
9607 set backtrace d_backtrace
9608 eval $inlibc
9609
9610 : Check if C backtrace is actually supported.
9611 case "$usecbacktrace" in
9612 "") usecbacktrace=$undef ;;
9613 [yY]*|true|$define)
9614 case "$d_backtrace" in
9615 [yY]*|true|$define)
9616 ;;
9617 *)
9618 echo "This system does not support backtrace" >&4
9619 usecbacktrace=$undef
9620 ;;
9621 esac
9622 ;;
9623 esac
9624
9625 : Check if faststdio is requested and available
9626 case "$usefaststdio" in
9627 $define|true|[yY]*|'')
9628 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9629 case "$xversion" in
9630 [68]) dflt='y' ;;
9631 *) dflt='n' ;;
9632 esac
9633 ;;
9634 *) dflt='n';;
9635 esac
9636 cat <<EOM
9637
9638 Perl can be built to use 'fast stdio', which means using the stdio
9639 library but also directly manipulating the stdio buffers to enable
9640 faster I/O. Using stdio is better for backward compatibility (especially
9641 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9642 interface has been preferred instead of stdio.
9643
9644 If this doesn't make any sense to you, just accept the default '$dflt'.
9645 EOM
9646 rp='Use the "fast stdio" if available?'
9647 . ./myread
9648 case "$ans" in
9649 y|Y) val="$define" ;;
9650 *) val="$undef" ;;
9651 esac
9652 set usefaststdio
9653 eval $setvar
9654
9655 : define an is-a-typedef? function
9656 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9657 case "$inclist" in
9658 "") inclist="sys/types.h";;
9659 esac;
9660 eval "varval=\$$var";
9661 case "$varval" in
9662 "")
9663 $rm -f temp.c;
9664 for inc in $inclist; do
9665 echo "#include <$inc>" >>temp.c;
9666 done;
9667 echo "#ifdef $type" >> temp.c;
9668 echo "printf(\"We have $type\");" >> temp.c;
9669 echo "#endif" >> temp.c;
9670 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9671 if $contains $type temp.E >/dev/null 2>&1; then
9672 eval "$var=\$type";
9673 else
9674 eval "$var=\$def";
9675 fi;
9676 $rm -f temp.?;;
9677 *) eval "$var=\$varval";;
9678 esac'
9679
9680 : define an is-a-typedef? function that prompts if the type is not available.
9681 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9682 case "$inclist" in
9683 "") inclist="sys/types.h";;
9684 esac;
9685 eval "varval=\$$var";
9686 case "$varval" in
9687 "")
9688 $rm -f temp.c;
9689 for inc in $inclist; do
9690 echo "#include <$inc>" >>temp.c;
9691 done;
9692 echo "#ifdef $type" >> temp.c;
9693 echo "printf(\"We have $type\");" >> temp.c;
9694 echo "#endif" >> temp.c;
9695 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9696 echo " " ;
9697 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9698 if $contains $type temp.E >/dev/null 2>&1; then
9699 echo "$type found." >&4;
9700 eval "$var=\$type";
9701 else
9702 echo "$type NOT found." >&4;
9703 dflt="$def";
9704 . ./myread ;
9705 eval "$var=\$ans";
9706 fi;
9707 $rm -f temp.?;;
9708 *) eval "$var=\$varval";;
9709 esac'
9710
9711 : see what type lseek is declared as in the kernel
9712 rp="What is the type used for lseek's offset on this system?"
9713 set off_t lseektype long stdio.h sys/types.h
9714 eval $typedef_ask
9715
9716 echo " "
9717 echo "Checking to see how big your file offsets are..." >&4
9718 $cat >try.c <<EOCP
9719 #include <sys/types.h>
9720 #include <stdio.h>
9721 int main()
9722 {
9723 printf("%d\n", (int)sizeof($lseektype));
9724 return(0);
9725 }
9726 EOCP
9727 set try
9728 if eval $compile_ok; then
9729 lseeksize=`$run ./try`
9730 echo "Your file offsets are $lseeksize bytes long."
9731 else
9732 dflt=$longsize
9733 echo " "
9734 echo "(I can't seem to compile the test program. Guessing...)"
9735 rp="What is the size of your file offsets (in bytes)?"
9736 . ./myread
9737 lseeksize="$ans"
9738 fi
9739 $rm_try
9740
9741 : see what type file positions are declared as in the library
9742 rp="What is the type for file position used by fsetpos()?"
9743 set fpos_t fpostype long stdio.h sys/types.h
9744 eval $typedef_ask
9745
9746 : Check size for Fpos_t
9747 echo " "
9748 case "$fpostype" in
9749 *_t) zzz="$fpostype" ;;
9750 *) zzz="fpos_t" ;;
9751 esac
9752 echo "Checking the size of $zzz..." >&4
9753 cat > try.c <<EOCP
9754 #include <sys/types.h>
9755 #include <stdio.h>
9756 #$i_stdlib I_STDLIB
9757 #ifdef I_STDLIB
9758 #include <stdlib.h>
9759 #endif
9760 int main() {
9761 printf("%d\n", (int)sizeof($fpostype));
9762 exit(0);
9763 }
9764 EOCP
9765 set try
9766 if eval $compile_ok; then
9767 yyy=`$run ./try`
9768 case "$yyy" in
9769 '') fpossize=4
9770 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9771 ;;
9772 *) fpossize=$yyy
9773 echo "Your $zzz is $fpossize bytes long."
9774 ;;
9775 esac
9776 else
9777 dflt="$longsize"
9778 echo " " >&4
9779 echo "(I can't compile the test program. Guessing...)" >&4
9780 rp="What is the size of your file positions (in bytes)?"
9781 . ./myread
9782 fpossize="$ans"
9783 fi
9784
9785 : Check for large file support
9786 # Backward compatibility (uselfs is deprecated).
9787 case "$uselfs" in
9788 "$define"|true|[yY]*)
9789 cat <<EOM >&4
9790
9791 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9792 EOM
9793 uselargefiles="$define"
9794 ;;
9795 esac
9796
9797 case "$lseeksize:$fpossize" in
9798 8:8) cat <<EOM
9799
9800 You can have files larger than 2 gigabytes.
9801 EOM
9802 val="$define" ;;
9803 *) case "$uselargefiles" in
9804 "$undef"|false|[nN]*) dflt='n' ;;
9805 *) dflt='y' ;;
9806 esac
9807 cat <<EOM
9808
9809 Perl can be built to understand large files (files larger than 2 gigabytes)
9810 on some systems. To do so, Configure can be run with -Duselargefiles.
9811
9812 If this doesn't make any sense to you, just accept the default '$dflt'.
9813 EOM
9814 rp='Try to understand large files, if available?'
9815 . ./myread
9816 case "$ans" in
9817 y|Y) val="$define" ;;
9818 *) val="$undef" ;;
9819 esac
9820 ;;
9821 esac
9822 set uselargefiles
9823 eval $setvar
9824 : Look for a hint-file generated 'call-back-unit'. If the
9825 : user has specified that a large files perl is to be built,
9826 : we may need to set or change some other defaults.
9827 if $test -f uselargefiles.cbu; then
9828 echo "Your platform has some specific hints regarding large file builds, using them..."
9829 . ./uselargefiles.cbu
9830 fi
9831 case "$uselargefiles" in
9832 "$define")
9833 if $test -f uselargefiles.cbu; then
9834 echo " "
9835 echo "Rechecking to see how big your file offsets are..." >&4
9836 $cat >try.c <<EOCP
9837 #include <sys/types.h>
9838 #include <stdio.h>
9839 int main()
9840 {
9841 printf("%d\n", (int)sizeof($lseektype));
9842 return(0);
9843 }
9844 EOCP
9845 set try
9846 if eval $compile_ok; then
9847 lseeksize=`$run ./try`
9848 $echo "Your file offsets are now $lseeksize bytes long."
9849 else
9850 dflt="$lseeksize"
9851 echo " "
9852 echo "(I can't seem to compile the test program. Guessing...)"
9853 rp="What is the size of your file offsets (in bytes)?"
9854 . ./myread
9855 lseeksize="$ans"
9856 fi
9857 case "$fpostype" in
9858 *_t) zzz="$fpostype" ;;
9859 *) zzz="fpos_t" ;;
9860 esac
9861 $echo $n "Rechecking the size of $zzz...$c" >&4
9862 $cat > try.c <<EOCP
9863 #include <sys/types.h>
9864 #include <stdio.h>
9865 #$i_stdlib I_STDLIB
9866 #ifdef I_STDLIB
9867 #include <stdlib.h>
9868 #endif
9869 int main() {
9870 printf("%d\n", (int)sizeof($fpostype));
9871 return(0);
9872 }
9873 EOCP
9874 set try
9875 if eval $compile_ok; then
9876 yyy=`$run ./try`
9877 dflt="$lseeksize"
9878 case "$yyy" in
9879 '') echo " "
9880 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9881 ;;
9882 *) fpossize=$yyy
9883 echo " $fpossize bytes." >&4
9884 ;;
9885 esac
9886 else
9887 dflt="$fpossize"
9888 echo " "
9889 echo "(I can't compile the test program. Guessing...)" >&4
9890 rp="What is the size of your file positions (in bytes)?"
9891 . ./myread
9892 fpossize="$ans"
9893 fi
9894 $rm_try
9895 fi
9896 ;;
9897 esac
9898
9899 : Check if we want perlio
9900 useperlio="$define"
9901
9902 : Set the vendorbin variables
9903 case "$vendorprefix" in
9904 '') d_vendorbin="$undef"
9905 vendorbin=''
9906 vendorbinexp=''
9907 ;;
9908 *) d_vendorbin="$define"
9909 : determine where vendor-supplied executables go.
9910 case "$vendorbin" in
9911 '') dflt=$vendorprefix/bin ;;
9912 *) dflt="$vendorbin" ;;
9913 esac
9914 fn=d~+
9915 rp='Pathname for the vendor-supplied executables directory?'
9916 . ./getfile
9917 vendorbin="$ans"
9918 vendorbinexp="$ansexp"
9919 ;;
9920 esac
9921 prefixvar=vendorbin
9922 . ./installprefix
9923
9924 : Set the vendorhtml1dir variables
9925 case "$vendorprefix" in
9926 '') vendorhtml1dir=''
9927 vendorhtml1direxp=''
9928 ;;
9929 *) : determine where vendor-supplied html pages go.
9930 : There is no standard location, so try to copy the previously-selected
9931 : directory structure for the core html pages.
9932 : XXX Better default suggestions would be welcome.
9933 case "$vendorhtml1dir" in
9934 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9935 *) dflt=$vendorhtml1dir ;;
9936 esac
9937 case "$dflt" in
9938 ''|' ') dflt=none ;;
9939 esac
9940 fn=dn+~
9941 rp='Pathname for the vendor-supplied html pages?'
9942 . ./getfile
9943 vendorhtml1dir="$ans"
9944 vendorhtml1direxp="$ansexp"
9945 ;;
9946 esac
9947 : Use ' ' for none so value is preserved next time through Configure
9948 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9949 prefixvar=vendorhtml1dir
9950 . ./installprefix
9951
9952 : Set the vendorhtml3dir variables
9953 case "$vendorprefix" in
9954 '') vendorhtml3dir=''
9955 vendorhtml3direxp=''
9956 ;;
9957 *) : determine where vendor-supplied module html pages go.
9958 : There is no standard location, so try to copy the previously-selected
9959 : directory structure for the core html pages.
9960 : XXX Better default suggestions would be welcome.
9961 case "$vendorhtml3dir" in
9962 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9963 *) dflt=$vendorhtml3dir ;;
9964 esac
9965 case "$dflt" in
9966 ''|' ') dflt=none ;;
9967 esac
9968 fn=dn+~
9969 rp='Pathname for the vendor-supplied html pages?'
9970 . ./getfile
9971 vendorhtml3dir="$ans"
9972 vendorhtml3direxp="$ansexp"
9973 ;;
9974 esac
9975 : Use ' ' for none so value is preserved next time through Configure
9976 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9977 prefixvar=vendorhtml3dir
9978 . ./installprefix
9979
9980 : Set the vendorman1dir variables
9981 case "$vendorprefix" in
9982 '') vendorman1dir=''
9983 vendorman1direxp=''
9984 ;;
9985 *) : determine where vendor-supplied manual pages go.
9986 case "$vendorman1dir" in
9987 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9988 *) dflt=$vendorman1dir ;;
9989 esac
9990 case "$dflt" in
9991 ''|' ') dflt=none ;;
9992 esac
9993 fn=nd~+
9994 rp='Pathname for the vendor-supplied manual section 1 pages?'
9995 . ./getfile
9996 vendorman1dir="$ans"
9997 vendorman1direxp="$ansexp"
9998 ;;
9999 esac
10000 : Use ' ' for none so value is preserved next time through Configure
10001 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10002 prefixvar=vendorman1dir
10003 . ./installprefix
10004
10005 : Set the vendorman3dir variables
10006 case "$vendorprefix" in
10007 '') vendorman3dir=''
10008 vendorman3direxp=''
10009 ;;
10010 *) : determine where vendor-supplied module manual pages go.
10011 case "$vendorman3dir" in
10012 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10013 *) dflt=$vendorman3dir ;;
10014 esac
10015 case "$dflt" in
10016 ''|' ') dflt=none ;;
10017 esac
10018 fn=nd~+
10019 rp='Pathname for the vendor-supplied manual section 3 pages?'
10020 . ./getfile
10021 vendorman3dir="$ans"
10022 vendorman3direxp="$ansexp"
10023 ;;
10024 esac
10025 : Use ' ' for none so value is preserved next time through Configure
10026 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10027 prefixvar=vendorman3dir
10028 . ./installprefix
10029
10030 : Set the vendorscript variables
10031 case "$vendorprefix" in
10032 '') d_vendorscript="$undef"
10033 vendorscript=''
10034 vendorscriptexp=''
10035 ;;
10036 *) d_vendorscript="$define"
10037 : determine where vendor-supplied scripts go.
10038 case "$vendorscript" in
10039 '') dflt=$vendorprefix/script
10040 $test -d $dflt || dflt=$vendorbin ;;
10041 *) dflt="$vendorscript" ;;
10042 esac
10043 $cat <<EOM
10044
10045 The installation process will create a directory for
10046 vendor-supplied scripts.
10047
10048 EOM
10049 fn=d~+
10050 rp='Pathname for the vendor-supplied scripts directory?'
10051 . ./getfile
10052 vendorscript="$ans"
10053 vendorscriptexp="$ansexp"
10054 ;;
10055 esac
10056 prefixvar=vendorscript
10057 . ./installprefix
10058
10059 : see if qgcvt exists
10060 set qgcvt d_qgcvt
10061 eval $inlibc
10062
10063 : Check what kind of doubles your system has
10064 $echo "Checking the kind of doubles you have..." >&4
10065 $cat >try.c <<EOP
10066 #$i_stdlib I_STDLIB
10067 #define DOUBLESIZE $doublesize
10068 #ifdef I_STDLIB
10069 #include <stdlib.h>
10070 #endif
10071 #include <stdio.h>
10072 static const double d = -0.1;
10073 int main() {
10074 unsigned const char* b = (unsigned const char*)(&d);
10075 #if DOUBLESIZE == 4
10076 if (b[0] == 0xCD && b[3] == 0xBD) {
10077 /* IEEE 754 32-bit little-endian */
10078 printf("1\n");
10079 exit(0);
10080 }
10081 if (b[0] == 0xBD && b[3] == 0xCD) {
10082 /* IEEE 754 32-bit big-endian */
10083 printf("2\n");
10084 exit(0);
10085 }
10086 if (b[0] == 0xCC && b[3] == 0xCC) {
10087 /* VAX format F, 32-bit PDP-style mixed endian. */
10088 printf("9\n");
10089 exit(0);
10090 }
10091 if (b[0] == 0xC0 && b[3] == 0x9A) {
10092 /* IBM single 32-bit */
10093 printf("12\n");
10094 exit(0);
10095 }
10096 #endif
10097 #if DOUBLESIZE == 8
10098 if (b[0] == 0x9A && b[7] == 0xBF) {
10099 /* IEEE 754 64-bit little-endian */
10100 printf("3\n");
10101 exit(0);
10102 }
10103 if (b[0] == 0xBF && b[7] == 0x9A) {
10104 /* IEEE 754 64-bit big-endian */
10105 printf("4\n");
10106 exit(0);
10107 }
10108 if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10109 /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10110 * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10111 * 99 99 b9 bf 9a 99 99 99 */
10112 printf("7\n");
10113 exit(0);
10114 }
10115 if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10116 /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10117 * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10118 * 99 99 99 9a bf b9 99 99 */
10119 printf("8\n");
10120 exit(0);
10121 }
10122 if (b[0] == 0xCC && b[7] == 0xCC) {
10123 /* VAX format D, 64-bit PDP-style mixed endian. */
10124 printf("10\n");
10125 exit(0);
10126 }
10127 if (b[0] == 0xD9 && b[7] == 0x99) {
10128 /* VAX format G, 64-bit PDP-style mixed endian. */
10129 printf("11\n");
10130 exit(0);
10131 }
10132 if (b[0] == 0xC0 && b[7] == 0x9A) {
10133 /* IBM double 64-bit */
10134 printf("13\n");
10135 exit(0);
10136 }
10137 if (b[0] == 0xBF && b[7] == 0xCD) {
10138 /* CRAY single 64-bit */
10139 printf("14\n");
10140 exit(0);
10141 }
10142 #endif
10143 #if DOUBLESIZE == 16
10144 if (b[0] == 0x9A && b[15] == 0xBF) {
10145 /* IEEE 754 128-bit little-endian */
10146 printf("5\n");
10147 exit(0);
10148 }
10149 if (b[0] == 0xBF && b[15] == 0x9A) {
10150 /* IEEE 754 128-bit big-endian */
10151 printf("6\n");
10152 exit(0);
10153 }
10154 #endif
10155 /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10156 * Whether those environments can still build Perl is debatable. */
10157 printf("-1\n"); /* unknown */
10158 exit(0);
10159 }
10160 EOP
10161 set try
10162 if eval $compile; then
10163 doublekind=`$run ./try`
10164 else
10165 doublekind=-1
10166 fi
10167 case "$doublekind" in
10168 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10169 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10170 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10171 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10172 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10173 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10174 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10175 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10176 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10177 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10178 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10179 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10180 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10181 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10182 *) echo "Cannot figure out your double. You Cyber, or something?" >&4 ;;
10183 esac
10184 d_double_style_ieee=$undef
10185 d_double_style_vax=$undef
10186 d_double_style_ibm=$undef
10187 d_double_style_cray=$undef
10188 case "$doublekind" in
10189 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10190 9|10|11) d_double_style_vax=$define ;;
10191 12|13) d_double_style_ibm=$define ;;
10192 14) d_double_style_cray=$define ;;
10193 esac
10194 case "$d_double_style_ieee" in
10195 $define)
10196 d_double_has_inf=$define
10197 d_double_has_nan=$define
10198 d_double_has_negative_zero=$define
10199 d_double_has_subnormals=$define
10200 ;;
10201 *)
10202 d_double_has_inf=$undef
10203 d_double_has_nan=$undef
10204 d_double_has_negative_zero=$undef
10205 d_double_has_subnormals=$undef
10206 ;;
10207 esac
10208 $rm_try
10209
10210 : Check print/scan long double stuff
10211 echo " "
10212
10213 if $test X"$d_longdbl" = X"$define"; then
10214
10215 echo "Checking how to print long doubles..." >&4
10216
10217 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10218 $cat >try.c <<'EOCP'
10219 #include <sys/types.h>
10220 #include <stdio.h>
10221 int main() {
10222 double d = 123.456;
10223 printf("%.3f\n", d);
10224 }
10225 EOCP
10226 set try
10227 if eval $compile; then
10228 yyy=`$run ./try`
10229 case "$yyy" in
10230 123.456)
10231 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10232 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10233 echo "We will use %f."
10234 ;;
10235 esac
10236 fi
10237 fi
10238
10239 if $test X"$sPRIfldbl" = X; then
10240 $cat >try.c <<'EOCP'
10241 #include <sys/types.h>
10242 #include <stdio.h>
10243 int main() {
10244 long double d = 123.456;
10245 printf("%.3Lf\n", d);
10246 }
10247 EOCP
10248 set try
10249 if eval $compile; then
10250 yyy=`$run ./try`
10251 case "$yyy" in
10252 123.456)
10253 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10254 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10255 echo "We will use %Lf."
10256 ;;
10257 esac
10258 fi
10259 fi
10260
10261 if $test X"$sPRIfldbl" = X; then
10262 $cat >try.c <<'EOCP'
10263 #include <sys/types.h>
10264 #include <stdio.h>
10265 int main() {
10266 long double d = 123.456;
10267 printf("%.3llf\n", d);
10268 }
10269 EOCP
10270 set try
10271 if eval $compile; then
10272 yyy=`$run ./try`
10273 case "$yyy" in
10274 123.456)
10275 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10276 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10277 echo "We will use %llf."
10278 ;;
10279 esac
10280 fi
10281 fi
10282
10283 if $test X"$sPRIfldbl" = X; then
10284 $cat >try.c <<'EOCP'
10285 #include <sys/types.h>
10286 #include <stdio.h>
10287 int main() {
10288 long double d = 123.456;
10289 printf("%.3lf\n", d);
10290 }
10291 EOCP
10292 set try
10293 if eval $compile; then
10294 yyy=`$run ./try`
10295 case "$yyy" in
10296 123.456)
10297 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10298 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10299 echo "We will use %lf."
10300 ;;
10301 esac
10302 fi
10303 fi
10304
10305 if $test X"$sPRIfldbl" = X; then
10306 echo "Cannot figure out how to print long doubles." >&4
10307 else
10308 sSCNfldbl=$sPRIfldbl # expect consistency
10309 fi
10310
10311 $rm_try
10312
10313 fi # d_longdbl
10314
10315 case "$sPRIfldbl" in
10316 '') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10317 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10318 d_SCNfldbl="$undef";
10319 ;;
10320 *) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10321 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10322 d_SCNfldbl="$define";
10323 ;;
10324 esac
10325
10326 : Before committing on uselongdouble, see whether that looks sane.
10327 if $test "$uselongdouble" = "$define"; then
10328 message=""
10329 echo " "
10330 echo "Checking if your long double math functions work right..." >&4
10331 $cat > try.c <<EOF
10332 #include <math.h>
10333 #include <stdio.h>
10334 int main() {
10335 printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10336 }
10337 EOF
10338 case "$osname:$gccversion" in
10339 aix:) saveccflags="$ccflags"
10340 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10341 esac
10342 set try
10343 if eval $compile_ok; then
10344 yyy=`$run ./try`
10345 fi
10346 case "$yyy" in
10347 3) echo "Your long double math functions are working correctly." >&4 ;;
10348 *) echo "Your long double math functions are broken, not using long doubles." >&4
10349 uselongdouble=$undef
10350 ;;
10351 esac
10352 $rm_try
10353 case "$osname:$gccversion" in
10354 aix:) ccflags="$saveccflags" ;; # restore
10355 esac
10356 fi
10357
10358 : Check how to convert floats to strings.
10359
10360 if test "X$d_Gconvert" = X; then
10361
10362 echo " "
10363 echo "Checking for an efficient way to convert floats to strings."
10364 echo " " > try.c
10365 case "$uselongdouble" in
10366 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10367 esac
10368 case "$d_longdbl" in
10369 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10370 esac
10371 case "$d_PRIgldbl" in
10372 "$define") echo "#define HAS_PRIgldbl" >>try.c ;;
10373 esac
10374 $cat >>try.c <<EOP
10375 #ifdef TRY_gconvert
10376 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10377 const char *myname = "gconvert";
10378 #endif
10379 #ifdef TRY_gcvt
10380 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10381 const char *myname = "gcvt";
10382 #endif
10383 #ifdef TRY_qgcvt
10384 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10385 const char *myname = "qgcvt";
10386 #define DOUBLETYPE long double
10387 #endif
10388 #ifdef TRY_sprintf
10389 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10390 #ifdef HAS_PRIgldbl
10391 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10392 #else
10393 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10394 #endif
10395 #else
10396 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10397 #endif
10398 const char *myname = "sprintf";
10399 #endif
10400
10401 #ifndef DOUBLETYPE
10402 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10403 #define DOUBLETYPE long double
10404 #else
10405 #define DOUBLETYPE double
10406 #endif
10407 #endif
10408
10409 #include <stdio.h>
10410
10411 #$i_stdlib I_STDLIB
10412 #ifdef I_STDLIB
10413 #include <stdlib.h>
10414 #endif
10415 #include <string.h>
10416
10417 void checkit(const char *expect, char *got)
10418 {
10419 if (strcmp(expect, got)) {
10420 printf("%s oddity: Expected %s, got %s\n",
10421 myname, expect, got);
10422 exit(1);
10423 }
10424 }
10425
10426 void lencheck(int expect, int got)
10427 {
10428 if (expect != got) {
10429 printf("%s length mismatch: Expected %d, got %d\n",
10430 myname, expect, got);
10431 exit(1);
10432 }
10433 }
10434
10435 int main()
10436 {
10437 char buf[64];
10438 buf[63] = '\0';
10439
10440 /* This must be 1st test on (which?) platform */
10441 /* Alan Burlison <[email protected]> */
10442 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10443 checkit("0.1", buf);
10444
10445 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10446 checkit("0.01", buf);
10447
10448 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10449 checkit("0.001", buf);
10450
10451 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10452 checkit("0.0001", buf);
10453
10454 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10455 if (strlen(buf) > 5)
10456 checkit("9e-005", buf); /* for Microsoft ?? */
10457 else
10458 checkit("9e-05", buf);
10459
10460 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10461 checkit("1", buf);
10462
10463 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10464 checkit("1.1", buf);
10465
10466 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10467 checkit("1.01", buf);
10468
10469 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10470 checkit("1.001", buf);
10471
10472 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10473 checkit("1.0001", buf);
10474
10475 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10476 checkit("1.00001", buf);
10477
10478 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10479 checkit("1.000001", buf);
10480
10481 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10482 checkit("0", buf);
10483
10484 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10485 checkit("-1", buf);
10486
10487 /* Some Linux gcvt's give 1.e+5 here. */
10488 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10489 checkit("100000", buf);
10490
10491 /* Some Linux gcvt's give -1.e+5 here. */
10492 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10493 checkit("-100000", buf);
10494
10495 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10496 checkit("123.456", buf);
10497
10498 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10499 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10500 /* 34 should be enough to scare even long double
10501 * places into using the e notation. */
10502 if (strlen(buf) > 5)
10503 checkit("1e+034", buf); /* for Microsoft */
10504 else
10505 checkit("1e+34", buf);
10506
10507 /* Test for an Ubuntu/Debian bug in gcvt and qgcvt. See: *
10508 * https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1899553 */
10509
10510 Gconvert((DOUBLETYPE)0.4, 53, 0, buf);
10511 lencheck(55, (int)strlen(buf));
10512
10513 /* For Perl, if you add additional tests here, also add them to
10514 * t/base/num.t for benefit of platforms not using Configure or
10515 * overriding d_Gconvert */
10516
10517 exit(0);
10518 }
10519 EOP
10520 : first add preferred functions to our list
10521 xxx_list=""
10522 for xxx_convert in $gconvert_preference; do
10523 case $xxx_convert in
10524 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10525 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10526 esac
10527 done
10528 : then add any others
10529 for xxx_convert in gconvert gcvt sprintf; do
10530 case "$xxx_list" in
10531 *$xxx_convert*) ;;
10532 *) xxx_list="$xxx_list $xxx_convert" ;;
10533 esac
10534 done
10535
10536 case "$d_longdbl$uselongdouble" in
10537 "$define$define")
10538 : again, add preferred functions to our list first
10539 xxx_ld_list=""
10540 for xxx_convert in $gconvert_ld_preference; do
10541 case $xxx_convert in
10542 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10543 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10544 esac
10545 done
10546 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10547 for xxx_convert in qgcvt sprintf $xxx_list; do
10548 case "$xxx_ld_list" in
10549 $xxx_convert*|*" $xxx_convert"*) ;;
10550 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10551 esac
10552 done
10553 : if sprintf cannot do long doubles, move it to the end
10554 if test "$d_PRIgldbl" != "$define"; then
10555 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10556 fi
10557 : if no qgcvt, remove it
10558 if test "$d_qgcvt" != "$define"; then
10559 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10560 fi
10561 : use the ld_list
10562 xxx_list="$xxx_ld_list"
10563 ;;
10564 esac
10565
10566 for xxx_convert in $xxx_list; do
10567 echo "Trying $xxx_convert..."
10568 $rm -f try try$_o core
10569 set try -DTRY_$xxx_convert
10570 if eval $compile; then
10571 echo "$xxx_convert() found." >&4
10572 if $run ./try; then
10573 echo "I'll use $xxx_convert to convert floats into a string." >&4
10574 break;
10575 else
10576 echo "...But $xxx_convert didn't work as I expected."
10577 xxx_convert=''
10578 fi
10579 else
10580 echo "$xxx_convert NOT found." >&4
10581 xxx_convert=''
10582 fi
10583 done
10584
10585 if test X$xxx_convert = X; then
10586 echo "*** WHOA THERE!!! ***" >&4
10587 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
10588 xxx_convert=sprintf
10589 fi
10590
10591 case "$xxx_convert" in
10592 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10593 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10594 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10595 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10596 "$define$define$define")
10597 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10598 "$define$define$undef")
10599 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10600 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10601 esac
10602 ;;
10603 esac
10604
10605 fi
10606 $rm_try
10607
10608 : see if _fwalk exists
10609 set fwalk d__fwalk
10610 eval $inlibc
10611
10612 : see if accept4 exists
10613 set accept4 d_accept4
10614 eval $inlibc
10615
10616 : Initialize h_fcntl
10617 h_fcntl=false
10618
10619 : Initialize h_sysfile
10620 h_sysfile=false
10621
10622 : access call always available on UNIX
10623 set access d_access
10624 eval $inlibc
10625
10626 : locate the flags for 'access()'
10627 case "$d_access" in
10628 "$define")
10629 echo " "
10630 $cat >access.c <<EOCP
10631 #include <sys/types.h>
10632 #ifdef I_FCNTL
10633 #include <fcntl.h>
10634 #endif
10635 #ifdef I_SYS_FILE
10636 #include <sys/file.h>
10637 #endif
10638 #ifdef I_UNISTD
10639 #include <unistd.h>
10640 #endif
10641 #$i_stdlib I_STDLIB
10642 #ifdef I_STDLIB
10643 #include <stdlib.h>
10644 #endif
10645 int main() {
10646 exit(R_OK);
10647 }
10648 EOCP
10649 : check sys/file.h first, no particular reason here
10650 if $test `./findhdr sys/file.h` && \
10651 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10652 h_sysfile=true;
10653 echo "<sys/file.h> defines the *_OK access constants." >&4
10654 elif $test `./findhdr fcntl.h` && \
10655 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10656 h_fcntl=true;
10657 echo "<fcntl.h> defines the *_OK access constants." >&4
10658 elif $test `./findhdr unistd.h` && \
10659 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10660 echo "<unistd.h> defines the *_OK access constants." >&4
10661 else
10662 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10663 fi
10664 ;;
10665 esac
10666 $rm -f access*
10667
10668 : see if accessx exists
10669 set accessx d_accessx
10670 eval $inlibc
10671
10672 : see if acosh exists
10673 set acosh d_acosh
10674 eval $inlibc
10675
10676 : see if aintl exists
10677 set aintl d_aintl
10678 eval $inlibc
10679
10680 : see if alarm exists
10681 set alarm d_alarm
10682 eval $inlibc
10683
10684 : see if 64bit time functions exists
10685
10686 set ctime64 d_ctime64
10687 eval $inlibc
10688
10689 set localtime64 d_localtime64
10690 eval $inlibc
10691
10692 set gmtime64 d_gmtime64
10693 eval $inlibc
10694
10695 set mktime64 d_mktime64
10696 eval $inlibc
10697
10698 set difftime64 d_difftime64
10699 eval $inlibc
10700
10701 set asctime64 d_asctime64
10702 eval $inlibc
10703
10704 : see if POSIX threads are available
10705 set pthread.h i_pthread
10706 eval $inhdr
10707
10708 : define a function to check prototypes
10709 $cat > protochk <<EOSH
10710 $startsh
10711 cc="$cc"
10712 optimize="$optimize"
10713 ccflags="$ccflags"
10714 define="$define"
10715 rm_try="$rm_try"
10716 usethreads=$usethreads
10717 i_pthread=$i_pthread
10718 pthread_h_first=$pthread_h_first
10719 EOSH
10720
10721 $cat >> protochk <<'EOSH'
10722
10723 $rm_try
10724 foo="$1"
10725 shift
10726 while test $# -ge 2; do
10727 case "$1" in
10728 $define) echo "#include <$2>" >> try.c ;;
10729 literal) echo "$2" >> try.c ;;
10730 esac
10731 # Extra magic for the benefit of systems that need pthread.h
10732 # to be included early to correctly detect threadsafe functions.
10733 # Such functions must guarantee themselves, though, that the usethreads
10734 # and i_pthread have been defined, before calling protochk.
10735 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10736 echo "#include <pthread.h>" >> try.c
10737 pthread_h_done=yes
10738 fi
10739 shift 2
10740 done
10741 cat >> try.c <<'EOCP'
10742 #define _(args) args
10743 EOCP
10744 echo "$foo" >> try.c
10745 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10746 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10747 status=$?
10748 $rm_try
10749 exit $status
10750 EOSH
10751 chmod +x protochk
10752 $eunicefix protochk
10753
10754 : Define hasproto macro for Configure internal use
10755 hasproto='varname=$1; func=$2; shift; shift;
10756 while $test $# -ge 2; do
10757 case "$1" in
10758 $define) echo "#include <$2>";;
10759 literal) echo "$2" ;;
10760 esac ;
10761 shift 2;
10762 done > try.c;
10763 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10764 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10765 echo "$func() prototype found.";
10766 val="$define";
10767 else
10768 echo "$func() prototype NOT found.";
10769 val="$undef";
10770 fi;
10771 set $varname;
10772 eval $setvar;
10773 $rm_try tryout.c'
10774
10775 : see if sys/types.h has to be included
10776 set sys/types.h i_systypes
10777 eval $inhdr
10778
10779 : see if sys/select.h has to be included
10780 set sys/select.h i_sysselct
10781 eval $inhdr
10782
10783 : Define hasfield macro for Configure internal use
10784 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10785 while $test $# -ge 2; do
10786 case "$1" in
10787 $define) echo "#include <$2>";;
10788 esac ;
10789 shift 2;
10790 done > try.c;
10791 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10792 set try;
10793 if eval $compile; then
10794 val="$define";
10795 else
10796 val="$undef";
10797 fi;
10798 set $varname;
10799 eval $setvar;
10800 $rm_try'
10801
10802 : see if we should include sys/time.h
10803 echo " "
10804 i_time='define'
10805 if test "X$timeincl" = X; then
10806 echo "Testing to see if we should include <sys/time.h>." >&4
10807 $echo $n "I'm now running the test program...$c"
10808 $cat >try.c <<EOCP
10809 #include <sys/types.h>
10810 #include <time.h>
10811 #ifdef I_SYSTIME
10812 #ifdef SYSTIMEKERNEL
10813 #define KERNEL
10814 #endif
10815 #include <sys/time.h>
10816 #endif
10817 #ifdef I_SYSSELECT
10818 #include <sys/select.h>
10819 #endif
10820 #$i_stdlib I_STDLIB
10821 #ifdef I_STDLIB
10822 #include <stdlib.h>
10823 #endif
10824 int main()
10825 {
10826 struct tm foo;
10827 #ifdef S_TIMEVAL
10828 struct timeval bar;
10829 #endif
10830 #ifdef S_TIMEZONE
10831 struct timezone tzp;
10832 #endif
10833 if (foo.tm_sec == foo.tm_sec)
10834 exit(0);
10835 #ifdef S_TIMEVAL
10836 if (bar.tv_sec == bar.tv_sec)
10837 exit(0);
10838 #endif
10839 exit(1);
10840 }
10841 EOCP
10842 flags=''
10843 for s_timezone in '-DS_TIMEZONE' ''; do
10844 sysselect=''
10845 for s_timeval in '-DS_TIMEVAL' ''; do
10846 for i_systimek in '' '-DSYSTIMEKERNEL'; do
10847 for i_systime in '-DI_SYSTIME' ''; do
10848 case "$flags" in
10849 '') $echo $n ".$c"
10850 set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10851 if eval $compile; then
10852 set X $i_systime $i_systimek $sysselect $s_timeval
10853 shift
10854 flags="$*"
10855 echo " "
10856 $echo $n "Succeeded with $flags$c"
10857 fi
10858 ;;
10859 esac
10860 done
10861 done
10862 done
10863 done
10864 timeincl=''
10865 echo " "
10866 case "$flags" in
10867 *SYSTIMEKERNEL*) i_systimek="$define"
10868 timeincl=`./findhdr sys/time.h`
10869 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10870 *) i_systimek="$undef";;
10871 esac
10872 case "$flags" in
10873 *I_SYSTIME*) i_systime="$define"
10874 timeincl=`./findhdr sys/time.h`" $timeincl"
10875 echo "We'll include <sys/time.h>." >&4;;
10876 *) i_systime="$undef";;
10877 esac
10878 $rm_try
10879 fi
10880 : see if struct tm knows about tm_zone
10881 case "$i_systime$i_time" in
10882 *$define*)
10883 echo " "
10884 echo "Checking to see if your struct tm has tm_zone field..." >&4
10885 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10886 eval $hasfield
10887 ;;
10888 *) val="$undef"
10889 set d_tm_tm_zone
10890 eval $setvar
10891 ;;
10892 esac
10893 case "$d_tm_tm_zone" in
10894 "$define") echo "Yes, it does." ;;
10895 *) echo "No, it doesn't." ;;
10896 esac
10897 : see if struct tm knows about tm_gmtoff
10898 case "$i_systime$i_time" in
10899 *$define*)
10900 echo " "
10901 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10902 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10903 eval $hasfield
10904 ;;
10905 *) val="$undef"
10906 set d_tm_tm_gmtoff
10907 eval $setvar
10908 ;;
10909 esac
10910 case "$d_tm_tm_gmtoff" in
10911 "$define") echo "Yes, it does." ;;
10912 *) echo "No, it doesn't." ;;
10913 esac
10914
10915 : see if asctime_r exists
10916 set asctime_r d_asctime_r
10917 eval $inlibc
10918 case "$d_asctime_r" in
10919 "$define")
10920 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10921 case "$d_asctime_r_proto:$usethreads" in
10922 ":define") d_asctime_r_proto=define
10923 set d_asctime_r_proto asctime_r $hdrs
10924 eval $hasproto ;;
10925 *) ;;
10926 esac
10927 case "$d_asctime_r_proto" in
10928 define)
10929 case "$asctime_r_proto" in
10930 ''|0) try='char* asctime_r(const struct tm*, char*);'
10931 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10932 esac
10933 case "$asctime_r_proto" in
10934 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10935 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10936 esac
10937 case "$asctime_r_proto" in
10938 ''|0) try='int asctime_r(const struct tm*, char*);'
10939 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10940 esac
10941 case "$asctime_r_proto" in
10942 ''|0) try='int asctime_r(const struct tm*, char*, int);'
10943 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10944 esac
10945 case "$asctime_r_proto" in
10946 ''|0) d_asctime_r=undef
10947 asctime_r_proto=0
10948 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10949 * ) case "$asctime_r_proto" in
10950 REENTRANT_PROTO*) ;;
10951 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10952 esac
10953 echo "Prototype: $try" ;;
10954 esac
10955 ;;
10956 *) case "$usethreads" in
10957 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10958 esac
10959 d_asctime_r=undef
10960 asctime_r_proto=0
10961 ;;
10962 esac
10963 ;;
10964 *) asctime_r_proto=0
10965 ;;
10966 esac
10967
10968 : see if asinh exists
10969 set asinh d_asinh
10970 eval $inlibc
10971
10972 : see if atanh exists
10973 set atanh d_atanh
10974 eval $inlibc
10975
10976 : see if atolf exists
10977 set atolf d_atolf
10978 eval $inlibc
10979
10980 : see if atoll exists
10981 set atoll d_atoll
10982 eval $inlibc
10983
10984 : See if a file contains compiler warnings
10985 case "$osname" in
10986 'aix')
10987 cat >compiler_warning <<EOSS
10988 # Sample for aix ('.5' indicates the column number in the line):
10989 # "op.h", line 203.5: 1506-159 (E) Bit field type specified for op_type
10990 # Since the word 'warning' isn't present, use a fairly rigorous match of what
10991 # warning messages look like
10992 # " o p . h ", line 203 . 5 : 1506 - 159 ( E )
10993 $grep -E "^\\"[A-Za-z][A-Za-z0-9_]*\.[ch]\\", line [1-9][0-9]*[.][1-9][0-9]*: [1-9][0-9]*-[1-9][0-9]* \([EW][)] " "\$1"
10994 EOSS
10995 compiler_warning=./compiler_warning
10996 chmod +x $compiler_warning
10997 ;;
10998 # Maybe a colon after the 'warning' would be appropriate
10999 *) compiler_warning="$contains -i warning"
11000 ;;
11001 esac
11002
11003 : Look for GCC-style attribute format
11004 case "$d_attribute_format" in
11005 '')
11006 echo " "
11007 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
11008 $cat >attrib.c <<'EOCP'
11009 #include <stdio.h>
11010 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
11011 EOCP
11012 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11013 if $compiler_warning attrib.out >/dev/null 2>&1; then
11014 echo "Your C compiler doesn't support __attribute__((format))."
11015 val="$undef"
11016 else
11017 echo "Your C compiler supports __attribute__((format))."
11018 val="$define"
11019 fi
11020 else
11021 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11022 val="$undef"
11023 fi
11024 ;;
11025 *) val="$d_attribute_format" ;;
11026 esac
11027 set d_attribute_format
11028 eval $setvar
11029 $rm -f attrib*
11030
11031 : Look for GCC-style attribute format with null format allowed
11032 case "$d_printf_format_null" in
11033 '') case "$d_attribute_format" in
11034 $define)
11035 echo " "
11036 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11037 $cat >attrib.c <<EOCP
11038 #include <stdio.h>
11039 #$i_stdlib I_STDLIB
11040 #ifdef I_STDLIB
11041 #include <stdlib.h>
11042 #endif
11043 #$i_inttypes I_INTTYPES
11044 #ifdef I_INTTYPES
11045 #include <inttypes.h>
11046 #endif
11047 #ifndef INTPTR_MAX
11048 #define intptr_t int
11049 #endif
11050 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11051 int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
11052 int main () { exit(null_printf(NULL)); }
11053 EOCP
11054 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11055 : run the executable in case it produces a run-time warning
11056 if $run ./attrib >>attrib.out 2>&1; then
11057 if $compiler_warning attrib.out >/dev/null 2>&1; then
11058 echo "Your C compiler doesn't allow __printf__ format to be null."
11059 val="$undef"
11060 else
11061 echo "Your C compiler allows __printf__ format to be null."
11062 val="$define"
11063 fi
11064 else
11065 echo "Your C compiler executable failed with __printf__ format null."
11066 val="$undef"
11067 fi
11068 else
11069 echo "Your C compiler fails with __printf__ format null."
11070 val="$undef"
11071 fi
11072 ;;
11073 *) val="$undef" ;;
11074 esac
11075 ;;
11076 *) val="$d_printf_format_null" ;;
11077 esac
11078 set d_printf_format_null
11079 eval $setvar
11080 $rm -f attrib*
11081
11082 : Look for GCC-style attribute malloc
11083 case "$d_attribute_malloc" in
11084 '')
11085 echo " "
11086 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11087 $cat >attrib.c <<'EOCP'
11088 #include <stdio.h>
11089 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11090 EOCP
11091 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11092 if $compiler_warning attrib.out >/dev/null 2>&1; then
11093 echo "Your C compiler doesn't support __attribute__((malloc))."
11094 val="$undef"
11095 else
11096 echo "Your C compiler supports __attribute__((malloc))."
11097 val="$define"
11098 fi
11099 else
11100 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11101 val="$undef"
11102 fi
11103 ;;
11104 *) val="$d_attribute_malloc" ;;
11105 esac
11106 set d_attribute_malloc
11107 eval $setvar
11108 $rm -f attrib*
11109
11110 : Look for GCC-style attribute nonnull
11111 case "$d_attribute_nonnull" in
11112 '')
11113 echo " "
11114 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11115 $cat >attrib.c <<'EOCP'
11116 #include <stdio.h>
11117 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11118 EOCP
11119 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11120 if $compiler_warning attrib.out >/dev/null 2>&1; then
11121 echo "Your C compiler doesn't support __attribute__((nonnull))."
11122 val="$undef"
11123 else
11124 echo "Your C compiler supports __attribute__((nonnull))."
11125 val="$define"
11126 fi
11127 else
11128 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11129 val="$undef"
11130 fi
11131 ;;
11132 *) val="$d_attribute_nonnull" ;;
11133 esac
11134 set d_attribute_nonnull
11135 eval $setvar
11136 $rm -f attrib*
11137
11138 : Look for GCC-style attribute noreturn
11139 case "$d_attribute_noreturn" in
11140 '')
11141 echo " "
11142 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11143 $cat >attrib.c <<'EOCP'
11144 #include <stdio.h>
11145 void fall_over_dead( void ) __attribute__((noreturn));
11146 EOCP
11147 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11148 if $compiler_warning attrib.out >/dev/null 2>&1; then
11149 echo "Your C compiler doesn't support __attribute__((noreturn))."
11150 val="$undef"
11151 else
11152 echo "Your C compiler supports __attribute__((noreturn))."
11153 val="$define"
11154 fi
11155 else
11156 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11157 val="$undef"
11158 fi
11159 ;;
11160 *) val="$d_attribute_noreturn" ;;
11161 esac
11162 set d_attribute_noreturn
11163 eval $setvar
11164 $rm -f attrib*
11165
11166 : Look for GCC-style attribute pure
11167 case "$d_attribute_pure" in
11168 '')
11169 echo " "
11170 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11171 $cat >attrib.c <<'EOCP'
11172 #include <stdio.h>
11173 int square( int n ) __attribute__((pure));
11174 EOCP
11175 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11176 if $compiler_warning attrib.out >/dev/null 2>&1; then
11177 echo "Your C compiler doesn't support __attribute__((pure))."
11178 val="$undef"
11179 else
11180 echo "Your C compiler supports __attribute__((pure))."
11181 val="$define"
11182 fi
11183 else
11184 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11185 val="$undef"
11186 fi
11187 ;;
11188 *) val="$d_attribute_pure" ;;
11189 esac
11190 set d_attribute_pure
11191 eval $setvar
11192 $rm -f attrib*
11193
11194 : Look for GCC-style attribute unused
11195 case "$d_attribute_unused" in
11196 '')
11197 echo " "
11198 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11199 $cat >attrib.c <<'EOCP'
11200 #include <stdio.h>
11201 int do_something( int dummy __attribute__((unused)), int n );
11202 EOCP
11203 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11204 if $compiler_warning attrib.out >/dev/null 2>&1; then
11205 echo "Your C compiler doesn't support __attribute__((unused))."
11206 val="$undef"
11207 else
11208 echo "Your C compiler supports __attribute__((unused))."
11209 val="$define"
11210 fi
11211 else
11212 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11213 val="$undef"
11214 fi
11215 ;;
11216 *) val="$d_attribute_unused" ;;
11217 esac
11218 set d_attribute_unused
11219 eval $setvar
11220 $rm -f attrib*
11221
11222 : Look for GCC-style attribute deprecated
11223 case "$d_attribute_deprecated" in
11224 '')
11225 echo " "
11226 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11227 $cat >attrib.c <<'EOCP'
11228 #include <stdio.h>
11229 int I_am_deprecated(void) __attribute__((deprecated));
11230 EOCP
11231 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11232 if $compiler_warning attrib.out >/dev/null 2>&1; then
11233 echo "Your C compiler doesn't support __attribute__((deprecated))."
11234 val="$undef"
11235 else
11236 echo "Your C compiler supports __attribute__((deprecated))."
11237 val="$define"
11238 fi
11239 else
11240 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11241 val="$undef"
11242 fi
11243 ;;
11244 *) val="$d_attribute_deprecated" ;;
11245 esac
11246 set d_attribute_deprecated
11247 eval $setvar
11248 $rm -f attrib*
11249
11250 : Look for GCC-style attribute warn_unused_result
11251 case "$d_attribute_warn_unused_result" in
11252 '')
11253 echo " "
11254 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11255 $cat >attrib.c <<'EOCP'
11256 #include <stdio.h>
11257 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11258 EOCP
11259 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11260 if $compiler_warning attrib.out >/dev/null 2>&1; then
11261 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11262 val="$undef"
11263 else
11264 echo "Your C compiler supports __attribute__((warn_unused_result))."
11265 val="$define"
11266 fi
11267 else
11268 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11269 val="$undef"
11270 fi
11271 ;;
11272 *) val="$d_attribute_warn_unused_result" ;;
11273 esac
11274 set d_attribute_warn_unused_result
11275 eval $setvar
11276 $rm -f attrib*
11277
11278 : Look for GCC-style attribute always_inline
11279 case "$d_attribute_always_inline" in
11280 '')
11281 echo " "
11282 echo "Checking whether your compiler can handle __attribute__((always_inline)) ..." >&4
11283 $cat >attrib.c <<'EOCP'
11284 #include <stdio.h>
11285 static __inline__ __attribute__((always_inline)) int I_will_always_be_inlined(void);
11286 EOCP
11287 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11288 if $compiler_warning attrib.out >/dev/null 2>&1; then
11289 echo "Your C compiler doesn't support __attribute__((always_inline))."
11290 val="$undef"
11291 else
11292 echo "Your C compiler supports __attribute__((always_inline))."
11293 val="$define"
11294 fi
11295 else
11296 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11297 val="$undef"
11298 fi
11299 ;;
11300 *) val="$d_attribute_always_inline" ;;
11301 esac
11302 set d_attribute_always_inline
11303 eval $setvar
11304 $rm -f attrib*
11305
11306 : Look for GCC-style attribute visibility
11307 case "$d_attribute_visibility" in
11308 '')
11309 echo " "
11310 echo "Checking whether your compiler can handle __attribute__((visibility)) ..." >&4
11311 $cat >attrib.c <<'EOCP'
11312 #include <stdio.h>
11313 __attribute__((visibility("hidden"))) int I_will_be_hidden(void);
11314 EOCP
11315 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11316 if $compiler_warning attrib.out >/dev/null 2>&1; then
11317 echo "Your C compiler doesn't support __attribute__((visibility))."
11318 val="$undef"
11319 else
11320 echo "Your C compiler supports __attribute__((visibility))."
11321 val="$define"
11322 fi
11323 else
11324 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11325 val="$undef"
11326 fi
11327 ;;
11328 *) val="$d_attribute_visibility" ;;
11329 esac
11330 set d_attribute_visibility
11331 eval $setvar
11332 $rm -f attrib*
11333
11334 : see if getpgrp exists
11335 set getpgrp d_getpgrp
11336 eval $inlibc
11337
11338 case "$d_getpgrp" in
11339 "$define")
11340 echo " "
11341 echo "Checking to see which flavor of getpgrp is in use..."
11342 $cat >try.c <<EOP
11343 #include <stdio.h>
11344 #$i_unistd I_UNISTD
11345 #include <sys/types.h>
11346 #ifdef I_UNISTD
11347 # include <unistd.h>
11348 #endif
11349 #$i_stdlib I_STDLIB
11350 #ifdef I_STDLIB
11351 #include <stdlib.h>
11352 #endif
11353 int main()
11354 {
11355 if (getuid() == 0) {
11356 printf("(I see you are running Configure as super-user...)\n");
11357 setuid(1);
11358 }
11359 #ifdef TRY_BSD_PGRP
11360 if (getpgrp(1) == 0)
11361 exit(0);
11362 #else
11363 if (getpgrp() > 0)
11364 exit(0);
11365 #endif
11366 exit(1);
11367 }
11368 EOP
11369 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11370 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11371 val="$define"
11372 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11373 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11374 val="$undef"
11375 else
11376 echo "I can't seem to compile and run the test program."
11377 if ./usg; then
11378 xxx="a USG one, i.e. you use getpgrp()."
11379 else
11380 # SVR4 systems can appear rather BSD-ish.
11381 case "$i_unistd" in
11382 $undef)
11383 xxx="a BSD one, i.e. you use getpgrp(pid)."
11384 val="$define"
11385 ;;
11386 $define)
11387 xxx="probably a USG one, i.e. you use getpgrp()."
11388 val="$undef"
11389 ;;
11390 esac
11391 fi
11392 echo "Assuming your getpgrp is $xxx" >&4
11393 fi
11394 ;;
11395 *) val="$undef";;
11396 esac
11397 set d_bsdgetpgrp
11398 eval $setvar
11399 $rm_try
11400
11401 : see if setpgrp exists
11402 set setpgrp d_setpgrp
11403 eval $inlibc
11404
11405 case "$d_setpgrp" in
11406 "$define")
11407 echo " "
11408 echo "Checking to see which flavor of setpgrp is in use..."
11409 $cat >try.c <<EOP
11410 #include <stdio.h>
11411 #$i_unistd I_UNISTD
11412 #include <sys/types.h>
11413 #ifdef I_UNISTD
11414 # include <unistd.h>
11415 #endif
11416 #$i_stdlib I_STDLIB
11417 #ifdef I_STDLIB
11418 #include <stdlib.h>
11419 #endif
11420 int main()
11421 {
11422 if (getuid() == 0) {
11423 printf("(I see you are running Configure as super-user...)\n");
11424 setuid(1);
11425 }
11426 #ifdef TRY_BSD_PGRP
11427 if (-1 == setpgrp(1, 1))
11428 exit(0);
11429 #else
11430 if (setpgrp() != -1)
11431 exit(0);
11432 #endif
11433 exit(1);
11434 }
11435 EOP
11436 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11437 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11438 val="$define"
11439 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11440 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11441 val="$undef"
11442 else
11443 echo "(I can't seem to compile and run the test program.)"
11444 if ./usg; then
11445 xxx="a USG one, i.e. you use setpgrp()."
11446 else
11447 # SVR4 systems can appear rather BSD-ish.
11448 case "$i_unistd" in
11449 $undef)
11450 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11451 val="$define"
11452 ;;
11453 $define)
11454 xxx="probably a USG one, i.e. you use setpgrp()."
11455 val="$undef"
11456 ;;
11457 esac
11458 fi
11459 echo "Assuming your setpgrp is $xxx" >&4
11460 fi
11461 ;;
11462 *) val="$undef";;
11463 esac
11464 set d_bsdsetpgrp
11465 eval $setvar
11466 $rm_try
11467
11468 : Look for GCC-style __builtin_add_overflow
11469 case "$d_builtin_add_overflow" in
11470 '')
11471 echo " "
11472 echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11473 $cat >try.c <<'EOCP'
11474 int main(void) {
11475 const unsigned int uint_max = ~0u;
11476 int target_int = 0;
11477 if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11478 return 1;
11479 }
11480 if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11481 return 1;
11482 }
11483 if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11484 return 1;
11485 }
11486 return 0;
11487 }
11488 EOCP
11489 set try
11490 if eval $compile && $run ./try; then
11491 echo "Your C compiler supports __builtin_add_overflow."
11492 val="$define"
11493 else
11494 echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11495 val="$undef"
11496 fi
11497 ;;
11498 *) val="$d_builtin_add_overflow" ;;
11499 esac
11500
11501 set d_builtin_add_overflow
11502 eval $setvar
11503 $rm_try
11504
11505 : Look for GCC-style __builtin_sub_overflow
11506 case "$d_builtin_sub_overflow" in
11507 '')
11508 echo " "
11509 echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11510 $cat >try.c <<'EOCP'
11511 int main(void) {
11512 const unsigned int uint_max = ~0u;
11513 int target_int = 0;
11514 if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11515 return 1;
11516 }
11517 if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11518 return 1;
11519 }
11520 if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11521 return 1;
11522 }
11523 return 0;
11524 }
11525 EOCP
11526 set try
11527 if eval $compile && $run ./try; then
11528 echo "Your C compiler supports __builtin_sub_overflow."
11529 val="$define"
11530 else
11531 echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11532 val="$undef"
11533 fi
11534 ;;
11535 *) val="$d_builtin_sub_overflow" ;;
11536 esac
11537
11538 set d_builtin_sub_overflow
11539 eval $setvar
11540 $rm_try
11541
11542 : Look for GCC-style __builtin_mul_overflow
11543 case "$d_builtin_mul_overflow" in
11544 '')
11545 echo " "
11546 echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11547 $cat >try.c <<'EOCP'
11548 int main(void) {
11549 const unsigned int uint_max = ~0u;
11550 int target_int = 0;
11551 if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11552 return 1;
11553 }
11554 if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11555 return 1;
11556 }
11557 if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11558 return 1;
11559 }
11560 return 0;
11561 }
11562 EOCP
11563 set try
11564 if eval $compile && $run ./try; then
11565 echo "Your C compiler supports __builtin_mul_overflow."
11566 val="$define"
11567 else
11568 echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11569 val="$undef"
11570 fi
11571 ;;
11572 *) val="$d_builtin_mul_overflow" ;;
11573 esac
11574
11575 set d_builtin_mul_overflow
11576 eval $setvar
11577 $rm_try
11578
11579 : Look for GCC-style __builtin_choose_expr
11580 case "$d_builtin_choose_expr" in
11581 '')
11582 echo " "
11583 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11584 $cat >try.c <<'EOCP'
11585 #include <assert.h>
11586 #include <stdlib.h>
11587 #include <stdio.h>
11588
11589 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11590
11591 int main(void) {
11592 assert( SYRINX(1) == 2112 );
11593 assert( SYRINX(1) != 5150 );
11594 assert( SYRINX(0) == 5150 );
11595 assert( SYRINX(0) != 2112 );
11596 puts( "All good!" );
11597 exit(0);
11598 }
11599
11600 EOCP
11601 set try
11602 if eval $compile && $run ./try; then
11603 echo "Your C compiler supports __builtin_choose_expr."
11604 val="$define"
11605 else
11606 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11607 val="$undef"
11608 fi
11609 ;;
11610 *) val="$d_builtin_choose_expr" ;;
11611 esac
11612
11613 set d_builtin_choose_expr
11614 eval $setvar
11615 $rm_try
11616
11617 : Look for GCC-style __builtin_expect
11618 case "$d_builtin_expect" in
11619 '')
11620 echo " "
11621 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11622 $cat >try.c <<'EOCP'
11623 int main(void) {
11624 int n = 50;
11625 if ( __builtin_expect(n, 0) ) n = 1;
11626 /* Remember shell exit code truth is 0, C truth is non-zero */
11627 return !(n == 1);
11628 }
11629 EOCP
11630 set try
11631 if eval $compile && $run ./try; then
11632 echo "Your C compiler supports __builtin_expect."
11633 val="$define"
11634 else
11635 echo "Your C compiler doesn't seem to understand __builtin_expect."
11636 val="$undef"
11637 fi
11638 ;;
11639 *) val="$d_builtin_expect" ;;
11640 esac
11641
11642 set d_builtin_expect
11643 eval $setvar
11644 $rm_try
11645
11646 : see if the Compiler supports C99 variadic macros
11647 echo "Checking for C99 variadic macros." >&4
11648 $cat >try.c <<EOCP
11649 #include <stdio.h>
11650 #include <stdarg.h>
11651
11652 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11653
11654 int main() {
11655 char buf[20];
11656 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11657 puts(buf);
11658 return 0;
11659 }
11660 EOCP
11661 set try
11662 if eval $compile && $run ./try 2>&1 >/dev/null; then
11663 case "`$run ./try`" in
11664 "123 456 789")
11665 echo "You have C99 variadic macros." >&4
11666 d_c99_variadic_macros="$define"
11667 ;;
11668 *)
11669 echo "You don't have functional C99 variadic macros." >&4
11670 d_c99_variadic_macros="$undef"
11671 ;;
11672 esac
11673 else
11674 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11675 d_c99_variadic_macros="$undef"
11676 fi
11677 $rm_try
11678
11679 : see if signal is declared as pointer to function returning int or void
11680 echo " "
11681 xxx=`./findhdr signal.h`
11682 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11683 if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
11684 echo "You have int (*signal())() instead of void." >&4
11685 val="$undef"
11686 elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
11687 echo "You have void (*signal())()." >&4
11688 val="$define"
11689 elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11690 echo "You have int (*signal())() instead of void." >&4
11691 val="$undef"
11692 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11693 echo "You have void (*signal())()." >&4
11694 val="$define"
11695 else
11696 case "$d_voidsig" in
11697 '')
11698 echo "I can't determine whether signal handler returns void or int..." >&4
11699 dflt=void
11700 rp="What type does your signal handler return?"
11701 . ./myread
11702 case "$ans" in
11703 v*) val="$define";;
11704 *) val="$undef";;
11705 esac;;
11706 "$define")
11707 echo "As you already told me, signal handler returns void." >&4
11708 val="$define"
11709 ;;
11710 *) echo "As you already told me, signal handler returns int." >&4
11711 val="$undef"
11712 ;;
11713 esac
11714 fi
11715 set d_voidsig
11716 eval $setvar
11717 case "$d_voidsig" in
11718 "$define") signal_t="void";;
11719 *) signal_t="int";;
11720 esac
11721 $rm -f $$.tmp
11722
11723 : check for ability to cast large floats to 32-bit ints.
11724 echo " "
11725 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11726 if $test "$intsize" -ge 4; then
11727 xxx=int
11728 else
11729 xxx=long
11730 fi
11731 $cat >try.c <<EOCP
11732 #include <stdio.h>
11733 #$i_stdlib I_STDLIB
11734 #ifdef I_STDLIB
11735 #include <stdlib.h>
11736 #endif
11737 #include <sys/types.h>
11738 #include <signal.h>
11739 $signal_t blech(int s) { exit(3); }
11740 int main()
11741 {
11742 $xxx i32;
11743 double f, g;
11744 int result = 0;
11745 char str[16];
11746 signal(SIGFPE, blech);
11747
11748 /* Don't let compiler optimize the test away. Store the number
11749 in a writable string for gcc to pass to sscanf under HP-UX.
11750 */
11751 sprintf(str, "2147483647");
11752 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11753 g = 10 * f;
11754 i32 = ($xxx) g;
11755
11756 /* x86 processors will probably give 0x8000 0000, which is a
11757 sign change. We don't want that. We want to mimic SPARC
11758 behavior here, which is to preserve the sign and give
11759 back 0x7fff ffff.
11760 */
11761 if (i32 != ($xxx) f)
11762 result |= 1;
11763 exit(result);
11764 }
11765 EOCP
11766 set try
11767 if eval $compile_ok; then
11768 $run ./try 2>/dev/null
11769 yyy=$?
11770 else
11771 echo "(I can't seem to compile the test program--assuming it can't)"
11772 yyy=1
11773 fi
11774 case "$yyy" in
11775 0) val="$define"
11776 echo "Yup, it can."
11777 ;;
11778 *) val="$undef"
11779 echo "Nope, it can't."
11780 ;;
11781 esac
11782 set d_casti32
11783 eval $setvar
11784 $rm_try
11785
11786 : check for ability to cast negative floats to unsigned
11787 echo " "
11788 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11789 $cat >try.c <<EOCP
11790 #include <stdio.h>
11791 #$i_stdlib I_STDLIB
11792 #ifdef I_STDLIB
11793 #include <stdlib.h>
11794 #endif
11795 #include <sys/types.h>
11796 #include <signal.h>
11797 $signal_t blech(int s) { exit(7); }
11798 $signal_t blech_in_list(int s) { exit(4); }
11799 unsigned long dummy_long(unsigned long p) { return p; }
11800 unsigned int dummy_int(unsigned int p) { return p; }
11801 unsigned short dummy_short(unsigned short p) { return p; }
11802 int main()
11803 {
11804 double f;
11805 unsigned long along;
11806 unsigned int aint;
11807 unsigned short ashort;
11808 int result = 0;
11809 char str[16];
11810
11811 /* Frustrate gcc-2.7.2's optimizer which failed this test with
11812 a direct f = -123. assignment. gcc-2.8.0 reportedly
11813 optimized the whole file away
11814 */
11815 /* Store the number in a writable string for gcc to pass to
11816 sscanf under HP-UX.
11817 */
11818 sprintf(str, "-123");
11819 sscanf(str, "%lf", &f); /* f = -123.; */
11820
11821 signal(SIGFPE, blech);
11822 along = (unsigned long)f;
11823 aint = (unsigned int)f;
11824 ashort = (unsigned short)f;
11825 if (along != (unsigned long)-123)
11826 result |= 1;
11827 if (aint != (unsigned int)-123)
11828 result |= 1;
11829 if (ashort != (unsigned short)-123)
11830 result |= 1;
11831 sprintf(str, "1073741824.");
11832 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11833 f = f + f;
11834 along = 0;
11835 along = (unsigned long)f;
11836 if (along != 0x80000000)
11837 result |= 2;
11838 f -= 1.;
11839 along = 0;
11840 along = (unsigned long)f;
11841 if (along != 0x7fffffff)
11842 result |= 1;
11843 f += 2.;
11844 along = 0;
11845 along = (unsigned long)f;
11846 if (along != 0x80000001)
11847 result |= 2;
11848 if (result)
11849 exit(result);
11850 signal(SIGFPE, blech_in_list);
11851 sprintf(str, "123.");
11852 sscanf(str, "%lf", &f); /* f = 123.; */
11853 along = dummy_long((unsigned long)f);
11854 aint = dummy_int((unsigned int)f);
11855 ashort = dummy_short((unsigned short)f);
11856 if (along != (unsigned long)123)
11857 result |= 4;
11858 if (aint != (unsigned int)123)
11859 result |= 4;
11860 if (ashort != (unsigned short)123)
11861 result |= 4;
11862 exit(result);
11863
11864 }
11865 EOCP
11866 set try
11867 if eval $compile_ok; then
11868 $run ./try 2>/dev/null
11869 castflags=$?
11870 else
11871 echo "(I can't seem to compile the test program--assuming it can't)"
11872 castflags=7
11873 fi
11874 case "$castflags" in
11875 0) val="$define"
11876 echo "Yup, it can."
11877 ;;
11878 *) val="$undef"
11879 echo "Nope, it can't."
11880 ;;
11881 esac
11882 set d_castneg
11883 eval $setvar
11884 $rm_try
11885
11886 : see if cbrt exists
11887 set cbrt d_cbrt
11888 eval $inlibc
11889
11890 : see if chown exists
11891 set chown d_chown
11892 eval $inlibc
11893
11894 : see if chroot exists
11895 set chroot d_chroot
11896 eval $inlibc
11897
11898 : see if chsize exists
11899 set chsize d_chsize
11900 eval $inlibc
11901
11902 : see if class exists
11903 set class d_class
11904 eval $inlibc
11905
11906 : see if clearenv exists
11907 set clearenv d_clearenv
11908 eval $inlibc
11909
11910 : Define hasstruct macro for Configure internal use
11911 hasstruct='varname=$1; struct=$2; shift; shift;
11912 while $test $# -ge 2; do
11913 case "$1" in
11914 $define) echo "#include <$2>";;
11915 esac ;
11916 shift 2;
11917 done > try.c;
11918 echo "int main () { struct $struct foo; }" >> try.c;
11919 set try;
11920 if eval $compile; then
11921 val="$define";
11922 else
11923 val="$undef";
11924 fi;
11925 set $varname;
11926 eval $setvar;
11927 $rm_try'
11928
11929 : see whether socket exists
11930 socketlib=''
11931 sockethdr=''
11932 echo " "
11933 $echo $n "Hmm... $c" >&4
11934 if set socket val -f d_socket; eval $csym; $val; then
11935 echo "Looks like you have Berkeley networking support." >&4
11936 d_socket="$define"
11937 if set setsockopt val -f; eval $csym; $val; then
11938 d_oldsock="$undef"
11939 else
11940 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11941 d_oldsock="$define"
11942 fi
11943 else
11944 if $contains socklib libc.list >/dev/null 2>&1; then
11945 echo "Looks like you have Berkeley networking support." >&4
11946 d_socket="$define"
11947 : we will have to assume that it supports the 4.2 BSD interface
11948 d_oldsock="$undef"
11949 else
11950 echo "You don't have Berkeley networking in libc$_a..." >&4
11951 if test "X$d_socket" = "X$define"; then
11952 echo "...but you seem to believe that you have sockets." >&4
11953 else
11954 for net in net socket
11955 do
11956 if test -f $sysroot/usr/lib/lib$net$_a; then
11957 ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) || \
11958 $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11959 if $contains socket libc.list >/dev/null 2>&1; then
11960 d_socket="$define"
11961 socketlib="-l$net"
11962 case "$net" in
11963 net)
11964 echo "...but the Wollongong group seems to have hacked it in." >&4
11965 sockethdr="-I$sysroot/usr/netinclude"
11966 ;;
11967 esac
11968 echo "Found Berkeley sockets interface in lib$net." >&4
11969 if $contains setsockopt libc.list >/dev/null 2>&1; then
11970 d_oldsock="$undef"
11971 else
11972 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11973 d_oldsock="$define"
11974 fi
11975 break
11976 fi
11977 fi
11978 done
11979 if test "X$d_socket" != "X$define"; then
11980 echo "or anywhere else I see." >&4
11981 d_socket="$undef"
11982 d_oldsock="$undef"
11983 fi
11984 fi
11985 fi
11986 fi
11987
11988 : see if socketpair exists
11989 set socketpair d_sockpair
11990 eval $inlibc
11991
11992
11993 echo "Checking the availability sa_len in the sock struct ..." >&4
11994 $cat >try.c <<EOF
11995 #include <sys/types.h>
11996 #include <sys/socket.h>
11997 int main() {
11998 struct sockaddr sa;
11999 return (sa.sa_len);
12000 }
12001 EOF
12002 val="$undef"
12003 set try; if eval $compile; then
12004 val="$define"
12005 fi
12006 set d_sockaddr_sa_len; eval $setvar
12007 $rm_try
12008
12009 echo "Checking the availability struct sockaddr_in6 ..." >&4
12010 $cat >try.c <<EOF
12011 #include <sys/types.h>
12012 #include <sys/socket.h>
12013 #include <netinet/in.h>
12014 int main() {
12015 struct sockaddr_in6 sin6;
12016 return (sin6.sin6_family);
12017 }
12018 EOF
12019 val="$undef"
12020 set try; if eval $compile; then
12021 val="$define"
12022 fi
12023 set d_sockaddr_in6; eval $setvar
12024 $rm_try
12025
12026 echo "Checking the availability struct sockaddr_storage ..." >&4
12027 $cat >try.c <<EOF
12028 #include <sys/types.h>
12029 #include <sys/socket.h>
12030 #include <netinet/in.h>
12031 int main() {
12032 struct sockaddr_storage sastor;
12033 return (sastor.ss_family);
12034 }
12035 EOF
12036 val="$undef"
12037 set try; if eval $compile; then
12038 val="$define"
12039 fi
12040 set d_sockaddr_storage; eval $setvar
12041 $rm_try
12042
12043 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
12044 $cat >try.c <<EOF
12045 #include <sys/types.h>
12046 #include <sys/socket.h>
12047 #include <netinet/in.h>
12048 int main() {
12049 struct sockaddr_in6 sin6;
12050 return (sin6.sin6_scope_id);
12051 }
12052 EOF
12053 val="$undef"
12054 set try; if eval $compile; then
12055 val="$define"
12056 fi
12057 set d_sin6_scope_id; eval $setvar
12058 $rm_try
12059
12060 echo "Checking the availability struct ip_mreq ..." >&4
12061 $cat >try.c <<EOF
12062 #include <sys/types.h>
12063 #include <sys/socket.h>
12064 #include <netinet/in.h>
12065 int main() {
12066 struct ip_mreq mreq;
12067 return (mreq.imr_multiaddr.s_addr);
12068 }
12069 EOF
12070 val="$undef"
12071 set try; if eval $compile; then
12072 val="$define"
12073 fi
12074 set d_ip_mreq; eval $setvar
12075 $rm_try
12076
12077 echo "Checking the availability struct ip_mreq_source ..." >&4
12078 $cat >try.c <<EOF
12079 #include <sys/types.h>
12080 #include <sys/socket.h>
12081 #include <netinet/in.h>
12082 int main() {
12083 struct ip_mreq_source mreq;
12084 return (mreq.imr_multiaddr.s_addr);
12085 }
12086 EOF
12087 val="$undef"
12088 set try; if eval $compile; then
12089 val="$define"
12090 fi
12091 set d_ip_mreq_source; eval $setvar
12092 $rm_try
12093
12094 echo "Checking the availability struct ipv6_mreq ..." >&4
12095 $cat >try.c <<EOF
12096 #include <sys/types.h>
12097 #include <sys/socket.h>
12098 #include <netinet/in.h>
12099 int main() {
12100 struct ipv6_mreq mreq;
12101 return (mreq.ipv6mr_interface);
12102 }
12103 EOF
12104 val="$undef"
12105 set try; if eval $compile; then
12106 val="$define"
12107 fi
12108 set d_ipv6_mreq; eval $setvar
12109 $rm_try
12110
12111 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12112 $cat >try.c <<EOF
12113 #include <sys/types.h>
12114 #include <sys/socket.h>
12115 #include <netinet/in.h>
12116 int main() {
12117 struct ipv6_mreq_source mreq;
12118 return (mreq.imr_multiaddr.s_addr);
12119 }
12120 EOF
12121 val="$undef"
12122 set try; if eval $compile; then
12123 val="$define"
12124 fi
12125 set d_ipv6_mreq_source; eval $setvar
12126 $rm_try
12127
12128 echo "Checking the availability of certain socket constants..." >&4
12129 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12130 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12131 $cat >try.c <<EOF
12132 #include <sys/types.h>
12133 #include <sys/socket.h>
12134 int main() {
12135 int i = $ENUM;
12136 }
12137 EOF
12138 val="$undef"
12139 set try; if eval $compile; then
12140 val="$define"
12141 fi
12142 set d_${enum}; eval $setvar
12143 $rm_try
12144 done
12145
12146 : see if this is a sys/uio.h system
12147 set sys/uio.h i_sysuio
12148 eval $inhdr
12149
12150 : Check for cmsghdr support
12151 echo " "
12152 echo "Checking to see if your system supports struct cmsghdr..." >&4
12153 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12154 eval $hasstruct
12155 case "$d_cmsghdr_s" in
12156 "$define") echo "Yes, it does." ;;
12157 *) echo "No, it doesn't." ;;
12158 esac
12159
12160 : see if copysign exists
12161 set copysign d_copysign
12162 eval $inlibc
12163
12164 : see if copysignl exists
12165 set copysignl d_copysignl
12166 eval $inlibc
12167
12168 : see if crypt exists
12169 echo " "
12170 set crypt d_crypt
12171 eval $inlibc
12172 case "$d_crypt" in
12173 $define) cryptlib='' ;;
12174 *) if set crypt val -f d_crypt; eval $csym; $val; then
12175 echo 'crypt() found.' >&4
12176 val="$define"
12177 cryptlib=''
12178 else
12179 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12180 if $test -z "$cryptlib"; then
12181 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12182 else
12183 cryptlib=-lcrypt
12184 fi
12185 if $test -z "$cryptlib"; then
12186 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12187 else
12188 cryptlib=-lcrypt
12189 fi
12190 if $test -z "$cryptlib"; then
12191 cryptlib=`./loc libcrypt$_a "" $libpth`
12192 else
12193 cryptlib=-lcrypt
12194 fi
12195 if $test -z "$cryptlib"; then
12196 echo 'crypt() NOT found.' >&4
12197 val="$undef"
12198 else
12199 val="$define"
12200 fi
12201 fi
12202 set d_crypt
12203 eval $setvar
12204 ;;
12205 esac
12206
12207 : see if this is a crypt.h system
12208 set crypt.h i_crypt
12209 eval $inhdr
12210
12211 : see if crypt_r exists
12212 set crypt_r d_crypt_r
12213 eval $inlibc
12214 case "$d_crypt_r" in
12215 "$define")
12216 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12217 case "$d_crypt_r_proto:$usethreads" in
12218 ":define") d_crypt_r_proto=define
12219 set d_crypt_r_proto crypt_r $hdrs
12220 eval $hasproto ;;
12221 *) ;;
12222 esac
12223 case "$d_crypt_r_proto" in
12224 define)
12225 case "$crypt_r_proto" in
12226 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12227 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12228 esac
12229 case "$crypt_r_proto" in
12230 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12231 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12232 esac
12233 case "$crypt_r_proto" in
12234 ''|0) d_crypt_r=undef
12235 crypt_r_proto=0
12236 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12237 * ) case "$crypt_r_proto" in
12238 REENTRANT_PROTO*) ;;
12239 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12240 esac
12241 echo "Prototype: $try" ;;
12242 esac
12243 ;;
12244 *) case "$usethreads" in
12245 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12246 esac
12247 d_crypt_r=undef
12248 crypt_r_proto=0
12249 ;;
12250 esac
12251 ;;
12252 *) crypt_r_proto=0
12253 ;;
12254 esac
12255
12256 : get csh whereabouts
12257 case "$csh" in
12258 'csh') val="$undef" ;;
12259 *) val="$define" ;;
12260 esac
12261 set d_csh
12262 eval $setvar
12263 : Respect a hint or command line value for full_csh.
12264 case "$full_csh" in
12265 '') full_csh=$csh ;;
12266 esac
12267
12268 : see if ctermid exists
12269 set ctermid d_ctermid
12270 eval $inlibc
12271
12272 : see if ctermid_r exists
12273 set ctermid_r d_ctermid_r
12274 eval $inlibc
12275 case "$d_ctermid_r" in
12276 "$define")
12277 hdrs="$i_systypes sys/types.h define stdio.h "
12278 case "$d_ctermid_r_proto:$usethreads" in
12279 ":define") d_ctermid_r_proto=define
12280 set d_ctermid_r_proto ctermid_r $hdrs
12281 eval $hasproto ;;
12282 *) ;;
12283 esac
12284 case "$d_ctermid_r_proto" in
12285 define)
12286 case "$ctermid_r_proto" in
12287 ''|0) try='char* ctermid_r(char*);'
12288 ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12289 esac
12290 case "$ctermid_r_proto" in
12291 ''|0) d_ctermid_r=undef
12292 ctermid_r_proto=0
12293 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12294 * ) case "$ctermid_r_proto" in
12295 REENTRANT_PROTO*) ;;
12296 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12297 esac
12298 echo "Prototype: $try" ;;
12299 esac
12300 ;;
12301 *) case "$usethreads" in
12302 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12303 esac
12304 d_ctermid_r=undef
12305 ctermid_r_proto=0
12306 ;;
12307 esac
12308 ;;
12309 *) ctermid_r_proto=0
12310 ;;
12311 esac
12312
12313 : see if ctime_r exists
12314 set ctime_r d_ctime_r
12315 eval $inlibc
12316 case "$d_ctime_r" in
12317 "$define")
12318 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12319 case "$d_ctime_r_proto:$usethreads" in
12320 ":define") d_ctime_r_proto=define
12321 set d_ctime_r_proto ctime_r $hdrs
12322 eval $hasproto ;;
12323 *) ;;
12324 esac
12325 case "$d_ctime_r_proto" in
12326 define)
12327 case "$ctime_r_proto" in
12328 ''|0) try='char* ctime_r(const time_t*, char*);'
12329 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12330 esac
12331 case "$ctime_r_proto" in
12332 ''|0) try='char* ctime_r(const time_t*, char*, int);'
12333 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12334 esac
12335 case "$ctime_r_proto" in
12336 ''|0) try='int ctime_r(const time_t*, char*);'
12337 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12338 esac
12339 case "$ctime_r_proto" in
12340 ''|0) try='int ctime_r(const time_t*, char*, int);'
12341 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12342 esac
12343 case "$ctime_r_proto" in
12344 ''|0) d_ctime_r=undef
12345 ctime_r_proto=0
12346 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12347 * ) case "$ctime_r_proto" in
12348 REENTRANT_PROTO*) ;;
12349 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12350 esac
12351 echo "Prototype: $try" ;;
12352 esac
12353 ;;
12354 *) case "$usethreads" in
12355 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12356 esac
12357 d_ctime_r=undef
12358 ctime_r_proto=0
12359 ;;
12360 esac
12361 ;;
12362 *) ctime_r_proto=0
12363 ;;
12364 esac
12365
12366 : see if cuserid exists
12367 set cuserid d_cuserid
12368 eval $inlibc
12369
12370 : see if dbm.h is available
12371 : see if dbmclose exists
12372 set dbmclose d_dbmclose
12373 eval $inlibc
12374
12375 case "$d_dbmclose" in
12376 $define)
12377 set dbm.h i_dbm
12378 eval $inhdr
12379 case "$i_dbm" in
12380 $define)
12381 val="$undef"
12382 set i_rpcsvcdbm
12383 eval $setvar
12384 ;;
12385 *) set rpcsvc/dbm.h i_rpcsvcdbm
12386 eval $inhdr
12387 ;;
12388 esac
12389 ;;
12390 *) echo "We won't be including <dbm.h>"
12391 val="$undef"
12392 set i_dbm
12393 eval $setvar
12394 val="$undef"
12395 set i_rpcsvcdbm
12396 eval $setvar
12397 ;;
12398 esac
12399
12400 : see if prototype for dbminit is available
12401 echo " "
12402 set d_dbminitproto dbminit $i_dbm dbm.h
12403 eval $hasproto
12404
12405 : see if difftime exists
12406 set difftime d_difftime
12407 eval $inlibc
12408
12409 : see if this is a dirent system
12410 echo " "
12411 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12412 val="$define"
12413 echo "<dirent.h> found." >&4
12414 else
12415 val="$undef"
12416 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12417 echo "<sys/dir.h> found." >&4
12418 echo " "
12419 else
12420 xinc=`./findhdr sys/ndir.h`
12421 fi
12422 echo "<dirent.h> NOT found." >&4
12423 fi
12424 set i_dirent
12425 eval $setvar
12426
12427 : Look for type of directory structure.
12428 echo " "
12429 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12430
12431 case "$direntrytype" in
12432 ''|' ')
12433 case "$i_dirent" in
12434 $define) guess1='struct dirent' ;;
12435 *) guess1='struct direct' ;;
12436 esac
12437 ;;
12438 *) guess1="$direntrytype"
12439 ;;
12440 esac
12441
12442 case "$guess1" in
12443 'struct dirent') guess2='struct direct' ;;
12444 *) guess2='struct dirent' ;;
12445 esac
12446
12447 if $contains "$guess1" try.c >/dev/null 2>&1; then
12448 direntrytype="$guess1"
12449 echo "Your directory entries are $direntrytype." >&4
12450 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12451 direntrytype="$guess2"
12452 echo "Your directory entries seem to be $direntrytype." >&4
12453 else
12454 echo "I don't recognize your system's directory entries." >&4
12455 rp="What type is used for directory entries on this system?"
12456 dflt="$guess1"
12457 . ./myread
12458 direntrytype="$ans"
12459 fi
12460 $rm_try
12461
12462 : see if the directory entry stores field length
12463 echo " "
12464 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12465 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12466 echo "Good, your directory entry keeps length information in d_namlen." >&4
12467 val="$define"
12468 else
12469 echo "Your directory entry does not know about the d_namlen field." >&4
12470 val="$undef"
12471 fi
12472 set d_dirnamlen
12473 eval $setvar
12474 $rm_try
12475
12476 : Look for DIR.dd_fd
12477 case "$i_dirent" in
12478 "$define")
12479 echo "Checking to see if DIR has a dd_fd member variable" >&4
12480 $cat >try.c <<EOCP
12481 #$i_stdlib I_STDLIB
12482 #ifdef I_STDLIB
12483 #include <stdlib.h>
12484 #endif
12485 #include <dirent.h>
12486
12487 int main() {
12488 DIR dir;
12489 dir.dd_fd = 1;
12490 return 0;
12491 }
12492 EOCP
12493 val=$undef
12494 set try
12495 if eval $compile; then
12496 echo "Yes, it does."
12497 val="$define"
12498 else
12499 echo "No, it does not."
12500 val="$undef"
12501 fi
12502 ;;
12503 *)
12504 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12505 val="$undef"
12506 ;;
12507 esac
12508 set d_dir_dd_fd
12509 eval $setvar
12510 $rm_try
12511
12512 : see if this is an sysdir system
12513 set sys/dir.h i_sysdir
12514 eval $inhdr
12515
12516 : see if this is an sysndir system
12517 set sys/ndir.h i_sysndir
12518 eval $inhdr
12519
12520 : Look for dirfd
12521 echo " "
12522 $cat >dirfd.c <<EOM
12523 #include <stdio.h>
12524 #$i_stdlib I_STDLIB
12525 #ifdef I_STDLIB
12526 #include <stdlib.h>
12527 #endif
12528 #$i_dirent I_DIRENT /**/
12529 #$i_sysdir I_SYS_DIR /**/
12530 #$i_sysndir I_SYS_NDIR /**/
12531 #$i_systypes I_SYS_TYPES /**/
12532 #if defined(I_SYS_TYPES)
12533 #include <sys/types.h>
12534 #endif
12535 #if defined(I_DIRENT)
12536 #include <dirent.h>
12537 #else
12538 #ifdef I_SYS_NDIR
12539 #include <sys/ndir.h>
12540 #else
12541 #ifdef I_SYS_DIR
12542 #include <sys/dir.h>
12543 #endif
12544 #endif
12545 #endif
12546 int main() {
12547 DIR *dirp = opendir(".");
12548 if (dirfd(dirp) >= 0)
12549 exit(0);
12550 else
12551 exit(1);
12552 }
12553 EOM
12554 val=$undef
12555 set dirfd
12556 if eval $compile; then
12557 val="$define"
12558 fi
12559 case "$val" in
12560 $define) echo "dirfd() found." >&4 ;;
12561 *) echo "dirfd() NOT found." >&4 ;;
12562 esac
12563 set d_dirfd
12564 eval $setvar
12565 $rm -f dirfd*
12566
12567 : see if dladdr exists
12568 set dladdr d_dladdr
12569 eval $inlibc
12570
12571 : see if dlerror exists
12572 xxx_runnm="$runnm"
12573 runnm=false
12574 set dlerror d_dlerror
12575 eval $inlibc
12576 runnm="$xxx_runnm"
12577
12578 : see if dlfcn is available
12579 set dlfcn.h i_dlfcn
12580 eval $inhdr
12581
12582 : Check what extension to use for shared libs
12583 case "$usedl" in
12584 $define|y|true)
12585 $cat << EOM
12586
12587 On a few systems, the dynamically loaded modules that perl generates and uses
12588 will need a different extension than shared libs. The default will probably
12589 be appropriate.
12590
12591 EOM
12592 case "$dlext" in
12593 '') dflt="$so" ;;
12594 *) dflt="$dlext" ;;
12595 esac
12596 rp='What is the extension of dynamically loaded modules'
12597 . ./myread
12598 dlext="$ans"
12599 ;;
12600 *)
12601 dlext="none"
12602 ;;
12603 esac
12604
12605 : Check if dlsym need a leading underscore
12606 echo " "
12607 val="$undef"
12608
12609 case "$dlsrc" in
12610 dl_dlopen.xs)
12611 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12612 $cat >dyna.c <<'EOM'
12613 void fred (void) { }
12614 EOM
12615
12616 $cat >fred.c<<EOM
12617
12618 #include <stdio.h>
12619 #$i_stdlib I_STDLIB
12620 #ifdef I_STDLIB
12621 #include <stdlib.h>
12622 #endif
12623 #$i_dlfcn I_DLFCN
12624 #ifdef I_DLFCN
12625 #include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
12626 #else
12627 #include <sys/types.h>
12628 #include <nlist.h>
12629 #include <link.h>
12630 #endif
12631
12632 extern void fred(void) ;
12633
12634 int main()
12635 {
12636 void * handle ;
12637 void * symbol ;
12638 #ifndef RTLD_LAZY
12639 int mode = 1 ;
12640 #else
12641 int mode = RTLD_LAZY ;
12642 #endif
12643 handle = dlopen("./dyna.$dlext", mode) ;
12644 if (handle == NULL) {
12645 printf ("1\n") ;
12646 fflush (stdout) ;
12647 exit(0);
12648 }
12649 symbol = dlsym(handle, "fred") ;
12650 if (symbol == NULL) {
12651 /* try putting a leading underscore */
12652 symbol = dlsym(handle, "_fred") ;
12653 if (symbol == NULL) {
12654 printf ("2\n") ;
12655 fflush (stdout) ;
12656 exit(0);
12657 }
12658 printf ("3\n") ;
12659 }
12660 else
12661 printf ("4\n") ;
12662 fflush (stdout) ;
12663 exit(0);
12664 }
12665 EOM
12666 : Call the object file tmp-dyna.o in case dlext=o.
12667 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12668 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12669 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12670 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12671 xxx=`$run ./fred`
12672 case $xxx in
12673 1) echo "Test program failed using dlopen." >&4
12674 echo "Perhaps you should not use dynamic loading." >&4;;
12675 2) echo "Test program failed using dlsym." >&4
12676 echo "Perhaps you should not use dynamic loading." >&4;;
12677 3) echo "dlsym needs a leading underscore" >&4
12678 val="$define" ;;
12679 4) echo "dlsym doesn't need a leading underscore." >&4;;
12680 esac
12681 else
12682 echo "I can't compile and run the test program." >&4
12683 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12684 fi
12685 ;;
12686 esac
12687
12688 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12689
12690 set d_dlsymun
12691 eval $setvar
12692
12693 : see if drand48_r exists
12694 set drand48_r d_drand48_r
12695 eval $inlibc
12696 case "$d_drand48_r" in
12697 "$define")
12698 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12699 case "$d_drand48_r_proto:$usethreads" in
12700 ":define") d_drand48_r_proto=define
12701 set d_drand48_r_proto drand48_r $hdrs
12702 eval $hasproto ;;
12703 *) ;;
12704 esac
12705 case "$d_drand48_r_proto" in
12706 define)
12707 case "$drand48_r_proto" in
12708 ''|0) try='int drand48_r(struct drand48_data*, double*);'
12709 ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12710 esac
12711 case "$drand48_r_proto" in
12712 ''|0) d_drand48_r=undef
12713 drand48_r_proto=0
12714 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12715 * ) case "$drand48_r_proto" in
12716 REENTRANT_PROTO*) ;;
12717 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12718 esac
12719 echo "Prototype: $try" ;;
12720 esac
12721 ;;
12722 *) case "$usethreads" in
12723 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12724 esac
12725 d_drand48_r=undef
12726 drand48_r_proto=0
12727 ;;
12728 esac
12729 ;;
12730 *) drand48_r_proto=0
12731 ;;
12732 esac
12733
12734 : see if prototype for drand48 is available
12735 echo " "
12736 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12737 eval $hasproto
12738
12739 : see if dup2 exists
12740 set dup2 d_dup2
12741 eval $inlibc
12742
12743 : see if dup3 exists
12744 set dup3 d_dup3
12745 eval $inlibc
12746
12747 : see if localeconv_l exists
12748 set localeconv_l d_localeconv_l
12749 eval $inlibc
12750
12751 : see if this is an xlocale.h system
12752 set xlocale.h i_xlocale
12753 eval $inhdr
12754
12755 : see if newlocale exists
12756 set newlocale d_newlocale
12757 eval $inlibc
12758
12759 : see if freelocale exists
12760 set freelocale d_freelocale
12761 eval $inlibc
12762
12763 : see if uselocale exists
12764 set uselocale d_uselocale
12765 eval $inlibc
12766
12767 : see if duplocale exists
12768 set duplocale d_duplocale
12769 eval $inlibc
12770
12771 : see if querylocale exists
12772 set querylocale d_querylocale
12773 eval $inlibc
12774
12775 : if we have xlocale.h, check whether it is needed
12776 case "$i_xlocale$d_newlocale$xlocale_needed" in
12777 "$define$define")
12778 echo "Checking if xlocale.h is needed..." >&4
12779 $cat >try.c <<EOF
12780 #include <locale.h>
12781 #include <stdio.h>
12782 #ifdef TRY_XLOCALE
12783 #include <xlocale.h>
12784 #endif
12785 #$d_localeconv_l HAVE_LOCALECONV_L
12786
12787 #ifdef HAVE_LOCALECONV_L
12788 struct lconv *(*lcptr)(locale_t) = localeconv_l;
12789 #endif
12790
12791 int main(void) {
12792 locale_t lc = newlocale(LC_ALL_MASK, "C", (locale_t)0);
12793
12794 #ifdef HAVE_LOCALECONV_L
12795 /* FreeBSD hides only localeconv_l() in xlocale.h */
12796 struct lconv *lcbuf = localeconv_l(lc);
12797 printf("decimal: %s\n", lcbuf->decimal_point);
12798 #endif
12799
12800 freelocale(lc);
12801 return 0;
12802 }
12803 EOF
12804 set try
12805 if eval $compile && $run ./try > /dev/null 2>&1 ; then
12806 echo "xlocale.h isn't needed" >&4
12807 xlocale_needed=$undef
12808 else
12809 set try -DTRY_XLOCALE
12810 if eval $compile && $run ./try > /dev/null 2>&1 ; then
12811 xlocale_needed=$define
12812 echo "xlocale.h is needed" >&4
12813 else
12814 echo "I can't build my test either way" >&4
12815 xlocale_needed=$undef
12816 fi
12817 fi
12818 $rm_try
12819 ;;
12820 *) xlocale_needed=$undef ;;
12821 esac
12822
12823 : see if eaccess exists
12824 set eaccess d_eaccess
12825 eval $inlibc
12826
12827 : see if endgrent exists
12828 set endgrent d_endgrent
12829 eval $inlibc
12830
12831 : see if this is an grp system
12832 set grp.h i_grp
12833 eval $inhdr
12834
12835 case "$i_grp" in
12836 $define)
12837 xxx=`./findhdr grp.h`
12838 $cppstdin $cppflags $cppminus < $xxx >$$.h
12839
12840 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12841 val="$define"
12842 else
12843 val="$undef"
12844 fi
12845 set d_grpasswd
12846 eval $setvar
12847
12848 $rm -f $$.h
12849 ;;
12850 *)
12851 val="$undef";
12852 set d_grpasswd; eval $setvar
12853 ;;
12854 esac
12855
12856 : see if endgrent_r exists
12857 set endgrent_r d_endgrent_r
12858 eval $inlibc
12859 case "$d_endgrent_r" in
12860 "$define")
12861 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12862 case "$d_endgrent_r_proto:$usethreads" in
12863 ":define") d_endgrent_r_proto=define
12864 set d_endgrent_r_proto endgrent_r $hdrs
12865 eval $hasproto ;;
12866 *) ;;
12867 esac
12868 case "$d_endgrent_r_proto" in
12869 define)
12870 case "$endgrent_r_proto" in
12871 ''|0) try='int endgrent_r(FILE**);'
12872 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12873 esac
12874 case "$endgrent_r_proto" in
12875 ''|0) try='void endgrent_r(FILE**);'
12876 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12877 esac
12878 case "$endgrent_r_proto" in
12879 ''|0) d_endgrent_r=undef
12880 endgrent_r_proto=0
12881 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12882 * ) case "$endgrent_r_proto" in
12883 REENTRANT_PROTO*) ;;
12884 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12885 esac
12886 echo "Prototype: $try" ;;
12887 esac
12888 ;;
12889 *) case "$usethreads" in
12890 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12891 esac
12892 d_endgrent_r=undef
12893 endgrent_r_proto=0
12894 ;;
12895 esac
12896 ;;
12897 *) endgrent_r_proto=0
12898 ;;
12899 esac
12900
12901 : see if endhostent exists
12902 set endhostent d_endhent
12903 eval $inlibc
12904
12905 : see if this is a netdb.h system
12906 set netdb.h i_netdb
12907 eval $inhdr
12908
12909 : see if endhostent_r exists
12910 set endhostent_r d_endhostent_r
12911 eval $inlibc
12912 case "$d_endhostent_r" in
12913 "$define")
12914 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12915 case "$d_endhostent_r_proto:$usethreads" in
12916 ":define") d_endhostent_r_proto=define
12917 set d_endhostent_r_proto endhostent_r $hdrs
12918 eval $hasproto ;;
12919 *) ;;
12920 esac
12921 case "$d_endhostent_r_proto" in
12922 define)
12923 case "$endhostent_r_proto" in
12924 ''|0) try='int endhostent_r(struct hostent_data*);'
12925 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12926 esac
12927 case "$endhostent_r_proto" in
12928 ''|0) try='void endhostent_r(struct hostent_data*);'
12929 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12930 esac
12931 case "$endhostent_r_proto" in
12932 ''|0) d_endhostent_r=undef
12933 endhostent_r_proto=0
12934 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12935 * ) case "$endhostent_r_proto" in
12936 REENTRANT_PROTO*) ;;
12937 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12938 esac
12939 echo "Prototype: $try" ;;
12940 esac
12941 ;;
12942 *) case "$usethreads" in
12943 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12944 esac
12945 d_endhostent_r=undef
12946 endhostent_r_proto=0
12947 ;;
12948 esac
12949 ;;
12950 *) endhostent_r_proto=0
12951 ;;
12952 esac
12953
12954 : see if endnetent exists
12955 set endnetent d_endnent
12956 eval $inlibc
12957
12958 : see if endnetent_r exists
12959 set endnetent_r d_endnetent_r
12960 eval $inlibc
12961 case "$d_endnetent_r" in
12962 "$define")
12963 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12964 case "$d_endnetent_r_proto:$usethreads" in
12965 ":define") d_endnetent_r_proto=define
12966 set d_endnetent_r_proto endnetent_r $hdrs
12967 eval $hasproto ;;
12968 *) ;;
12969 esac
12970 case "$d_endnetent_r_proto" in
12971 define)
12972 case "$endnetent_r_proto" in
12973 ''|0) try='int endnetent_r(struct netent_data*);'
12974 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12975 esac
12976 case "$endnetent_r_proto" in
12977 ''|0) try='void endnetent_r(struct netent_data*);'
12978 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12979 esac
12980 case "$endnetent_r_proto" in
12981 ''|0) d_endnetent_r=undef
12982 endnetent_r_proto=0
12983 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12984 * ) case "$endnetent_r_proto" in
12985 REENTRANT_PROTO*) ;;
12986 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12987 esac
12988 echo "Prototype: $try" ;;
12989 esac
12990 ;;
12991 *) case "$usethreads" in
12992 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12993 esac
12994 d_endnetent_r=undef
12995 endnetent_r_proto=0
12996 ;;
12997 esac
12998 ;;
12999 *) endnetent_r_proto=0
13000 ;;
13001 esac
13002
13003 : see if endprotoent exists
13004 set endprotoent d_endpent
13005 eval $inlibc
13006
13007 : see if endprotoent_r exists
13008 set endprotoent_r d_endprotoent_r
13009 eval $inlibc
13010 case "$d_endprotoent_r" in
13011 "$define")
13012 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13013 case "$d_endprotoent_r_proto:$usethreads" in
13014 ":define") d_endprotoent_r_proto=define
13015 set d_endprotoent_r_proto endprotoent_r $hdrs
13016 eval $hasproto ;;
13017 *) ;;
13018 esac
13019 case "$d_endprotoent_r_proto" in
13020 define)
13021 case "$endprotoent_r_proto" in
13022 ''|0) try='int endprotoent_r(struct protoent_data*);'
13023 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
13024 esac
13025 case "$endprotoent_r_proto" in
13026 ''|0) try='void endprotoent_r(struct protoent_data*);'
13027 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
13028 esac
13029 case "$endprotoent_r_proto" in
13030 ''|0) d_endprotoent_r=undef
13031 endprotoent_r_proto=0
13032 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
13033 * ) case "$endprotoent_r_proto" in
13034 REENTRANT_PROTO*) ;;
13035 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
13036 esac
13037 echo "Prototype: $try" ;;
13038 esac
13039 ;;
13040 *) case "$usethreads" in
13041 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
13042 esac
13043 d_endprotoent_r=undef
13044 endprotoent_r_proto=0
13045 ;;
13046 esac
13047 ;;
13048 *) endprotoent_r_proto=0
13049 ;;
13050 esac
13051
13052 : see if endpwent exists
13053 set endpwent d_endpwent
13054 eval $inlibc
13055
13056 : see if this is a pwd.h system
13057 set pwd.h i_pwd
13058 eval $inhdr
13059
13060 case "$i_pwd" in
13061 $define)
13062 xxx=`./findhdr pwd.h`
13063 $cppstdin $cppflags $cppminus < $xxx >$$.h
13064
13065 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
13066 val="$define"
13067 else
13068 val="$undef"
13069 fi
13070 set d_pwquota
13071 eval $setvar
13072
13073 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13074 val="$define"
13075 else
13076 val="$undef"
13077 fi
13078 set d_pwage
13079 eval $setvar
13080
13081 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13082 val="$define"
13083 else
13084 val="$undef"
13085 fi
13086 set d_pwchange
13087 eval $setvar
13088
13089 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13090 val="$define"
13091 else
13092 val="$undef"
13093 fi
13094 set d_pwclass
13095 eval $setvar
13096
13097 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13098 val="$define"
13099 else
13100 val="$undef"
13101 fi
13102 set d_pwexpire
13103 eval $setvar
13104
13105 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13106 val="$define"
13107 else
13108 val="$undef"
13109 fi
13110 set d_pwcomment
13111 eval $setvar
13112
13113 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13114 val="$define"
13115 else
13116 val="$undef"
13117 fi
13118 set d_pwgecos
13119 eval $setvar
13120
13121 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13122 val="$define"
13123 else
13124 val="$undef"
13125 fi
13126 set d_pwpasswd
13127 eval $setvar
13128
13129 $rm -f $$.h
13130 ;;
13131 *)
13132 val="$undef";
13133 set d_pwquota; eval $setvar
13134 set d_pwage; eval $setvar
13135 set d_pwchange; eval $setvar
13136 set d_pwclass; eval $setvar
13137 set d_pwexpire; eval $setvar
13138 set d_pwcomment; eval $setvar
13139 set d_pwgecos; eval $setvar
13140 set d_pwpasswd; eval $setvar
13141 ;;
13142 esac
13143
13144 : see if endpwent_r exists
13145 set endpwent_r d_endpwent_r
13146 eval $inlibc
13147 case "$d_endpwent_r" in
13148 "$define")
13149 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13150 case "$d_endpwent_r_proto:$usethreads" in
13151 ":define") d_endpwent_r_proto=define
13152 set d_endpwent_r_proto endpwent_r $hdrs
13153 eval $hasproto ;;
13154 *) ;;
13155 esac
13156 case "$d_endpwent_r_proto" in
13157 define)
13158 case "$endpwent_r_proto" in
13159 ''|0) try='int endpwent_r(FILE**);'
13160 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13161 esac
13162 case "$endpwent_r_proto" in
13163 ''|0) try='void endpwent_r(FILE**);'
13164 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13165 esac
13166 case "$endpwent_r_proto" in
13167 ''|0) d_endpwent_r=undef
13168 endpwent_r_proto=0
13169 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13170 * ) case "$endpwent_r_proto" in
13171 REENTRANT_PROTO*) ;;
13172 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13173 esac
13174 echo "Prototype: $try" ;;
13175 esac
13176 ;;
13177 *) case "$usethreads" in
13178 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13179 esac
13180 d_endpwent_r=undef
13181 endpwent_r_proto=0
13182 ;;
13183 esac
13184 ;;
13185 *) endpwent_r_proto=0
13186 ;;
13187 esac
13188
13189 : see if endservent exists
13190 set endservent d_endsent
13191 eval $inlibc
13192
13193 : see if endservent_r exists
13194 set endservent_r d_endservent_r
13195 eval $inlibc
13196 case "$d_endservent_r" in
13197 "$define")
13198 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13199 case "$d_endservent_r_proto:$usethreads" in
13200 ":define") d_endservent_r_proto=define
13201 set d_endservent_r_proto endservent_r $hdrs
13202 eval $hasproto ;;
13203 *) ;;
13204 esac
13205 case "$d_endservent_r_proto" in
13206 define)
13207 case "$endservent_r_proto" in
13208 ''|0) try='int endservent_r(struct servent_data*);'
13209 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13210 esac
13211 case "$endservent_r_proto" in
13212 ''|0) try='void endservent_r(struct servent_data*);'
13213 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13214 esac
13215 case "$endservent_r_proto" in
13216 ''|0) d_endservent_r=undef
13217 endservent_r_proto=0
13218 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13219 * ) case "$endservent_r_proto" in
13220 REENTRANT_PROTO*) ;;
13221 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13222 esac
13223 echo "Prototype: $try" ;;
13224 esac
13225 ;;
13226 *) case "$usethreads" in
13227 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13228 esac
13229 d_endservent_r=undef
13230 endservent_r_proto=0
13231 ;;
13232 esac
13233 ;;
13234 *) endservent_r_proto=0
13235 ;;
13236 esac
13237
13238 : Locate the flags for 'open()'
13239 echo " "
13240 $cat >try.c <<EOCP
13241 #include <sys/types.h>
13242 #ifdef I_FCNTL
13243 #include <fcntl.h>
13244 #endif
13245 #ifdef I_SYS_FILE
13246 #include <sys/file.h>
13247 #endif
13248 #$i_stdlib I_STDLIB
13249 #ifdef I_STDLIB
13250 #include <stdlib.h>
13251 #endif
13252 int main() {
13253 if(O_RDONLY);
13254 #ifdef O_TRUNC
13255 exit(0);
13256 #else
13257 exit(1);
13258 #endif
13259 }
13260 EOCP
13261 : check sys/file.h first to get FREAD on Sun
13262 if $test `./findhdr sys/file.h` && \
13263 set try -DI_SYS_FILE && eval $compile; then
13264 h_sysfile=true;
13265 echo "<sys/file.h> defines the O_* constants..." >&4
13266 if $run ./try; then
13267 echo "and you have the 3 argument form of open()." >&4
13268 val="$define"
13269 else
13270 echo "but not the 3 argument form of open(). Oh, well." >&4
13271 val="$undef"
13272 fi
13273 elif $test `./findhdr fcntl.h` && \
13274 set try -DI_FCNTL && eval $compile; then
13275 h_fcntl=true;
13276 echo "<fcntl.h> defines the O_* constants..." >&4
13277 if $run ./try; then
13278 echo "and you have the 3 argument form of open()." >&4
13279 val="$define"
13280 else
13281 echo "but not the 3 argument form of open(). Oh, well." >&4
13282 val="$undef"
13283 fi
13284 else
13285 val="$undef"
13286 echo "I can't find the O_* constant definitions! You got problems." >&4
13287 fi
13288 set d_open3
13289 eval $setvar
13290 $rm_try
13291
13292 : see if this is a sys/file.h system
13293 val=''
13294 set sys/file.h val
13295 eval $inhdr
13296
13297 : do we need to include sys/file.h ?
13298 case "$val" in
13299 "$define")
13300 echo " "
13301 if $h_sysfile; then
13302 val="$define"
13303 echo "We'll be including <sys/file.h>." >&4
13304 else
13305 val="$undef"
13306 echo "We won't be including <sys/file.h>." >&4
13307 fi
13308 ;;
13309 *)
13310 h_sysfile=false
13311 ;;
13312 esac
13313 set i_sysfile
13314 eval $setvar
13315
13316 : see if fcntl.h is there
13317 val=''
13318 set fcntl.h val
13319 eval $inhdr
13320
13321 : see if we can include fcntl.h
13322 case "$val" in
13323 "$define")
13324 echo " "
13325 if $h_fcntl; then
13326 val="$define"
13327 echo "We'll be including <fcntl.h>." >&4
13328 else
13329 val="$undef"
13330 if $h_sysfile; then
13331 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13332 else
13333 echo "We won't be including <fcntl.h>." >&4
13334 fi
13335 fi
13336 ;;
13337 *)
13338 h_fcntl=false
13339 val="$undef"
13340 ;;
13341 esac
13342 set i_fcntl
13343 eval $setvar
13344
13345 : see if fork exists
13346 set fork d_fork
13347 eval $inlibc
13348
13349 : see if pipe exists
13350 set pipe d_pipe
13351 eval $inlibc
13352
13353 : check for non-blocking I/O stuff
13354 case "$h_sysfile" in
13355 true) echo "#include <sys/file.h>" > head.c;;
13356 *)
13357 case "$h_fcntl" in
13358 true) echo "#include <fcntl.h>" > head.c;;
13359 *) echo "#include <sys/fcntl.h>" > head.c;;
13360 esac
13361 ;;
13362 esac
13363 echo " "
13364 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13365 case "$o_nonblock" in
13366 '')
13367 $cat head.c > try.c
13368 $cat >>try.c <<EOCP
13369 #include <stdio.h>
13370 #$i_stdlib I_STDLIB
13371 #ifdef I_STDLIB
13372 #include <stdlib.h>
13373 #endif
13374 #$i_fcntl I_FCNTL
13375 #ifdef I_FCNTL
13376 #include <fcntl.h>
13377 #endif
13378 int main() {
13379 #ifdef O_NONBLOCK
13380 printf("O_NONBLOCK\n");
13381 exit(0);
13382 #endif
13383 #ifdef O_NDELAY
13384 printf("O_NDELAY\n");
13385 exit(0);
13386 #endif
13387 #ifdef FNDELAY
13388 printf("FNDELAY\n");
13389 exit(0);
13390 #endif
13391 exit(0);
13392 }
13393 EOCP
13394 set try
13395 if eval $compile_ok; then
13396 o_nonblock=`$run ./try`
13397 case "$o_nonblock" in
13398 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13399 *) echo "Seems like we can use $o_nonblock.";;
13400 esac
13401 else
13402 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13403 fi
13404 ;;
13405 *) echo "Using $hint value $o_nonblock.";;
13406 esac
13407 $rm_try
13408
13409 echo " "
13410 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13411 case "$eagain" in
13412 '')
13413 case "$d_fork:$d_pipe:$d_alarm" in
13414 define:define:define)
13415 $cat head.c > try.c
13416 $cat >>try.c <<EOCP
13417 #include <errno.h>
13418 #include <sys/types.h>
13419 #include <signal.h>
13420 #include <stdio.h>
13421 #$i_stdlib I_STDLIB
13422 #ifdef I_STDLIB
13423 #include <stdlib.h>
13424 #endif
13425 #$i_fcntl I_FCNTL
13426 #ifdef I_FCNTL
13427 #include <fcntl.h>
13428 #endif
13429 #define MY_O_NONBLOCK $o_nonblock
13430 #ifndef errno /* XXX need better Configure test */
13431 extern int errno;
13432 #endif
13433 #$i_unistd I_UNISTD
13434 #ifdef I_UNISTD
13435 #include <unistd.h>
13436 #endif
13437 #include <string.h>
13438 $signal_t blech(int x) { exit(3); }
13439 EOCP
13440 $cat >> try.c <<'EOCP'
13441 int main()
13442 {
13443 int pd[2];
13444 int pu[2];
13445 char buf[1];
13446 char string[100];
13447 int ret;
13448
13449 ret = pipe(pd); /* Down: child -> parent */
13450 if (ret != 0)
13451 exit(3);
13452 ret = pipe(pu); /* Up: parent -> child */
13453 if (ret != 0)
13454 exit(3);
13455 if (0 != fork()) {
13456 close(pd[1]); /* Parent reads from pd[0] */
13457 close(pu[0]); /* Parent writes (blocking) to pu[1] */
13458 #ifdef F_SETFL
13459 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13460 exit(1);
13461 #else
13462 exit(4);
13463 #endif
13464 signal(SIGALRM, blech);
13465 alarm(5);
13466 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
13467 exit(2);
13468 sprintf(string, "%d\n", ret);
13469 ret = write(2, string, strlen(string));
13470 if (ret != strlen(string))
13471 exit(3);
13472 alarm(0);
13473 #ifdef EAGAIN
13474 if (errno == EAGAIN) {
13475 printf("EAGAIN\n");
13476 goto ok;
13477 }
13478 #endif
13479 #ifdef EWOULDBLOCK
13480 if (errno == EWOULDBLOCK)
13481 printf("EWOULDBLOCK\n");
13482 #endif
13483 ok:
13484 ret = write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
13485 if (ret != 1)
13486 exit(3);
13487 sleep(2); /* Give it time to close our pipe */
13488 alarm(5);
13489 ret = read(pd[0], buf, 1); /* Should read EOF */
13490 alarm(0);
13491 sprintf(string, "%d\n", ret);
13492 ret = write(4, string, strlen(string));
13493 if (ret != strlen(string))
13494 exit(3);
13495 exit(0);
13496 }
13497
13498 close(pd[0]); /* We write to pd[1] */
13499 close(pu[1]); /* We read from pu[0] */
13500 ret = read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
13501 if (ret != 1)
13502 exit(3);
13503 close(pd[1]); /* Pipe pd is now fully closed! */
13504 exit(0); /* Bye bye, thank you for playing! */
13505 }
13506 EOCP
13507 set try
13508 if eval $compile_ok; then
13509 echo "$startsh" >mtry
13510 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13511 chmod +x mtry
13512 $run ./mtry >/dev/null 2>&1
13513 case $? in
13514 0) eagain=`$cat try.out`;;
13515 1) echo "Could not perform non-blocking setting!";;
13516 2) echo "I did a successful read() for something that was not there!";;
13517 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13518 4) echo "Could not find F_SETFL!";;
13519 *) echo "Something terribly wrong happened during testing.";;
13520 esac
13521 rd_nodata=`$cat try.ret`
13522 echo "A read() system call with no data present returns $rd_nodata."
13523 case "$rd_nodata" in
13524 0|-1) ;;
13525 *)
13526 echo "(That's peculiar, fixing that to be -1.)"
13527 rd_nodata=-1
13528 ;;
13529 esac
13530 case "$eagain" in
13531 '')
13532 echo "Forcing errno EAGAIN on read() with no data available."
13533 eagain=EAGAIN
13534 ;;
13535 *)
13536 echo "Your read() sets errno to $eagain when no data is available."
13537 ;;
13538 esac
13539 status=`$cat try.err`
13540 case "$status" in
13541 0) echo "And it correctly returns 0 to signal EOF.";;
13542 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13543 *) echo "However, your read() returns '$status' on EOF??";;
13544 esac
13545 val="$define"
13546 if test "$status" = "$rd_nodata"; then
13547 echo "WARNING: you can't distinguish between EOF and no data!"
13548 val="$undef"
13549 fi
13550 else
13551 echo "I can't compile the test program--assuming errno EAGAIN will do."
13552 eagain=EAGAIN
13553 fi
13554 ;;
13555 *) echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13556 eagain=EAGAIN
13557 val="$define"
13558 ;;
13559 esac
13560 set d_eofnblk
13561 eval $setvar
13562 ;;
13563 *)
13564 echo "Using $hint value $eagain."
13565 echo "Your read() returns $rd_nodata when no data is present."
13566 case "$d_eofnblk" in
13567 "$define") echo "And you can see EOF because read() returns 0.";;
13568 "$undef") echo "But you can't see EOF status from read() returned value.";;
13569 *)
13570 echo "(Assuming you can't see EOF status from read anyway.)"
13571 d_eofnblk=$undef
13572 ;;
13573 esac
13574 ;;
13575 esac
13576 $rm_try head.c mtry
13577
13578 : see if erf exists
13579 set erf d_erf
13580 eval $inlibc
13581
13582 : see if erfc exists
13583 set erfc d_erfc
13584 eval $inlibc
13585
13586 : see if exp2 exists
13587 set exp2 d_exp2
13588 eval $inlibc
13589
13590 : see if expm1 exists
13591 set expm1 d_expm1
13592 eval $inlibc
13593
13594 : see if _ptr and _cnt from stdio act std
13595 echo " "
13596
13597 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13598 echo "(Looks like you have stdio.h from BSD.)"
13599 case "$stdio_ptr" in
13600 '') stdio_ptr='((fp)->_p)'
13601 ptr_lval=$define
13602 ;;
13603 *) ptr_lval=$d_stdio_ptr_lval;;
13604 esac
13605 case "$stdio_cnt" in
13606 '') stdio_cnt='((fp)->_r)'
13607 cnt_lval=$define
13608 ;;
13609 *) cnt_lval=$d_stdio_cnt_lval;;
13610 esac
13611 case "$stdio_base" in
13612 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13613 esac
13614 case "$stdio_bufsiz" in
13615 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13616 esac
13617 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13618 echo "(Looks like you have stdio.h from Linux.)"
13619 case "$stdio_ptr" in
13620 '') stdio_ptr='((fp)->_IO_read_ptr)'
13621 ptr_lval=$define
13622 ;;
13623 *) ptr_lval=$d_stdio_ptr_lval;;
13624 esac
13625 case "$stdio_cnt" in
13626 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13627 cnt_lval=$undef
13628 ;;
13629 *) cnt_lval=$d_stdio_cnt_lval;;
13630 esac
13631 case "$stdio_base" in
13632 '') stdio_base='((fp)->_IO_read_base)';;
13633 esac
13634 case "$stdio_bufsiz" in
13635 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13636 esac
13637 else
13638 case "$stdio_ptr" in
13639 '') stdio_ptr='((fp)->_ptr)'
13640 ptr_lval=$define
13641 ;;
13642 *) ptr_lval=$d_stdio_ptr_lval;;
13643 esac
13644 case "$stdio_cnt" in
13645 '') stdio_cnt='((fp)->_cnt)'
13646 cnt_lval=$define
13647 ;;
13648 *) cnt_lval=$d_stdio_cnt_lval;;
13649 esac
13650 case "$stdio_base" in
13651 '') stdio_base='((fp)->_base)';;
13652 esac
13653 case "$stdio_bufsiz" in
13654 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13655 esac
13656 fi
13657
13658 : test whether _ptr and _cnt really work
13659 echo "Checking how std your stdio is..." >&4
13660 $cat >try.c <<EOP
13661 #include <stdio.h>
13662 #$i_stdlib I_STDLIB
13663 #ifdef I_STDLIB
13664 #include <stdlib.h>
13665 #endif
13666 #include <string.h>
13667 #define FILE_ptr(fp) $stdio_ptr
13668 #define FILE_cnt(fp) $stdio_cnt
13669 int main() {
13670 FILE *fp = fopen("try.c", "r");
13671 char c = getc(fp);
13672 if (
13673 18 <= FILE_cnt(fp) &&
13674 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13675 )
13676 exit(0);
13677 exit(1);
13678 }
13679 EOP
13680 val="$undef"
13681 set try
13682 if eval $compile && $to try.c; then
13683 if $run ./try; then
13684 echo "Your stdio acts pretty std."
13685 val="$define"
13686 else
13687 echo "Your stdio isn't very std."
13688 fi
13689 else
13690 echo "Your stdio doesn't appear very std."
13691 fi
13692 $rm_try
13693
13694 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13695 # direct buffer manipulation no longer works. The Configure tests
13696 # should be changed to correctly detect this, but until then,
13697 # the following check should at least let perl compile and run.
13698 # (This quick fix should be updated before 5.8.1.)
13699 # To be defensive, reject all unknown versions, and all versions > 2.2.9.
13700 # A. Dougherty, June 3, 2002.
13701 case "$d_gnulibc" in
13702 $define)
13703 case "$gnulibc_version" in
13704 2.[01]*) ;;
13705 2.2) ;;
13706 2.2.[0-9]) ;;
13707 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13708 val="$undef"
13709 ;;
13710 esac
13711 ;;
13712 esac
13713 set d_stdstdio
13714 eval $setvar
13715
13716 : Can _ptr be used as an lvalue?
13717 case "$d_stdstdio$ptr_lval" in
13718 $define$define) val=$define ;;
13719 *) val=$undef ;;
13720 esac
13721 set d_stdio_ptr_lval
13722 eval $setvar
13723
13724 : Can _cnt be used as an lvalue?
13725 case "$d_stdstdio$cnt_lval" in
13726 $define$define) val=$define ;;
13727 *) val=$undef ;;
13728 esac
13729 set d_stdio_cnt_lval
13730 eval $setvar
13731
13732
13733 : test whether setting _ptr sets _cnt as a side effect
13734 d_stdio_ptr_lval_sets_cnt="$undef"
13735 d_stdio_ptr_lval_nochange_cnt="$undef"
13736 case "$d_stdio_ptr_lval$d_stdstdio" in
13737 $define$define)
13738 echo "Checking to see what happens if we set the stdio ptr..." >&4
13739 $cat >try.c <<EOP
13740 #include <stdio.h>
13741 /* Can we scream? */
13742 /* Eat dust sed :-) */
13743 /* In the buffer space, no one can hear you scream. */
13744 #$i_stdlib I_STDLIB
13745 #ifdef I_STDLIB
13746 #include <stdlib.h>
13747 #endif
13748 #define FILE_ptr(fp) $stdio_ptr
13749 #define FILE_cnt(fp) $stdio_cnt
13750 #include <sys/types.h>
13751 int main() {
13752 FILE *fp = fopen("try.c", "r");
13753 int c;
13754 char *ptr;
13755 size_t cnt;
13756 if (!fp) {
13757 puts("Fail even to read");
13758 exit(1);
13759 }
13760 c = getc(fp); /* Read away the first # */
13761 if (c == EOF) {
13762 puts("Fail even to read");
13763 exit(1);
13764 }
13765 if (!(
13766 18 <= FILE_cnt(fp) &&
13767 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13768 )) {
13769 puts("Fail even to read");
13770 exit (1);
13771 }
13772 ptr = (char*) FILE_ptr(fp);
13773 cnt = (size_t)FILE_cnt(fp);
13774
13775 FILE_ptr(fp) += 42;
13776
13777 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13778 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13779 exit (1);
13780 }
13781 if (FILE_cnt(fp) <= 20) {
13782 printf ("Fail (<20 chars to test)");
13783 exit (1);
13784 }
13785 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13786 puts("Fail compare");
13787 exit (1);
13788 }
13789 if (cnt == FILE_cnt(fp)) {
13790 puts("Pass_unchanged");
13791 exit (0);
13792 }
13793 if (FILE_cnt(fp) == (cnt - 42)) {
13794 puts("Pass_changed");
13795 exit (0);
13796 }
13797 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13798 return 1;
13799
13800 }
13801 EOP
13802 set try
13803 if eval $compile && $to try.c; then
13804 case `$run ./try` in
13805 Pass_changed)
13806 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
13807 d_stdio_ptr_lval_sets_cnt="$define" ;;
13808 Pass_unchanged)
13809 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
13810 d_stdio_ptr_lval_nochange_cnt="$define" ;;
13811 Fail*)
13812 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
13813 *)
13814 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13815 esac
13816 else
13817 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
13818 fi
13819 $rm_try
13820 ;;
13821 esac
13822
13823 : see if _base is also standard
13824 val="$undef"
13825 case "$d_stdstdio" in
13826 $define)
13827 $cat >try.c <<EOP
13828 #include <stdio.h>
13829 #$i_stdlib I_STDLIB
13830 #ifdef I_STDLIB
13831 #include <stdlib.h>
13832 #endif
13833 #define FILE_base(fp) $stdio_base
13834 #define FILE_bufsiz(fp) $stdio_bufsiz
13835 int main() {
13836 FILE *fp = fopen("try.c", "r");
13837 char c = getc(fp);
13838 if (
13839 19 <= FILE_bufsiz(fp) &&
13840 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13841 )
13842 exit(0);
13843 exit(1);
13844 }
13845 EOP
13846 set try
13847 if eval $compile && $to try.c; then
13848 if $run ./try; then
13849 echo "And its _base field acts std."
13850 val="$define"
13851 else
13852 echo "But its _base field isn't std."
13853 fi
13854 else
13855 echo "However, it seems to be lacking the _base field."
13856 fi
13857 $rm_try
13858 ;;
13859 esac
13860 set d_stdiobase
13861 eval $setvar
13862
13863 : see if fast_stdio exists
13864 val="$undef"
13865 case "$d_stdstdio:$d_stdio_ptr_lval" in
13866 "$define:$define")
13867 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13868 *$define*)
13869 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >&4
13870 val="$define"
13871 ;;
13872 esac
13873 ;;
13874 esac
13875 set d_faststdio
13876 eval $setvar
13877
13878 : see if fchdir exists
13879 set fchdir d_fchdir
13880 eval $inlibc
13881
13882 : see if fchmod exists
13883 set fchmod d_fchmod
13884 eval $inlibc
13885
13886 : check for openat, unlinkat, renameat, linkat, fchmodat
13887 set openat d_openat
13888 eval $inlibc
13889
13890 set unlinkat d_unlinkat
13891 eval $inlibc
13892
13893 set renameat d_renameat
13894 eval $inlibc
13895
13896 set linkat d_linkat
13897 eval $inlibc
13898
13899 set fchmodat d_fchmodat
13900 eval $inlibc
13901
13902 : see if fchown exists
13903 set fchown d_fchown
13904 eval $inlibc
13905
13906 : see if this is an fcntl system
13907 set fcntl d_fcntl
13908 eval $inlibc
13909
13910 : See if fcntl-based locking works.
13911 echo " "
13912 $cat >try.c <<EOCP
13913 #$i_stdlib I_STDLIB
13914 #ifdef I_STDLIB
13915 #include <stdlib.h>
13916 #endif
13917 #include <unistd.h>
13918 #include <fcntl.h>
13919 #include <signal.h>
13920 $signal_t blech(int x) { exit(3); }
13921 int main() {
13922 #if defined(F_SETLK) && defined(F_SETLKW)
13923 struct flock flock;
13924 int retval, fd;
13925 fd = open("try.c", O_RDONLY);
13926 flock.l_type = F_RDLCK;
13927 flock.l_whence = SEEK_SET;
13928 flock.l_start = flock.l_len = 0;
13929 signal(SIGALRM, blech);
13930 alarm(10);
13931 retval = fcntl(fd, F_SETLK, &flock);
13932 close(fd);
13933 (retval < 0 ? exit(2) : exit(0));
13934 #else
13935 exit(2);
13936 #endif
13937 }
13938 EOCP
13939 echo "Checking if fcntl-based file locking works... "
13940 case "$d_fcntl" in
13941 "$define")
13942 set try
13943 if eval $compile_ok; then
13944 if $run ./try; then
13945 echo "Yes, it seems to work."
13946 val="$define"
13947 else
13948 echo "Nope, it didn't work."
13949 val="$undef"
13950 case "$?" in
13951 3) $cat >&4 <<EOM
13952 ***
13953 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13954 *** This is (almost) impossible.
13955 *** If your NFS lock daemons are not feeling well, something like
13956 *** this may happen, please investigate. Cannot continue, aborting.
13957 ***
13958 EOM
13959 exit 1
13960 ;;
13961 esac
13962 fi
13963 else
13964 echo "I'm unable to compile the test program, so I'll assume not."
13965 val="$undef"
13966 fi
13967 ;;
13968 *) val="$undef";
13969 echo "Nope, since you don't even have fcntl()."
13970 ;;
13971 esac
13972 set d_fcntl_can_lock
13973 eval $setvar
13974 $rm_try
13975
13976 : check for fd_set items
13977 $cat <<EOM
13978
13979 Checking to see how well your C compiler handles fd_set and friends ...
13980 EOM
13981 $cat >try.c <<EOCP
13982 #$i_stdlib I_STDLIB
13983 #ifdef I_STDLIB
13984 #include <stdlib.h>
13985 #endif
13986 #$i_systime I_SYS_TIME
13987 #$i_sysselct I_SYS_SELECT
13988 #$d_socket HAS_SOCKET
13989 #include <sys/types.h>
13990 #ifdef HAS_SOCKET
13991 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13992 #endif
13993 #ifdef I_SYS_TIME
13994 #include <sys/time.h>
13995 #endif
13996 #ifdef I_SYS_SELECT
13997 #include <sys/select.h>
13998 #endif
13999 int main() {
14000 fd_set fds;
14001
14002 #ifdef TRYBITS
14003 if(fds.fds_bits);
14004 #endif
14005
14006 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
14007 exit(0);
14008 #else
14009 exit(1);
14010 #endif
14011 }
14012 EOCP
14013 set try -DTRYBITS
14014 if eval $compile; then
14015 d_fds_bits="$define"
14016 d_fd_set="$define"
14017 echo "Well, your system knows about the normal fd_set typedef..." >&4
14018 if $run ./try; then
14019 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
14020 d_fd_macros="$define"
14021 else
14022 $cat >&4 <<'EOM'
14023 but not the normal fd_set macros! Gaaack! I'll have to cover for you.
14024 EOM
14025 d_fd_macros="$undef"
14026 fi
14027 else
14028 $cat <<'EOM'
14029 Hmm, your compiler has some difficulty with fd_set. Checking further...
14030 EOM
14031 set try
14032 if eval $compile; then
14033 d_fds_bits="$undef"
14034 d_fd_set="$define"
14035 echo "Well, your system has some sort of fd_set available..." >&4
14036 if $run ./try; then
14037 echo "and you have the normal fd_set macros." >&4
14038 d_fd_macros="$define"
14039 else
14040 $cat <<'EOM'
14041 but not the normal fd_set macros! Gross! More work for me...
14042 EOM
14043 d_fd_macros="$undef"
14044 fi
14045 else
14046 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
14047 d_fd_set="$undef"
14048 d_fds_bits="$undef"
14049 d_fd_macros="$undef"
14050 fi
14051 fi
14052 $rm_try
14053
14054 : see if fdclose exists
14055 set fdclose d_fdclose
14056 eval $inlibc
14057
14058 : see if fdim exists
14059 set fdim d_fdim
14060 eval $inlibc
14061
14062 : see if fegetround exists
14063 set fegetround d_fegetround
14064 eval $inlibc
14065
14066 : see if ffs exists
14067 set ffs d_ffs
14068 eval $inlibc
14069 : see if ffsl exists
14070 set ffsl d_ffsl
14071 eval $inlibc
14072
14073 : see if fgetpos exists
14074 set fgetpos d_fgetpos
14075 eval $inlibc
14076
14077 : see if finite exists
14078 set finite d_finite
14079 eval $inlibc
14080
14081 : see if finitel exists
14082 set finitel d_finitel
14083 eval $inlibc
14084
14085 : see if flock exists
14086 set flock d_flock
14087 eval $inlibc
14088
14089 : see if prototype for flock is available
14090 echo " "
14091 set d_flockproto flock $i_sysfile sys/file.h
14092 eval $hasproto
14093
14094 : see if fma exists
14095 set fma d_fma
14096 eval $inlibc
14097
14098 : see if fmax exists
14099 set fmax d_fmax
14100 eval $inlibc
14101
14102 : see if fmin exists
14103 set fmin d_fmin
14104 eval $inlibc
14105
14106 : see if fp_class exists
14107 set fp_class d_fp_class
14108 eval $inlibc
14109
14110 : check for fpclassify
14111 echo "Checking to see if you have fpclassify..." >&4
14112 $cat >try.c <<EOCP
14113 #include <math.h>
14114 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14115 EOCP
14116 set try
14117 if eval $compile; then
14118 val="$define"
14119 echo "You have fpclassify."
14120 else
14121 val="$undef"
14122 echo "You do not have fpclassify."
14123 fi
14124 $rm_try
14125 set d_fpclassify
14126 eval $setvar
14127
14128 : see if fp_classify exists
14129 set fp_classify d_fp_classify
14130 eval $inlibc
14131
14132 : see if fp_classl exists
14133 set fp_classl d_fp_classl
14134 eval $inlibc
14135
14136 : see if pathconf exists
14137 set pathconf d_pathconf
14138 eval $inlibc
14139
14140 : see if fpathconf exists
14141 set fpathconf d_fpathconf
14142 eval $inlibc
14143
14144 : see if fpclass exists
14145 set fpclass d_fpclass
14146 eval $inlibc
14147
14148 : see if fpclassl exists
14149 set fpclassl d_fpclassl
14150 eval $inlibc
14151
14152 : see if fpgetround exists
14153 set fpgetround d_fpgetround
14154 eval $inlibc
14155
14156 : check for fpos64_t
14157 echo " "
14158 echo "Checking to see if you have fpos64_t..." >&4
14159 $cat >try.c <<EOCP
14160 #include <stdio.h>
14161 int main() { fpos64_t x = 7; }
14162 EOCP
14163 set try
14164 if eval $compile; then
14165 val="$define"
14166 echo "You have fpos64_t."
14167 else
14168 val="$undef"
14169 echo "You do not have fpos64_t."
14170 case "$fpossize" in
14171 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14172 esac
14173 fi
14174 $rm_try
14175 set d_fpos64_t
14176 eval $setvar
14177
14178 : see if frexpl exists
14179 set frexpl d_frexpl
14180 eval $inlibc
14181
14182 : see if this is a sys/param system
14183 set sys/param.h i_sysparam
14184 eval $inhdr
14185
14186 : see if this is a sys/mount.h system
14187 set sys/mount.h i_sysmount
14188 eval $inhdr
14189
14190 : Check for fs_data_s
14191 echo " "
14192 echo "Checking to see if your system supports struct fs_data..." >&4
14193 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14194 eval $hasstruct
14195 case "$d_fs_data_s" in
14196 "$define") echo "Yes, it does." ;;
14197 *) echo "No, it doesn't." ;;
14198 esac
14199
14200 : see if fseeko exists
14201 set fseeko d_fseeko
14202 eval $inlibc
14203 case "$longsize" in
14204 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14205 esac
14206
14207 : see if fsetpos exists
14208 set fsetpos d_fsetpos
14209 eval $inlibc
14210
14211 : see if fstatfs exists
14212 set fstatfs d_fstatfs
14213 eval $inlibc
14214
14215 : see if statvfs exists
14216 set statvfs d_statvfs
14217 eval $inlibc
14218
14219 : see if fstatvfs exists
14220 set fstatvfs d_fstatvfs
14221 eval $inlibc
14222
14223 : see if fsync exists
14224 set fsync d_fsync
14225 eval $inlibc
14226
14227 : see if ftello exists
14228 set ftello d_ftello
14229 eval $inlibc
14230 case "$longsize" in
14231 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14232 esac
14233
14234 : check for a working futimes
14235 d_futimes="$undef"
14236 echo " "
14237 echo "Checking if you have a working futimes()" >&4
14238 $cat >try.c <<EOCP
14239 #include <stdio.h>
14240 #include <stdlib.h>
14241 #include <sys/time.h>
14242 #include <errno.h>
14243 #include <fcntl.h>
14244 #include <stdlib.h>
14245
14246 int main ()
14247 {
14248 int fd, rv;
14249 fd = open ("try.c", O_RDWR);
14250 if (-1 == fd) exit (1);
14251 rv = futimes (fd, NULL);
14252 exit (rv == -1 ? errno : 0);
14253 }
14254 EOCP
14255 set try
14256 if eval $compile; then
14257 `$run ./try`
14258 rc=$?
14259 case "$rc" in
14260 0) echo "Yes, you have" >&4
14261 d_futimes="$define"
14262 ;;
14263 *) echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14264 ;;
14265 esac
14266 else
14267 echo "No, it does not (probably harmless)" >&4
14268 fi
14269 $rm_try
14270
14271 : look for gai_strerror
14272 echo " "
14273 $cat >try.c <<'EOCP'
14274 #include <sys/types.h>
14275 #include <sys/socket.h>
14276 #include <netdb.h>
14277 int main ()
14278 {
14279 return (gai_strerror (0) ? 0 : 1);
14280 }
14281 EOCP
14282 set try
14283 val="$undef"
14284 if eval $compile; then
14285 `$run ./try`
14286 case "$?" in
14287 0) echo "A working gai_strerror() found." >&4
14288 val="$define" ;;
14289 *) echo "gai_strerror() found, but it doesn't work" >&4
14290 ;;
14291 esac
14292 else
14293 echo "gai_strerror() NOT found." >&4
14294 fi
14295 set d_gai_strerror
14296 eval $setvar
14297 $rm_try
14298
14299 : see if ndbm.h is available
14300 set ndbm.h i_ndbm
14301 eval $inhdr
14302 : Compatibility location for RedHat 7.1
14303 set gdbm/ndbm.h i_gdbmndbm
14304 eval $inhdr
14305 : Compatibility location for Debian 4.0
14306 set gdbm-ndbm.h i_gdbm_ndbm
14307 eval $inhdr
14308
14309 val="$undef"
14310 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14311 : see if dbm_open exists
14312 set dbm_open d_dbm_open
14313 eval $inlibc
14314 case "$d_dbm_open" in
14315 $undef)
14316 i_ndbm="$undef"
14317 i_gdbmndbm="$undef"
14318 i_gdbm_ndbm="$undef"
14319 echo "We won't be including <ndbm.h>"
14320 val="$undef"
14321 ;;
14322 *) val="$define"
14323 ;;
14324 esac
14325 fi
14326 set d_ndbm
14327 eval $setvar
14328
14329 ndbm_hdr_protochk='name=$1; hdr=$2;
14330 eval "ihdr=\$""i_$name";
14331 val="$undef";
14332 if $test "$ihdr" = "$define"; then
14333 $echo "Checking if your <$hdr> uses prototypes..." >&4;
14334 case "$d_cplusplus" in
14335 $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14336 *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14337 esac;
14338 case "$val" in
14339 $define) $echo "Your <$hdr> seems to have prototypes";;
14340 *) $echo "Your <$hdr> does not seem to have prototypes";;
14341 esac;
14342 fi;
14343 set "d_${name}_h_uses_prototypes";
14344 eval $setvar'
14345
14346 set ndbm ndbm.h
14347 eval $ndbm_hdr_protochk
14348 set gdbmndbm gdbm/ndbm.h
14349 eval $ndbm_hdr_protochk
14350 set gdbm_ndbm gdbm-ndbm.h
14351 eval $ndbm_hdr_protochk
14352
14353 : see if getaddrinfo exists
14354 set getaddrinfo d_getaddrinfo
14355 eval $inlibc
14356
14357 : see if getcwd exists
14358 set getcwd d_getcwd
14359 eval $inlibc
14360
14361 : check for getenv behavior
14362 case "$d_getenv_preserves_other_thread" in
14363 '')
14364 $echo "Checking to see if getenv() preserves a different thread's results" >&4
14365 $cat >try.c <<EOCP
14366 #$i_stdlib I_STDLIB
14367 #ifdef I_STDLIB
14368 # include <stdlib.h>
14369 #endif
14370 #include <stdio.h>
14371 #include <string.h>
14372 #$i_pthread I_PTHREAD
14373 #ifdef I_PTHREAD
14374 # include <pthread.h>
14375 #endif
14376
14377 void *
14378 thread_start(void * arg)
14379 {
14380 return (void *) getenv("HOME");
14381 }
14382
14383 int main() {
14384 char * main_buffer;
14385 char save_main_buffer[1000];
14386 pthread_t subthread;
14387 pthread_attr_t attr;
14388
14389 main_buffer = getenv("PATH");
14390
14391 /* If too large for our generous allowance, return we couldn't figure it
14392 * out. */
14393 if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
14394 exit(2);
14395 }
14396
14397 strcpy(save_main_buffer, main_buffer);
14398
14399 if (pthread_attr_init(&attr) != 0) {
14400 exit(2);
14401 }
14402
14403 if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
14404 exit(2);
14405 }
14406
14407 if (pthread_join(subthread, NULL) != 0) {
14408 exit(2);
14409 }
14410
14411 exit(! (strcmp(main_buffer, save_main_buffer) == 0));
14412 }
14413 EOCP
14414 val=
14415 set try
14416 if eval $compile_ok; then
14417 $run ./try
14418 rc=$?
14419 case "$rc" in
14420 0) echo "getenv() didn't destroy another thread's buffer" >&4
14421 val=$define
14422 ;;
14423 1) echo "getenv() does destroy another thread's buffer" >&4
14424 val=$undef
14425 ;;
14426 *) echo "Couldn't determine if getenv() destroys another thread's return value (code=$rc); assuming it does" >&4
14427 val=$undef
14428 ;;
14429 esac
14430 else
14431 echo "(I can't seem to compile the test program.)" >&4
14432 echo "Assuming that your C library's getenv destroys another thread's return value." >&4
14433 val=$undef
14434 fi
14435 set d_getenv_preserves_other_thread
14436 eval $setvar
14437 $rm_try
14438 ;;
14439 esac
14440
14441 : see if getespwnam exists
14442 set getespwnam d_getespwnam
14443 eval $inlibc
14444
14445 : see if getfsstat exists
14446 set getfsstat d_getfsstat
14447 eval $inlibc
14448
14449 : see if getgrent exists
14450 set getgrent d_getgrent
14451 eval $inlibc
14452
14453 : see if getgrent_r exists
14454 set getgrent_r d_getgrent_r
14455 eval $inlibc
14456 case "$d_getgrent_r" in
14457 "$define")
14458 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14459 case "$d_getgrent_r_proto:$usethreads" in
14460 ":define") d_getgrent_r_proto=define
14461 set d_getgrent_r_proto getgrent_r $hdrs
14462 eval $hasproto ;;
14463 *) ;;
14464 esac
14465 case "$d_getgrent_r_proto" in
14466 define)
14467 case "$getgrent_r_proto" in
14468 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14469 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14470 esac
14471 case "$getgrent_r_proto" in
14472 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14473 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14474 esac
14475 case "$getgrent_r_proto" in
14476 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14477 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14478 esac
14479 case "$getgrent_r_proto" in
14480 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14481 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14482 esac
14483 case "$getgrent_r_proto" in
14484 ''|0) try='int getgrent_r(struct group*, char*, int);'
14485 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14486 esac
14487 case "$getgrent_r_proto" in
14488 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14489 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14490 esac
14491 case "$getgrent_r_proto" in
14492 ''|0) d_getgrent_r=undef
14493 getgrent_r_proto=0
14494 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14495 * ) case "$getgrent_r_proto" in
14496 REENTRANT_PROTO*) ;;
14497 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14498 esac
14499 echo "Prototype: $try" ;;
14500 esac
14501 ;;
14502 *) case "$usethreads" in
14503 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14504 esac
14505 d_getgrent_r=undef
14506 getgrent_r_proto=0
14507 ;;
14508 esac
14509 ;;
14510 *) getgrent_r_proto=0
14511 ;;
14512 esac
14513
14514 : see if getgrgid_r exists
14515 set getgrgid_r d_getgrgid_r
14516 eval $inlibc
14517 case "$d_getgrgid_r" in
14518 "$define")
14519 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14520 case "$d_getgrgid_r_proto:$usethreads" in
14521 ":define") d_getgrgid_r_proto=define
14522 set d_getgrgid_r_proto getgrgid_r $hdrs
14523 eval $hasproto ;;
14524 *) ;;
14525 esac
14526 case "$d_getgrgid_r_proto" in
14527 define)
14528 case "$getgrgid_r_proto" in
14529 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14530 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14531 esac
14532 case "$getgrgid_r_proto" in
14533 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14534 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14535 esac
14536 case "$getgrgid_r_proto" in
14537 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14538 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14539 esac
14540 case "$getgrgid_r_proto" in
14541 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14542 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14543 esac
14544 case "$getgrgid_r_proto" in
14545 ''|0) d_getgrgid_r=undef
14546 getgrgid_r_proto=0
14547 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14548 * ) case "$getgrgid_r_proto" in
14549 REENTRANT_PROTO*) ;;
14550 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14551 esac
14552 echo "Prototype: $try" ;;
14553 esac
14554 ;;
14555 *) case "$usethreads" in
14556 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14557 esac
14558 d_getgrgid_r=undef
14559 getgrgid_r_proto=0
14560 ;;
14561 esac
14562 ;;
14563 *) getgrgid_r_proto=0
14564 ;;
14565 esac
14566
14567 : see if getgrnam_r exists
14568 set getgrnam_r d_getgrnam_r
14569 eval $inlibc
14570 case "$d_getgrnam_r" in
14571 "$define")
14572 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14573 case "$d_getgrnam_r_proto:$usethreads" in
14574 ":define") d_getgrnam_r_proto=define
14575 set d_getgrnam_r_proto getgrnam_r $hdrs
14576 eval $hasproto ;;
14577 *) ;;
14578 esac
14579 case "$d_getgrnam_r_proto" in
14580 define)
14581 case "$getgrnam_r_proto" in
14582 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14583 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14584 esac
14585 case "$getgrnam_r_proto" in
14586 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14587 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14588 esac
14589 case "$getgrnam_r_proto" in
14590 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14591 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14592 esac
14593 case "$getgrnam_r_proto" in
14594 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14595 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14596 esac
14597 case "$getgrnam_r_proto" in
14598 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14599 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14600 esac
14601 case "$getgrnam_r_proto" in
14602 ''|0) d_getgrnam_r=undef
14603 getgrnam_r_proto=0
14604 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14605 * ) case "$getgrnam_r_proto" in
14606 REENTRANT_PROTO*) ;;
14607 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14608 esac
14609 echo "Prototype: $try" ;;
14610 esac
14611 ;;
14612 *) case "$usethreads" in
14613 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14614 esac
14615 d_getgrnam_r=undef
14616 getgrnam_r_proto=0
14617 ;;
14618 esac
14619 ;;
14620 *) getgrnam_r_proto=0
14621 ;;
14622 esac
14623
14624 : see if gethostbyaddr exists
14625 set gethostbyaddr d_gethbyaddr
14626 eval $inlibc
14627
14628 : see if gethostbyname exists
14629 set gethostbyname d_gethbyname
14630 eval $inlibc
14631
14632 : see if gethostent exists
14633 set gethostent d_gethent
14634 eval $inlibc
14635
14636 : see how we will look up host name
14637 echo " "
14638 call=''
14639 if set gethostname val -f d_gethname; eval $csym; $val; then
14640 echo 'gethostname() found.' >&4
14641 d_gethname="$define"
14642 call=gethostname
14643 fi
14644 if set uname val -f d_uname; eval $csym; $val; then
14645 if ./xenix; then
14646 $cat <<'EOM'
14647 uname() was found, but you're running xenix, and older versions of xenix
14648 have a broken uname(). If you don't really know whether your xenix is old
14649 enough to have a broken system call, use the default answer.
14650
14651 EOM
14652 dflt=y
14653 case "$d_uname" in
14654 "$define") dflt=n;;
14655 esac
14656 rp='Is your uname() broken?'
14657 . ./myread
14658 case "$ans" in
14659 n*) d_uname="$define"; call=uname;;
14660 esac
14661 else
14662 echo 'uname() found.' >&4
14663 d_uname="$define"
14664 case "$call" in
14665 '') call=uname ;;
14666 esac
14667 fi
14668 fi
14669 case "$d_gethname" in
14670 '') d_gethname="$undef";;
14671 esac
14672 case "$d_uname" in
14673 '') d_uname="$undef";;
14674 esac
14675 case "$d_uname$d_gethname" in
14676 *define*)
14677 dflt=n
14678 cat <<EOM
14679
14680 Every now and then someone has a $call() that lies about the hostname
14681 but can't be fixed for political or economic reasons. If you wish, I can
14682 pretend $call() isn't there and maybe compute hostname at run-time
14683 thanks to the '$phostname' command.
14684
14685 EOM
14686 rp="Shall I ignore $call() from now on?"
14687 . ./myread
14688 case "$ans" in
14689 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14690 esac;;
14691 esac
14692 case "$phostname" in
14693 '') aphostname='';;
14694 *) case "$aphostname" in
14695 /*) ;;
14696 *) set X $phostname
14697 shift
14698 file=$1
14699 shift
14700 file=`./loc $file $file $pth`
14701 aphostname=`echo $file $*`
14702 ;;
14703 esac
14704 ;;
14705 esac
14706 case "$d_uname$d_gethname" in
14707 *define*) ;;
14708 *)
14709 case "$phostname" in
14710 '')
14711 echo "There will be no way for $package to get your hostname." >&4;;
14712 *)
14713 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14714 ;;
14715 esac;;
14716 esac
14717 case "$d_phostname" in
14718 '') d_phostname="$undef";;
14719 esac
14720
14721 : see if gethostbyaddr_r exists
14722 set gethostbyaddr_r d_gethostbyaddr_r
14723 eval $inlibc
14724 case "$d_gethostbyaddr_r" in
14725 "$define")
14726 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14727 case "$d_gethostbyaddr_r_proto:$usethreads" in
14728 ":define") d_gethostbyaddr_r_proto=define
14729 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14730 eval $hasproto ;;
14731 *) ;;
14732 esac
14733 case "$d_gethostbyaddr_r_proto" in
14734 define)
14735 case "$gethostbyaddr_r_proto" in
14736 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14737 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14738 esac
14739 case "$gethostbyaddr_r_proto" in
14740 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14741 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14742 esac
14743 case "$gethostbyaddr_r_proto" in
14744 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14745 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14746 esac
14747 case "$gethostbyaddr_r_proto" in
14748 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14749 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14750 esac
14751 case "$gethostbyaddr_r_proto" in
14752 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14753 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14754 esac
14755 case "$gethostbyaddr_r_proto" in
14756 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14757 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14758 esac
14759 case "$gethostbyaddr_r_proto" in
14760 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14761 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14762 esac
14763 case "$gethostbyaddr_r_proto" in
14764 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14765 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14766 esac
14767 case "$gethostbyaddr_r_proto" in
14768 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14769 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14770 esac
14771 case "$gethostbyaddr_r_proto" in
14772 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14773 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14774 esac
14775 case "$gethostbyaddr_r_proto" in
14776 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14777 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14778 esac
14779 case "$gethostbyaddr_r_proto" in
14780 ''|0) d_gethostbyaddr_r=undef
14781 gethostbyaddr_r_proto=0
14782 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14783 * ) case "$gethostbyaddr_r_proto" in
14784 REENTRANT_PROTO*) ;;
14785 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14786 esac
14787 echo "Prototype: $try" ;;
14788 esac
14789 ;;
14790 *) case "$usethreads" in
14791 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14792 esac
14793 d_gethostbyaddr_r=undef
14794 gethostbyaddr_r_proto=0
14795 ;;
14796 esac
14797 ;;
14798 *) gethostbyaddr_r_proto=0
14799 ;;
14800 esac
14801
14802 : see if gethostbyname_r exists
14803 set gethostbyname_r d_gethostbyname_r
14804 eval $inlibc
14805 case "$d_gethostbyname_r" in
14806 "$define")
14807 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14808 case "$d_gethostbyname_r_proto:$usethreads" in
14809 ":define") d_gethostbyname_r_proto=define
14810 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14811 eval $hasproto ;;
14812 *) ;;
14813 esac
14814 case "$d_gethostbyname_r_proto" in
14815 define)
14816 case "$gethostbyname_r_proto" in
14817 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14818 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14819 esac
14820 case "$gethostbyname_r_proto" in
14821 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14822 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14823 esac
14824 case "$gethostbyname_r_proto" in
14825 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14826 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14827 esac
14828 case "$gethostbyname_r_proto" in
14829 ''|0) d_gethostbyname_r=undef
14830 gethostbyname_r_proto=0
14831 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14832 * ) case "$gethostbyname_r_proto" in
14833 REENTRANT_PROTO*) ;;
14834 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14835 esac
14836 echo "Prototype: $try" ;;
14837 esac
14838 ;;
14839 *) case "$usethreads" in
14840 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14841 esac
14842 d_gethostbyname_r=undef
14843 gethostbyname_r_proto=0
14844 ;;
14845 esac
14846 ;;
14847 *) gethostbyname_r_proto=0
14848 ;;
14849 esac
14850
14851 : see if gethostent_r exists
14852 set gethostent_r d_gethostent_r
14853 eval $inlibc
14854 case "$d_gethostent_r" in
14855 "$define")
14856 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14857 case "$d_gethostent_r_proto:$usethreads" in
14858 ":define") d_gethostent_r_proto=define
14859 set d_gethostent_r_proto gethostent_r $hdrs
14860 eval $hasproto ;;
14861 *) ;;
14862 esac
14863 case "$d_gethostent_r_proto" in
14864 define)
14865 case "$gethostent_r_proto" in
14866 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14867 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14868 esac
14869 case "$gethostent_r_proto" in
14870 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14871 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14872 esac
14873 case "$gethostent_r_proto" in
14874 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14875 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14876 esac
14877 case "$gethostent_r_proto" in
14878 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14879 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14880 esac
14881 case "$gethostent_r_proto" in
14882 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14883 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14884 esac
14885 case "$gethostent_r_proto" in
14886 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14887 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14888 esac
14889 case "$gethostent_r_proto" in
14890 ''|0) d_gethostent_r=undef
14891 gethostent_r_proto=0
14892 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14893 * ) case "$gethostent_r_proto" in
14894 REENTRANT_PROTO*) ;;
14895 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14896 esac
14897 echo "Prototype: $try" ;;
14898 esac
14899 ;;
14900 *) case "$usethreads" in
14901 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14902 esac
14903 d_gethostent_r=undef
14904 gethostent_r_proto=0
14905 ;;
14906 esac
14907 ;;
14908 *) gethostent_r_proto=0
14909 ;;
14910 esac
14911
14912 : see if prototypes for various gethostxxx netdb.h functions are available
14913 echo " "
14914 set d_gethostprotos gethostent $i_netdb netdb.h
14915 eval $hasproto
14916
14917 : see if getitimer exists
14918 set getitimer d_getitimer
14919 eval $inlibc
14920
14921 : see if getlogin exists
14922 set getlogin d_getlogin
14923 eval $inlibc
14924
14925 : see if getlogin_r exists
14926 set getlogin_r d_getlogin_r
14927 eval $inlibc
14928 case "$d_getlogin_r" in
14929 "$define")
14930 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14931 case "$d_getlogin_r_proto:$usethreads" in
14932 ":define") d_getlogin_r_proto=define
14933 set d_getlogin_r_proto getlogin_r $hdrs
14934 eval $hasproto ;;
14935 *) ;;
14936 esac
14937 case "$d_getlogin_r_proto" in
14938 define)
14939 case "$getlogin_r_proto" in
14940 ''|0) try='int getlogin_r(char*, size_t);'
14941 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14942 esac
14943 case "$getlogin_r_proto" in
14944 ''|0) try='int getlogin_r(char*, int);'
14945 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14946 esac
14947 case "$getlogin_r_proto" in
14948 ''|0) try='char* getlogin_r(char*, size_t);'
14949 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14950 esac
14951 case "$getlogin_r_proto" in
14952 ''|0) try='char* getlogin_r(char*, int);'
14953 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14954 esac
14955 case "$getlogin_r_proto" in
14956 ''|0) d_getlogin_r=undef
14957 getlogin_r_proto=0
14958 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14959 * ) case "$getlogin_r_proto" in
14960 REENTRANT_PROTO*) ;;
14961 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14962 esac
14963 echo "Prototype: $try" ;;
14964 esac
14965 ;;
14966 *) case "$usethreads" in
14967 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14968 esac
14969 d_getlogin_r=undef
14970 getlogin_r_proto=0
14971 ;;
14972 esac
14973 ;;
14974 *) getlogin_r_proto=0
14975 ;;
14976 esac
14977
14978 : see if getmnt exists
14979 set getmnt d_getmnt
14980 eval $inlibc
14981
14982 : see if getmntent exists
14983 set getmntent d_getmntent
14984 eval $inlibc
14985
14986 : see if getnameinfo exists
14987 set getnameinfo d_getnameinfo
14988 eval $inlibc
14989
14990 : see if getnetbyaddr exists
14991 set getnetbyaddr d_getnbyaddr
14992 eval $inlibc
14993
14994 : see if getnetbyname exists
14995 set getnetbyname d_getnbyname
14996 eval $inlibc
14997
14998 : see if getnetent exists
14999 set getnetent d_getnent
15000 eval $inlibc
15001
15002 : see if getnetbyaddr_r exists
15003 set getnetbyaddr_r d_getnetbyaddr_r
15004 eval $inlibc
15005 case "$d_getnetbyaddr_r" in
15006 "$define")
15007 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15008 case "$d_getnetbyaddr_r_proto:$usethreads" in
15009 ":define") d_getnetbyaddr_r_proto=define
15010 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
15011 eval $hasproto ;;
15012 *) ;;
15013 esac
15014 case "$d_getnetbyaddr_r_proto" in
15015 define)
15016 case "$getnetbyaddr_r_proto" in
15017 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
15018 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
15019 esac
15020 case "$getnetbyaddr_r_proto" in
15021 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
15022 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
15023 esac
15024 case "$getnetbyaddr_r_proto" in
15025 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
15026 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
15027 esac
15028 case "$getnetbyaddr_r_proto" in
15029 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
15030 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
15031 esac
15032 case "$getnetbyaddr_r_proto" in
15033 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
15034 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
15035 esac
15036 case "$getnetbyaddr_r_proto" in
15037 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
15038 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
15039 esac
15040 case "$getnetbyaddr_r_proto" in
15041 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
15042 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
15043 esac
15044 case "$getnetbyaddr_r_proto" in
15045 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
15046 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
15047 esac
15048 case "$getnetbyaddr_r_proto" in
15049 ''|0) d_getnetbyaddr_r=undef
15050 getnetbyaddr_r_proto=0
15051 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
15052 * ) case "$getnetbyaddr_r_proto" in
15053 REENTRANT_PROTO*) ;;
15054 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
15055 esac
15056 echo "Prototype: $try" ;;
15057 esac
15058 ;;
15059 *) case "$usethreads" in
15060 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
15061 esac
15062 d_getnetbyaddr_r=undef
15063 getnetbyaddr_r_proto=0
15064 ;;
15065 esac
15066 ;;
15067 *) getnetbyaddr_r_proto=0
15068 ;;
15069 esac
15070
15071 : see if getnetbyname_r exists
15072 set getnetbyname_r d_getnetbyname_r
15073 eval $inlibc
15074 case "$d_getnetbyname_r" in
15075 "$define")
15076 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15077 case "$d_getnetbyname_r_proto:$usethreads" in
15078 ":define") d_getnetbyname_r_proto=define
15079 set d_getnetbyname_r_proto getnetbyname_r $hdrs
15080 eval $hasproto ;;
15081 *) ;;
15082 esac
15083 case "$d_getnetbyname_r_proto" in
15084 define)
15085 case "$getnetbyname_r_proto" in
15086 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
15087 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
15088 esac
15089 case "$getnetbyname_r_proto" in
15090 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
15091 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
15092 esac
15093 case "$getnetbyname_r_proto" in
15094 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
15095 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
15096 esac
15097 case "$getnetbyname_r_proto" in
15098 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
15099 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
15100 esac
15101 case "$getnetbyname_r_proto" in
15102 ''|0) d_getnetbyname_r=undef
15103 getnetbyname_r_proto=0
15104 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
15105 * ) case "$getnetbyname_r_proto" in
15106 REENTRANT_PROTO*) ;;
15107 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
15108 esac
15109 echo "Prototype: $try" ;;
15110 esac
15111 ;;
15112 *) case "$usethreads" in
15113 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
15114 esac
15115 d_getnetbyname_r=undef
15116 getnetbyname_r_proto=0
15117 ;;
15118 esac
15119 ;;
15120 *) getnetbyname_r_proto=0
15121 ;;
15122 esac
15123
15124 : see if getnetent_r exists
15125 set getnetent_r d_getnetent_r
15126 eval $inlibc
15127 case "$d_getnetent_r" in
15128 "$define")
15129 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15130 case "$d_getnetent_r_proto:$usethreads" in
15131 ":define") d_getnetent_r_proto=define
15132 set d_getnetent_r_proto getnetent_r $hdrs
15133 eval $hasproto ;;
15134 *) ;;
15135 esac
15136 case "$d_getnetent_r_proto" in
15137 define)
15138 case "$getnetent_r_proto" in
15139 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
15140 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
15141 esac
15142 case "$getnetent_r_proto" in
15143 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
15144 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
15145 esac
15146 case "$getnetent_r_proto" in
15147 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
15148 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
15149 esac
15150 case "$getnetent_r_proto" in
15151 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
15152 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
15153 esac
15154 case "$getnetent_r_proto" in
15155 ''|0) try='int getnetent_r(struct netent*, char*, int);'
15156 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
15157 esac
15158 case "$getnetent_r_proto" in
15159 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
15160 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
15161 esac
15162 case "$getnetent_r_proto" in
15163 ''|0) d_getnetent_r=undef
15164 getnetent_r_proto=0
15165 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
15166 * ) case "$getnetent_r_proto" in
15167 REENTRANT_PROTO*) ;;
15168 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15169 esac
15170 echo "Prototype: $try" ;;
15171 esac
15172 ;;
15173 *) case "$usethreads" in
15174 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15175 esac
15176 d_getnetent_r=undef
15177 getnetent_r_proto=0
15178 ;;
15179 esac
15180 ;;
15181 *) getnetent_r_proto=0
15182 ;;
15183 esac
15184
15185 : see if prototypes for various getnetxxx netdb.h functions are available
15186 echo " "
15187 set d_getnetprotos getnetent $i_netdb netdb.h
15188 eval $hasproto
15189
15190 : see if getpagesize exists
15191 set getpagesize d_getpagsz
15192 eval $inlibc
15193
15194 : Optional checks for getprotobyname and getprotobynumber
15195
15196 : see if getprotobyname exists
15197 set getprotobyname d_getpbyname
15198 eval $inlibc
15199
15200 : see if getprotobynumber exists
15201 set getprotobynumber d_getpbynumber
15202 eval $inlibc
15203
15204 : see if getprotoent exists
15205 set getprotoent d_getpent
15206 eval $inlibc
15207
15208 : see if getpgid exists
15209 set getpgid d_getpgid
15210 eval $inlibc
15211
15212 : see if getpgrp2 exists
15213 set getpgrp2 d_getpgrp2
15214 eval $inlibc
15215
15216 : see if getppid exists
15217 set getppid d_getppid
15218 eval $inlibc
15219
15220 : see if getpriority exists
15221 set getpriority d_getprior
15222 eval $inlibc
15223
15224 : see if getprotobyname_r exists
15225 set getprotobyname_r d_getprotobyname_r
15226 eval $inlibc
15227 case "$d_getprotobyname_r" in
15228 "$define")
15229 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15230 case "$d_getprotobyname_r_proto:$usethreads" in
15231 ":define") d_getprotobyname_r_proto=define
15232 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15233 eval $hasproto ;;
15234 *) ;;
15235 esac
15236 case "$d_getprotobyname_r_proto" in
15237 define)
15238 case "$getprotobyname_r_proto" in
15239 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15240 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15241 esac
15242 case "$getprotobyname_r_proto" in
15243 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15244 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15245 esac
15246 case "$getprotobyname_r_proto" in
15247 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15248 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15249 esac
15250 case "$getprotobyname_r_proto" in
15251 ''|0) d_getprotobyname_r=undef
15252 getprotobyname_r_proto=0
15253 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15254 * ) case "$getprotobyname_r_proto" in
15255 REENTRANT_PROTO*) ;;
15256 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15257 esac
15258 echo "Prototype: $try" ;;
15259 esac
15260 ;;
15261 *) case "$usethreads" in
15262 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15263 esac
15264 d_getprotobyname_r=undef
15265 getprotobyname_r_proto=0
15266 ;;
15267 esac
15268 ;;
15269 *) getprotobyname_r_proto=0
15270 ;;
15271 esac
15272
15273 : see if getprotobynumber_r exists
15274 set getprotobynumber_r d_getprotobynumber_r
15275 eval $inlibc
15276 case "$d_getprotobynumber_r" in
15277 "$define")
15278 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15279 case "$d_getprotobynumber_r_proto:$usethreads" in
15280 ":define") d_getprotobynumber_r_proto=define
15281 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15282 eval $hasproto ;;
15283 *) ;;
15284 esac
15285 case "$d_getprotobynumber_r_proto" in
15286 define)
15287 case "$getprotobynumber_r_proto" in
15288 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15289 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15290 esac
15291 case "$getprotobynumber_r_proto" in
15292 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15293 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15294 esac
15295 case "$getprotobynumber_r_proto" in
15296 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15297 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15298 esac
15299 case "$getprotobynumber_r_proto" in
15300 ''|0) d_getprotobynumber_r=undef
15301 getprotobynumber_r_proto=0
15302 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15303 * ) case "$getprotobynumber_r_proto" in
15304 REENTRANT_PROTO*) ;;
15305 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15306 esac
15307 echo "Prototype: $try" ;;
15308 esac
15309 ;;
15310 *) case "$usethreads" in
15311 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15312 esac
15313 d_getprotobynumber_r=undef
15314 getprotobynumber_r_proto=0
15315 ;;
15316 esac
15317 ;;
15318 *) getprotobynumber_r_proto=0
15319 ;;
15320 esac
15321
15322 : see if getprotoent_r exists
15323 set getprotoent_r d_getprotoent_r
15324 eval $inlibc
15325 case "$d_getprotoent_r" in
15326 "$define")
15327 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15328 case "$d_getprotoent_r_proto:$usethreads" in
15329 ":define") d_getprotoent_r_proto=define
15330 set d_getprotoent_r_proto getprotoent_r $hdrs
15331 eval $hasproto ;;
15332 *) ;;
15333 esac
15334 case "$d_getprotoent_r_proto" in
15335 define)
15336 case "$getprotoent_r_proto" in
15337 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15338 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15339 esac
15340 case "$getprotoent_r_proto" in
15341 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15342 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15343 esac
15344 case "$getprotoent_r_proto" in
15345 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15346 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15347 esac
15348 case "$getprotoent_r_proto" in
15349 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15350 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15351 esac
15352 case "$getprotoent_r_proto" in
15353 ''|0) d_getprotoent_r=undef
15354 getprotoent_r_proto=0
15355 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15356 * ) case "$getprotoent_r_proto" in
15357 REENTRANT_PROTO*) ;;
15358 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15359 esac
15360 echo "Prototype: $try" ;;
15361 esac
15362 ;;
15363 *) case "$usethreads" in
15364 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15365 esac
15366 d_getprotoent_r=undef
15367 getprotoent_r_proto=0
15368 ;;
15369 esac
15370 ;;
15371 *) getprotoent_r_proto=0
15372 ;;
15373 esac
15374
15375 : see if prototypes for various getprotoxxx netdb.h functions are available
15376 echo " "
15377 set d_getprotoprotos getprotoent $i_netdb netdb.h
15378 eval $hasproto
15379
15380 : see if getprpwnam exists
15381 set getprpwnam d_getprpwnam
15382 eval $inlibc
15383
15384 : see if getpwent exists
15385 set getpwent d_getpwent
15386 eval $inlibc
15387
15388 : see if getpwent_r exists
15389 set getpwent_r d_getpwent_r
15390 eval $inlibc
15391 case "$d_getpwent_r" in
15392 "$define")
15393 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15394 case "$d_getpwent_r_proto:$usethreads" in
15395 ":define") d_getpwent_r_proto=define
15396 set d_getpwent_r_proto getpwent_r $hdrs
15397 eval $hasproto ;;
15398 *) ;;
15399 esac
15400 case "$d_getpwent_r_proto" in
15401 define)
15402 case "$getpwent_r_proto" in
15403 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15404 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15405 esac
15406 case "$getpwent_r_proto" in
15407 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15408 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15409 esac
15410 case "$getpwent_r_proto" in
15411 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15412 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15413 esac
15414 case "$getpwent_r_proto" in
15415 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15416 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15417 esac
15418 case "$getpwent_r_proto" in
15419 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15420 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15421 esac
15422 case "$getpwent_r_proto" in
15423 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15424 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15425 esac
15426 case "$getpwent_r_proto" in
15427 ''|0) d_getpwent_r=undef
15428 getpwent_r_proto=0
15429 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15430 * ) case "$getpwent_r_proto" in
15431 REENTRANT_PROTO*) ;;
15432 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15433 esac
15434 echo "Prototype: $try" ;;
15435 esac
15436 ;;
15437 *) case "$usethreads" in
15438 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15439 esac
15440 d_getpwent_r=undef
15441 getpwent_r_proto=0
15442 ;;
15443 esac
15444 ;;
15445 *) getpwent_r_proto=0
15446 ;;
15447 esac
15448
15449 : see if getpwnam_r exists
15450 set getpwnam_r d_getpwnam_r
15451 eval $inlibc
15452 case "$d_getpwnam_r" in
15453 "$define")
15454 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15455 case "$d_getpwnam_r_proto:$usethreads" in
15456 ":define") d_getpwnam_r_proto=define
15457 set d_getpwnam_r_proto getpwnam_r $hdrs
15458 eval $hasproto ;;
15459 *) ;;
15460 esac
15461 case "$d_getpwnam_r_proto" in
15462 define)
15463 case "$getpwnam_r_proto" in
15464 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15465 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15466 esac
15467 case "$getpwnam_r_proto" in
15468 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15469 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15470 esac
15471 case "$getpwnam_r_proto" in
15472 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15473 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15474 esac
15475 case "$getpwnam_r_proto" in
15476 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15477 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15478 esac
15479 case "$getpwnam_r_proto" in
15480 ''|0) d_getpwnam_r=undef
15481 getpwnam_r_proto=0
15482 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15483 * ) case "$getpwnam_r_proto" in
15484 REENTRANT_PROTO*) ;;
15485 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15486 esac
15487 echo "Prototype: $try" ;;
15488 esac
15489 ;;
15490 *) case "$usethreads" in
15491 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15492 esac
15493 d_getpwnam_r=undef
15494 getpwnam_r_proto=0
15495 ;;
15496 esac
15497 ;;
15498 *) getpwnam_r_proto=0
15499 ;;
15500 esac
15501
15502 : see if getpwuid_r exists
15503 set getpwuid_r d_getpwuid_r
15504 eval $inlibc
15505 case "$d_getpwuid_r" in
15506 "$define")
15507 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15508 case "$d_getpwuid_r_proto:$usethreads" in
15509 ":define") d_getpwuid_r_proto=define
15510 set d_getpwuid_r_proto getpwuid_r $hdrs
15511 eval $hasproto ;;
15512 *) ;;
15513 esac
15514 case "$d_getpwuid_r_proto" in
15515 define)
15516 case "$getpwuid_r_proto" in
15517 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15518 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15519 esac
15520 case "$getpwuid_r_proto" in
15521 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15522 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15523 esac
15524 case "$getpwuid_r_proto" in
15525 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15526 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15527 esac
15528 case "$getpwuid_r_proto" in
15529 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15530 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15531 esac
15532 case "$getpwuid_r_proto" in
15533 ''|0) d_getpwuid_r=undef
15534 getpwuid_r_proto=0
15535 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15536 * ) case "$getpwuid_r_proto" in
15537 REENTRANT_PROTO*) ;;
15538 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15539 esac
15540 echo "Prototype: $try" ;;
15541 esac
15542 ;;
15543 *) case "$usethreads" in
15544 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15545 esac
15546 d_getpwuid_r=undef
15547 getpwuid_r_proto=0
15548 ;;
15549 esac
15550 ;;
15551 *) getpwuid_r_proto=0
15552 ;;
15553 esac
15554
15555 : Optional checks for getsbyname and getsbyport
15556
15557 : see if getservbyname exists
15558 set getservbyname d_getsbyname
15559 eval $inlibc
15560
15561 : see if getservbyport exists
15562 set getservbyport d_getsbyport
15563 eval $inlibc
15564
15565 : see if getservent exists
15566 set getservent d_getsent
15567 eval $inlibc
15568
15569 : see if getservbyname_r exists
15570 set getservbyname_r d_getservbyname_r
15571 eval $inlibc
15572 case "$d_getservbyname_r" in
15573 "$define")
15574 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15575 case "$d_getservbyname_r_proto:$usethreads" in
15576 ":define") d_getservbyname_r_proto=define
15577 set d_getservbyname_r_proto getservbyname_r $hdrs
15578 eval $hasproto ;;
15579 *) ;;
15580 esac
15581 case "$d_getservbyname_r_proto" in
15582 define)
15583 case "$getservbyname_r_proto" in
15584 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15585 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15586 esac
15587 case "$getservbyname_r_proto" in
15588 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15589 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15590 esac
15591 case "$getservbyname_r_proto" in
15592 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15593 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15594 esac
15595 case "$getservbyname_r_proto" in
15596 ''|0) d_getservbyname_r=undef
15597 getservbyname_r_proto=0
15598 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15599 * ) case "$getservbyname_r_proto" in
15600 REENTRANT_PROTO*) ;;
15601 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15602 esac
15603 echo "Prototype: $try" ;;
15604 esac
15605 ;;
15606 *) case "$usethreads" in
15607 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15608 esac
15609 d_getservbyname_r=undef
15610 getservbyname_r_proto=0
15611 ;;
15612 esac
15613 ;;
15614 *) getservbyname_r_proto=0
15615 ;;
15616 esac
15617
15618 : see if getservbyport_r exists
15619 set getservbyport_r d_getservbyport_r
15620 eval $inlibc
15621 case "$d_getservbyport_r" in
15622 "$define")
15623 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15624 case "$d_getservbyport_r_proto:$usethreads" in
15625 ":define") d_getservbyport_r_proto=define
15626 set d_getservbyport_r_proto getservbyport_r $hdrs
15627 eval $hasproto ;;
15628 *) ;;
15629 esac
15630 case "$d_getservbyport_r_proto" in
15631 define)
15632 case "$getservbyport_r_proto" in
15633 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15634 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15635 esac
15636 case "$getservbyport_r_proto" in
15637 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15638 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15639 esac
15640 case "$getservbyport_r_proto" in
15641 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15642 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15643 esac
15644 case "$getservbyport_r_proto" in
15645 ''|0) d_getservbyport_r=undef
15646 getservbyport_r_proto=0
15647 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15648 * ) case "$getservbyport_r_proto" in
15649 REENTRANT_PROTO*) ;;
15650 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15651 esac
15652 echo "Prototype: $try" ;;
15653 esac
15654 ;;
15655 *) case "$usethreads" in
15656 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15657 esac
15658 d_getservbyport_r=undef
15659 getservbyport_r_proto=0
15660 ;;
15661 esac
15662 ;;
15663 *) getservbyport_r_proto=0
15664 ;;
15665 esac
15666
15667 : see if getservent_r exists
15668 set getservent_r d_getservent_r
15669 eval $inlibc
15670 case "$d_getservent_r" in
15671 "$define")
15672 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15673 case "$d_getservent_r_proto:$usethreads" in
15674 ":define") d_getservent_r_proto=define
15675 set d_getservent_r_proto getservent_r $hdrs
15676 eval $hasproto ;;
15677 *) ;;
15678 esac
15679 case "$d_getservent_r_proto" in
15680 define)
15681 case "$getservent_r_proto" in
15682 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15683 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15684 esac
15685 case "$getservent_r_proto" in
15686 ''|0) try='int getservent_r(struct servent*, char*, int);'
15687 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15688 esac
15689 case "$getservent_r_proto" in
15690 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15691 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15692 esac
15693 case "$getservent_r_proto" in
15694 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15695 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15696 esac
15697 case "$getservent_r_proto" in
15698 ''|0) d_getservent_r=undef
15699 getservent_r_proto=0
15700 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15701 * ) case "$getservent_r_proto" in
15702 REENTRANT_PROTO*) ;;
15703 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15704 esac
15705 echo "Prototype: $try" ;;
15706 esac
15707 ;;
15708 *) case "$usethreads" in
15709 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15710 esac
15711 d_getservent_r=undef
15712 getservent_r_proto=0
15713 ;;
15714 esac
15715 ;;
15716 *) getservent_r_proto=0
15717 ;;
15718 esac
15719
15720 : see if prototypes for various getservxxx netdb.h functions are available
15721 echo " "
15722 set d_getservprotos getservent $i_netdb netdb.h
15723 eval $hasproto
15724
15725 : see if getspnam exists
15726 set getspnam d_getspnam
15727 eval $inlibc
15728
15729 : see if this is a shadow.h system
15730 set shadow.h i_shadow
15731 eval $inhdr
15732
15733 : see if getspnam_r exists
15734 set getspnam_r d_getspnam_r
15735 eval $inlibc
15736 case "$d_getspnam_r" in
15737 "$define")
15738 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15739 case "$d_getspnam_r_proto:$usethreads" in
15740 ":define") d_getspnam_r_proto=define
15741 set d_getspnam_r_proto getspnam_r $hdrs
15742 eval $hasproto ;;
15743 *) ;;
15744 esac
15745 case "$d_getspnam_r_proto" in
15746 define)
15747 case "$getspnam_r_proto" in
15748 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15749 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15750 esac
15751 case "$getspnam_r_proto" in
15752 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15753 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15754 esac
15755 case "$getspnam_r_proto" in
15756 ''|0) d_getspnam_r=undef
15757 getspnam_r_proto=0
15758 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15759 * ) case "$getspnam_r_proto" in
15760 REENTRANT_PROTO*) ;;
15761 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15762 esac
15763 echo "Prototype: $try" ;;
15764 esac
15765 ;;
15766 *) case "$usethreads" in
15767 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15768 esac
15769 d_getspnam_r=undef
15770 getspnam_r_proto=0
15771 ;;
15772 esac
15773 ;;
15774 *) getspnam_r_proto=0
15775 ;;
15776 esac
15777
15778 : see if gettimeofday or ftime exists
15779 set gettimeofday d_gettimeod
15780 eval $inlibc
15781 case "$d_gettimeod" in
15782 "$undef")
15783 set ftime d_ftime
15784 eval $inlibc
15785 ;;
15786 *)
15787 val="$undef"; set d_ftime; eval $setvar
15788 ;;
15789 esac
15790 case "$d_gettimeod$d_ftime" in
15791 "$undef$undef")
15792 echo " "
15793 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15794 ;;
15795 esac
15796
15797 : see if gmtime_r exists
15798 set gmtime_r d_gmtime_r
15799 eval $inlibc
15800 case "$d_gmtime_r" in
15801 "$define")
15802 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15803 case "$d_gmtime_r_proto:$usethreads" in
15804 ":define") d_gmtime_r_proto=define
15805 set d_gmtime_r_proto gmtime_r $hdrs
15806 eval $hasproto ;;
15807 *) ;;
15808 esac
15809 case "$d_gmtime_r_proto" in
15810 define)
15811 case "$gmtime_r_proto" in
15812 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15813 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15814 esac
15815 case "$gmtime_r_proto" in
15816 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15817 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15818 esac
15819 case "$gmtime_r_proto" in
15820 ''|0) d_gmtime_r=undef
15821 gmtime_r_proto=0
15822 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15823 * ) case "$gmtime_r_proto" in
15824 REENTRANT_PROTO*) ;;
15825 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15826 esac
15827 echo "Prototype: $try" ;;
15828 esac
15829 ;;
15830 *) case "$usethreads" in
15831 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15832 esac
15833 d_gmtime_r=undef
15834 gmtime_r_proto=0
15835 ;;
15836 esac
15837 ;;
15838 *) gmtime_r_proto=0
15839 ;;
15840 esac
15841
15842 : see if hasmntopt exists
15843 set hasmntopt d_hasmntopt
15844 eval $inlibc
15845
15846 : see if this is a netinet/in.h or sys/in.h system
15847 set netinet/in.h i_niin sys/in.h i_sysin
15848 eval $inhdr
15849
15850 : see if arpa/inet.h has to be included
15851 set arpa/inet.h i_arpainet
15852 eval $inhdr
15853
15854 : see if htonl --and friends-- exists
15855 val=''
15856 set htonl val
15857 eval $inlibc
15858
15859 : Maybe they are macros.
15860 case "$val" in
15861 $undef)
15862 $cat >htonl.c <<EOM
15863 #include <stdio.h>
15864 #include <sys/types.h>
15865 #$i_niin I_NETINET_IN
15866 #$i_sysin I_SYS_IN
15867 #$i_arpainet I_ARPA_INET
15868 #ifdef I_NETINET_IN
15869 #include <netinet/in.h>
15870 #endif
15871 #ifdef I_SYS_IN
15872 #include <sys/in.h>
15873 #endif
15874 #ifdef I_ARPA_INET
15875 #include <arpa/inet.h>
15876 #endif
15877 #ifdef htonl
15878 printf("Defined as a macro.");
15879 #endif
15880 EOM
15881 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15882 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15883 val="$define"
15884 echo "But it seems to be defined as a macro." >&4
15885 fi
15886 $rm -f htonl.?
15887 ;;
15888 esac
15889 set d_htonl
15890 eval $setvar
15891
15892 : see if hypot exists
15893 set hypot d_hypot
15894 eval $inlibc
15895
15896 : see if ilogb exists
15897 set ilogb d_ilogb
15898 eval $inlibc
15899
15900 : see if ilogbl exists
15901 set ilogbl d_ilogbl
15902 eval $inlibc
15903
15904 : check whether inet_aton exists
15905 set inet_aton d_inetaton
15906 eval $inlibc
15907
15908 : see if inet_ntop exists
15909 set inet_ntop d_inetntop
15910 eval $inlibc
15911
15912 : see if inet_pton exists
15913 set inet_pton d_inetpton
15914 eval $inlibc
15915
15916 : Look for isascii
15917 echo " "
15918 $cat >isascii.c <<EOCP
15919 #include <stdio.h>
15920 #include <ctype.h>
15921 #$i_stdlib I_STDLIB
15922 #ifdef I_STDLIB
15923 #include <stdlib.h>
15924 #endif
15925 int main() {
15926 int c = 'A';
15927 if (isascii(c))
15928 exit(0);
15929 else
15930 exit(1);
15931 }
15932 EOCP
15933 set isascii
15934 if eval $compile; then
15935 echo "isascii() found." >&4
15936 val="$define"
15937 else
15938 echo "isascii() NOT found." >&4
15939 val="$undef"
15940 fi
15941 set d_isascii
15942 eval $setvar
15943 $rm -f isascii*
15944
15945 : Look for isblank
15946 echo " "
15947 $cat >isblank.c <<'EOCP'
15948 #include <stdio.h>
15949 #include <ctype.h>
15950 int main() {
15951 int c = ' ';
15952 if (isblank(c))
15953 return 0 ;
15954 else
15955 return 1 ;
15956 }
15957 EOCP
15958 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15959 echo "isblank() found." >&4
15960 val="$define"
15961 else
15962 echo "isblank() NOT found." >&4
15963 val="$undef"
15964 fi
15965 set d_isblank
15966 eval $setvar
15967 $rm -f isblank*
15968
15969 : check for isfinite
15970 echo "Checking to see if you have isfinite..." >&4
15971 $cat >try.c <<EOCP
15972 #include <math.h>
15973 int main() { return isfinite(0.0); }
15974 EOCP
15975 set try
15976 if eval $compile; then
15977 val="$define"
15978 echo "You have isfinite."
15979 else
15980 val="$undef"
15981 echo "You do not have isfinite."
15982 fi
15983 $rm_try
15984 set d_isfinite
15985 eval $setvar
15986
15987 : see if isfinitel exists
15988 set isfinitel d_isfinitel
15989 eval $inlibc
15990
15991 : check for isinf
15992 echo "Checking to see if you have isinf..." >&4
15993 $cat >try.c <<EOCP
15994 #include <math.h>
15995 int main() { return isinf(0.0); }
15996 EOCP
15997 set try
15998 if eval $compile; then
15999 val="$define"
16000 echo "You have isinf."
16001 else
16002 val="$undef"
16003 echo "You do not have isinf."
16004 fi
16005 $rm_try
16006 set d_isinf
16007 eval $setvar
16008
16009 : see if isinfl exists
16010 set isinfl d_isinfl
16011 eval $inlibc
16012
16013 : check for isless
16014 echo "Checking to see if you have isless..." >&4
16015 $cat >try.c <<EOCP
16016 #include <math.h>
16017 int main() { return isless(2.0, 1.0); }
16018 EOCP
16019 set try
16020 if eval $compile; then
16021 val="$define"
16022 echo "You have isless."
16023 else
16024 val="$undef"
16025 echo "You do not have isless."
16026 fi
16027 $rm_try
16028 set d_isless
16029 eval $setvar
16030
16031 : check for isnan
16032 echo "Checking to see if you have isnan..." >&4
16033 $cat >try.c <<EOCP
16034 #include <math.h>
16035 int main() { return isnan(0.0); }
16036 EOCP
16037 set try
16038 if eval $compile; then
16039 val="$define"
16040 echo "You have isnan."
16041 else
16042 val="$undef"
16043 echo "You do not have isnan."
16044 fi
16045 $rm_try
16046 set d_isnan
16047 eval $setvar
16048
16049 : see if isnanl exists
16050 set isnanl d_isnanl
16051 eval $inlibc
16052
16053 : check for isnormal
16054 echo "Checking to see if you have isnormal..." >&4
16055 $cat >try.c <<EOCP
16056 #include <math.h>
16057 int main() { return isnormal(0.0); }
16058 EOCP
16059 set try
16060 if eval $compile; then
16061 val="$define"
16062 echo "You have isnormal."
16063 else
16064 val="$undef"
16065 echo "You do not have isnormal."
16066 fi
16067 $rm_try
16068 set d_isnormal
16069 eval $setvar
16070
16071 : see if j0 exists
16072 set j0 d_j0
16073 eval $inlibc
16074
16075 : see if j0l exists
16076 set j0l d_j0l
16077 eval $inlibc
16078
16079 : see if killpg exists
16080 set killpg d_killpg
16081 eval $inlibc
16082
16083 : see if localeconv exists
16084 set localeconv d_locconv
16085 eval $inlibc
16086
16087 : see if libc has the POSIX.1-2008 currency locale rules
16088 case "$d_locconv:$d_lc_monetary_2008" in
16089 $define:)
16090 $cat >try.c <<EOCP
16091 #include <locale.h>
16092 int main() {
16093 struct lconv *lc = localeconv();
16094 char int_p_cs_precedes = lc->int_p_cs_precedes;
16095 return 0;
16096 }
16097 EOCP
16098 set try
16099 if eval $compile; then
16100 d_lc_monetary_2008="$define"
16101 else
16102 d_lc_monetary_2008="$undef"
16103 fi;
16104 $rm_try
16105 ;;
16106 *) d_lc_monetary_2008="$undef"
16107 ;;
16108 esac
16109
16110 : see if lchown exists
16111 echo " "
16112 $cat > try.c <<EOCP
16113 #include <pwd.h>
16114 #include <stdio.h>
16115 #include <stdlib.h>
16116 #$i_unistd I_UNISTD
16117 #ifdef I_UNISTD
16118 # include <unistd.h>
16119 #endif
16120 int main(int argc, char *argv[])
16121 {
16122 if (lchown("./try.c", -1, getgid()) == -1) {
16123 exit(EXIT_FAILURE);
16124 }
16125 exit(EXIT_SUCCESS);
16126 }
16127 EOCP
16128 set try
16129 if eval $compile && ./try; then
16130 $echo "lchown() found." >&4
16131 val="$define"
16132 else
16133 $echo "lchown() NOT found." >&4
16134 val="$undef"
16135 fi
16136 set d_lchown
16137 eval $setvar
16138 $rm_try
16139
16140 : See if number of significant digits in a double precision number is known
16141 echo " "
16142 $cat >ldbl_dig.c <<EOM
16143 #include <limits.h>
16144 #include <float.h>
16145 #ifdef LDBL_DIG
16146 printf("Contains LDBL_DIG");
16147 #endif
16148 EOM
16149 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16150 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16151 echo "LDBL_DIG found." >&4
16152 val="$define"
16153 else
16154 echo "LDBL_DIG NOT found." >&4
16155 val="$undef"
16156 fi
16157 $rm -f ldbl_dig.?
16158 set d_ldbl_dig
16159 eval $setvar
16160
16161 : see if lgamma exists
16162 set lgamma d_lgamma
16163 eval $inlibc
16164
16165 : see if lgamma_r exists
16166 set lgamma_r d_lgamma_r
16167 eval $inlibc
16168
16169 : check to see if math.h defines _LIB_VERSION
16170 d_libm_lib_version="$undef"
16171 echo " "
16172 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16173 $cat >try.c <<EOCP
16174 #include <unistd.h>
16175 #include <math.h>
16176 #include <stdio.h>
16177 int main (int argc, char *argv[])
16178 {
16179 printf ("%d\n", _LIB_VERSION);
16180 return (0);
16181 } /* main */
16182 EOCP
16183 set try
16184 if eval $compile; then
16185 foo=`$run ./try`
16186 echo "Yes, it does ($foo)" >&4
16187 d_libm_lib_version="$define"
16188 else
16189 echo "No, it does not (probably harmless)" >&4
16190 fi
16191 $rm_try
16192
16193 : see if link exists
16194 set link d_link
16195 eval $inlibc
16196
16197 : see if llrint exists
16198 set llrint d_llrint
16199 eval $inlibc
16200
16201 : see if llrintl exists
16202 set llrintl d_llrintl
16203 eval $inlibc
16204
16205 : see if llround exists
16206 set llround d_llround
16207 eval $inlibc
16208
16209 : see if llroundl exists
16210 set llroundl d_llroundl
16211 eval $inlibc
16212
16213 : see if malloc/malloc.h has to be included
16214 set malloc/malloc.h i_mallocmalloc
16215 eval $inhdr
16216
16217 : see if this is a malloc.h system
16218 : we want a real compile instead of Inhdr because some systems have a
16219 : malloc.h that just gives a compile error saying to use stdlib.h instead
16220 echo " "
16221 $cat >try.c <<EOCP
16222 #include <stdlib.h>
16223 #include <malloc.h>
16224 #$i_mallocmalloc I_MALLOCMALLOC
16225 #ifdef I_MALLOCMALLOC
16226 # include <malloc/malloc.h>
16227 #endif
16228
16229 int main () { return 0; }
16230 EOCP
16231 set try
16232 if eval $compile; then
16233 echo "<malloc.h> found." >&4
16234 val="$define"
16235 else
16236 echo "<malloc.h> NOT found." >&4
16237 val="$undef"
16238 fi
16239 $rm_try
16240 set i_malloc
16241 eval $setvar
16242
16243 : see if localtime_r exists
16244 set localtime_r d_localtime_r
16245 eval $inlibc
16246 case "$d_localtime_r" in
16247 "$define")
16248 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16249 case "$d_localtime_r_proto:$usethreads" in
16250 ":define") d_localtime_r_proto=define
16251 set d_localtime_r_proto localtime_r $hdrs
16252 eval $hasproto ;;
16253 *) ;;
16254 esac
16255 case "$d_localtime_r_proto" in
16256 define)
16257 case "$localtime_r_proto" in
16258 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16259 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16260 esac
16261 case "$localtime_r_proto" in
16262 ''|0) try='int localtime_r(const time_t*, struct tm*);'
16263 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16264 esac
16265 case "$localtime_r_proto" in
16266 ''|0) d_localtime_r=undef
16267 localtime_r_proto=0
16268 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16269 * ) case "$localtime_r_proto" in
16270 REENTRANT_PROTO*) ;;
16271 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16272 esac
16273 echo "Prototype: $try" ;;
16274 esac
16275 ;;
16276 *) case "$usethreads" in
16277 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16278 esac
16279 d_localtime_r=undef
16280 localtime_r_proto=0
16281 ;;
16282 esac
16283 ;;
16284 *) localtime_r_proto=0
16285 ;;
16286 esac
16287
16288 : see if localtime_r calls tzset
16289 case "$localtime_r_proto" in
16290 REENTRANT_PROTO*)
16291 $cat >try.c <<EOCP
16292 /* Does our libc's localtime_r call tzset ?
16293 * return 0 if so, 1 otherwise.
16294 */
16295 #$i_systypes I_SYS_TYPES
16296 #$i_unistd I_UNISTD
16297 #$i_time I_TIME
16298 #$i_stdlib I_STDLIB
16299 #$i_malloc I_MALLOC
16300 #ifdef I_SYS_TYPES
16301 # include <sys/types.h>
16302 #endif
16303 #ifdef I_UNISTD
16304 # include <unistd.h>
16305 #endif
16306 #ifdef I_TIME
16307 # include <time.h>
16308 #endif
16309 #ifdef I_STDLIB
16310 #include <stdlib.h>
16311 #endif
16312 #include <string.h>
16313 #ifdef I_MALLOC
16314 # include <malloc.h>
16315 #endif
16316 int main()
16317 {
16318 int result = 0;
16319 time_t t = time(0L);
16320 char w_tz[]="TZ" "=GMT+5",
16321 e_tz[]="TZ" "=GMT-5",
16322 *tz_e = (char*)malloc(16),
16323 *tz_w = (char*)malloc(16);
16324 struct tm tm_e, tm_w;
16325 memset(&tm_e,'\0',sizeof(struct tm));
16326 memset(&tm_w,'\0',sizeof(struct tm));
16327 strcpy(tz_e,e_tz);
16328 strcpy(tz_w,w_tz);
16329
16330 putenv(tz_e);
16331 localtime_r(&t, &tm_e);
16332
16333 putenv(tz_w);
16334 localtime_r(&t, &tm_w);
16335
16336 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16337 result = 1;
16338
16339 free(tz_e);free(tz_w);
16340 return result;
16341 }
16342 EOCP
16343 set try
16344 if eval $compile; then
16345 if $run ./try; then
16346 d_localtime_r_needs_tzset=undef;
16347 else
16348 d_localtime_r_needs_tzset=define;
16349 fi;
16350 else
16351 d_localtime_r_needs_tzset=undef;
16352 fi;
16353 ;;
16354 *)
16355 d_localtime_r_needs_tzset=undef;
16356 ;;
16357 esac
16358 $rm_try
16359
16360 : see if lockf exists
16361 set lockf d_lockf
16362 eval $inlibc
16363
16364 : see if log1p exists
16365 set log1p d_log1p
16366 eval $inlibc
16367
16368 : see if log2 exists
16369 set log2 d_log2
16370 eval $inlibc
16371
16372 : see if logb exists
16373 set logb d_logb
16374 eval $inlibc
16375
16376 : see if lrint exists
16377 set lrint d_lrint
16378 eval $inlibc
16379
16380 : see if lrintl exists
16381 set lrintl d_lrintl
16382 eval $inlibc
16383
16384 : see if lround exists
16385 set lround d_lround
16386 eval $inlibc
16387
16388 : see if lroundl exists
16389 set lroundl d_lroundl
16390 eval $inlibc
16391
16392 : see if prototype for lseek is available
16393 echo " "
16394 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16395 eval $hasproto
16396
16397 : see if lstat exists
16398 set lstat d_lstat
16399 eval $inlibc
16400
16401 : see if madvise exists
16402 set madvise d_madvise
16403 eval $inlibc
16404
16405 : see if malloc_size exists
16406 set malloc_size d_malloc_size
16407 eval $inlibc
16408
16409 : see if malloc_size_good exists
16410 set malloc_good_size d_malloc_good_size
16411 eval $inlibc
16412
16413 : see if malloc_usable_size exists
16414 set malloc_usable_size d_malloc_usable_size
16415 eval $inlibc
16416
16417 : see if mblen exists
16418 set mblen d_mblen
16419 eval $inlibc
16420
16421 : see if mbrlen exists
16422 set mbrlen d_mbrlen
16423 eval $inlibc
16424
16425 : see if mbrtowc exists
16426 set mbrtowc d_mbrtowc
16427 eval $inlibc
16428
16429 : see if mbstowcs exists
16430 set mbstowcs d_mbstowcs
16431 eval $inlibc
16432
16433 : see if mbtowc exists
16434 set mbtowc d_mbtowc
16435 eval $inlibc
16436
16437 : see if memmem exists
16438 : We need both a prototype in string.h and the symbol in libc.
16439 echo " "
16440 d_memmem_proto=''
16441 xx1="#$d_gnulibc HAS_GNULIBC"
16442 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16443 xx3='# define _GNU_SOURCE'
16444 xx4='#endif'
16445 set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16446 eval $hasproto
16447 case "$d_memmem_proto" in
16448 define) # see if memmem exists
16449 set memmem d_memmem
16450 eval $inlibc
16451 ;;
16452 *) val=$undef
16453 set d_memmem
16454 eval $setvar
16455 ;;
16456 esac
16457
16458 : see if memrchr exists
16459 : We need both a prototype in string.h and the symbol in libc.
16460 echo " "
16461 d_memrchr_proto=''
16462 xx1="#$d_gnulibc HAS_GNULIBC"
16463 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16464 xx3='# define _GNU_SOURCE'
16465 xx4='#endif'
16466 set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16467 eval $hasproto
16468 case "$d_memrchr_proto" in
16469 define) # see if memrchr exists
16470 set memrchr d_memrchr
16471 eval $inlibc
16472 ;;
16473 *) val=$undef
16474 set d_memrchr
16475 eval $setvar
16476 ;;
16477 esac
16478
16479 : see if mkdir exists
16480 set mkdir d_mkdir
16481 eval $inlibc
16482
16483 : see if mkdtemp exists
16484 set mkdtemp d_mkdtemp
16485 eval $inlibc
16486
16487 : see if mkfifo exists
16488 set mkfifo d_mkfifo
16489 eval $inlibc
16490
16491 : see if mkostemp exists
16492 set mkostemp d_mkostemp
16493 eval $inlibc
16494
16495 : see if mkstemp exists
16496 set mkstemp d_mkstemp
16497 eval $inlibc
16498
16499 : see if mkstemps exists
16500 set mkstemps d_mkstemps
16501 eval $inlibc
16502
16503 : see if mktime exists
16504 set mktime d_mktime
16505 eval $inlibc
16506
16507 : see if sys/mman.h has to be included
16508 set sys/mman.h i_sysmman
16509 eval $inhdr
16510
16511 : see if mmap exists
16512 set mmap d_mmap
16513 eval $inlibc
16514 : see what shmat returns
16515 : default to something harmless
16516 mmaptype='void *'
16517 case "$i_sysmman$d_mmap" in
16518 "$define$define")
16519 $cat >mmap.c <<'END'
16520 #include <sys/mman.h>
16521 void *mmap();
16522 END
16523 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16524 mmaptype='void *'
16525 else
16526 mmaptype='caddr_t'
16527 fi
16528 echo "and it returns ($mmaptype)." >&4
16529 ;;
16530 esac
16531
16532 : see if sqrtl exists
16533 set sqrtl d_sqrtl
16534 eval $inlibc
16535
16536 : see if scalbnl exists
16537 set scalbnl d_scalbnl
16538 eval $inlibc
16539
16540 : see if truncl exists
16541 set truncl d_truncl
16542 eval $inlibc
16543
16544 : see if modfl exists
16545 set modfl d_modfl
16546 eval $inlibc
16547
16548 : see if prototype for modfl is available
16549 echo " "
16550 set d_modflproto modfl define math.h
16551 eval $hasproto
16552
16553 if $test "$uselongdouble" = "$define"; then
16554 message=""
16555 if $test "$d_sqrtl" != "$define"; then
16556 message="$message sqrtl"
16557 fi
16558 if $test "$d_modfl" != "$define"; then
16559 if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16560 echo "You have both truncl and copysignl, so I can emulate modfl."
16561 else
16562 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16563 echo "You have both aintl and copysignl, so I can emulate modfl."
16564 else
16565 message="$message modfl"
16566 fi
16567 fi
16568 fi
16569 if $test "$d_frexpl" != "$define"; then
16570 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16571 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16572 else
16573 message="$message frexpl"
16574 fi
16575 fi
16576 if $test "$d_ldexpl" != "$define"; then
16577 message="$message ldexpl"
16578 fi
16579
16580 if $test "$message" != ""; then
16581 $cat <<EOM >&4
16582
16583 *** You requested the use of long doubles but you do not seem to have
16584 *** the following mathematical functions needed for long double support:
16585 *** $message
16586 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16587 *** Cannot continue, aborting.
16588
16589 EOM
16590
16591 exit 1
16592 fi
16593 fi
16594
16595 : see if mprotect exists
16596 set mprotect d_mprotect
16597 eval $inlibc
16598
16599 : see if msgctl exists
16600 set msgctl d_msgctl
16601 eval $inlibc
16602
16603 : see if msgget exists
16604 set msgget d_msgget
16605 eval $inlibc
16606
16607 : see if msgsnd exists
16608 set msgsnd d_msgsnd
16609 eval $inlibc
16610
16611 : see if msgrcv exists
16612 set msgrcv d_msgrcv
16613 eval $inlibc
16614
16615 : see how much of the 'msg*(2)' library is present.
16616 h_msg=true
16617 echo " "
16618 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16619 *"$undef"*) h_msg=false;;
16620 esac
16621 case "$osname" in
16622 freebsd)
16623 case "`ipcs 2>&1`" in
16624 "SVID messages"*"not configured"*)
16625 echo "Your $osname does not have the msg*(2) configured." >&4
16626 h_msg=false
16627 val="$undef"
16628 set msgctl d_msgctl
16629 eval $setvar
16630 set msgget d_msgget
16631 eval $setvar
16632 set msgsnd d_msgsnd
16633 eval $setvar
16634 set msgrcv d_msgrcv
16635 eval $setvar
16636 ;;
16637 esac
16638 ;;
16639 esac
16640 : we could also check for sys/ipc.h ...
16641 if $h_msg && $test `./findhdr sys/msg.h`; then
16642 echo "You have the full msg*(2) library." >&4
16643 val="$define"
16644 else
16645 echo "You don't have the full msg*(2) library." >&4
16646 val="$undef"
16647 fi
16648 set d_msg
16649 eval $setvar
16650
16651 : Check for msghdr_s
16652 echo " "
16653 echo "Checking to see if your system supports struct msghdr..." >&4
16654 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16655 eval $hasstruct
16656 case "$d_msghdr_s" in
16657 "$define") echo "Yes, it does." ;;
16658 *) echo "No, it doesn't." ;;
16659 esac
16660
16661 : see if msync exists
16662 set msync d_msync
16663 eval $inlibc
16664
16665 : see if munmap exists
16666 set munmap d_munmap
16667 eval $inlibc
16668
16669 : see if nan exists
16670 set nan d_nan
16671 eval $inlibc
16672
16673 : see if nanosleep exists
16674 set nanosleep d_nanosleep
16675 eval $inlibc
16676
16677 : see if nearbyint exists
16678 set nearbyint d_nearbyint
16679 eval $inlibc
16680
16681 : see if nextafter exists
16682 set nextafter d_nextafter
16683 eval $inlibc
16684
16685 : see if nexttoward exists
16686 set nexttoward d_nexttoward
16687 eval $inlibc
16688
16689 : see if nice exists
16690 set nice d_nice
16691 eval $inlibc
16692
16693 : see if this is a langinfo.h system
16694 set langinfo.h i_langinfo
16695 eval $inhdr
16696
16697 : see if nl_langinfo and/or nl_langinfo_l exist
16698 set nl_langinfo d_nl_langinfo
16699 eval $inlibc
16700 set nl_langinfo_l d_nl_langinfo_l
16701 eval $inlibc
16702
16703 : Look for non 'int'-sized bitfields
16704 case "$d_non_int_bitfields" in
16705 '')
16706 echo " " >&4
16707 echo "Checking whether your compiler can handle struct bitfields that aren't 'int' or 'unsigned int' ..." >&4
16708 $cat >try.c <<'EOCP'
16709 #include <stdio.h>
16710 struct foo {
16711 unsigned char byte:1;
16712 unsigned short halfword:1;
16713 } bar;
16714 EOCP
16715 if $cc $ccflags -c try.c >try.out 2>&1 ; then
16716 if $compiler_warning try.out >/dev/null 2>&1; then
16717 echo "Your C compiler doesn't support struct bitfields that aren't 'int' or 'unsigned int'." >&4
16718 val="$undef"
16719 else
16720 echo "Your C compiler supports struct bitfields besides 'int' and 'unsigned int'." >&4
16721 val="$define"
16722 fi
16723 else
16724 echo "Your C compiler doesn't seem to understand struct bitfields that aren't 'int' or 'unsigned int' at all." >&4
16725 val="$undef"
16726 fi
16727 ;;
16728 *) val="$d_non_int_bitfields" ;;
16729 esac
16730 set d_non_int_bitfields
16731 eval $setvar
16732 $rm_try
16733
16734 : see if this is a quadmath.h system
16735 set quadmath.h i_quadmath
16736 eval $inhdr
16737
16738 : Check basic sizes
16739 echo " "
16740 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16741
16742 case "$use64bitint:$d_quad:$quadtype" in
16743 define:define:?*)
16744 ivtype="$quadtype"
16745 uvtype="$uquadtype"
16746 ivsize=8
16747 uvsize=8
16748 ;;
16749 *) ivtype="long"
16750 uvtype="unsigned long"
16751 ivsize=$longsize
16752 uvsize=$longsize
16753 ;;
16754 esac
16755
16756 case "$uselongdouble:$d_longdbl" in
16757 define:define)
16758 nvtype="long double"
16759 nvsize=$longdblsize
16760 ;;
16761 *) nvtype=double
16762 nvsize=$doublesize
16763 ;;
16764 esac
16765
16766 case "$usequadmath:$i_quadmath" in
16767 define:define)
16768 nvtype="__float128"
16769 nvsize=16
16770 : libquadmath is not in the usual places, and the place
16771 : changes if the compiler is upgraded. So ask the compiler if it
16772 : can find it.
16773 : We do not need to save this, if it fails we abort.
16774 libs="$libs -lquadmath"
16775 set try
16776 $cat >try.c <<EOM
16777 #include <quadmath.h>
16778 #include <stdio.h>
16779 int main(int argc, char *argv[]) {
16780 __float128 x = 1.0;
16781 if (fabsq(logq(x)) > 1e-6) {
16782 fputs("quadmath is broken\n", stderr);
16783 return 1;
16784 }
16785 puts("define");
16786 return 0;
16787 }
16788 EOM
16789 yyy=''
16790 if eval $compile_ok; then
16791 yyy=`$run ./try`
16792 case "$yyy" in
16793 define) ;;
16794 *) cat <<EOM >&4
16795
16796 *** You requested the use of the quadmath library, but
16797 *** it appears to be nonfunctional.
16798 *** Cannot continue, aborting.
16799
16800 EOM
16801 exit 1
16802 ;;
16803 esac
16804 else
16805 $cat <<EOM >&4
16806
16807 *** You requested the use of the quadmath library, but you
16808 *** do not seem to have the quadmath library installed.
16809 *** Cannot continue, aborting.
16810 EOM
16811 exit 1
16812 fi
16813 ;;
16814 define:*) $cat <<EOM >&4
16815
16816 *** You requested the use of the quadmath library, but you
16817 *** do not seem to have the required header, <quadmath.h>.
16818 EOM
16819 case "$gccversion" in
16820 [23].*|4.[0-5]*)
16821 $cat <<EOM >&4
16822 *** Your gcc looks a bit old:
16823 *** $gccversion
16824 EOM
16825 ;;
16826 '')
16827 $cat <<EOM >&4
16828 *** You are not running a gcc.
16829 EOM
16830 ;;
16831 esac
16832 $cat <<EOM >&4
16833 *** For the quadmath library you need at least gcc 4.6.
16834 *** Cannot continue, aborting.
16835 EOM
16836 exit 1
16837 ;;
16838 esac
16839
16840 $echo "(IV will be "$ivtype", $ivsize bytes)"
16841 $echo "(UV will be "$uvtype", $uvsize bytes)"
16842 $echo "(NV will be "$nvtype", $nvsize bytes)"
16843
16844 $cat >try.c <<EOCP
16845 #$i_inttypes I_INTTYPES
16846 #ifdef I_INTTYPES
16847 #include <inttypes.h>
16848 #endif
16849 #include <stdio.h>
16850 int main() {
16851 #ifdef INT8
16852 int8_t i = INT8_MAX;
16853 uint8_t u = UINT8_MAX;
16854 printf("int8_t\n");
16855 #endif
16856 #ifdef INT16
16857 int16_t i = INT16_MAX;
16858 uint16_t u = UINT16_MAX;
16859 printf("int16_t\n");
16860 #endif
16861 #ifdef INT32
16862 int32_t i = INT32_MAX;
16863 uint32_t u = UINT32_MAX;
16864 printf("int32_t\n");
16865 #endif
16866 }
16867 EOCP
16868
16869 i8type="signed char"
16870 u8type="unsigned char"
16871 i8size=1
16872 u8size=1
16873
16874 case "$i16type" in
16875 '') case "$shortsize" in
16876 2) i16type=short
16877 u16type="unsigned short"
16878 i16size=$shortsize
16879 u16size=$shortsize
16880 ;;
16881 esac
16882 ;;
16883 esac
16884 case "$i16type" in
16885 '') set try -DINT16
16886 if eval $compile; then
16887 case "`$run ./try`" in
16888 int16_t)
16889 i16type=int16_t
16890 u16type=uint16_t
16891 i16size=2
16892 u16size=2
16893 ;;
16894 esac
16895 fi
16896 ;;
16897 esac
16898 case "$i16type" in
16899 '') if $test $shortsize -ge 2; then
16900 i16type=short
16901 u16type="unsigned short"
16902 i16size=$shortsize
16903 u16size=$shortsize
16904 fi
16905 ;;
16906 esac
16907
16908 case "$i32type" in
16909 '') case "$longsize" in
16910 4) i32type=long
16911 u32type="unsigned long"
16912 i32size=$longsize
16913 u32size=$longsize
16914 ;;
16915 *) case "$intsize" in
16916 4) i32type=int
16917 u32type="unsigned int"
16918 i32size=$intsize
16919 u32size=$intsize
16920 ;;
16921 esac
16922 ;;
16923 esac
16924 ;;
16925 esac
16926 case "$i32type" in
16927 '') set try -DINT32
16928 if eval $compile; then
16929 case "`$run ./try`" in
16930 int32_t)
16931 i32type=int32_t
16932 u32type=uint32_t
16933 i32size=4
16934 u32size=4
16935 ;;
16936 esac
16937 fi
16938 ;;
16939 esac
16940 case "$i32type" in
16941 '') if $test $intsize -ge 4; then
16942 i32type=int
16943 u32type="unsigned int"
16944 i32size=$intsize
16945 u32size=$intsize
16946 fi
16947 ;;
16948 esac
16949
16950 case "$i64type" in
16951 '') case "$d_quad:$quadtype" in
16952 define:?*)
16953 i64type="$quadtype"
16954 u64type="$uquadtype"
16955 i64size=8
16956 u64size=8
16957 ;;
16958 esac
16959 ;;
16960 esac
16961
16962 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16963 $cat <<EOP >try.c
16964 #include <stdio.h>
16965 #$i_stdlib I_STDLIB
16966 #ifdef I_STDLIB
16967 #include <stdlib.h>
16968 #endif
16969 #$i_inttypes I_INTTYPES
16970 #ifdef I_INTTYPES
16971 #include <inttypes.h>
16972 #endif
16973 #include <sys/types.h>
16974 #include <signal.h>
16975 #ifdef SIGFPE
16976 /* volatile so that the compiler has to store it out to memory */
16977 volatile int bletched = 0;
16978 $signal_t blech(int s) { bletched = 1; }
16979 #endif
16980 int main() {
16981 $uvtype u = 0;
16982 $nvtype d;
16983 int n = 8 * $uvsize;
16984 int i;
16985 #ifdef SIGFPE
16986 signal(SIGFPE, blech);
16987 #endif
16988
16989 for (i = 0; i < n; i++) {
16990 u = u << 1 | ($uvtype)1;
16991 d = ($nvtype)u;
16992 if (($uvtype)d != u)
16993 break;
16994 if (d <= 0)
16995 break;
16996 d = ($nvtype)(u - 1);
16997 if (($uvtype)d != (u - 1))
16998 break;
16999 #ifdef SIGFPE
17000 if (bletched)
17001 break;
17002 #endif
17003 }
17004 printf("%d\n", ((i == n) ? -n : i));
17005 exit(0);
17006 }
17007 EOP
17008 set try
17009
17010 d_nv_preserves_uv="$undef"
17011 if eval $compile; then
17012 nv_preserves_uv_bits="`$run ./try`"
17013 fi
17014 case "$nv_preserves_uv_bits" in
17015 \-[1-9]*)
17016 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
17017 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." >&4
17018 d_nv_preserves_uv="$define"
17019 ;;
17020 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." >&4
17021 d_nv_preserves_uv="$undef" ;;
17022 *) $echo "Can't figure out how many bits your NVs preserve." >&4
17023 nv_preserves_uv_bits="0" ;;
17024 esac
17025 $rm_try
17026
17027 $echo "Checking to find the largest integer value your NVs can hold..." >&4
17028 $cat <<EOP >try.c
17029 #include <stdio.h>
17030
17031 typedef $nvtype NV;
17032
17033 int
17034 main() {
17035 NV value = 2;
17036 int count = 1;
17037
17038 while(count < 256) {
17039 /* volatile so that the compiler has to store it out to memory */
17040 volatile NV up = value + 1.0;
17041 volatile NV negated = -value;
17042 volatile NV down = negated - 1.0;
17043 volatile NV got_up = up - value;
17044 int up_good = got_up == 1.0;
17045 int got_down = down - negated;
17046 int down_good = got_down == -1.0;
17047
17048 if (down_good != up_good) {
17049 fprintf(stderr,
17050 "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
17051 up_good, (double) got_up, down_good, (double) got_down,
17052 count, (double) value);
17053 return 1;
17054 }
17055 if (!up_good) {
17056 while (1) {
17057 if (count > 8) {
17058 count -= 8;
17059 fputs("256.0", stdout);
17060 } else {
17061 count--;
17062 fputs("2.0", stdout);
17063 }
17064 if (!count) {
17065 puts("");
17066 return 0;
17067 }
17068 fputs("*", stdout);
17069 }
17070 }
17071 value *= 2;
17072 ++count;
17073 }
17074 fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
17075 count, (double) value);
17076 return 1;
17077 }
17078 EOP
17079 set try
17080
17081 nv_overflows_integers_at='0'
17082 if eval $compile; then
17083 xxx="`$run ./try`"
17084 case "$?" in
17085 0)
17086 case "$xxx" in
17087 2*) cat >&4 <<EOM
17088 The largest integer your NVs can preserve is equal to $xxx
17089 EOM
17090 nv_overflows_integers_at="$xxx"
17091 ;;
17092 *) cat >&4 <<EOM
17093 Cannot determine the largest integer value your NVs can hold, unexpected output
17094 '$xxx'
17095 EOM
17096 ;;
17097 esac
17098 ;;
17099 *) cat >&4 <<EOM
17100 Cannot determine the largest integer value your NVs can hold
17101 EOM
17102 ;;
17103 esac
17104 fi
17105 $rm_try
17106
17107 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
17108 $cat <<EOP >try.c
17109 #include <stdio.h>
17110 #$i_stdlib I_STDLIB
17111 #ifdef I_STDLIB
17112 #include <stdlib.h>
17113 #endif
17114 #include <string.h>
17115 #include <sys/types.h>
17116 #include <signal.h>
17117 #ifdef SIGFPE
17118 /* volatile so that the compiler has to store it out to memory */
17119 volatile int bletched = 0;
17120 $signal_t blech(int s) { bletched = 1; }
17121 #endif
17122
17123 int checkit($nvtype d, const char *where) {
17124 void *v = &d;
17125 unsigned char *p = (unsigned char *)v;
17126 unsigned char *end = p + sizeof(d);
17127 int fail = 0;
17128
17129 while (p < end)
17130 fail += *p++;
17131
17132 if (!fail)
17133 return 0;
17134
17135 p = (unsigned char *)v;
17136 printf("No - %s: 0x", where);
17137 while (p < end)
17138 printf ("%02X", *p++);
17139 printf("\n");
17140 return 1;
17141 }
17142
17143 int main(int argc, char **argv) {
17144 $nvtype d = 0.0;
17145 int fail = 0;
17146 fail += checkit(d, "0.0");
17147
17148 /* The compiler shouldn't be assuming that bletched is 0 */
17149 d = bletched;
17150
17151 fail += checkit(d, "bleched");
17152
17153 #ifdef SIGFPE
17154 signal(SIGFPE, blech);
17155 #endif
17156
17157 /* Paranoia - the compiler should have no way of knowing that ANSI says
17158 that argv[argc] will always be NULL. Actually, if it did assume this it
17159 would be buggy, as this is C and main() can be called from elsewhere in
17160 the program. */
17161 d = argv[argc] ? 1 : 0;
17162
17163 if (d) {
17164 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17165 }
17166
17167 fail += checkit(d, "ternary");
17168
17169 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17170
17171 if (d != 0.0) {
17172 printf("No - memset doesn't give 0.0\n");
17173 /* This might just blow up: */
17174 printf("(gives %g)\n", d);
17175 return 1;
17176 }
17177
17178 #ifdef SIGFPE
17179 if (bletched) {
17180 printf("No - something bleched\n");
17181 return 1;
17182 }
17183 #endif
17184 if (fail) {
17185 printf("No - %d fail(s)\n", fail);
17186 return 1;
17187 }
17188 printf("Yes\n");
17189 return 0;
17190 }
17191 EOP
17192 set try
17193
17194 d_nv_zero_is_allbits_zero="$undef"
17195 if eval $compile; then
17196 xxx="`$run ./try`"
17197 case "$?" in
17198 0)
17199 case "$xxx" in
17200 Yes) cat >&4 <<EOM
17201 0.0 is represented as all bits zero in memory
17202 EOM
17203 d_nv_zero_is_allbits_zero="$define"
17204 ;;
17205 *) cat >&4 <<EOM
17206 0.0 is not represented as all bits zero in memory
17207 EOM
17208 d_nv_zero_is_allbits_zero="$undef"
17209 ;;
17210 esac
17211 ;;
17212 *) cat >&4 <<EOM
17213 0.0 is not represented as all bits zero in memory
17214 EOM
17215 d_nv_zero_is_allbits_zero="$undef"
17216 ;;
17217 esac
17218 fi
17219 $rm_try
17220
17221 : check for off64_t
17222 echo " "
17223 echo "Checking to see if you have off64_t..." >&4
17224 $cat >try.c <<EOCP
17225 #include <sys/types.h>
17226 #include <unistd.h>
17227 int main() { off64_t x = 7; }
17228 EOCP
17229 set try
17230 if eval $compile; then
17231 val="$define"
17232 echo "You have off64_t."
17233 else
17234 val="$undef"
17235 echo "You do not have off64_t."
17236 case "$lseeksize" in
17237 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17238 esac
17239 fi
17240 $rm_try
17241 set d_off64_t
17242 eval $setvar
17243
17244 : how to create joinable pthreads
17245 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17246 echo " "
17247 echo "Checking what constant to use for creating joinable pthreads..." >&4
17248 $cat >try.c <<'EOCP'
17249 #include <pthread.h>
17250 int main() {
17251 int detachstate = JOINABLE;
17252 }
17253 EOCP
17254 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17255 if eval $compile; then
17256 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17257 val="$undef" # Yes, undef.
17258 set d_old_pthread_create_joinable
17259 eval $setvar
17260 val=""
17261 set old_pthread_create_joinable
17262 eval $setvar
17263 else
17264 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17265 if eval $compile; then
17266 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17267 val="$define"
17268 set d_old_pthread_create_joinable
17269 eval $setvar
17270 val=PTHREAD_CREATE_UNDETACHED
17271 set old_pthread_create_joinable
17272 eval $setvar
17273 else
17274 set try -DJOINABLE=__UNDETACHED
17275 if eval $compile; then
17276 echo "You seem to use __UNDETACHED." >&4
17277 val="$define"
17278 set d_old_pthread_create_joinable
17279 eval $setvar
17280 val=__UNDETACHED
17281 set old_pthread_create_joinable
17282 eval $setvar
17283 else
17284 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
17285 val="$define"
17286 set d_old_pthread_create_joinable
17287 eval $setvar
17288 val=0
17289 set old_pthread_create_joinable
17290 eval $setvar
17291 fi
17292 fi
17293 fi
17294 $rm_try
17295 else
17296 d_old_pthread_create_joinable="$undef"
17297 old_pthread_create_joinable=""
17298 fi
17299
17300 : see if pause exists
17301 set pause d_pause
17302 eval $inlibc
17303
17304 : see if locale.h is available
17305 set locale.h i_locale
17306 eval $inhdr
17307
17308 : see if this system has wctype.h
17309 set wctype.h i_wctype
17310 eval $inhdr
17311
17312 : see if towupper exists
17313 set towupper d_towupper
17314 eval $inlibc
17315
17316 : check for setlocale function and behavior
17317 case "$d_setlocale" in
17318 '')
17319 $cat >&4 <<EOM
17320
17321 Checking to see if you have setlocale() and its behavior
17322 EOM
17323 $cat >try.c <<EOCP
17324 #include <stdlib.h>
17325 #include <string.h>
17326 #$i_locale I_LOCALE
17327 #ifdef I_LOCALE
17328 # include <locale.h>
17329 #endif
17330 #$i_wctype I_WCTYPE
17331 #ifdef I_WCTYPE
17332 # include <wctype.h>
17333 #endif
17334
17335 int main() {
17336 const char * invalid_name = "\a"; /* This is really invalid! */
17337 int accepts_any_locale_name = 0;
17338 int has_C_UTF8 = 0;
17339 unsigned char bad_setlocale = 255;
17340
17341 /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
17342 * disabled. It's hard to imagine an instance where meaningful locale
17343 * handling could be done without LC_CTYPE */
17344 const char * name = setlocale(LC_CTYPE, "C");
17345
17346 if (name == NULL || strcmp(name, "C") != 0) {
17347 exit(bad_setlocale);
17348 }
17349
17350 name = setlocale(LC_CTYPE, invalid_name);
17351 if (name != NULL) {
17352
17353 /* Let it pass if it accepts the name but gives back one of the C
17354 * locales */
17355 if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
17356 accepts_any_locale_name = 1;
17357 }
17358 }
17359
17360 name = setlocale(LC_CTYPE, "C.UTF-8");
17361 if (name != NULL) {
17362 unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
17363
17364 #$d_towupper HAS_TOWUPPER
17365 #ifdef HAS_TOWUPPER
17366
17367 /* We assume that if the machine doesn't have the C99 towupper, it
17368 * doesn't have C.UTF-8, even if we successfully changed locales to
17369 * include it. This seems safer even on platforms that didn't accept
17370 * the really invalid name */
17371
17372 if (towupper(y_with_diaeresis) == 0x178) {
17373 has_C_UTF8 = 1;
17374 }
17375
17376 #endif
17377
17378 }
17379
17380 exit( 0 /* (separator - min_separator) << 3
17381 | uses_name_value_pair_names << 2
17382 */
17383 | has_C_UTF8 << 1
17384 | accepts_any_locale_name);
17385
17386 }
17387 EOCP
17388 val=
17389 set d_setlocale
17390 eval $setvar
17391 case $d_setlocale in
17392 $undef) d_setlocale_accepts_any_locale_name="$undef"
17393 d_has_C_UTF8="false"
17394 ;;
17395 *) set try
17396 if eval $compile; then
17397 echo "Your system has setlocale()..." >&4
17398 $run ./try
17399 case $? in
17400 0) echo "and it seems sane; you don't have a C.UTF-8 locale" >&4
17401 d_setlocale="$define"
17402 d_setlocale_accepts_any_locale_name="$undef"
17403 d_has_C_UTF8="false"
17404 ;;
17405 1) echo "and it seems sane, but accepts any locale name as valid" >&4
17406 d_setlocale="$define"
17407 d_setlocale_accepts_any_locale_name="$define"
17408 d_has_C_UTF8="false"
17409 ;;
17410 2) echo "and it seems sane; you have a C.UTF-8 locale" >&4
17411 d_setlocale="$define"
17412 d_setlocale_accepts_any_locale_name="$undef"
17413 d_has_C_UTF8="true"
17414 ;;
17415 3) echo "and it seems sane, but accepts any locale name as valid" >&4
17416 d_setlocale="$define"
17417 d_setlocale_accepts_any_locale_name="$define"
17418 d_has_C_UTF8="true"
17419 ;;
17420 *) echo "but it doesn't seem to work, so we won't use it." >&4
17421 d_setlocale="$undef"
17422 d_setlocale_accepts_any_locale_name="$undef"
17423 d_has_C_UTF8="false"
17424 ;;
17425 esac
17426 else
17427 echo "your system does not have setlocale()" >&4
17428 d_setlocale="$undef"
17429 d_setlocale_accepts_any_locale_name="$undef"
17430 d_has_C_UTF8="false"
17431 fi
17432 esac
17433 $rm_try
17434 ;;
17435 *) val="$d_setlocale"
17436 set d_setlocale
17437 eval $setvar
17438 case "$d_setlocale" in
17439 $undef) echo "There may be other ways to set the locale on your system, so we need to ask:" >&4
17440 ;;
17441 esac
17442 rp="Does your system have the C.UTF-8 locale?"
17443 dflt=n
17444 . ./myread
17445 case "$ans" in
17446 [Yy]*) d_has_C_UTF8="true"
17447 c_utf8_locale=" or C.UTF-8"
17448 ;;
17449 *) d_has_C_UTF8="false"
17450 c_utf8_locale=""
17451 ;;
17452 esac
17453 case "$d_setlocale" in
17454 $define)
17455 rp="When you set your locale to something besides C$c_utf8_locale, does it actually do so? (Answer no if it just pretends to set it)" >&4
17456 dflt=n
17457 . ./myread
17458 case "$ans" in
17459 true|[Yy]*)
17460 d_setlocale_accepts_any_locale_name="$define"
17461 ;;
17462 *) d_setlocale_accepts_any_locale_name="$undef"
17463 ;;
17464 esac
17465 ;;
17466 *) d_setlocale_accepts_any_locale_name="$undef"
17467 ;;
17468 esac
17469 esac
17470
17471 : Check the syntax of LC_ALL when categories are set to different locales
17472 echo " "
17473 $echo "Checking the syntax of LC_ALL when categories are set to different locales..." >&4
17474
17475 case $d_setlocale in
17476 $define)
17477 $rm -f try try.*
17478 $cat >try.c <<'EOF'
17479 #include <limits.h>
17480 #include <locale.h>
17481 #include <stdlib.h>
17482 #include <string.h>
17483 #include <stdio.h>
17484
17485 #ifndef LC_ALL
17486
17487 int
17488 main (const int argc, const char ** argv)
17489 {
17490 }
17491
17492 #else
17493 # define C_ARRAY_LENGTH(a) (sizeof(a)/sizeof((a)[0]))
17494 # define strEQ(s1,s2) (strcmp(s1,s2) == 0)
17495 # define strNE(s1,s2) (strcmp(s1,s2) != 0)
17496 # define Copy(s,d,n,t) (void)memcpy((char*)(d),(const char*)(s), (n) * sizeof(t))
17497 # define memEQ(s1,s2,l) (memcmp(((const void *) (s1)), ((const void *) (s2)), l) == 0)
17498 # define memNE(s1,s2,l) (! memEQ(s1,s2,l))
17499
17500 int
17501 main (const int argc, const char ** argv)
17502 {
17503
17504 int debug = 0;
17505
17506 /* All categories Perl knows about on any system. If any are missing, this
17507 * won't work for that system, and they must be added here and in perl.h,
17508 * locale.c */
17509 const int categories[] = {
17510
17511 # ifdef LC_CTYPE
17512 LC_CTYPE,
17513 # endif
17514 # ifdef LC_NUMERIC
17515 LC_NUMERIC,
17516 # endif
17517 # ifdef LC_COLLATE
17518 LC_COLLATE,
17519 # endif
17520 # ifdef LC_TIME
17521 LC_TIME,
17522 # endif
17523 # ifdef LC_MESSAGES
17524 LC_MESSAGES,
17525 # endif
17526 # ifdef LC_MONETARY
17527 LC_MONETARY,
17528 # endif
17529 # ifdef LC_ADDRESS
17530 LC_ADDRESS,
17531 # endif
17532 # ifdef LC_IDENTIFICATION
17533 LC_IDENTIFICATION,
17534 # endif
17535 # ifdef LC_MEASUREMENT
17536 LC_MEASUREMENT,
17537 # endif
17538 # ifdef LC_PAPER
17539 LC_PAPER,
17540 # endif
17541 # ifdef LC_TELEPHONE
17542 LC_TELEPHONE,
17543 # endif
17544 # ifdef LC_NAME
17545 LC_NAME,
17546 # endif
17547 # ifdef LC_SYNTAX
17548 LC_SYNTAX,
17549 # endif
17550 # ifdef LC_TOD
17551 LC_TOD
17552 # endif
17553
17554 };
17555
17556 const char * category_names[] = {
17557
17558 # ifdef LC_CTYPE
17559 "LC_CTYPE",
17560 # endif
17561 # ifdef LC_NUMERIC
17562 "LC_NUMERIC",
17563 # endif
17564 # ifdef LC_COLLATE
17565 "LC_COLLATE",
17566 # endif
17567 # ifdef LC_TIME
17568 "LC_TIME",
17569 # endif
17570 # ifdef LC_MESSAGES
17571 "LC_MESSAGES",
17572 # endif
17573 # ifdef LC_MONETARY
17574 "LC_MONETARY",
17575 # endif
17576 # ifdef LC_ADDRESS
17577 "LC_ADDRESS",
17578 # endif
17579 # ifdef LC_IDENTIFICATION
17580 "LC_IDENTIFICATION",
17581 # endif
17582 # ifdef LC_MEASUREMENT
17583 "LC_MEASUREMENT",
17584 # endif
17585 # ifdef LC_PAPER
17586 "LC_PAPER",
17587 # endif
17588 # ifdef LC_TELEPHONE
17589 "LC_TELEPHONE",
17590 # endif
17591 # ifdef LC_NAME
17592 "LC_NAME",
17593 # endif
17594 # ifdef LC_SYNTAX
17595 "LC_SYNTAX",
17596 # endif
17597 # ifdef LC_TOD
17598 "LC_TOD"
17599 # endif
17600
17601 };
17602
17603 char alternate[1024] = { '\0' } ;
17604
17605 /* This is a list of locales that are likely to be found on any machine
17606 * (Windows and non-Windows) */
17607 const char * candidates[] = {
17608 "POSIX",
17609 "C.UTF-8",
17610 "en_US",
17611 "en_US.UTF-8",
17612 "American",
17613 "English"
17614 };
17615 char separator[1024];
17616 size_t separator_len = 0;
17617 unsigned int distincts_count = 0;
17618
17619 /* We look through the candidates for one which returns the same non-C
17620 * locale for every category */
17621 for (unsigned int i = 0; i < C_ARRAY_LENGTH(candidates); i++) {
17622 const char * candidate = candidates[i];
17623 distincts_count = 0;
17624 alternate[0] = '\0';
17625
17626 for (unsigned int j = 0; j < C_ARRAY_LENGTH(categories); j++) {
17627 const int category = categories[j];
17628 const char * locale_name = setlocale(category, candidate);
17629
17630 if (locale_name == NULL) { /* Not on this system */
17631 break;
17632 }
17633
17634 if (debug) fprintf(stderr,
17635 "i=%d,j=%d;"
17636 " Return of setlocale(%d=%s, '%s') is '%s'\n",
17637 i, j,
17638 category, category_names[j],
17639 candidate, locale_name);
17640
17641 /* If the candidate is indistinguishable from C, break to try the
17642 * next candidate */
17643 if (strEQ(locale_name, "C")) {
17644 break;
17645 }
17646
17647 /* Save the name the first time through, and on subsequent ones */
17648 /* make sure the name is the same as before, so the code below can
17649 * be assured of finding it when searching */
17650 if (j == 0) {
17651 strncpy(alternate, locale_name, sizeof(alternate));
17652 }
17653 else if (strNE(alternate, locale_name)) {
17654 break;
17655 }
17656
17657 distincts_count++;
17658 }
17659
17660 /* Done with this candidate. If every category returned the same non-C
17661 * name, this candidate works. It not, loop to try the next candidate
17662 * */
17663 if (distincts_count == C_ARRAY_LENGTH(categories)) {
17664 break;
17665 }
17666 }
17667
17668 /* Here, either found a suitable candidate, or exhausted the possibilities.
17669 * In the latter case, give up */
17670 if (distincts_count < C_ARRAY_LENGTH(categories)) {
17671 fprintf(stderr, "Couldn't find a locale distinguishable from C\n");
17672 return 1;
17673 }
17674
17675 /* An example syntax, from cygwin, is:
17676 * LC_COLLATE/LC_CTYPE/LC_MONETARY/LC_NUMERIC/LC_TIME/LC_MESSAGES
17677 * The locales for a given category are always in the same position,
17678 * indicated above, with a slash separating them */
17679
17680 int map_LC_ALL_position_to_category[C_ARRAY_LENGTH(categories)];
17681
17682 /* Initialize */
17683 for (unsigned int i = 0; i < C_ARRAY_LENGTH(categories); i++) {
17684 map_LC_ALL_position_to_category[i] = INT_MAX;
17685 }
17686
17687 const char * lc_all = NULL;
17688
17689 /* We need to find the category that goes in each position */
17690 for (unsigned int i = 0; i < C_ARRAY_LENGTH(categories); i++) {
17691
17692 /* First set everything to 'C' */
17693 if (! setlocale(LC_ALL, "C")) {
17694 fprintf(stderr, "Failed to set LC_ALL to C\n");
17695 return 1;
17696 }
17697
17698 /* Then set this category to the alternate */
17699 if (! setlocale(categories[i], alternate)) {
17700 fprintf(stderr, "Failed to set %d to to '%s'\n",
17701 categories[i], alternate);
17702 return 1;
17703 }
17704
17705 /* Then find what the system says LC_ALL looks like with just this one
17706 * category not set to 'C' */
17707 lc_all = setlocale(LC_ALL, NULL);
17708 if (! lc_all) {
17709 fprintf(stderr, "Failed to retrieve LC_ALL\n");
17710 return 1;
17711 }
17712
17713 if (debug) fprintf(stderr, "LC_ALL is '%s'\n", lc_all);
17714
17715 /* Assume is name=value pairs if the result contains both an equals and
17716 * a semi-colon. */
17717 if (strchr(lc_all, '=') && strchr(lc_all, ';')) {
17718 fprintf(stdout, "\"=;\"\n\n");
17719 return 0;
17720 }
17721
17722 /* Here isn't name=value pairs. Find the position of the alternate */
17723 const char * alt_pos = strstr(lc_all, alternate);
17724 if (! alt_pos) {
17725 fprintf(stderr, "Couldn't find '%s' in '%s'\n", alternate, lc_all);
17726 return 1;
17727 }
17728
17729 /* Parse the LC_ALL string from the beginning up to where the alternate
17730 * locale is */
17731 const char * s = lc_all;
17732 int count = 0;
17733 while (s < alt_pos) {
17734
17735 /* Count the 'C' locales before the non-C one. (Note the letter
17736 * 'C' can only occur as the entire 'C' locale, since all of them
17737 * are that locale before 'alt_pos') */
17738 const char * next_C = (const char *) memchr(s, 'C', alt_pos - s);
17739 if (next_C) {
17740 count++;
17741 s = next_C + 1;
17742 continue;
17743 }
17744
17745 /* Here, there is no 'C' between 's' and the alternate locale, so
17746 * 'count' gives the total number of occurrences of 'C' in that
17747 * span. If count is 0, this is the first category in an LC_ALL
17748 * string, and we know its position, but not the separator. */
17749 if (count == 0) {
17750 break;
17751 }
17752
17753 /* When 'count' isn't 0, 's' points to one past the previous 'C'.
17754 * The separator starts here, ending just before the non-C locale.
17755 */
17756
17757 const char * new_sep = s;
17758 unsigned int new_sep_len = alt_pos - s;
17759
17760 /* If we don't already have a separator saved, save this as it */
17761 if (separator_len == 0) {
17762 separator_len = new_sep_len;
17763 Copy(s, separator, separator_len, char);
17764 separator[separator_len] = '\0';
17765 }
17766 else { /* Otherwise make sure it's the same string as previously
17767 * calculated */
17768 if ( new_sep_len != separator_len
17769 || memNE(separator, new_sep, separator_len))
17770 {
17771 fprintf(stderr, "Unexpectedly got distinct separators"
17772 " '%s' vs '%s\n", separator, new_sep);
17773 return 1;
17774 }
17775 }
17776
17777 /* Here, we have found the position of category[i] in LC_ALL. */
17778 break;
17779
17780 } /* End of loop parsing the LC_ALL string */
17781
17782 if (map_LC_ALL_position_to_category[count] != INT_MAX) {
17783 fprintf(stderr, "Categories %d and %d both appear to occupy"
17784 " position %d in LC_ALL; there is something"
17785 " wrong with the calculation\n",
17786 categories[count], categories[i],
17787 count);
17788 return 1;
17789 }
17790
17791 /* Save the position of this category */
17792 map_LC_ALL_position_to_category[count] = categories[i];
17793
17794 } /* End of loop through all the categories */
17795
17796 fprintf(stdout, "\"%s\"\n{", separator);
17797 for (unsigned int i = 0; i < C_ARRAY_LENGTH(categories) - 1; i++) {
17798 fprintf(stdout, " %d,", map_LC_ALL_position_to_category[i]);
17799 }
17800 fprintf(stdout, " %d }\n", map_LC_ALL_position_to_category[
17801 C_ARRAY_LENGTH(categories) - 1]);
17802 return 0;
17803
17804 }
17805
17806 #endif
17807 EOF
17808 set try
17809 if eval $compile_ok; then
17810 output=`$run ./try 2>/dev/null`
17811 separator=`echo "$output" | $sed 1q`
17812 case $separator in
17813 "\"=;\"")
17814 d_perl_lc_all_uses_name_value_pairs="$define"
17815 d_perl_lc_all_separator="$undef"
17816 perl_lc_all_separator=
17817 d_perl_lc_all_category_positions_init="$undef"
17818 perl_lc_all_category_positions_init=
17819 ;;
17820 "") d_perl_lc_all_uses_name_value_pairs="$undef"
17821 d_perl_lc_all_separator="$undef"
17822 perl_lc_all_separator=
17823 d_perl_lc_all_category_positions_init="$undef"
17824 perl_lc_all_category_positions_init=
17825 ;;
17826 *) d_perl_lc_all_uses_name_value_pairs="$undef"
17827 d_perl_lc_all_separator="$define"
17828 perl_lc_all_separator="$separator"
17829 d_perl_lc_all_category_positions_init="$define"
17830 perl_lc_all_category_positions_init=`echo "$output" | sed -n 2p`
17831 ;;
17832 esac
17833 else
17834 $echo "Failed to compile lc_all probe" >&4
17835 fi
17836 $rm -f try try.*
17837 ;;
17838 *) d_perl_lc_all_separator="$undef"
17839 perl_lc_all_separator=
17840 d_perl_lc_all_category_positions_init="$undef"
17841 perl_lc_all_category_positions_init=
17842
17843 # No setlocale(), but using this default allows our code to compile
17844 # and run without having to have a bunch more #ifdef's
17845 d_perl_lc_all_uses_name_value_pairs="$define"
17846 ;;
17847 esac
17848
17849 : see if pipe2 exists
17850 set pipe2 d_pipe2
17851 eval $inlibc
17852
17853 : see if poll exists
17854 set poll d_poll
17855 eval $inlibc
17856
17857 : see if prctl exists
17858 set prctl d_prctl
17859 eval $inlibc
17860
17861 : see if prctl supports PR_SET_NAME
17862 d_prctl_set_name=$undef
17863 case $d_prctl in
17864 $define)
17865 $cat >try.c <<EOM
17866 #ifdef __ANDROID__
17867 #include <unistd.h>
17868 #endif
17869 #include <sys/prctl.h>
17870
17871 int main (int argc, char *argv[])
17872 {
17873 return (prctl (PR_SET_NAME, "Test"));
17874 } /* main */
17875 EOM
17876 set try
17877 if eval $compile_ok && $run ./try; then
17878 echo "Your prctl (PR_SET_NAME, ...) works"
17879 d_prctl_set_name=$define
17880 fi
17881 $rm_try
17882 ;;
17883 esac
17884
17885 : see if readlink exists
17886 set readlink d_readlink
17887 eval $inlibc
17888
17889 : Check if there is a /proc symlink to the abs path of
17890 : the executing program. We will honor hints of d_procselfexe=$undef
17891 : or procselfexe being non-empty, otherwise will try to determine both
17892 : if we have readlink.
17893 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17894 : referenced, and AmigaOS does not have a proc filesystem anyway.
17895 echo " "
17896 val="$undef"
17897 if $test "X$d_procselfexe" = Xundef; then
17898 procselfexe=''
17899 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17900 val="$define"
17901 elif $test "X$d_readlink" = Xdefine; then
17902 : NetBSD first as /proc/self is a symlink to /proc/curproc,
17903 : and it feels more tidy to avoid an extra level of symlink
17904 set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17905 while test $# -gt 0; do
17906 type=$1; try=$2
17907 shift; shift
17908 if $issymlink $try; then
17909 $ls -l $try > reflect
17910 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17911 echo "You have $type-like $try."
17912 procselfexe='"'$try'"'
17913 val="$define"
17914 : This will break out of the loop
17915 set X; shift
17916 fi
17917 fi
17918 done
17919 fi
17920 $rm -f reflect
17921 set d_procselfexe
17922 eval $setvar
17923
17924 : backward compatibility for d_hvfork
17925 if test X$d_hvfork != X; then
17926 d_vfork="$d_hvfork"
17927 d_hvfork=''
17928 fi
17929 : see if there is a vfork
17930 val=''
17931 set vfork val
17932 eval $inlibc
17933
17934 d_pseudofork=$undef
17935
17936 : Ok, but do we want to use it. vfork is reportedly unreliable in
17937 : perl on Solaris 2.x, and probably elsewhere.
17938 case "$val" in
17939 $define)
17940 echo " "
17941 case "$usevfork" in
17942 false) dflt='n';;
17943 *) dflt='y';;
17944 esac
17945 cat <<'EOM'
17946
17947 Perl can only use a vfork() that doesn't suffer from strict
17948 restrictions on calling functions or modifying global data in
17949 the child. For example, glibc-2.1 contains such a vfork()
17950 that is unsuitable. If your system provides a proper fork()
17951 call, chances are that you do NOT want perl to use vfork().
17952
17953 EOM
17954 rp="Do you still want to use vfork()?"
17955 . ./myread
17956 case "$ans" in
17957 y|Y) ;;
17958 *)
17959 echo "Ok, we won't use vfork()."
17960 val="$undef"
17961 ;;
17962 esac
17963 ;;
17964 esac
17965 set d_vfork
17966 eval $setvar
17967 case "$d_vfork" in
17968 $define) usevfork='true';;
17969 *) usevfork='false';;
17970 esac
17971
17972 : see whether the pthread_atfork exists
17973 $cat >try.c <<EOP
17974 #include <pthread.h>
17975 #include <stdio.h>
17976 int main() {
17977 #ifdef PTHREAD_ATFORK
17978 pthread_atfork(NULL,NULL,NULL);
17979 #endif
17980 }
17981 EOP
17982
17983 : see if pthread_atfork exists
17984 set try -DPTHREAD_ATFORK
17985 if eval $compile; then
17986 val="$define"
17987 else
17988 val="$undef"
17989 fi
17990 case "$usethreads" in
17991 $define)
17992 case "$val" in
17993 $define) echo 'pthread_atfork found.' >&4 ;;
17994 *) echo 'pthread_atfork NOT found.' >&4 ;;
17995 esac
17996 esac
17997 set d_pthread_atfork
17998 eval $setvar
17999
18000 : see if pthread_attr_setscope exists
18001 set pthread_attr_setscope d_pthread_attr_setscope
18002 eval $inlibc
18003
18004 : see whether the various POSIXish _yields exist
18005 $cat >try.c <<EOP
18006 #include <pthread.h>
18007 #include <stdio.h>
18008 int main() {
18009 #ifdef SCHED_YIELD
18010 sched_yield();
18011 #else
18012 #ifdef PTHREAD_YIELD
18013 pthread_yield();
18014 #else
18015 #ifdef PTHREAD_YIELD_NULL
18016 pthread_yield(NULL);
18017 #endif
18018 #endif
18019 #endif
18020 }
18021 EOP
18022 : see if sched_yield exists
18023 set try -DSCHED_YIELD
18024 if eval $compile; then
18025 val="$define"
18026 sched_yield='sched_yield()'
18027 else
18028 val="$undef"
18029 fi
18030 case "$usethreads" in
18031 $define)
18032 case "$val" in
18033 $define) echo 'sched_yield() found.' >&4 ;;
18034 *) echo 'sched_yield() NOT found.' >&4 ;;
18035 esac
18036 esac
18037 set d_sched_yield
18038 eval $setvar
18039
18040 : see if pthread_yield exists
18041 set try -DPTHREAD_YIELD
18042 if eval $compile; then
18043 val="$define"
18044 case "$sched_yield" in
18045 '') sched_yield='pthread_yield()' ;;
18046 esac
18047 else
18048 set try -DPTHREAD_YIELD_NULL
18049 if eval $compile; then
18050 val="$define"
18051 case "$sched_yield" in
18052 '') sched_yield='pthread_yield(NULL)' ;;
18053 esac
18054 else
18055 val="$undef"
18056 fi
18057 fi
18058 case "$usethreads" in
18059 $define)
18060 case "$val" in
18061 $define) echo 'pthread_yield() found.' >&4 ;;
18062 *) echo 'pthread_yield() NOT found.' >&4 ;;
18063 esac
18064 ;;
18065 esac
18066 set d_pthread_yield
18067 eval $setvar
18068 case "$sched_yield" in
18069 '') sched_yield=undef ;;
18070 esac
18071 $rm_try
18072
18073 : check for ptrdiff_t
18074 echo " "
18075 echo "Checking to see if you have ptrdiff_t..." >&4
18076 $cat >try.c <<EOCP
18077 #include <stddef.h>
18078 int main() { ptrdiff_t x = 7; }
18079 EOCP
18080 set try
18081 if eval $compile; then
18082 val="$define"
18083 echo "You have ptrdiff_t."
18084 else
18085 val="$undef"
18086 echo "You do not have ptrdiff_t."
18087 fi
18088 $rm_try
18089 set d_ptrdiff_t
18090 eval $setvar
18091
18092 : see if random_r exists
18093 set random_r d_random_r
18094 eval $inlibc
18095 case "$d_random_r" in
18096 "$define")
18097 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18098 case "$d_random_r_proto:$usethreads" in
18099 ":define") d_random_r_proto=define
18100 set d_random_r_proto random_r $hdrs
18101 eval $hasproto ;;
18102 *) ;;
18103 esac
18104 case "$d_random_r_proto" in
18105 define)
18106 case "$random_r_proto" in
18107 ''|0) try='int random_r(int*, struct random_data*);'
18108 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
18109 esac
18110 case "$random_r_proto" in
18111 ''|0) try='int random_r(long*, struct random_data*);'
18112 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
18113 esac
18114 case "$random_r_proto" in
18115 ''|0) try='int random_r(struct random_data*, int32_t*);'
18116 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
18117 esac
18118 case "$random_r_proto" in
18119 ''|0) d_random_r=undef
18120 random_r_proto=0
18121 echo "Disabling random_r, cannot determine prototype." >&4 ;;
18122 * ) case "$random_r_proto" in
18123 REENTRANT_PROTO*) ;;
18124 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
18125 esac
18126 echo "Prototype: $try" ;;
18127 esac
18128 ;;
18129 *) case "$usethreads" in
18130 define) echo "random_r has no prototype, not using it." >&4 ;;
18131 esac
18132 d_random_r=undef
18133 random_r_proto=0
18134 ;;
18135 esac
18136 ;;
18137 *) random_r_proto=0
18138 ;;
18139 esac
18140
18141 : see if readdir and friends exist
18142 set readdir d_readdir
18143 eval $inlibc
18144 set seekdir d_seekdir
18145 eval $inlibc
18146 set telldir d_telldir
18147 eval $inlibc
18148 set rewinddir d_rewinddir
18149 eval $inlibc
18150
18151 : see if readdir64_r exists
18152 set readdir64_r d_readdir64_r
18153 eval $inlibc
18154 case "$d_readdir64_r" in
18155 "$define")
18156 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
18157 case "$d_readdir64_r_proto:$usethreads" in
18158 ":define") d_readdir64_r_proto=define
18159 set d_readdir64_r_proto readdir64_r $hdrs
18160 eval $hasproto ;;
18161 *) ;;
18162 esac
18163 case "$d_readdir64_r_proto" in
18164 define)
18165 case "$readdir64_r_proto" in
18166 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
18167 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
18168 esac
18169 case "$readdir64_r_proto" in
18170 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
18171 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
18172 esac
18173 case "$readdir64_r_proto" in
18174 ''|0) d_readdir64_r=undef
18175 readdir64_r_proto=0
18176 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
18177 * ) case "$readdir64_r_proto" in
18178 REENTRANT_PROTO*) ;;
18179 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
18180 esac
18181 echo "Prototype: $try" ;;
18182 esac
18183 ;;
18184 *) case "$usethreads" in
18185 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
18186 esac
18187 d_readdir64_r=undef
18188 readdir64_r_proto=0
18189 ;;
18190 esac
18191 ;;
18192 *) readdir64_r_proto=0
18193 ;;
18194 esac
18195
18196 : see if readdir_r exists
18197 set readdir_r d_readdir_r
18198 eval $inlibc
18199 case "$d_readdir_r" in
18200 "$define")
18201 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
18202 case "$d_readdir_r_proto:$usethreads" in
18203 ":define") d_readdir_r_proto=define
18204 set d_readdir_r_proto readdir_r $hdrs
18205 eval $hasproto ;;
18206 *) ;;
18207 esac
18208 case "$d_readdir_r_proto" in
18209 define)
18210 case "$readdir_r_proto" in
18211 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
18212 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
18213 esac
18214 case "$readdir_r_proto" in
18215 ''|0) try='int readdir_r(DIR*, struct dirent*);'
18216 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
18217 esac
18218 case "$readdir_r_proto" in
18219 ''|0) d_readdir_r=undef
18220 readdir_r_proto=0
18221 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
18222 * ) case "$readdir_r_proto" in
18223 REENTRANT_PROTO*) ;;
18224 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
18225 esac
18226 echo "Prototype: $try" ;;
18227 esac
18228 ;;
18229 *) case "$usethreads" in
18230 define) echo "readdir_r has no prototype, not using it." >&4 ;;
18231 esac
18232 d_readdir_r=undef
18233 readdir_r_proto=0
18234 ;;
18235 esac
18236 ;;
18237 *) readdir_r_proto=0
18238 ;;
18239 esac
18240
18241 : see if readv exists
18242 set readv d_readv
18243 eval $inlibc
18244
18245 : see if recvmsg exists
18246 set recvmsg d_recvmsg
18247 eval $inlibc
18248
18249 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
18250 echo " "
18251 if set regcomp val -f d_regcomp; eval $csym; $val; then
18252 echo 'regcomp() found.' >&4
18253 d_regcomp="$define"
18254 d_regcmp="$undef"
18255 d_re_comp="$undef"
18256 elif set regcmp val -f d_regcmp; eval $csym; $val; then
18257 echo 'regcmp() found.' >&4
18258 d_regcmp="$define"
18259 d_regcomp="$undef"
18260 d_re_comp="$undef"
18261 elif set re_comp val -f d_re_comp; eval $csym; $val; then
18262 echo 're_comp() found, assuming re_exec() also exists.' >&4
18263 d_re_comp="$define"
18264 d_regcomp="$undef"
18265 d_regcmp="$undef"
18266 else
18267 $cat >&4 <<EOM
18268 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
18269 EOM
18270 d_regcmp="$undef"
18271 d_re_comp="$undef"
18272 d_regcomp="$undef"
18273 fi
18274
18275 : see if remainder exists
18276 set remainder d_remainder
18277 eval $inlibc
18278
18279 : see if remquo exists
18280 set remquo d_remquo
18281 eval $inlibc
18282
18283 : see if rename exists
18284 set rename d_rename
18285 eval $inlibc
18286
18287 : see if rint exists
18288 set rint d_rint
18289 eval $inlibc
18290
18291 : see if rmdir exists
18292 set rmdir d_rmdir
18293 eval $inlibc
18294
18295 : see if round exists
18296 set round d_round
18297 eval $inlibc
18298
18299 : see if prototype for sbrk is available
18300 echo " "
18301 set d_sbrkproto sbrk $i_unistd unistd.h
18302 eval $hasproto
18303
18304 : see if scalbn exists
18305 set scalbn d_scalbn
18306 eval $inlibc
18307
18308 : see if select exists
18309 set select d_select
18310 eval $inlibc
18311
18312 : see if semctl exists
18313 set semctl d_semctl
18314 eval $inlibc
18315
18316 : see if semget exists
18317 set semget d_semget
18318 eval $inlibc
18319
18320 : see if semop exists
18321 set semop d_semop
18322 eval $inlibc
18323
18324 : see how much of the 'sem*(2)' library is present.
18325 h_sem=true
18326 echo " "
18327 case "$d_semctl$d_semget$d_semop" in
18328 *"$undef"*) h_sem=false;;
18329 esac
18330 case "$osname" in
18331 freebsd)
18332 case "`ipcs 2>&1`" in
18333 "SVID messages"*"not configured"*)
18334 echo "Your $osname does not have the sem*(2) configured." >&4
18335 h_sem=false
18336 val="$undef"
18337 set semctl d_semctl
18338 eval $setvar
18339 set semget d_semget
18340 eval $setvar
18341 set semop d_semop
18342 eval $setvar
18343 ;;
18344 esac
18345 ;;
18346 esac
18347 : we could also check for sys/ipc.h ...
18348 if $h_sem && $test `./findhdr sys/sem.h`; then
18349 echo "You have the full sem*(2) library." >&4
18350 val="$define"
18351 else
18352 echo "You don't have the full sem*(2) library." >&4
18353 val="$undef"
18354 fi
18355 set d_sem
18356 eval $setvar
18357
18358 : see whether sys/sem.h defines union semun
18359 echo " "
18360 $cat > try.c <<'END'
18361 #include <sys/types.h>
18362 #include <sys/ipc.h>
18363 #include <sys/sem.h>
18364 int main () { union semun semun; semun.buf = 0; }
18365 END
18366 set try
18367 if eval $compile; then
18368 echo "You have union semun in <sys/sem.h>." >&4
18369 val="$define"
18370 else
18371 echo "You do not have union semun in <sys/sem.h>." >&4
18372 val="$undef"
18373 fi
18374 $rm_try
18375 set d_union_semun
18376 eval $setvar
18377
18378 : see how to do semctl IPC_STAT
18379 case "$d_sem" in
18380 $define)
18381 echo " "
18382 $cat > tryh.h <<END
18383 #ifndef S_IRUSR
18384 # ifdef S_IREAD
18385 # define S_IRUSR S_IREAD
18386 # define S_IWUSR S_IWRITE
18387 # define S_IXUSR S_IEXEC
18388 # else
18389 # define S_IRUSR 0400
18390 # define S_IWUSR 0200
18391 # define S_IXUSR 0100
18392 # endif
18393 # define S_IRGRP (S_IRUSR>>3)
18394 # define S_IWGRP (S_IWUSR>>3)
18395 # define S_IXGRP (S_IXUSR>>3)
18396 # define S_IROTH (S_IRUSR>>6)
18397 # define S_IWOTH (S_IWUSR>>6)
18398 # define S_IXOTH (S_IXUSR>>6)
18399 #endif
18400 #ifndef S_IRWXU
18401 # define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
18402 # define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
18403 # define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
18404 #endif
18405 END
18406 : see whether semctl IPC_STAT can use union semun
18407 case "$d_semctl_semun" in
18408 '')
18409 val="$undef"
18410 $cat > try.c <<END
18411 #include <sys/types.h>
18412 #include <sys/ipc.h>
18413 #include <sys/sem.h>
18414 #include <sys/stat.h>
18415 #include <stdio.h>
18416 #include <errno.h>
18417 #include "tryh.h"
18418 #ifndef errno
18419 extern int errno;
18420 #endif
18421 #$d_union_semun HAS_UNION_SEMUN
18422 int main() {
18423 union semun
18424 #ifndef HAS_UNION_SEMUN
18425 {
18426 int val;
18427 struct semid_ds *buf;
18428 unsigned short *array;
18429 }
18430 #endif
18431 arg;
18432 int sem, st;
18433
18434 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
18435 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18436 if (sem > -1) {
18437 struct semid_ds argbuf;
18438 arg.buf = &argbuf;
18439 # ifdef IPC_STAT
18440 st = semctl(sem, 0, IPC_STAT, arg);
18441 if (st == 0)
18442 printf("semun\n");
18443 else
18444 # endif /* IPC_STAT */
18445 printf("semctl IPC_STAT failed: errno = %d\n", errno);
18446 # ifdef IPC_RMID
18447 if (semctl(sem, 0, IPC_RMID, arg) != 0)
18448 # endif /* IPC_RMID */
18449 printf("semctl IPC_RMID failed: errno = %d\n", errno);
18450 } else
18451 #endif /* IPC_PRIVATE && ... */
18452 printf("semget failed: errno = %d\n", errno);
18453 return 0;
18454 }
18455 END
18456 set try
18457 if eval $compile; then
18458 xxx=`$run ./try`
18459 case "$xxx" in
18460 semun) val="$define" ;;
18461 esac
18462 fi
18463 $rm_try
18464 set d_semctl_semun
18465 eval $setvar
18466 ;;
18467 esac
18468 case "$d_semctl_semun" in
18469 $define)
18470 echo "You can use union semun for semctl IPC_STAT." >&4
18471 also='also'
18472 ;;
18473 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
18474 also=''
18475 ;;
18476 esac
18477
18478 : see whether semctl IPC_STAT can use struct semid_ds pointer
18479 case "$d_semctl_semid_ds" in
18480 '')
18481 val="$undef"
18482 $cat > try.c <<'END'
18483 #include <sys/types.h>
18484 #include <sys/ipc.h>
18485 #include <sys/sem.h>
18486 #include <sys/stat.h>
18487 #include "tryh.h"
18488 #include <stdio.h>
18489 #include <errno.h>
18490 #ifndef errno
18491 extern int errno;
18492 #endif
18493 int main() {
18494 union semun
18495 #ifndef HAS_UNION_SEMUN
18496 {
18497 int val;
18498 struct semid_ds *buf;
18499 unsigned short *array;
18500 }
18501 #endif
18502 arg;
18503 struct semid_ds argbuf;
18504 int sem, st;
18505
18506 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
18507 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18508 if (sem > -1) {
18509 arg.buf = &argbuf;
18510 # ifdef IPC_STAT
18511 st = semctl(sem, 0, IPC_STAT, arg);
18512 if (st == 0)
18513 printf("semid_ds\n");
18514 else
18515 # endif /* IPC_STAT */
18516 printf("semctl IPC_STAT failed: errno = %d\n", errno);
18517 # ifdef IPC_RMID
18518 if (semctl(sem, 0, IPC_RMID, arg) != 0)
18519 # endif /* IPC_RMID */
18520 printf("semctl IPC_RMID failed: errno = %d\n", errno);
18521 } else
18522 #endif /* IPC_PRIVATE && ... */
18523 printf("semget failed: errno = %d\n", errno);
18524
18525 return 0;
18526 }
18527 END
18528 set try
18529 if eval $compile; then
18530 xxx=`$run ./try`
18531 case "$xxx" in
18532 semid_ds) val="$define" ;;
18533 esac
18534 fi
18535 $rm_try
18536 set d_semctl_semid_ds
18537 eval $setvar
18538 ;;
18539 esac
18540 case "$d_semctl_semid_ds" in
18541 $define)
18542 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18543 ;;
18544 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18545 ;;
18546 esac
18547 ;;
18548 *) val="$undef"
18549
18550 # We do not have the full sem*(2) library, so assume we can not
18551 # use either.
18552
18553 set d_semctl_semun
18554 eval $setvar
18555
18556 set d_semctl_semid_ds
18557 eval $setvar
18558 ;;
18559 esac
18560 $rm_try tryh.h
18561
18562 : see if sendmsg exists
18563 set sendmsg d_sendmsg
18564 eval $inlibc
18565
18566 : see if setegid exists
18567 set setegid d_setegid
18568 eval $inlibc
18569
18570 : see if setenv exists
18571 set setenv d_setenv
18572 eval $inlibc
18573
18574 : see if seteuid exists
18575 set seteuid d_seteuid
18576 eval $inlibc
18577
18578 : see if setgrent exists
18579 set setgrent d_setgrent
18580 eval $inlibc
18581
18582 : see if setgrent_r exists
18583 set setgrent_r d_setgrent_r
18584 eval $inlibc
18585 case "$d_setgrent_r" in
18586 "$define")
18587 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18588 case "$d_setgrent_r_proto:$usethreads" in
18589 ":define") d_setgrent_r_proto=define
18590 set d_setgrent_r_proto setgrent_r $hdrs
18591 eval $hasproto ;;
18592 *) ;;
18593 esac
18594 case "$d_setgrent_r_proto" in
18595 define)
18596 case "$setgrent_r_proto" in
18597 ''|0) try='int setgrent_r(FILE**);'
18598 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18599 esac
18600 case "$setgrent_r_proto" in
18601 ''|0) try='void setgrent_r(FILE**);'
18602 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18603 esac
18604 case "$setgrent_r_proto" in
18605 ''|0) d_setgrent_r=undef
18606 setgrent_r_proto=0
18607 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18608 * ) case "$setgrent_r_proto" in
18609 REENTRANT_PROTO*) ;;
18610 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18611 esac
18612 echo "Prototype: $try" ;;
18613 esac
18614 ;;
18615 *) case "$usethreads" in
18616 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18617 esac
18618 d_setgrent_r=undef
18619 setgrent_r_proto=0
18620 ;;
18621 esac
18622 ;;
18623 *) setgrent_r_proto=0
18624 ;;
18625 esac
18626
18627 : see if sethostent exists
18628 set sethostent d_sethent
18629 eval $inlibc
18630
18631 : see if sethostent_r exists
18632 set sethostent_r d_sethostent_r
18633 eval $inlibc
18634 case "$d_sethostent_r" in
18635 "$define")
18636 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18637 case "$d_sethostent_r_proto:$usethreads" in
18638 ":define") d_sethostent_r_proto=define
18639 set d_sethostent_r_proto sethostent_r $hdrs
18640 eval $hasproto ;;
18641 *) ;;
18642 esac
18643 case "$d_sethostent_r_proto" in
18644 define)
18645 case "$sethostent_r_proto" in
18646 ''|0) try='int sethostent_r(int, struct hostent_data*);'
18647 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18648 esac
18649 case "$sethostent_r_proto" in
18650 ''|0) try='void sethostent_r(int, struct hostent_data*);'
18651 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18652 esac
18653 case "$sethostent_r_proto" in
18654 ''|0) d_sethostent_r=undef
18655 sethostent_r_proto=0
18656 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18657 * ) case "$sethostent_r_proto" in
18658 REENTRANT_PROTO*) ;;
18659 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18660 esac
18661 echo "Prototype: $try" ;;
18662 esac
18663 ;;
18664 *) case "$usethreads" in
18665 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18666 esac
18667 d_sethostent_r=undef
18668 sethostent_r_proto=0
18669 ;;
18670 esac
18671 ;;
18672 *) sethostent_r_proto=0
18673 ;;
18674 esac
18675
18676 : see if setitimer exists
18677 set setitimer d_setitimer
18678 eval $inlibc
18679
18680 : see if setlinebuf exists
18681 set setlinebuf d_setlinebuf
18682 eval $inlibc
18683
18684 : see if setlocale_r exists
18685 set setlocale_r d_setlocale_r
18686 eval $inlibc
18687 case "$d_setlocale_r" in
18688 "$define")
18689 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18690 case "$d_setlocale_r_proto:$usethreads" in
18691 ":define") d_setlocale_r_proto=define
18692 set d_setlocale_r_proto setlocale_r $hdrs
18693 eval $hasproto ;;
18694 *) ;;
18695 esac
18696 case "$d_setlocale_r_proto" in
18697 define)
18698 case "$setlocale_r_proto" in
18699 ''|0) try='int setlocale_r(int, const char*, char*, int);'
18700 ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18701 esac
18702 case "$setlocale_r_proto" in
18703 ''|0) d_setlocale_r=undef
18704 setlocale_r_proto=0
18705 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18706 * ) case "$setlocale_r_proto" in
18707 REENTRANT_PROTO*) ;;
18708 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18709 esac
18710 echo "Prototype: $try" ;;
18711 esac
18712 ;;
18713 *) case "$usethreads" in
18714 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18715 esac
18716 d_setlocale_r=undef
18717 setlocale_r_proto=0
18718 ;;
18719 esac
18720 ;;
18721 *) setlocale_r_proto=0
18722 ;;
18723 esac
18724
18725 : see if setnetent exists
18726 set setnetent d_setnent
18727 eval $inlibc
18728
18729 : see if setnetent_r exists
18730 set setnetent_r d_setnetent_r
18731 eval $inlibc
18732 case "$d_setnetent_r" in
18733 "$define")
18734 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18735 case "$d_setnetent_r_proto:$usethreads" in
18736 ":define") d_setnetent_r_proto=define
18737 set d_setnetent_r_proto setnetent_r $hdrs
18738 eval $hasproto ;;
18739 *) ;;
18740 esac
18741 case "$d_setnetent_r_proto" in
18742 define)
18743 case "$setnetent_r_proto" in
18744 ''|0) try='int setnetent_r(int, struct netent_data*);'
18745 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18746 esac
18747 case "$setnetent_r_proto" in
18748 ''|0) try='void setnetent_r(int, struct netent_data*);'
18749 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18750 esac
18751 case "$setnetent_r_proto" in
18752 ''|0) d_setnetent_r=undef
18753 setnetent_r_proto=0
18754 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18755 * ) case "$setnetent_r_proto" in
18756 REENTRANT_PROTO*) ;;
18757 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18758 esac
18759 echo "Prototype: $try" ;;
18760 esac
18761 ;;
18762 *) case "$usethreads" in
18763 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18764 esac
18765 d_setnetent_r=undef
18766 setnetent_r_proto=0
18767 ;;
18768 esac
18769 ;;
18770 *) setnetent_r_proto=0
18771 ;;
18772 esac
18773
18774 : see if setprotoent exists
18775 set setprotoent d_setpent
18776 eval $inlibc
18777
18778 : see if setpgid exists
18779 set setpgid d_setpgid
18780 eval $inlibc
18781
18782 : see if setpgrp2 exists
18783 set setpgrp2 d_setpgrp2
18784 eval $inlibc
18785
18786 : see if setpriority exists
18787 set setpriority d_setprior
18788 eval $inlibc
18789
18790 : see if setproctitle exists
18791 set setproctitle d_setproctitle
18792 eval $inlibc
18793
18794 : see if setprotoent_r exists
18795 set setprotoent_r d_setprotoent_r
18796 eval $inlibc
18797 case "$d_setprotoent_r" in
18798 "$define")
18799 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18800 case "$d_setprotoent_r_proto:$usethreads" in
18801 ":define") d_setprotoent_r_proto=define
18802 set d_setprotoent_r_proto setprotoent_r $hdrs
18803 eval $hasproto ;;
18804 *) ;;
18805 esac
18806 case "$d_setprotoent_r_proto" in
18807 define)
18808 case "$setprotoent_r_proto" in
18809 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18810 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18811 esac
18812 case "$setprotoent_r_proto" in
18813 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18814 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18815 esac
18816 case "$setprotoent_r_proto" in
18817 ''|0) d_setprotoent_r=undef
18818 setprotoent_r_proto=0
18819 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18820 * ) case "$setprotoent_r_proto" in
18821 REENTRANT_PROTO*) ;;
18822 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18823 esac
18824 echo "Prototype: $try" ;;
18825 esac
18826 ;;
18827 *) case "$usethreads" in
18828 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18829 esac
18830 d_setprotoent_r=undef
18831 setprotoent_r_proto=0
18832 ;;
18833 esac
18834 ;;
18835 *) setprotoent_r_proto=0
18836 ;;
18837 esac
18838
18839 : see if setpwent exists
18840 set setpwent d_setpwent
18841 eval $inlibc
18842
18843 : see if setpwent_r exists
18844 set setpwent_r d_setpwent_r
18845 eval $inlibc
18846 case "$d_setpwent_r" in
18847 "$define")
18848 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18849 case "$d_setpwent_r_proto:$usethreads" in
18850 ":define") d_setpwent_r_proto=define
18851 set d_setpwent_r_proto setpwent_r $hdrs
18852 eval $hasproto ;;
18853 *) ;;
18854 esac
18855 case "$d_setpwent_r_proto" in
18856 define)
18857 case "$setpwent_r_proto" in
18858 ''|0) try='int setpwent_r(FILE**);'
18859 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18860 esac
18861 case "$setpwent_r_proto" in
18862 ''|0) try='void setpwent_r(FILE**);'
18863 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18864 esac
18865 case "$setpwent_r_proto" in
18866 ''|0) d_setpwent_r=undef
18867 setpwent_r_proto=0
18868 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18869 * ) case "$setpwent_r_proto" in
18870 REENTRANT_PROTO*) ;;
18871 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18872 esac
18873 echo "Prototype: $try" ;;
18874 esac
18875 ;;
18876 *) case "$usethreads" in
18877 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18878 esac
18879 d_setpwent_r=undef
18880 setpwent_r_proto=0
18881 ;;
18882 esac
18883 ;;
18884 *) setpwent_r_proto=0
18885 ;;
18886 esac
18887
18888 : see if setregid exists
18889 set setregid d_setregid
18890 eval $inlibc
18891 set setresgid d_setresgid
18892 eval $inlibc
18893
18894 : see if setreuid exists
18895 set setreuid d_setreuid
18896 eval $inlibc
18897 set setresuid d_setresuid
18898 eval $inlibc
18899
18900 : see if setrgid exists
18901 set setrgid d_setrgid
18902 eval $inlibc
18903
18904 : see if setruid exists
18905 set setruid d_setruid
18906 eval $inlibc
18907
18908 : see if setservent exists
18909 set setservent d_setsent
18910 eval $inlibc
18911
18912 : see if setservent_r exists
18913 set setservent_r d_setservent_r
18914 eval $inlibc
18915 case "$d_setservent_r" in
18916 "$define")
18917 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18918 case "$d_setservent_r_proto:$usethreads" in
18919 ":define") d_setservent_r_proto=define
18920 set d_setservent_r_proto setservent_r $hdrs
18921 eval $hasproto ;;
18922 *) ;;
18923 esac
18924 case "$d_setservent_r_proto" in
18925 define)
18926 case "$setservent_r_proto" in
18927 ''|0) try='int setservent_r(int, struct servent_data*);'
18928 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18929 esac
18930 case "$setservent_r_proto" in
18931 ''|0) try='void setservent_r(int, struct servent_data*);'
18932 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18933 esac
18934 case "$setservent_r_proto" in
18935 ''|0) d_setservent_r=undef
18936 setservent_r_proto=0
18937 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18938 * ) case "$setservent_r_proto" in
18939 REENTRANT_PROTO*) ;;
18940 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18941 esac
18942 echo "Prototype: $try" ;;
18943 esac
18944 ;;
18945 *) case "$usethreads" in
18946 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18947 esac
18948 d_setservent_r=undef
18949 setservent_r_proto=0
18950 ;;
18951 esac
18952 ;;
18953 *) setservent_r_proto=0
18954 ;;
18955 esac
18956
18957 : see if setsid exists
18958 set setsid d_setsid
18959 eval $inlibc
18960
18961 : see if setvbuf exists
18962 set setvbuf d_setvbuf
18963 eval $inlibc
18964
18965 : see if shmctl exists
18966 set shmctl d_shmctl
18967 eval $inlibc
18968
18969 : see if shmget exists
18970 set shmget d_shmget
18971 eval $inlibc
18972
18973 : see if shmat exists
18974 set shmat d_shmat
18975 eval $inlibc
18976 : see what shmat returns
18977 case "$d_shmat" in
18978 "$define")
18979 $cat >shmat.c <<'END'
18980 #include <sys/shm.h>
18981 void *shmat();
18982 END
18983 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18984 shmattype='void *'
18985 else
18986 shmattype='char *'
18987 fi
18988 echo "and it returns ($shmattype)." >&4
18989 : see if a prototype for shmat is available
18990 xxx=`./findhdr sys/shm.h`
18991 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18992 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18993 val="$define"
18994 else
18995 val="$undef"
18996 fi
18997 $rm -f shmat.[co]
18998 ;;
18999 *)
19000 val="$undef"
19001 ;;
19002 esac
19003 set d_shmatprototype
19004 eval $setvar
19005
19006 : see if shmdt exists
19007 set shmdt d_shmdt
19008 eval $inlibc
19009
19010 : see how much of the 'shm*(2)' library is present.
19011 h_shm=true
19012 echo " "
19013 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
19014 *"$undef"*) h_shm=false;;
19015 esac
19016 case "$osname" in
19017 freebsd)
19018 case "`ipcs 2>&1`" in
19019 "SVID shared memory"*"not configured"*)
19020 echo "Your $osname does not have the shm*(2) configured." >&4
19021 h_shm=false
19022 val="$undef"
19023 set shmctl d_shmctl
19024 eval $setvar
19025 set shmget d_shmget
19026 eval $setvar
19027 set shmat d_shmat
19028 eval $setvar
19029 set shmdt d_shmdt
19030 eval $setvar
19031 ;;
19032 esac
19033 ;;
19034 esac
19035 : we could also check for sys/ipc.h ...
19036 if $h_shm && $test `./findhdr sys/shm.h`; then
19037 echo "You have the full shm*(2) library." >&4
19038 val="$define"
19039 else
19040 echo "You don't have the full shm*(2) library." >&4
19041 val="$undef"
19042 fi
19043 set d_shm
19044 eval $setvar
19045
19046 : see if we have sigaction
19047 echo " "
19048 if set sigaction val -f d_sigaction; eval $csym; $val; then
19049 echo 'sigaction() found.' >&4
19050 $cat > try.c <<EOP
19051 #include <stdio.h>
19052 #include <sys/types.h>
19053 #include <signal.h>
19054 #$i_stdlib I_STDLIB
19055 #ifdef I_STDLIB
19056 #include <stdlib.h>
19057 #endif
19058 int main()
19059 {
19060 struct sigaction act, oact;
19061 act.sa_flags = 0;
19062 oact.sa_handler = 0;
19063 /* so that act and oact are used */
19064 exit(act.sa_flags == 0 && oact.sa_handler == 0);
19065 }
19066 EOP
19067 set try
19068 if eval $compile_ok; then
19069 val="$define"
19070 else
19071 echo "But you don't seem to have a usable struct sigaction." >&4
19072 val="$undef"
19073 fi
19074 else
19075 echo 'sigaction NOT found.' >&4
19076 val="$undef"
19077 fi
19078 set d_sigaction; eval $setvar
19079 $rm_try
19080
19081 : see what type pids are declared as in the kernel
19082 rp="What is the type of process ids on this system?"
19083 set pid_t pidtype int stdio.h sys/types.h
19084 eval $typedef_ask
19085
19086 : see what type uids are declared as in the kernel
19087 echo " "
19088 echo "Looking for the type for user ids returned by getuid()."
19089 set uid_t uidtype xxx stdio.h sys/types.h
19090 eval $typedef
19091 case "$uidtype" in
19092 xxx)
19093 xxx=`./findhdr sys/user.h`
19094 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19095 case $1 in
19096 unsigned) dflt="$1 $2" ;;
19097 *) dflt="$1" ;;
19098 esac
19099 ;;
19100 *) dflt="$uidtype";;
19101 esac
19102 case "$uidtype" in
19103 uid_t) echo "uid_t found." ;;
19104 *) rp="What is the type for user ids returned by getuid()?"
19105 . ./myread
19106 uidtype="$ans"
19107 ;;
19108 esac
19109
19110 : Define hasfield_t macro for Configure internal use
19111 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
19112 while $test $# -ge 2; do
19113 case "$1" in
19114 $define) echo "#include <$2>";;
19115 esac ;
19116 shift 2;
19117 done > try.c;
19118 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
19119 set try;
19120 if eval $compile; then
19121 val="$define";
19122 else
19123 val="$undef";
19124 fi;
19125 set $varname;
19126 eval $setvar;
19127 $rm_try'
19128
19129 : see what siginfo fields we have
19130 case "$d_sigaction" in
19131 "$define")
19132 echo "Checking if your siginfo_t has si_errno field...">&4
19133 set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
19134 eval $hasfield_t;
19135
19136 echo "Checking if your siginfo_t has si_pid field...">&4
19137 set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
19138 eval $hasfield_t;
19139
19140 echo "Checking if your siginfo_t has si_uid field...">&4
19141 set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
19142 eval $hasfield_t;
19143
19144 echo "Checking if your siginfo_t has si_addr field...">&4
19145 set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
19146 eval $hasfield_t;
19147
19148 echo "Checking if your siginfo_t has si_status field...">&4
19149 set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
19150 eval $hasfield_t;
19151
19152 echo "Checking if your siginfo_t has si_band field...">&4
19153 set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
19154 eval $hasfield_t;
19155
19156 echo "Checking if your siginfo_t has si_value field...">&4
19157 set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
19158 eval $hasfield_t;
19159
19160 echo "Checking if your siginfo_t has si_fd field...">&4
19161 set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
19162 eval $hasfield_t;
19163
19164 ;;
19165 *)
19166 d_siginfo_si_errno="$undef"
19167 d_siginfo_si_pid="$undef"
19168 d_siginfo_si_uid="$undef"
19169 d_siginfo_si_addr="$undef"
19170 d_siginfo_si_status="$undef"
19171 d_siginfo_si_band="$undef"
19172 d_siginfo_si_value="$undef"
19173 d_siginfo_si_fd="$undef"
19174 ;;
19175 esac
19176
19177 : see if this is a sunmath.h system
19178 set sunmath.h i_sunmath
19179 eval $inhdr
19180
19181 : see if signbit exists
19182 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
19183 $cat >try.c <<EOCP
19184 #$i_sunmath I_SUNMATH
19185 #include <math.h>
19186 #ifdef I_SUNMATH /* Solaris special math library */
19187 # include <sunmath.h>
19188 #endif
19189 #define NV $nvtype
19190 int main(int argc, char **argv)
19191 {
19192 NV x = 0.0;
19193 NV y = -1.0;
19194 if ((signbit(x) == 0) && (signbit(y) != 0))
19195 return 0;
19196 else
19197 return 1;
19198 }
19199 EOCP
19200 val="$undef"
19201 set try
19202 if eval $compile; then
19203 if $run ./try; then
19204 $echo "Yes." >&4
19205 val="$define"
19206 else
19207 $echo "Signbit seems to be available, but doesn't work as I expected."
19208 $echo "I won't use it." >&4
19209 val="$undef"
19210 fi
19211 else
19212 $echo "Nope." >&4
19213 dflt="$undef"
19214 fi
19215 set d_signbit
19216 eval $setvar
19217 $rm_try
19218
19219 : see if sigprocmask exists
19220 set sigprocmask d_sigprocmask
19221 eval $inlibc
19222
19223 : see if sigsetjmp exists
19224 echo " "
19225 case "$d_sigsetjmp" in
19226 '')
19227 $cat >try.c <<EOP
19228 #include <setjmp.h>
19229 #$i_stdlib I_STDLIB
19230 #ifdef I_STDLIB
19231 #include <stdlib.h>
19232 #endif
19233 sigjmp_buf env;
19234 int set = 1;
19235 int main()
19236 {
19237 if (sigsetjmp(env,1))
19238 exit(set);
19239 set = 0;
19240 siglongjmp(env, 1);
19241 exit(1);
19242 }
19243 EOP
19244 set try
19245 if eval $compile; then
19246 if $run ./try >/dev/null 2>&1; then
19247 echo "POSIX sigsetjmp found." >&4
19248 val="$define"
19249 else
19250 $cat >&4 <<EOM
19251 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
19252 I'll ignore them.
19253 EOM
19254 val="$undef"
19255 fi
19256 else
19257 echo "sigsetjmp not found." >&4
19258 val="$undef"
19259 fi
19260 ;;
19261 *) val="$d_sigsetjmp"
19262 case "$d_sigsetjmp" in
19263 $define) echo "POSIX sigsetjmp found." >&4;;
19264 $undef) echo "sigsetjmp not found." >&4;;
19265 esac
19266 ;;
19267 esac
19268 set d_sigsetjmp
19269 eval $setvar
19270 $rm_try
19271
19272 : see if snprintf exists
19273 set snprintf d_snprintf
19274 eval $inlibc
19275
19276 : see if vsnprintf exists
19277 set vsnprintf d_vsnprintf
19278 eval $inlibc
19279
19280 case "$d_snprintf-$d_vsnprintf" in
19281 "$define-$define")
19282 $cat <<EOM
19283 Checking whether your snprintf() and vsnprintf() work okay...
19284 EOM
19285 $cat >try.c <<'EOCP'
19286 /* v?snprintf testing logic courtesy of Russ Allbery.
19287 * According to C99:
19288 * - if the buffer is too short it still must be \0-terminated
19289 * - if the buffer is too short the potentially required length
19290 * must be returned and not -1
19291 * - if the buffer is NULL the potentially required length
19292 * must be returned and not -1 or core dump
19293 */
19294 #include <stdio.h>
19295 #include <stdarg.h>
19296
19297 char buf[2];
19298
19299 int test (char *format, ...)
19300 {
19301 va_list args;
19302 int count;
19303
19304 va_start (args, format);
19305 count = vsnprintf (buf, sizeof buf, format, args);
19306 va_end (args);
19307 return count;
19308 }
19309
19310 int main ()
19311 {
19312 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
19313 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
19314 }
19315 EOCP
19316 set try
19317 if eval $compile; then
19318 `$run ./try`
19319 case "$?" in
19320 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
19321 *) cat <<EOM >&4
19322 Your snprintf() and snprintf() don't seem to be working okay.
19323 EOM
19324 d_snprintf="$undef"
19325 d_vsnprintf="$undef"
19326 ;;
19327 esac
19328 else
19329 echo "(I can't seem to compile the test program--assuming they don't)"
19330 d_snprintf="$undef"
19331 d_vsnprintf="$undef"
19332 fi
19333 $rm_try
19334 ;;
19335 esac
19336
19337 : see if sockatmark exists
19338 set sockatmark d_sockatmark
19339 eval $inlibc
19340
19341 : see if prototype for sockatmark is available
19342 echo " "
19343 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
19344 eval $hasproto
19345
19346 : see if socks5_init exists
19347 set socks5_init d_socks5_init
19348 eval $inlibc
19349
19350 : see if srand48_r exists
19351 set srand48_r d_srand48_r
19352 eval $inlibc
19353 case "$d_srand48_r" in
19354 "$define")
19355 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19356 case "$d_srand48_r_proto:$usethreads" in
19357 ":define") d_srand48_r_proto=define
19358 set d_srand48_r_proto srand48_r $hdrs
19359 eval $hasproto ;;
19360 *) ;;
19361 esac
19362 case "$d_srand48_r_proto" in
19363 define)
19364 case "$srand48_r_proto" in
19365 ''|0) try='int srand48_r(long, struct drand48_data*);'
19366 ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
19367 esac
19368 case "$srand48_r_proto" in
19369 ''|0) d_srand48_r=undef
19370 srand48_r_proto=0
19371 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
19372 * ) case "$srand48_r_proto" in
19373 REENTRANT_PROTO*) ;;
19374 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
19375 esac
19376 echo "Prototype: $try" ;;
19377 esac
19378 ;;
19379 *) case "$usethreads" in
19380 define) echo "srand48_r has no prototype, not using it." >&4 ;;
19381 esac
19382 d_srand48_r=undef
19383 srand48_r_proto=0
19384 ;;
19385 esac
19386 ;;
19387 *) srand48_r_proto=0
19388 ;;
19389 esac
19390
19391 : see if srandom_r exists
19392 set srandom_r d_srandom_r
19393 eval $inlibc
19394 case "$d_srandom_r" in
19395 "$define")
19396 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19397 case "$d_srandom_r_proto:$usethreads" in
19398 ":define") d_srandom_r_proto=define
19399 set d_srandom_r_proto srandom_r $hdrs
19400 eval $hasproto ;;
19401 *) ;;
19402 esac
19403 case "$d_srandom_r_proto" in
19404 define)
19405 case "$srandom_r_proto" in
19406 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
19407 ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
19408 esac
19409 case "$srandom_r_proto" in
19410 ''|0) d_srandom_r=undef
19411 srandom_r_proto=0
19412 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
19413 * ) case "$srandom_r_proto" in
19414 REENTRANT_PROTO*) ;;
19415 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
19416 esac
19417 echo "Prototype: $try" ;;
19418 esac
19419 ;;
19420 *) case "$usethreads" in
19421 define) echo "srandom_r has no prototype, not using it." >&4 ;;
19422 esac
19423 d_srandom_r=undef
19424 srandom_r_proto=0
19425 ;;
19426 esac
19427 ;;
19428 *) srandom_r_proto=0
19429 ;;
19430 esac
19431
19432 : see if prototype for setresgid is available
19433 echo " "
19434 set d_sresgproto setresgid $i_unistd unistd.h
19435 eval $hasproto
19436
19437 : see if prototype for setresuid is available
19438 echo " "
19439 set d_sresuproto setresuid $i_unistd unistd.h
19440 eval $hasproto
19441
19442 : see if stat exists
19443 set stat d_stat
19444 eval $inlibc
19445
19446 : see if sys/stat.h is available
19447 set sys/stat.h i_sysstat
19448 eval $inhdr
19449
19450 : see if stat knows about block sizes
19451 echo " "
19452 echo "Checking to see if your struct stat has st_blocks field..." >&4
19453 set d_statblks stat st_blocks $i_sysstat sys/stat.h
19454 eval $hasfield
19455
19456 : see if this is a sys/vfs.h system
19457 set sys/vfs.h i_sysvfs
19458 eval $inhdr
19459
19460 : see if this is a sys/statfs.h system
19461 set sys/statfs.h i_sysstatfs
19462 eval $inhdr
19463
19464 : Check for statfs_s
19465 echo " "
19466 echo "Checking to see if your system supports struct statfs..." >&4
19467 set 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
19468 eval $hasstruct
19469 case "$d_statfs_s" in
19470 "$define") echo "Yes, it does." ;;
19471 *) echo "No, it doesn't." ;;
19472 esac
19473
19474 : see if struct statfs knows about f_flags
19475 case "$d_statfs_s" in
19476 define)
19477 echo " "
19478 echo "Checking to see if your struct statfs has f_flags field..." >&4
19479 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
19480 eval $hasfield
19481 ;;
19482 *) val="$undef"
19483 set d_statfs_f_flags
19484 eval $setvar
19485 ;;
19486 esac
19487 case "$d_statfs_f_flags" in
19488 "$define") echo "Yes, it does." ;;
19489 *) echo "No, it doesn't." ;;
19490 esac
19491
19492 : see what flavor, if any, of static inline is supported
19493 echo " "
19494 echo "Checking to see if your system supports static inline..."
19495 $cat > try.c <<'EOCP'
19496 #include <stdlib.h>
19497 extern int f_via_a(int x);
19498 extern int f_via_b(int x);
19499 int main(int argc, char **argv)
19500 {
19501 int y;
19502
19503 y = f_via_a(0);
19504 #ifdef USE_B
19505 y = f_via_b(0);
19506 #endif
19507 if (y == 42) {
19508 return EXIT_SUCCESS;
19509 }
19510 else {
19511 return EXIT_FAILURE;
19512 }
19513 }
19514 EOCP
19515 $cat > a.c <<'EOCP'
19516 static INLINE int f(int x) {
19517 int y;
19518 y = x + 42;
19519 return y;
19520 }
19521
19522 int f_via_a(int x)
19523 {
19524 return f(x);
19525 }
19526 EOCP
19527 $cat > b.c <<'EOCP'
19528 extern int f(int x);
19529
19530 int f_via_b(int x)
19531 {
19532 return f(x);
19533 }
19534 EOCP
19535
19536 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19537 case "$perl_static_inline" in
19538 '') # Check the various possibilities, and break out on success.
19539 # For gcc, prefer __inline__, which will still permit
19540 # cflags.SH to add in -ansi.
19541 case "$gccversion" in
19542 '') xxx="inline __inline__ __inline _inline";;
19543 *) xxx="__inline__ inline __inline _inline";;
19544 esac
19545 for inline in $xxx; do
19546 set try -DINLINE=$inline a.c
19547 if eval $compile && $run ./try; then
19548 # Now make sure there is no external linkage of static
19549 # functions
19550 set try -DINLINE=$inline -DUSE_B a.c b.c
19551 if eval $compile && $run ./try; then
19552 $echo "Your compiler supports static $inline, " >&4
19553 $echo "but it also creates an external definition," >&4
19554 $echo "so I won't use it." >&4
19555 val=$undef
19556 else
19557 $echo "Your compiler supports static $inline." >&4
19558 val=$define
19559 perl_static_inline="static $inline";
19560 break;
19561 fi
19562 else
19563 $echo "Your compiler does NOT support static $inline." >&4
19564 val="$undef"
19565 fi
19566 done
19567 ;;
19568 *inline*) # Some variant of inline exists.
19569 echo "Keeping your $hint value of $perl_static_inline."
19570 val=$define
19571 ;;
19572 static) # No inline capabilities
19573 echo "Keeping your $hint value of $perl_static_inline."
19574 val=$undef
19575 ;;
19576 *) # Unrecognized previous value -- blindly trust the supplied
19577 # value and hope it makes sense. Use old value for
19578 # d_static_inline, if there is one.
19579 echo "Keeping your $hint value of $perl_static_inline."
19580 case "$d_static_inline" in
19581 '') val=$define ;;
19582 *) val=$d_static_inline ;;
19583 esac
19584 ;;
19585 esac
19586 # Fallback to plain 'static' if nothing worked.
19587 case "$perl_static_inline" in
19588 '')
19589 perl_static_inline="static"
19590 val=$undef
19591 ;;
19592 esac
19593 set d_static_inline
19594 eval $setvar
19595 $rm -f a.[co] b.[co]
19596 $rm_try
19597
19598 : Check stream access
19599 $cat >&4 <<EOM
19600 Checking how to access stdio streams by file descriptor number...
19601 EOM
19602 case "$stdio_stream_array" in
19603 '') $cat >try.c <<EOCP
19604 #include <stdio.h>
19605 int main() {
19606 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19607 printf("yes\n");
19608 }
19609 EOCP
19610 for s in _iob __iob __sF
19611 do
19612 set try -DSTDIO_STREAM_ARRAY=$s
19613 if eval $compile; then
19614 case "`$run ./try`" in
19615 yes) stdio_stream_array=$s; break ;;
19616 esac
19617 fi
19618 done
19619 $rm_try
19620 esac
19621 case "$stdio_stream_array" in
19622 '') $cat >&4 <<EOM
19623 I can't figure out how to access stdio streams by file descriptor number.
19624 EOM
19625 d_stdio_stream_array="$undef"
19626 ;;
19627 *) $cat >&4 <<EOM
19628 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19629 EOM
19630 d_stdio_stream_array="$define"
19631 ;;
19632 esac
19633
19634 : see if strcoll exists
19635 set strcoll d_strcoll
19636 eval $inlibc
19637
19638 : see if strerror_l exists
19639 set strerror_l d_strerror_l
19640 eval $inlibc
19641
19642 : see if strerror_r exists
19643 set strerror_r d_strerror_r
19644 eval $inlibc
19645 case "$d_strerror_r" in
19646 "$define")
19647 hdrs="$i_systypes sys/types.h define stdio.h define string.h"
19648 case "$d_strerror_r_proto:$usethreads" in
19649 ":define") d_strerror_r_proto=define
19650 set d_strerror_r_proto strerror_r $hdrs
19651 eval $hasproto ;;
19652 *) ;;
19653 esac
19654 case "$d_strerror_r_proto" in
19655 define)
19656 case "$strerror_r_proto" in
19657 ''|0) try='int strerror_r(int, char*, size_t);'
19658 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19659 esac
19660 case "$strerror_r_proto" in
19661 ''|0) try='int strerror_r(int, char*, int);'
19662 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19663 esac
19664 case "$strerror_r_proto" in
19665 ''|0) try='char* strerror_r(int, char*, size_t);'
19666 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19667 esac
19668 case "$strerror_r_proto" in
19669 ''|0) d_strerror_r=undef
19670 strerror_r_proto=0
19671 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19672 * ) case "$strerror_r_proto" in
19673 REENTRANT_PROTO*) ;;
19674 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19675 esac
19676 echo "Prototype: $try" ;;
19677 esac
19678 ;;
19679 *) case "$usethreads" in
19680 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19681 esac
19682 d_strerror_r=undef
19683 strerror_r_proto=0
19684 ;;
19685 esac
19686 ;;
19687 *) strerror_r_proto=0
19688 ;;
19689 esac
19690
19691 : see if strftime exists
19692 set strftime d_strftime
19693 eval $inlibc
19694
19695 : see if strlcat exists
19696 : We need both a prototype in string.h and the symbol in libc.
19697 echo " "
19698 d_strlcat_proto=''
19699 xx1="#$d_gnulibc HAS_GNULIBC"
19700 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19701 xx3='# define _GNU_SOURCE'
19702 xx4='#endif'
19703 set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19704 eval $hasproto
19705 case "$d_strlcat_proto" in
19706 define) # see if strlcat exists
19707 set strlcat d_strlcat
19708 eval $inlibc
19709 ;;
19710 *) val=$undef
19711 set d_strlcat
19712 eval $setvar
19713 ;;
19714 esac
19715
19716 : see if strlcpy exists
19717 : We need both a prototype in string.h and the symbol in libc.
19718 echo " "
19719 d_strlcpy_proto=''
19720 xx1="#$d_gnulibc HAS_GNULIBC"
19721 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19722 xx3='# define _GNU_SOURCE'
19723 xx4='#endif'
19724 set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19725 eval $hasproto
19726 case "$d_strlcpy_proto" in
19727 define) # see if strlcpy exists
19728 set strlcpy d_strlcpy
19729 eval $inlibc
19730 ;;
19731 *) val=$undef
19732 set d_strlcpy
19733 eval $setvar
19734 ;;
19735 esac
19736
19737 : see if strnlen exists
19738 set strnlen d_strnlen
19739 eval $inlibc
19740
19741 : see if strtod exists
19742 set strtod d_strtod
19743 eval $inlibc
19744
19745 : see if strtod_l exists
19746 set strtod_l d_strtod_l
19747 eval $inlibc
19748
19749 : see if strtol exists
19750 set strtol d_strtol
19751 eval $inlibc
19752
19753 : see if strtold exists
19754 set strtold d_strtold
19755 eval $inlibc
19756
19757 : see if strtold_l exists
19758 set strtold_l d_strtold_l
19759 eval $inlibc
19760
19761 : see if strtoll exists
19762 set strtoll d_strtoll
19763 eval $inlibc
19764
19765 case "$d_longlong-$d_strtoll" in
19766 "$define-$define")
19767 $cat <<EOM
19768 Checking whether your strtoll() works okay...
19769 EOM
19770 $cat >try.c <<'EOCP'
19771 #include <errno.h>
19772 #ifdef __hpux
19773 #define strtoll __strtoll
19774 #endif
19775 #ifdef __EMX__
19776 #define strtoll _strtoll
19777 #endif
19778 #include <stdio.h>
19779 #include <stdlib.h>
19780 static int bad = 0;
19781 void check(const char *s, long long ell, int een) {
19782 long long gll;
19783 errno = 0;
19784 gll = strtoll(s, 0, 10);
19785 if (!((gll == ell) && (errno == een)))
19786 bad++;
19787 }
19788 int main() {
19789 check(" 1", 1LL, 0);
19790 check(" 0", 0LL, 0);
19791 check("-1", -1LL, 0);
19792 check("-9223372036854775808", -9223372036854775808LL, 0);
19793 check("-9223372036854775808", -9223372036854775808LL, 0);
19794 check(" 9223372036854775807", 9223372036854775807LL, 0);
19795 check("-9223372036854775808", -9223372036854775808LL, 0);
19796 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
19797 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19798 if (!bad)
19799 printf("ok\n");
19800 }
19801 EOCP
19802 set try
19803 if eval $compile; then
19804 yyy=`$run ./try`
19805 case "$yyy" in
19806 ok) echo "Your strtoll() seems to be working okay." ;;
19807 *) cat <<EOM >&4
19808 Your strtoll() doesn't seem to be working okay.
19809 EOM
19810 d_strtoll="$undef"
19811 ;;
19812 esac
19813 else
19814 echo "(I can't seem to compile the test program--assuming it doesn't)"
19815 d_strtoll="$undef"
19816 fi
19817 ;;
19818 esac
19819
19820 : see if strtoq exists
19821 set strtoq d_strtoq
19822 eval $inlibc
19823
19824 : see if strtoul exists
19825 set strtoul d_strtoul
19826 eval $inlibc
19827
19828 case "$d_strtoul" in
19829 "$define")
19830 $cat <<EOM
19831 Checking whether your strtoul() works okay...
19832 EOM
19833 $cat >try.c <<'EOCP'
19834 #include <stdlib.h>
19835 #include <errno.h>
19836 #include <stdio.h>
19837 static int bad = 0;
19838 void check(const char *s, unsigned long eul, int een) {
19839 unsigned long gul;
19840 errno = 0;
19841 gul = strtoul(s, 0, 10);
19842 if (!((gul == eul) && (errno == een)))
19843 bad++;
19844 }
19845 int main() {
19846 check(" 1", 1L, 0);
19847 check(" 0", 0L, 0);
19848 EOCP
19849 case "$longsize" in
19850 8)
19851 $cat >>try.c <<'EOCP'
19852 check("18446744073709551615", 18446744073709551615UL, 0);
19853 check("18446744073709551616", 18446744073709551615UL, ERANGE);
19854 #if 0 /* strtoul() for /^-/ strings is undefined. */
19855 check("-1", 18446744073709551615UL, 0);
19856 check("-18446744073709551614", 2, 0);
19857 check("-18446744073709551615", 1, 0);
19858 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19859 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19860 #endif
19861 EOCP
19862 ;;
19863 4)
19864 $cat >>try.c <<'EOCP'
19865 check("4294967295", 4294967295UL, 0);
19866 check("4294967296", 4294967295UL, ERANGE);
19867 #if 0 /* strtoul() for /^-/ strings is undefined. */
19868 check("-1", 4294967295UL, 0);
19869 check("-4294967294", 2, 0);
19870 check("-4294967295", 1, 0);
19871 check("-4294967296", 4294967295UL, ERANGE);
19872 check("-4294967297", 4294967295UL, ERANGE);
19873 #endif
19874 EOCP
19875 ;;
19876 *)
19877 : Should we write these tests to be more portable by sprintf-ing
19878 : ~0 and then manipulating that char string as input for strtol?
19879 ;;
19880 esac
19881 $cat >>try.c <<'EOCP'
19882 if (!bad)
19883 printf("ok\n");
19884 return 0;
19885 }
19886 EOCP
19887 set try
19888 if eval $compile; then
19889 case "`$run ./try`" in
19890 ok) echo "Your strtoul() seems to be working okay." ;;
19891 *) cat <<EOM >&4
19892 Your strtoul() doesn't seem to be working okay.
19893 EOM
19894 d_strtoul="$undef"
19895 ;;
19896 esac
19897 else
19898 echo "(I can't seem to compile the test program--assuming it doesn't)"
19899 d_strtoul="$undef"
19900 fi
19901 ;;
19902 esac
19903
19904 : see if strtoull exists
19905 set strtoull d_strtoull
19906 eval $inlibc
19907
19908 case "$d_longlong-$d_strtoull" in
19909 "$define-$define")
19910 $cat <<EOM
19911 Checking whether your strtoull() works okay...
19912 EOM
19913 $cat >try.c <<'EOCP'
19914 #include <stdlib.h>
19915 #include <errno.h>
19916 #ifdef __hpux
19917 #define strtoull __strtoull
19918 #endif
19919 #include <stdio.h>
19920 static int bad = 0;
19921 void check(const char *s, long long eull, int een) {
19922 long long gull;
19923 errno = 0;
19924 gull = strtoull(s, 0, 10);
19925 if (!((gull == eull) && (errno == een)))
19926 bad++;
19927 }
19928 int main() {
19929 check(" 1", 1LL, 0);
19930 check(" 0", 0LL, 0);
19931 check("18446744073709551615", 18446744073709551615ULL, 0);
19932 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
19933 #if 0 /* strtoull() for /^-/ strings is undefined. */
19934 check("-1", 18446744073709551615ULL, 0);
19935 check("-18446744073709551614", 2LL, 0);
19936 check("-18446744073709551615", 1LL, 0);
19937 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19938 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19939 #endif
19940 if (!bad)
19941 printf("ok\n");
19942 }
19943 EOCP
19944 set try
19945 if eval $compile; then
19946 case "`$run ./try`" in
19947 ok) echo "Your strtoull() seems to be working okay." ;;
19948 *) cat <<EOM >&4
19949 Your strtoull() doesn't seem to be working okay.
19950 EOM
19951 d_strtoull="$undef"
19952 ;;
19953 esac
19954 else
19955 echo "(I can't seem to compile the test program--assuming it doesn't)"
19956 d_strtoull="$undef"
19957 fi
19958 ;;
19959 esac
19960
19961 : see if strtouq exists
19962 set strtouq d_strtouq
19963 eval $inlibc
19964
19965 case "$d_strtouq" in
19966 "$define")
19967 $cat <<EOM
19968 Checking whether your strtouq() works okay...
19969 EOM
19970 $cat >try.c <<'EOCP'
19971 #include <stdlib.h>
19972 #include <errno.h>
19973 #include <stdio.h>
19974 static int bad = 0;
19975 void check(const char *s, unsigned long long eull, int een) {
19976 unsigned long long gull;
19977 errno = 0;
19978 gull = strtouq(s, 0, 10);
19979 if (!((gull == eull) && (errno == een)))
19980 bad++;
19981 }
19982 int main() {
19983 check(" 1", 1LL, 0);
19984 check(" 0", 0LL, 0);
19985 check("18446744073709551615", 18446744073709551615ULL, 0);
19986 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
19987 #if 0 /* strtouq() for /^-/ strings is undefined. */
19988 check("-1", 18446744073709551615ULL, 0);
19989 check("-18446744073709551614", 2LL, 0);
19990 check("-18446744073709551615", 1LL, 0);
19991 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19992 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19993 #endif
19994 if (!bad)
19995 printf("ok\n");
19996 return 0;
19997 }
19998 EOCP
19999 set try
20000 if eval $compile; then
20001 case "`$run ./try`" in
20002 ok) echo "Your strtouq() seems to be working okay." ;;
20003 *) cat <<EOM >&4
20004 Your strtouq() doesn't seem to be working okay.
20005 EOM
20006 d_strtouq="$undef"
20007 ;;
20008 esac
20009 else
20010 echo "(I can't seem to compile the test program--assuming it doesn't)"
20011 d_strtouq="$undef"
20012 fi
20013 ;;
20014 esac
20015
20016 : see if strxfrm exists
20017 set strxfrm d_strxfrm
20018 eval $inlibc
20019
20020 : see if strxfrm_l exists
20021 set strxfrm_l d_strxfrm_l
20022 eval $inlibc
20023
20024 : see if symlink exists
20025 set symlink d_symlink
20026 eval $inlibc
20027
20028 : see if syscall exists
20029 set syscall d_syscall
20030 eval $inlibc
20031
20032 : see if this is a sys/syscall.h system
20033 set sys/syscall.h i_syssyscall
20034 eval $inhdr
20035
20036 : see if prototype for syscall is available
20037 echo " "
20038 set d_syscallproto syscall $i_unistd unistd.h $i_syssyscall sys/syscall.h
20039 eval $hasproto
20040
20041 : see if sysconf exists
20042 set sysconf d_sysconf
20043 eval $inlibc
20044
20045 : see if sys_errlist[] exists
20046 echo " "
20047 if test "X$d_syserrlst" = X; then
20048 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
20049 echo "You have sys_errlist[], so we could roll our own strerror."
20050 d_syserrlst="$define"
20051 else
20052 echo "You don't have sys_errlist[], so strerror() is welcome."
20053 d_syserrlst="$undef"
20054 fi
20055 fi
20056
20057 : see if system exists
20058 set system d_system
20059 eval $inlibc
20060
20061 : see if tcgetpgrp exists
20062 set tcgetpgrp d_tcgetpgrp
20063 eval $inlibc
20064
20065 : see if tcsetpgrp exists
20066 set tcsetpgrp d_tcsetpgrp
20067 eval $inlibc
20068
20069 : see if prototype for telldir is available
20070 echo " "
20071 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
20072 eval $hasproto
20073
20074 : see if tgamma exists
20075 set tgamma d_tgamma
20076 eval $inlibc
20077
20078 : see what flavor, if any, of thread local storage is supported
20079 echo " "
20080 echo "Checking to see if your system supports C11 thread local storage..."
20081 $cat > try.c <<'EOCP'
20082 #include <stdio.h>
20083 #include <stdlib.h>
20084 #include <pthread.h>
20085
20086 static int plus_one = 1;
20087 static int minus_one = -1;
20088
20089 PROBE_MACRO int *minion;
20090
20091 int callback (const void *a, const void *b) {
20092 int val_a = *minion * *(const int *)a;
20093 int val_b = *minion * *(const int *)b;
20094 return val_a < val_b ? -1 : val_a > val_b;
20095 }
20096
20097 #define SIZE 8
20098
20099 void *thread_function(void *arg) {
20100 /* thread local variables should start zeroed in each thread. */
20101 if (minion != NULL) {
20102 fprintf(stderr, "__thread variable started with %p, should be NULL\n",
20103 minion);
20104 exit(2);
20105 }
20106 minion = &minus_one;
20107
20108 int array[SIZE];
20109 unsigned int i;
20110 for (i = 0; i < SIZE; ++i) {
20111 /* "Hash randomisation" - this array isn't in sorted order: */
20112 array[i ^ 5] = i * i;
20113 }
20114
20115 qsort(array, SIZE, sizeof(int), callback);
20116
20117 int bad = 0;
20118 for (i = 0; i < SIZE; ++i) {
20119 int want = (SIZE - 1 - i) * (SIZE - 1 - i);
20120 int have = array[i];
20121 if (want != have) {
20122 ++bad;
20123 fprintf(stderr, "array[%u] - want %i, have %i\n", i, want, have);
20124 }
20125 }
20126 if (bad)
20127 exit(3);
20128
20129 return NULL;
20130 }
20131
20132 int main(int argc, char **argv) {
20133 if (minion != NULL) {
20134 fprintf(stderr, "__thread variable started with %p, should be NULL\n",
20135 minion);
20136 exit(4);
20137 }
20138
20139 minion = &plus_one;
20140
20141 pthread_t tid;
20142 int result = pthread_create(&tid, NULL, thread_function, NULL);
20143 if (result) {
20144 fprintf(stderr, "pthread_create failed (%d)\n", result);
20145 exit(5);
20146 }
20147
20148 result = pthread_join(tid, NULL);
20149 if (result) {
20150 fprintf(stderr, "pthread_join failed (%d)\n", result);
20151 exit(6);
20152 }
20153
20154 if (minion == NULL) {
20155 fprintf(stderr, "__thread variable should not be NULL\n");
20156 exit(7);
20157 }
20158 if (!(minion == &plus_one && *minion == 1)) {
20159 fprintf(stderr, "__thread variable should be %d @ %p, not %d @ %p\n",
20160 1, &plus_one, *minion, minion);
20161 exit(8);
20162 }
20163
20164 return 0;
20165 }
20166 EOCP
20167
20168 # Respect a hint (or previous) value for perl_thread_local, if there is one.
20169 case "$perl_thread_local" in
20170 '') # Check the various possibilities, and break out on success.
20171 for thread_local in _Thread_local __thread; do
20172 set try -DPROBE_MACRO=$thread_local
20173 if eval $compile && $run ./try; then
20174 $echo "Your compiler supports $thread_local." >&4
20175 val=$define
20176 perl_thread_local="$thread_local";
20177 break;
20178 fi
20179 $echo "Your compiler does NOT support $thread_local." >&4
20180 val="$undef"
20181 done
20182 ;;
20183 *thread*|*Thread*) # Some variant of thread local exists.
20184 echo "Keeping your $hint value of $perl_thread_local."
20185 val=$define
20186 ;;
20187 *) # Unrecognized previous value -- blindly trust the supplied
20188 # value and hope it makes sense. Use old value for
20189 # d_thread_local, if there is one.
20190 echo "Keeping your $hint value of $perl_thread_local."
20191 case "$d_thread_local" in
20192 '') val=$define ;;
20193 *) val=$d_thread_local ;;
20194 esac
20195 ;;
20196 esac
20197 set d_thread_local
20198 eval $setvar
20199 $rm_try
20200
20201 : see if time exists
20202 echo " "
20203 if test "X$d_time" = X -o X"$timetype" = X; then
20204 if set time val -f d_time; eval $csym; $val; then
20205 echo 'time() found.' >&4
20206 val="$define"
20207 rp="What is the type returned by time() on this system?"
20208 set time_t timetype long stdio.h sys/types.h
20209 eval $typedef_ask
20210 else
20211 echo 'time() not found, hope that will do.' >&4
20212 val="$undef"
20213 timetype='int';
20214 fi
20215 set d_time
20216 eval $setvar
20217 fi
20218
20219 : see if timegm exists
20220 set timegm d_timegm
20221 eval $inlibc
20222
20223 : see if this is a sys/times.h system
20224 set sys/times.h i_systimes
20225 eval $inhdr
20226
20227 : see if times exists
20228 echo " "
20229 if set times val -f d_times; eval $csym; $val; then
20230 echo 'times() found.' >&4
20231 d_times="$define"
20232 inc=''
20233 case "$i_systimes" in
20234 "$define") inc='sys/times.h';;
20235 esac
20236 rp="What is the type returned by times() on this system?"
20237 set clock_t clocktype long stdio.h sys/types.h $inc
20238 eval $typedef_ask
20239 else
20240 echo 'times() NOT found, hope that will do.' >&4
20241 d_times="$undef"
20242 clocktype='int'
20243 fi
20244
20245 : see if tmpnam_r exists
20246 set tmpnam_r d_tmpnam_r
20247 eval $inlibc
20248 case "$d_tmpnam_r" in
20249 "$define")
20250 hdrs="$i_systypes sys/types.h define stdio.h "
20251 case "$d_tmpnam_r_proto:$usethreads" in
20252 ":define") d_tmpnam_r_proto=define
20253 set d_tmpnam_r_proto tmpnam_r $hdrs
20254 eval $hasproto ;;
20255 *) ;;
20256 esac
20257 case "$d_tmpnam_r_proto" in
20258 define)
20259 case "$tmpnam_r_proto" in
20260 ''|0) try='char* tmpnam_r(char*);'
20261 ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
20262 esac
20263 case "$tmpnam_r_proto" in
20264 ''|0) d_tmpnam_r=undef
20265 tmpnam_r_proto=0
20266 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
20267 * ) case "$tmpnam_r_proto" in
20268 REENTRANT_PROTO*) ;;
20269 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
20270 esac
20271 echo "Prototype: $try" ;;
20272 esac
20273 ;;
20274 *) case "$usethreads" in
20275 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
20276 esac
20277 d_tmpnam_r=undef
20278 tmpnam_r_proto=0
20279 ;;
20280 esac
20281 ;;
20282 *) tmpnam_r_proto=0
20283 ;;
20284 esac
20285
20286 : see if towlower exists
20287 set towlower d_towlower
20288 eval $inlibc
20289
20290 : see if trunc exists
20291 set trunc d_trunc
20292 eval $inlibc
20293
20294 : see if truncate exists
20295 set truncate d_truncate
20296 eval $inlibc
20297
20298 : see if ttyname_r exists
20299 set ttyname_r d_ttyname_r
20300 eval $inlibc
20301 case "$d_ttyname_r" in
20302 "$define")
20303 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
20304 case "$d_ttyname_r_proto:$usethreads" in
20305 ":define") d_ttyname_r_proto=define
20306 set d_ttyname_r_proto ttyname_r $hdrs
20307 eval $hasproto ;;
20308 *) ;;
20309 esac
20310 case "$d_ttyname_r_proto" in
20311 define)
20312 case "$ttyname_r_proto" in
20313 ''|0) try='int ttyname_r(int, char*, size_t);'
20314 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
20315 esac
20316 case "$ttyname_r_proto" in
20317 ''|0) try='int ttyname_r(int, char*, int);'
20318 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
20319 esac
20320 case "$ttyname_r_proto" in
20321 ''|0) try='char* ttyname_r(int, char*, int);'
20322 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
20323 esac
20324 case "$ttyname_r_proto" in
20325 ''|0) d_ttyname_r=undef
20326 ttyname_r_proto=0
20327 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
20328 * ) case "$ttyname_r_proto" in
20329 REENTRANT_PROTO*) ;;
20330 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
20331 esac
20332 echo "Prototype: $try" ;;
20333 esac
20334 ;;
20335 *) case "$usethreads" in
20336 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
20337 esac
20338 d_ttyname_r=undef
20339 ttyname_r_proto=0
20340 ;;
20341 esac
20342 ;;
20343 *) ttyname_r_proto=0
20344 ;;
20345 esac
20346
20347 : see if tzname[] exists
20348 echo " "
20349 if set tzname val -a d_tzname; eval $csym; $val; then
20350 val="$define"
20351 echo 'tzname[] found.' >&4
20352 else
20353 val="$undef"
20354 echo 'tzname[] NOT found.' >&4
20355 fi
20356 set d_tzname
20357 eval $setvar
20358
20359 : Check if is a multiplatform env
20360 case "$osname" in
20361 darwin) multiarch="$define" ;;
20362 esac
20363 case "$multiarch" in
20364 ''|[nN]*) multiarch="$undef" ;;
20365 esac
20366
20367 : check for ordering of bytes in a UV
20368 echo " "
20369 case "$multiarch" in
20370 *$define*)
20371 $cat <<EOM
20372 You seem to be doing a multiarchitecture build,
20373 skipping the byteorder check.
20374
20375 EOM
20376 byteorder='ffff'
20377 ;;
20378 *)
20379 case "$byteorder" in
20380 '')
20381 $cat <<'EOM'
20382 In the following, larger digits indicate more significance. A big-endian
20383 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
20384 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
20385 machines may have weird orders like 3412. A Cray will report 87654321,
20386 an Alpha will report 12345678. If the test program works the default is
20387 probably right.
20388 I'm now running the test program...
20389 EOM
20390 $cat >try.c <<EOCP
20391 #include <stdio.h>
20392 #$i_stdlib I_STDLIB
20393 #ifdef I_STDLIB
20394 #include <stdlib.h>
20395 #endif
20396 #$i_inttypes I_INTTYPES
20397 #ifdef I_INTTYPES
20398 #include <inttypes.h>
20399 #endif
20400 #include <sys/types.h>
20401 typedef $uvtype UV;
20402 int main()
20403 {
20404 int i;
20405 union {
20406 UV l;
20407 char c[$uvsize];
20408 } u;
20409
20410 if ($uvsize > 4)
20411 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
20412 else
20413 u.l = (UV)0x04030201;
20414 for (i = 0; i < $uvsize; i++)
20415 printf("%c", u.c[i]+'0');
20416 printf("\n");
20417 exit(0);
20418 }
20419 EOCP
20420 xxx_prompt=y
20421 set try
20422 if eval $compile && $run ./try > /dev/null; then
20423 dflt=`$run ./try`
20424 case "$dflt" in
20425 [1-4][1-4][1-4][1-4]|12345678|87654321)
20426 echo "(The test program ran ok.)"
20427 echo "byteorder=$dflt"
20428 xxx_prompt=n
20429 ;;
20430 ????|????????) echo "(The test program ran ok.)" ;;
20431 *) echo "(The test program didn't run right for some reason.)" ;;
20432 esac
20433 else
20434 dflt='4321'
20435 cat <<'EOM'
20436 (I can't seem to compile the test program. Guessing big-endian...)
20437 EOM
20438 fi
20439 case "$xxx_prompt" in
20440 y)
20441 rp="What is the order of bytes in $uvtype?"
20442 . ./myread
20443 byteorder="$ans"
20444 ;;
20445 *) byteorder=$dflt
20446 ;;
20447 esac
20448 ;;
20449 esac
20450 $rm_try
20451 ;;
20452 esac
20453
20454 : Checking 32bit alignedness
20455 $cat <<EOM
20456
20457 Checking to see whether you can access character data unalignedly...
20458 EOM
20459 case "$d_u32align" in
20460 '') $cat >try.c <<EOCP
20461 #include <stdio.h>
20462 #$i_stdlib I_STDLIB
20463 #ifdef I_STDLIB
20464 #include <stdlib.h>
20465 #endif
20466 #define U32 $u32type
20467 #define BYTEORDER 0x$byteorder
20468 #define U8 $u8type
20469 #include <signal.h>
20470 #ifdef SIGBUS
20471 $signal_t bletch(int s) { exit(4); }
20472 #endif
20473 int main() {
20474 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
20475 volatile U8 buf[8];
20476 volatile U32 *up;
20477 int i;
20478
20479 if (sizeof(U32) != 4) {
20480 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
20481 exit(1);
20482 }
20483
20484 fflush(stdout);
20485
20486 #ifdef SIGBUS
20487 signal(SIGBUS, bletch);
20488 #endif
20489
20490 buf[0] = 0;
20491 buf[1] = 0;
20492 buf[2] = 0;
20493 buf[3] = 1;
20494 buf[4] = 0;
20495 buf[5] = 0;
20496 buf[6] = 0;
20497 buf[7] = 1;
20498
20499 for (i = 0; i < 4; i++) {
20500 up = (U32*)(buf + i);
20501 if (! ((*up == 1 << (8*i)) || /* big-endian */
20502 (*up == 1 << (8*(3-i))) /* little-endian */
20503 )
20504 )
20505 {
20506 printf("read failed (%x)\n", *up);
20507 exit(2);
20508 }
20509 }
20510
20511 /* write test */
20512 for (i = 0; i < 4; i++) {
20513 up = (U32*)(buf + i);
20514 *up = 0xBeef;
20515 if (*up != 0xBeef) {
20516 printf("write failed (%x)\n", *up);
20517 exit(3);
20518 }
20519 }
20520
20521 exit(0);
20522 #else
20523 printf("1\n");
20524 exit(1);
20525 #endif
20526 return 0;
20527 }
20528 EOCP
20529 set try
20530 if eval $compile_ok; then
20531 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
20532 $run ./try 2>&1 >/dev/null
20533 case "$?" in
20534 0) cat >&4 <<EOM
20535 You can access character data pretty unalignedly.
20536 EOM
20537 d_u32align="$undef"
20538 ;;
20539 *) cat >&4 <<EOM
20540 It seems that you must access character data in an aligned manner.
20541 EOM
20542 d_u32align="$define"
20543 ;;
20544 esac
20545 else
20546 rp='Can you access character data at unaligned addresses?'
20547 dflt='n'
20548 . ./myread
20549 case "$ans" in
20550 [yY]*) d_u32align="$undef" ;;
20551 *) d_u32align="$define" ;;
20552 esac
20553 fi
20554 $rm_try
20555 ;;
20556 esac
20557
20558 : see if ualarm exists
20559 set ualarm d_ualarm
20560 eval $inlibc
20561
20562 : see if umask exists
20563 set umask d_umask
20564 eval $inlibc
20565
20566 : see if unordered exists
20567 set unordered d_unordered
20568 eval $inlibc
20569
20570 : see if unsetenv exists
20571 set unsetenv d_unsetenv
20572 eval $inlibc
20573
20574 : see if usleep exists
20575 set usleep d_usleep
20576 eval $inlibc
20577
20578 : see if prototype for usleep is available
20579 echo " "
20580 set d_usleepproto usleep $i_unistd unistd.h
20581 eval $hasproto
20582
20583 : see if ustat exists
20584 set ustat d_ustat
20585 eval $inlibc
20586
20587 : see if closedir exists
20588 set closedir d_closedir
20589 eval $inlibc
20590
20591 case "$d_closedir" in
20592 "$define")
20593 echo " "
20594 echo "Checking whether closedir() returns a status..." >&4
20595 cat > try.c <<EOM
20596 #$i_dirent I_DIRENT /**/
20597 #$i_sysdir I_SYS_DIR /**/
20598 #$i_sysndir I_SYS_NDIR /**/
20599 #$i_systypes I_SYS_TYPES /**/
20600
20601 #if defined(I_SYS_TYPES)
20602 #include <sys/types.h>
20603 #endif
20604 #if defined(I_DIRENT)
20605 #include <dirent.h>
20606 #else
20607 #ifdef I_SYS_NDIR
20608 #include <sys/ndir.h>
20609 #else
20610 #ifdef I_SYS_DIR
20611 #include <sys/dir.h>
20612 #endif
20613 #endif
20614 #endif
20615 int main() { return closedir(opendir(".")); }
20616 EOM
20617 set try
20618 if eval $compile_ok; then
20619 if $run ./try > /dev/null 2>&1 ; then
20620 echo "Yes, it does."
20621 val="$undef"
20622 else
20623 echo "No, it doesn't."
20624 val="$define"
20625 fi
20626 else
20627 echo "(I can't seem to compile the test program--assuming it doesn't)"
20628 val="$define"
20629 fi
20630 ;;
20631 *)
20632 val="$undef";
20633 ;;
20634 esac
20635 set d_void_closedir
20636 eval $setvar
20637 $rm_try
20638
20639 : see if there is a wait4
20640 set wait4 d_wait4
20641 eval $inlibc
20642
20643 : see if waitpid exists
20644 set waitpid d_waitpid
20645 eval $inlibc
20646
20647 : see if wcrtomb exists
20648 set wcrtomb d_wcrtomb
20649 eval $inlibc
20650
20651 : look for wcscmp
20652 echo " "
20653 $cat >try.c <<'EOCP'
20654 #include <stdio.h>
20655 #include <wchar.h>
20656 int main ()
20657 {
20658 wchar_t *s = L" ";
20659 return (wcscmp (s, s) ? 1 : 0);
20660 }
20661 EOCP
20662 set try
20663 val="$undef"
20664 if eval $compile; then
20665 `$run ./try`
20666 case "$?" in
20667 0) echo "A working wcscmp() found." >&4
20668 val="$define" ;;
20669 *) echo "wcscmp() found, but it doesn't work" >&4
20670 ;;
20671 esac
20672 else
20673 echo "wcscmp() NOT found." >&4
20674 fi
20675 set d_wcscmp
20676 eval $setvar
20677 $rm_try
20678
20679 : see if wcstombs exists
20680 set wcstombs d_wcstombs
20681 eval $inlibc
20682
20683 : look for wcsxfrm
20684 echo " "
20685 $cat >try.c <<'EOCP'
20686 #include <errno.h>
20687 #include <wchar.h>
20688 int main ()
20689 {
20690 wchar_t dst[4], *src = L" ";
20691 errno = 0;
20692 return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20693 }
20694 EOCP
20695 set try
20696 val="$undef"
20697 if eval $compile; then
20698 `$run ./try`
20699 case "$?" in
20700 0) echo "A working wcsxfrm() found." >&4
20701 val="$define" ;;
20702 *) echo "wcsxfrm() found, but it doesn't work" >&4
20703 ;;
20704 esac
20705 else
20706 echo "wcsxfrm() NOT found." >&4
20707 fi
20708 set d_wcsxfrm
20709 eval $setvar
20710 $rm_try
20711
20712 : see if wctomb exists
20713 set wctomb d_wctomb
20714 eval $inlibc
20715
20716 : see if writev exists
20717 set writev d_writev
20718 eval $inlibc
20719
20720 : check for alignment requirements
20721 echo " "
20722 case "$alignbytes" in
20723 '') echo "Checking alignment constraints..." >&4
20724 $cat >try.c <<EOCP
20725 #include <stdio.h>
20726 struct foobar {
20727 char foo;
20728 $nvtype bar;
20729 } try_algn;
20730 int main()
20731 {
20732 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20733 return(0);
20734 }
20735 EOCP
20736 set try
20737 if eval $compile_ok; then
20738 dflt=`$run ./try`
20739 else
20740 dflt='8'
20741 echo "(I can't seem to compile the test program...)"
20742 fi
20743 case "$multiarch" in
20744 *$define*)
20745 : The usual safe value is 8, but Darwin with -Duselongdouble
20746 : needs 16. Hence, we will take 8 as a minimum, but allow
20747 : Configure to pick a larger value if needed.
20748 if $test "$dflt" -lt 8; then
20749 dflt='8'
20750 echo "Setting alignment to 8 for multiarch support.">&4
20751 fi
20752 ;;
20753 esac
20754 ;;
20755 *) dflt="$alignbytes"
20756 ;;
20757 esac
20758 rp="Doubles must be aligned on a how-many-byte boundary?"
20759 . ./myread
20760 alignbytes="$ans"
20761 $rm_try
20762
20763 : set the base revision
20764 baserev=5.0
20765
20766 : length of character in bytes. Is always 1, otherwise it is not C
20767 : This used to be a test using sizeof
20768 charsize=1
20769
20770 : Check for the number of bits in a character
20771 case "$charbits" in
20772 '') echo "Checking how long a character is (in bits)..." >&4
20773 $cat >try.c <<EOCP
20774 #include <stdio.h>
20775 int main ()
20776 {
20777 int n;
20778 unsigned char c;
20779 for (c = 1, n = 0; c; c <<= 1, n++) ;
20780 printf ("%d\n", n);
20781 return (0);
20782 }
20783 EOCP
20784 set try
20785 if eval $compile_ok; then
20786 dflt=`$run ./try`
20787 else
20788 dflt='8'
20789 echo "(I can't seem to compile the test program. Guessing...)"
20790 fi
20791 ;;
20792 *)
20793 dflt="$charbits"
20794 ;;
20795 esac
20796 rp="What is the length of a character (in bits)?"
20797 . ./myread
20798 charbits="$ans"
20799 $rm_try
20800 case "$charbits" in
20801 8) ;;
20802 *) cat >&4 << EOM
20803 Your system has an unsigned character size of $charbits bits, which
20804 is rather unusual (normally it is 8 bits). Perl likely will not work
20805 correctly on your system, with subtle bugs in various places.
20806 EOM
20807 rp='Do you really want to continue?'
20808 dflt='n'
20809 . ./myread
20810 case "$ans" in
20811 [yY]) echo >&4 "Okay, continuing." ;;
20812 *) exit 1 ;;
20813 esac
20814 esac
20815
20816 : how do we concatenate cpp tokens here?
20817 echo " "
20818 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20819 $cat >cpp_stuff.c <<'EOCP'
20820 #define RCAT(a,b)a/**/b
20821 #define ACAT(a,b)a ## b
20822 RCAT(Rei,ser)
20823 ACAT(Cir,cus)
20824 EOCP
20825 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20826 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20827 echo "Oh! Smells like ANSI's been here." >&4
20828 echo "We can catify or stringify, separately or together!"
20829 cpp_stuff=42
20830 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20831 echo "Ah, yes! The good old days!" >&4
20832 echo "However, in the good old days we don't know how to stringify and"
20833 echo "catify at the same time."
20834 cpp_stuff=1
20835 else
20836 $cat >&4 <<EOM
20837 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20838 You're going to have to edit the values of CAT[2-5] in config.h...
20839 EOM
20840 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20841 fi
20842 $rm -f cpp_stuff.*
20843
20844 : see if this is a db.h system
20845 set db.h i_db
20846 eval $inhdr
20847
20848 case "$i_db" in
20849 $define)
20850 : Check db version.
20851 echo " "
20852 echo "Checking Berkeley DB version ..." >&4
20853 $cat >try.c <<EOCP
20854 #include <sys/types.h>
20855 #include <stdio.h>
20856 #$i_stdlib I_STDLIB
20857 #ifdef I_STDLIB
20858 #include <stdlib.h>
20859 #endif
20860 #include <db.h>
20861 int main(int argc, char *argv[])
20862 {
20863 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20864 int Major, Minor, Patch ;
20865 unsigned long Version ;
20866 (void)db_version(&Major, &Minor, &Patch) ;
20867 if (argc == 2) {
20868 printf("%d %d %d %d %d %d\n",
20869 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20870 Major, Minor, Patch);
20871 exit(0);
20872 }
20873 printf("You have Berkeley DB Version 2 or greater.\n");
20874
20875 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20876 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20877 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20878 Major, Minor, Patch) ;
20879
20880 /* check that db.h & libdb are compatible */
20881 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20882 printf("db.h and libdb are incompatible.\n") ;
20883 exit(3);
20884 }
20885
20886 printf("db.h and libdb are compatible.\n") ;
20887
20888 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20889 + DB_VERSION_PATCH ;
20890
20891 /* needs to be >= 2.3.4 */
20892 if (Version < 2003004) {
20893 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20894 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20895 exit(2);
20896 }
20897
20898 exit(0);
20899 #else
20900 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20901 if (argc == 2) {
20902 printf("1 0 0\n");
20903 exit(0);
20904 }
20905 printf("You have Berkeley DB Version 1.\n");
20906 exit(0); /* DB version < 2: the coast is clear. */
20907 #else
20908 exit(1); /* <db.h> not Berkeley DB? */
20909 #endif
20910 #endif
20911 }
20912 EOCP
20913 set try
20914 if eval $compile_ok && $run ./try; then
20915 echo 'Looks OK.' >&4
20916 set `$run ./try 1`
20917 db_version_major=$1
20918 db_version_minor=$2
20919 db_version_patch=$3
20920 else
20921 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
20922 i_db=$undef
20923 case " $libs " in
20924 *"-ldb "*)
20925 : Remove db from list of libraries to use
20926 echo "Removing unusable -ldb from library list" >&4
20927 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20928 shift
20929 libs="$*"
20930 echo "libs = $libs" >&4
20931 ;;
20932 esac
20933 fi
20934 $rm_try
20935 ;;
20936 esac
20937
20938 case "$i_db" in
20939 define)
20940 : Check the return type needed for hash
20941 echo " "
20942 echo "Checking return type needed for hash for Berkeley DB ..." >&4
20943 $cat >try.c <<EOCP
20944 #include <sys/types.h>
20945 #include <db.h>
20946
20947 #ifndef DB_VERSION_MAJOR
20948 u_int32_t hash_cb (const void* ptr, size_t size)
20949 {
20950 return 0;
20951 }
20952 HASHINFO info;
20953 int main()
20954 {
20955 info.hash = hash_cb;
20956 }
20957 #endif
20958 EOCP
20959 if $cc $ccflags -c try.c >try.out 2>&1 ; then
20960 if $compiler_warning try.out >>/dev/null 2>&1 ; then
20961 db_hashtype='int'
20962 else
20963 db_hashtype='u_int32_t'
20964 fi
20965 else
20966 : XXX Maybe we should just give up here.
20967 db_hashtype=u_int32_t
20968 $cat try.out >&4
20969 echo "Help: I can't seem to compile the db test program." >&4
20970 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20971 fi
20972 $rm_try
20973 echo "Your version of Berkeley DB uses $db_hashtype for hash."
20974 ;;
20975 *) db_hashtype=u_int32_t
20976 ;;
20977 esac
20978 case "$i_db" in
20979 define)
20980 : Check the return type needed for prefix
20981 echo " "
20982 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20983 cat >try.c <<EOCP
20984 #include <sys/types.h>
20985 #include <db.h>
20986
20987 #ifndef DB_VERSION_MAJOR
20988 size_t prefix_cb (const DBT *key1, const DBT *key2)
20989 {
20990 return 0;
20991 }
20992 BTREEINFO info;
20993 int main()
20994 {
20995 info.prefix = prefix_cb;
20996 }
20997 #endif
20998 EOCP
20999 if $cc $ccflags -c try.c >try.out 2>&1 ; then
21000 if $compiler_warning try.out >>/dev/null 2>&1 ; then
21001 db_prefixtype='int'
21002 else
21003 db_prefixtype='size_t'
21004 fi
21005 else
21006 db_prefixtype='size_t'
21007 : XXX Maybe we should just give up here.
21008 $cat try.out >&4
21009 echo "Help: I can't seem to compile the db test program." >&4
21010 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
21011 fi
21012 $rm_try
21013 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
21014 ;;
21015 *) db_prefixtype='size_t'
21016 ;;
21017 esac
21018
21019 : Include . in @INC
21020 $cat <<EOM
21021
21022 Historically Perl has provided a final fallback of the current working
21023 directory '.' when searching for a library. This, however, can lead to
21024 problems when a Perl program which loads optional modules is called from
21025 a shared directory. This can lead to executing unexpected code.
21026
21027 EOM
21028
21029 # When changing to exclude by default:
21030 case "$default_inc_excludes_dot" in
21031 $undef|false|[nN]*) dflt="n" ;;
21032 *) dflt="y" ;;
21033 esac
21034 # To turn exclude off by default:
21035 #case "$default_inc_excludes_dot" in
21036 # $define|true|[yY]*) dflt="y" ;;
21037 # *) dflt="n" ;;
21038 #esac
21039
21040 rp='Exclude '.' from @INC by default? '
21041 . ./myread
21042 case "$ans" in
21043 [nN]|undef) default_inc_excludes_dot="$undef" ;;
21044 *) default_inc_excludes_dot="$define" ;;
21045 esac
21046
21047 : Check what kind of inf/nan your system has
21048 $echo "Checking the kind of infinities and nans you have..." >&4
21049 $echo "(The following tests may crash. That's okay.)" >&4
21050 $cat >try.c <<EOP
21051 #define DOUBLESIZE $doublesize
21052 #$d_longdbl HAS_LONG_DOUBLE
21053 #ifdef HAS_LONG_DOUBLE
21054 #define LONG_DOUBLESIZE $longdblsize
21055 #define LONG_DOUBLEKIND $longdblkind
21056 #endif
21057 #include <math.h>
21058 #include <string.h>
21059 #include <stdio.h>
21060 /* Note that whether the sign bit is on or off
21061 * for NaN depends on the CPU/FPU, and possibly
21062 * can be affected by the build toolchain.
21063 *
21064 * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
21065 * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
21066 * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
21067 * (respectively) as opposed to the more usual
21068 * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
21069 *
21070 * Pre-IEEE-754 floating point format do not even have inf/nan support
21071 * at all. They might have a "max" value (DBL_MAX), which may be deadly
21072 * to even mention, causing immediate SIGFPE or equivalent: this is
21073 * the case with VAX floating point, for example.
21074 */
21075 static void bytes(void *v, unsigned int n) {
21076 unsigned char *p = (unsigned char *)v;
21077 int i;
21078 for (i = 0; i < n; i++) {
21079 printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
21080 }
21081 }
21082 int main(int argc, char *argv[]) {
21083 /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
21084 * because some compilers are 'smart' and not only warn but refuse to
21085 * compile such 'illegal' values. */
21086 double dinf = exp(1e9);
21087 double dnan = sqrt(-1.0);
21088 #ifdef HAS_LONG_DOUBLE
21089 long double ldinf = (long double)exp(1e9);
21090 long double ldnan = (long double)sqrt(-1.0);
21091 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
21092 /* the 80-bit long doubles might have garbage in their excess bytes */
21093 memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
21094 memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
21095 # endif
21096 #endif
21097 if (argc == 2) {
21098 switch (argv[1][0]) {
21099 case '1': bytes(&dinf, sizeof(dinf)); break;
21100 case '2': bytes(&dnan, sizeof(dnan)); break;
21101 #ifdef HAS_LONG_DOUBLE
21102 case '3': bytes(&ldinf, sizeof(ldinf)); break;
21103 case '4': bytes(&ldnan, sizeof(ldnan)); break;
21104 #endif
21105 }
21106 }
21107 return 0;
21108 }
21109 EOP
21110 set try
21111 if eval $compile; then
21112 doubleinfbytes=`$run ./try 1`
21113 doublenanbytes=`$run ./try 2`
21114 case "$d_longdbl" in
21115 $define)
21116 longdblinfbytes=`$run ./try 3`
21117 longdblnanbytes=`$run ./try 4`
21118 ;;
21119 esac
21120 else
21121 # Defaults in case the above test program failed.
21122 case "$doublekind" in
21123 1) # IEEE 754 32-bit LE
21124 doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
21125 doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
21126 ;;
21127 2) # IEEE 754 32-bit BE
21128 doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
21129 doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
21130 ;;
21131 3) # IEEE 754 64-bit LE
21132 doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
21133 doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
21134 ;;
21135 4) # IEEE 754 64-bit BE
21136 doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21137 doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21138 ;;
21139 5) # IEEE 754 128-bit LE
21140 doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
21141 doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
21142 ;;
21143 6) # IEEE 754 128-bit BE
21144 doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21145 doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21146 ;;
21147 7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
21148 doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
21149 doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
21150 ;;
21151 8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
21152 doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
21153 doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
21154 ;;
21155 9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
21156 doubleinfbytes=$undef
21157 doublenanbytes=$undef
21158 ;;
21159 *) # No idea.
21160 doubleinfbytes=$undef
21161 doublenanbytes=$undef
21162 ;;
21163 esac
21164 case "$longdblkind" in
21165 1) # IEEE 754 128-bit LE
21166 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
21167 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
21168 ;;
21169 2) # IEEE 754 128-bit BE
21170 longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21171 longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21172 ;;
21173 3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
21174 case "$longdblsize" in
21175 12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
21176 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
21177 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
21178 ;;
21179 16) # x86_64
21180 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21181 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21182 ;;
21183 *) # No idea.
21184 longdblinfbytes=$undef
21185 longdblnanbytes=$undef
21186 ;;
21187 esac
21188 ;;
21189 4) # IEEE 754 80-bit BE, 12 or 16 bytes
21190 case "$longdblsize" in
21191 12) # 32-bit system
21192 longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21193 longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21194 ;;
21195 16) # 64-bit system
21196 longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21197 longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21198 ;;
21199 *) # No idea.
21200 longdblinfbytes=$undef
21201 longdblnanbytes=$undef
21202 ;;
21203 esac
21204 ;;
21205 5) # 128-bit LE-LE "double double"
21206 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
21207 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
21208 ;;
21209 6) # 128-bit BE-BE "double double"
21210 longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21211 longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21212 ;;
21213 7) # 128-bit LE-BE "double double"
21214 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21215 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21216 ;;
21217 8) # 128-bit BE-LE "double double"
21218 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21219 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21220 ;;
21221 9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
21222 longdblinfbytes=$undef
21223 longdblnanbytes=$undef
21224 ;;
21225 *) # No idea.
21226 longdblinfbytes=$undef
21227 longdblnanbytes=$undef
21228 ;;
21229 esac
21230 fi
21231 # In case the program crashed the values are empty, turn them undef.
21232 case "$doubleinfbytes" in
21233 '') doubleinfbytes=$undef ;;
21234 esac
21235 case "$doublenanbytes" in
21236 '') doublenanbytes=$undef ;;
21237 esac
21238 case "$longdblinfbytes" in
21239 '') longdblinfbytes=$undef ;;
21240 esac
21241 case "$longdblnanbytes" in
21242 '') longdblnanbytes=$undef ;;
21243 esac
21244 $rm_try
21245
21246 : Check the length of the double mantissa
21247 $echo "Checking how many mantissa bits your doubles have..." >&4
21248 $cat >try.c <<EOP
21249 #$i_sunmath I_SUNMATH
21250 #include <float.h>
21251 #ifdef I_SUNMATH
21252 # include <sunmath.h>
21253 #endif
21254 #ifdef DBL_MANT_DIG
21255 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
21256 #endif
21257 #include <stdio.h>
21258 int main(int argc, char *argv[]) {
21259 #ifdef BITS
21260 printf("%d\n", BITS);
21261 #endif
21262 return 0;
21263 }
21264 EOP
21265 set try
21266 if eval $compile; then
21267 doublemantbits=`$run ./try`
21268 else
21269 doublemantbits="$undef"
21270 fi
21271 $rm_try
21272
21273 : Check the length of the longdouble mantissa
21274 $echo "Checking how many mantissa bits your long doubles have..." >&4
21275 $cat >try.c <<EOP
21276 #$i_sunmath I_SUNMATH
21277 #include <float.h>
21278 #ifdef I_SUNMATH
21279 # include <sunmath.h>
21280 #endif
21281 #$d_longdbl HAS_LONG_DOUBLE
21282 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
21283 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
21284 /* This format has no implicit bit. Beware, however, that for
21285 * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
21286 * the top three bits are used for inf (100) / qnan (11x) / snan (101),
21287 * and the top bit must have been one since 387, zero is plain invalid.
21288 * For normal fp values, the LDBL_MANT_DIG is fine, though. */
21289 # define BITS LDBL_MANT_DIG
21290 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
21291 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
21292 * reason e.g. Irix thinks 107. But in any case, we want only
21293 * the number of real bits, the implicit bits are of no interest. */
21294 # define BITS 2 * (DBL_MANT_DIG - 1)
21295 # else
21296 # define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
21297 # endif
21298 #endif
21299 #include <stdio.h>
21300 int main(int argc, char *argv[]) {
21301 #ifdef BITS
21302 printf("%d\n", BITS);
21303 #endif
21304 return 0;
21305 }
21306 EOP
21307 set try
21308 if eval $compile; then
21309 longdblmantbits=`$run ./try`
21310 else
21311 longdblmantbits="$undef"
21312 fi
21313 $rm_try
21314
21315 : Check the length of the NV mantissa
21316 $echo "Checking how many mantissa bits your NVs have..." >&4
21317 if test "X$usequadmath" = "X$define"; then
21318 nvmantbits=112 # 128-1-15
21319 else
21320 if test "X$nvsize" = "X$doublesize"; then
21321 nvmantbits="$doublemantbits"
21322 else
21323 if test "X$nvsize" = "X$longdblsize"; then
21324 nvmantbits="$longdblmantbits"
21325 else
21326 nvmantbits="$undef"
21327 fi
21328 fi
21329 fi
21330
21331 : How can we generate normalized random numbers ?
21332 echo " "
21333 echo "Using our internal random number implementation..." >&4
21334
21335 case "$ccflags" in
21336 *-Dmy_rand=*|*-Dmy_srand=*)
21337 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
21338 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
21339 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
21340 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
21341 ;;
21342 esac
21343
21344 randfunc=Perl_drand48
21345 drand01="Perl_drand48()"
21346 seedfunc="Perl_drand48_init"
21347 randbits=48
21348 randseedtype=U32
21349
21350 : Probe whether dtrace builds an object, as newer Illumos requires an input
21351 : object file that uses at least one of the probes defined in the .d file
21352 case "$usedtrace" in
21353 $define)
21354 case "$dtracexnolibs" in
21355 $define|true|[yY]*)
21356 dtracexnolibs=$define
21357 $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
21358 ;;
21359 ' '|'')
21360 if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
21361 dtracexnolibs=$define
21362 echo "Your dtrace accepts -xnolibs"
21363 elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
21364 dtracexnolibs=$undef
21365 echo "Your dtrace doesn't accept -xnolibs"
21366 else
21367 echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
21368 exit 1
21369 fi
21370 ;;
21371 *)
21372 dtracexnolibs=$undef
21373 $dtrace -h -s ../perldtrace.d -o perldtrace.h
21374 ;;
21375 esac
21376 case $dtracexnolibs in
21377 $define) xnolibs=-xnolibs ;;
21378 *) xnolibs= ;;
21379 esac
21380
21381 case "$dtraceobject" in
21382 $define|true|[yY]*)
21383 dtraceobject=$define
21384 ;;
21385 ' '|'')
21386 $cat >try.c <<EOM
21387 #include "perldtrace.h"
21388 int main(void) {
21389 PERL_LOADED_FILE("dummy");
21390 return 0;
21391 }
21392 EOM
21393 dtraceobject=$undef
21394 if $cc -c -o try.o $optimize $ccflags try.c \
21395 && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
21396 dtraceobject=$define
21397 echo "Your dtrace builds an object file"
21398 fi
21399 ;;
21400 *) dtraceobject=$undef ;;
21401 esac
21402 $rm_try perldtrace.o perldtrace.h
21403 esac
21404
21405 : Determine if this is an EBCDIC system
21406 echo " "
21407 echo "Determining whether or not we are on an EBCDIC system..." >&4
21408 $cat >try.c <<'EOM'
21409 int main()
21410 {
21411 if ('M'==0xd4) return 0;
21412 return 1;
21413 }
21414 EOM
21415
21416 val=$undef
21417 set try
21418 if eval $compile_ok; then
21419 if $run ./try; then
21420 echo "You seem to speak EBCDIC." >&4
21421 val="$define"
21422 else
21423 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
21424 fi
21425 else
21426 echo "I'm unable to compile the test program." >&4
21427 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
21428 fi
21429 $rm_try
21430 set ebcdic
21431 eval $setvar
21432
21433 : Check how to flush
21434 echo " "
21435 $cat >&4 <<EOM
21436 Checking how to flush all pending stdio output...
21437 EOM
21438 # I only know how to find the first 32 possibly open files on SunOS.
21439 # See also hints/sunos_4_1.sh and util.c --AD
21440 case "$osname" in
21441 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
21442 esac
21443 $cat >>try.c <<EOCP
21444 #include <stdio.h>
21445 #$i_stdlib I_STDLIB
21446 #ifdef I_STDLIB
21447 #include <stdlib.h>
21448 #endif
21449 #$i_unistd I_UNISTD
21450 #ifdef I_UNISTD
21451 # include <unistd.h>
21452 #endif
21453 #$d_sysconf HAS_SYSCONF
21454 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
21455 #ifdef HAS_STDIO_STREAM_ARRAY
21456 # define STDIO_STREAM_ARRAY $stdio_stream_array
21457 #endif
21458 int main() {
21459 FILE* p;
21460 unlink("try.out");
21461 p = fopen("try.out", "w");
21462 #ifdef TRY_FPUTC
21463 fputc('x', p);
21464 #else
21465 # ifdef TRY_FPRINTF
21466 fprintf(p, "x");
21467 # endif
21468 #endif
21469 #ifdef TRY_FFLUSH_NULL
21470 fflush(NULL);
21471 #endif
21472 #ifdef TRY_FFLUSH_ALL
21473 {
21474 long open_max = -1;
21475 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
21476 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
21477 # else
21478 # if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
21479 open_max = sysconf(_SC_OPEN_MAX);
21480 # else
21481 # ifdef FOPEN_MAX
21482 open_max = FOPEN_MAX;
21483 # else
21484 # ifdef OPEN_MAX
21485 open_max = OPEN_MAX;
21486 # else
21487 # ifdef _NFILE
21488 open_max = _NFILE;
21489 # endif
21490 # endif
21491 # endif
21492 # endif
21493 # endif
21494 # ifdef HAS_STDIO_STREAM_ARRAY
21495 if (open_max > 0) {
21496 long i;
21497 for (i = 0; i < open_max; i++)
21498 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
21499 STDIO_STREAM_ARRAY[i]._file < open_max &&
21500 STDIO_STREAM_ARRAY[i]._flag)
21501 fflush(&STDIO_STREAM_ARRAY[i]);
21502 }
21503 # endif
21504 }
21505 #endif
21506 _exit(42);
21507 }
21508 EOCP
21509 : first we have to find out how _not_ to flush
21510 $to try.c
21511 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
21512 output=''
21513 set try -DTRY_FPUTC
21514 if eval $compile; then
21515 $run ./try 2>/dev/null
21516 code="$?"
21517 $from try.out
21518 if $test ! -s try.out -a "X$code" = X42; then
21519 output=-DTRY_FPUTC
21520 fi
21521 fi
21522 case "$output" in
21523 '')
21524 set try -DTRY_FPRINTF
21525 if eval $compile; then
21526 $run ./try 2>/dev/null
21527 code="$?"
21528 $from try.out
21529 if $test ! -s try.out -a "X$code" = X42; then
21530 output=-DTRY_FPRINTF
21531 fi
21532 fi
21533 ;;
21534 esac
21535 fi
21536 : check for fflush NULL behavior
21537 case "$fflushNULL" in
21538 '') set try -DTRY_FFLUSH_NULL $output
21539 if eval $compile; then
21540 $run ./try 2>/dev/null
21541 code="$?"
21542 $from try.out
21543 if $test -s try.out -a "X$code" = X42; then
21544 fflushNULL="`$cat try.out`"
21545 else
21546 if $test "X$code" != X42; then
21547 $cat >&4 <<EOM
21548 (If this test failed, don't worry, we'll try another method shortly.)
21549 EOM
21550 fi
21551 fi
21552 fi
21553 $rm -f core try.core core.try.*
21554 case "$fflushNULL" in
21555 x) $cat >&4 <<EOM
21556 Your fflush(NULL) works okay for output streams.
21557 Let's see if it clobbers input pipes...
21558 EOM
21559 # As of mid-March 2000 all versions of Solaris appear to have a stdio
21560 # bug that improperly flushes the input end of pipes. So we avoid the
21561 # autoflush on fork/system/exec support for now. :-(
21562 $cat >tryp.c <<EOCP
21563 #include <stdio.h>
21564 int
21565 main(int argc, char **argv)
21566 {
21567 char buf[1024];
21568 int i;
21569 char *bp = buf;
21570 while (1) {
21571 while ((i = getc(stdin)) != -1
21572 && (*bp++ = i) != '\n'
21573 && bp < &buf[1024])
21574 /* DO NOTHING */ ;
21575 *bp = '\0';
21576 fprintf(stdout, "%s", buf);
21577 fflush(NULL);
21578 if (i == -1)
21579 return 0;
21580 bp = buf;
21581 }
21582 }
21583 EOCP
21584 fflushNULL="$define"
21585 set tryp
21586 if eval $compile; then
21587 $rm -f tryp.out
21588 # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
21589 if $test "X$targethost" != X; then
21590 $to tryp.c
21591 $to tryp
21592 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21593 else
21594 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
21595 fi
21596 if cmp tryp.c tryp.out >/dev/null 2>&1; then
21597 $cat >&4 <<EOM
21598 fflush(NULL) seems to behave okay with input streams.
21599 EOM
21600 fflushNULL="$define"
21601 else
21602 $cat >&4 <<EOM
21603 Ouch, fflush(NULL) clobbers input pipes! We will not use it.
21604 EOM
21605 fflushNULL="$undef"
21606 fi
21607 fi
21608 $rm -f core tryp.c tryp.core core.tryp.*
21609 ;;
21610 '') $cat >&4 <<EOM
21611 Your fflush(NULL) isn't working (contrary to ANSI C).
21612 EOM
21613 fflushNULL="$undef"
21614 ;;
21615 *) $cat >&4 <<EOM
21616 Cannot figure out whether your fflush(NULL) works or not.
21617 I'm assuming it doesn't (contrary to ANSI C).
21618 EOM
21619 fflushNULL="$undef"
21620 ;;
21621 esac
21622 ;;
21623 $define|true|[yY]*)
21624 fflushNULL="$define"
21625 ;;
21626 *)
21627 fflushNULL="$undef"
21628 ;;
21629 esac
21630 : check explicit looping only if NULL did not work, and if the pipe
21631 : bug does not show up on an explicit flush too
21632 case "$fflushNULL" in
21633 "$undef")
21634 $cat >tryp.c <<EOCP
21635 #include <stdio.h>
21636 int
21637 main(int argc, char **argv)
21638 {
21639 char buf[1024];
21640 int i;
21641 char *bp = buf;
21642 while (1) {
21643 while ((i = getc(stdin)) != -1
21644 && (*bp++ = i) != '\n'
21645 && bp < &buf[1024])
21646 /* DO NOTHING */ ;
21647 *bp = '\0';
21648 fprintf(stdout, "%s", buf);
21649 fflush(stdin);
21650 if (i == -1)
21651 return 0;
21652 bp = buf;
21653 }
21654 }
21655 EOCP
21656 set tryp
21657 if eval $compile; then
21658 $rm -f tryp.out
21659 if $test "X$targethost" != X; then
21660 $to tryp.c
21661 $to tryp
21662 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21663 else
21664 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
21665 fi
21666 if cmp tryp.c tryp.out >/dev/null 2>&1; then
21667 $cat >&4 <<EOM
21668 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
21669 EOM
21670 : now check for fflushall behaviour
21671 case "$fflushall" in
21672 '') set try -DTRY_FFLUSH_ALL $output
21673 if eval $compile; then
21674 $cat >&4 <<EOM
21675 (Now testing the other method--but note that this also may fail.)
21676 EOM
21677 $run ./try 2>/dev/null
21678 code=$?
21679 $from try.out
21680 if $test -s try.out -a "X$code" = X42; then
21681 fflushall="`$cat try.out`"
21682 fi
21683 fi
21684 $rm_try
21685 case "$fflushall" in
21686 x) $cat >&4 <<EOM
21687 Whew. Flushing explicitly all the stdio streams works.
21688 EOM
21689 fflushall="$define"
21690 ;;
21691 '') $cat >&4 <<EOM
21692 Sigh. Flushing explicitly all the stdio streams doesn't work.
21693 EOM
21694 fflushall="$undef"
21695 ;;
21696 *) $cat >&4 <<EOM
21697 Cannot figure out whether flushing stdio streams explicitly works or not.
21698 I'm assuming it doesn't.
21699 EOM
21700 fflushall="$undef"
21701 ;;
21702 esac
21703 ;;
21704 "$define"|true|[yY]*)
21705 fflushall="$define"
21706 ;;
21707 *)
21708 fflushall="$undef"
21709 ;;
21710 esac
21711 else
21712 $cat >&4 <<EOM
21713 All is futile. Even fflush(stdin) clobbers input pipes!
21714 EOM
21715 fflushall="$undef"
21716 fi
21717 else
21718 fflushall="$undef"
21719 fi
21720 $rm -f core tryp.c tryp.core core.tryp.*
21721 ;;
21722 *) fflushall="$undef"
21723 ;;
21724 esac
21725
21726 case "$fflushNULL$fflushall" in
21727 undefundef)
21728 $cat <<EOM
21729 OK, I give up. I cannot figure out how to flush pending stdio output.
21730 We won't be flushing handles at all before fork/exec/popen.
21731 EOM
21732 ;;
21733 esac
21734 $rm_try tryp
21735
21736 : Store the full pathname to the ar program for use in the C program
21737 : Respect a hint or command line value for full_ar.
21738 case "$full_ar" in
21739 '') full_ar=$ar ;;
21740 esac
21741
21742 : Store the full pathname to the sed program for use in the C program
21743 full_sed=$sed
21744
21745 : see what type gids are declared as in the kernel
21746 echo " "
21747 echo "Looking for the type for group ids returned by getgid()."
21748 set gid_t gidtype xxx stdio.h sys/types.h
21749 eval $typedef
21750 case "$gidtype" in
21751 xxx)
21752 xxx=`./findhdr sys/user.h`
21753 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21754 case $1 in
21755 unsigned) dflt="$1 $2" ;;
21756 *) dflt="$1" ;;
21757 esac
21758 ;;
21759 *) dflt="$gidtype";;
21760 esac
21761 case "$gidtype" in
21762 gid_t) echo "gid_t found." ;;
21763 *) rp="What is the type for group ids returned by getgid()?"
21764 . ./myread
21765 gidtype="$ans"
21766 ;;
21767 esac
21768
21769 : Check the size of GID
21770 echo " "
21771 case "$gidtype" in
21772 *_t) zzz="$gidtype" ;;
21773 *) zzz="gid" ;;
21774 esac
21775 echo "Checking the size of $zzz..." >&4
21776 cat > try.c <<EOCP
21777 #include <sys/types.h>
21778 #include <stdio.h>
21779 #$i_stdlib I_STDLIB
21780 #ifdef I_STDLIB
21781 #include <stdlib.h>
21782 #endif
21783 int main() {
21784 printf("%d\n", (int)sizeof($gidtype));
21785 exit(0);
21786 }
21787 EOCP
21788 set try
21789 if eval $compile_ok; then
21790 yyy=`$run ./try`
21791 case "$yyy" in
21792 '') gidsize=4
21793 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21794 ;;
21795 *) gidsize=$yyy
21796 echo "Your $zzz is $gidsize bytes long."
21797 ;;
21798 esac
21799 else
21800 gidsize=4
21801 echo "(I can't compile the test program--guessing $gidsize.)" >&4
21802 fi
21803
21804 : Check if GID is signed
21805 echo " "
21806 case "$gidtype" in
21807 *_t) zzz="$gidtype" ;;
21808 *) zzz="gid" ;;
21809 esac
21810 echo "Checking the sign of $zzz..." >&4
21811 cat > try.c <<EOCP
21812 #include <sys/types.h>
21813 #include <stdio.h>
21814 int main() {
21815 $gidtype foo = -1;
21816 if (foo < 0)
21817 printf("-1\n");
21818 else
21819 printf("1\n");
21820 }
21821 EOCP
21822 set try
21823 if eval $compile; then
21824 yyy=`$run ./try`
21825 case "$yyy" in
21826 '') gidsign=1
21827 echo "(I can't execute the test program--guessing unsigned.)" >&4
21828 ;;
21829 *) gidsign=$yyy
21830 case "$gidsign" in
21831 1) echo "Your $zzz is unsigned." ;;
21832 -1) echo "Your $zzz is signed." ;;
21833 esac
21834 ;;
21835 esac
21836 else
21837 gidsign=1
21838 echo "(I can't compile the test program--guessing unsigned.)" >&4
21839 fi
21840
21841 : Check 64bit sizes
21842 echo " "
21843
21844 if $test X"$quadtype" != X; then
21845
21846 echo "Checking how to print 64-bit integers..." >&4
21847
21848 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21849 $cat >try.c <<'EOCP'
21850 #include <sys/types.h>
21851 #include <stdio.h>
21852 int main() {
21853 int q = 12345678901;
21854 printf("%ld\n", q);
21855 }
21856 EOCP
21857 set try
21858 if eval $compile; then
21859 yyy=`$run ./try`
21860 case "$yyy" in
21861 12345678901)
21862 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21863 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21864 echo "We will use %d."
21865 ;;
21866 esac
21867 fi
21868 fi
21869
21870 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21871 $cat >try.c <<'EOCP'
21872 #include <sys/types.h>
21873 #include <stdio.h>
21874 int main() {
21875 long q = 12345678901;
21876 printf("%ld\n", q);
21877 }
21878 EOCP
21879 set try
21880 if eval $compile; then
21881 yyy=`$run ./try`
21882 case "$yyy" in
21883 12345678901)
21884 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21885 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21886 echo "We will use %ld."
21887 ;;
21888 esac
21889 fi
21890 fi
21891
21892 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21893 $cat >try.c <<'EOCP'
21894 #include <sys/types.h>
21895 #include <inttypes.h>
21896 #include <stdio.h>
21897 int main() {
21898 int64_t q = 12345678901;
21899 printf("%" PRId64 "\n", q);
21900 }
21901 EOCP
21902 set try
21903 if eval $compile; then
21904 yyy=`$run ./try`
21905 case "$yyy" in
21906 12345678901)
21907 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21908 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIX64;
21909 echo "We will use the C9X style."
21910 ;;
21911 esac
21912 fi
21913 fi
21914
21915 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21916 $cat >try.c <<'EOCP'
21917 #include <sys/types.h>
21918 #include <stdio.h>
21919 int main() {
21920 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21921 printf("%lld\n", q);
21922 }
21923 EOCP
21924 set try
21925 if eval $compile; then
21926 yyy=`$run ./try`
21927 case "$yyy" in
21928 12345678901)
21929 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21930 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21931 echo "We will use the %lld style."
21932 ;;
21933 esac
21934 fi
21935 fi
21936
21937 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21938 $cat >try.c <<EOCP
21939 #include <sys/types.h>
21940 #include <stdio.h>
21941 int main() {
21942 $quadtype q = 12345678901;
21943 printf("%qd\n", q);
21944 }
21945 EOCP
21946 set try
21947 if eval $compile; then
21948 yyy=`$run ./try`
21949 case "$yyy" in
21950 12345678901)
21951 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21952 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21953 echo "We will use %qd."
21954 ;;
21955 esac
21956 fi
21957 fi
21958
21959 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21960 $cat >try.c <<EOCP
21961 #include <sys/types.h>
21962 #include <stdio.h>
21963 int main() {
21964 $quadtype q = 12345678901;
21965 printf("%Ld\n", q);
21966 }
21967 EOCP
21968 set try
21969 if eval $compile; then
21970 yyy=`$run ./try`
21971 case "$yyy" in
21972 12345678901)
21973 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21974 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21975 echo "We will use %Ld."
21976 ;;
21977 esac
21978 fi
21979 fi
21980
21981 if $test X"$sPRId64" = X; then
21982 echo "Cannot figure out how to print 64-bit integers." >&4
21983 fi
21984 $rm_try
21985
21986 fi
21987
21988 case "$sPRId64" in
21989 '') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21990 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21991 ;;
21992 *) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21993 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21994 ;;
21995 esac
21996
21997 : Check format strings for internal types
21998 echo " "
21999 $echo "Checking the format strings to be used for Perl's internal types..." >&4
22000
22001 if $test X"$ivsize" = X8; then
22002 ivdformat="$sPRId64"
22003 uvuformat="$sPRIu64"
22004 uvoformat="$sPRIo64"
22005 uvxformat="$sPRIx64"
22006 uvXUformat="$sPRIXU64"
22007 else
22008 if $test X"$ivsize" = X"$longsize"; then
22009 ivdformat='"ld"'
22010 uvuformat='"lu"'
22011 uvoformat='"lo"'
22012 uvxformat='"lx"'
22013 uvXUformat='"lX"'
22014 else
22015 if $test X"$ivsize" = X"$intsize"; then
22016 ivdformat='"d"'
22017 uvuformat='"u"'
22018 uvoformat='"o"'
22019 uvxformat='"x"'
22020 uvXUformat='"X"'
22021 else
22022 : far out
22023 if $test X"$ivsize" = X"$shortsize"; then
22024 ivdformat='"hd"'
22025 uvuformat='"hu"'
22026 uvoformat='"ho"'
22027 uvxformat='"hx"'
22028 uvXUformat='"hX"'
22029 fi
22030 fi
22031 fi
22032 fi
22033
22034 if $test X"$usequadmath" = X"$define"; then
22035 nveformat='"Qe"'
22036 nvfformat='"Qf"'
22037 nvgformat='"Qg"'
22038 nvEUformat='"QE"'
22039 nvFUformat='"QF"'
22040 nvGUformat='"QG"'
22041 else
22042 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
22043 nveformat="$sPRIeldbl"
22044 nvfformat="$sPRIfldbl"
22045 nvgformat="$sPRIgldbl"
22046 nvEUformat="$sPRIEUldbl"
22047 nvFUformat="$sPRIFUldbl"
22048 nvGUformat="$sPRIGUldbl"
22049 else
22050 nveformat='"e"'
22051 nvfformat='"f"'
22052 nvgformat='"g"'
22053 nvEUformat='"E"'
22054 nvFUformat='"F"'
22055 nvGUformat='"G"'
22056 fi
22057 fi
22058
22059 case "$ivdformat" in
22060 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
22061 exit 1
22062 ;;
22063 esac
22064
22065 : Check format string for GID
22066
22067 echo " "
22068 $echo "Checking the format string to be used for gids..." >&4
22069
22070 case "$gidsign" in
22071 -1) if $test X"$gidsize" = X"$ivsize"; then
22072 gidformat="$ivdformat"
22073 else
22074 if $test X"$gidsize" = X"$longsize"; then
22075 gidformat='"ld"'
22076 else
22077 if $test X"$gidsize" = X"$intsize"; then
22078 gidformat='"d"'
22079 else
22080 if $test X"$gidsize" = X"$shortsize"; then
22081 gidformat='"hd"'
22082 fi
22083 fi
22084 fi
22085 fi
22086 ;;
22087 *) if $test X"$gidsize" = X"$uvsize"; then
22088 gidformat="$uvuformat"
22089 else
22090 if $test X"$gidsize" = X"$longsize"; then
22091 gidformat='"lu"'
22092 else
22093 if $test X"$gidsize" = X"$intsize"; then
22094 gidformat='"u"'
22095 else
22096 if $test X"$gidsize" = X"$shortsize"; then
22097 gidformat='"hu"'
22098 fi
22099 fi
22100 fi
22101 fi
22102 ;;
22103 esac
22104
22105 : see if getgroups exists
22106 set getgroups d_getgrps
22107 eval $inlibc
22108
22109 : see if setgroups exists
22110 set setgroups d_setgrps
22111 eval $inlibc
22112
22113 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
22114 echo " "
22115 case "$d_getgrps$d_setgrps" in
22116 *define*)
22117 case "$groupstype" in
22118 '') dflt="$gidtype" ;;
22119 *) dflt="$groupstype" ;;
22120 esac
22121 $cat <<EOM
22122 What type of pointer is the second argument to getgroups() and setgroups()?
22123 Usually this is the same as group ids, $gidtype, but not always.
22124
22125 EOM
22126 rp='What type pointer is the second argument to getgroups() and setgroups()?'
22127 . ./myread
22128 groupstype="$ans"
22129 ;;
22130 *) groupstype="$gidtype";;
22131 esac
22132
22133 : Check format strings for internal 32bit types
22134 echo " "
22135 $echo "Checking the format strings to be used for Perl's internal 32bit-types..." >&4
22136
22137 case "$i32dformat" in
22138 '') case "$i32type" in
22139 int)
22140 i32dformat='"d"'
22141 u32uformat='"u"'
22142 u32oformat='"o"'
22143 u32xformat='"x"'
22144 u32XUformat='"X"'
22145 ;;
22146 long)
22147 i32dformat='"ld"'
22148 u32uformat='"lu"'
22149 u32oformat='"lo"'
22150 u32xformat='"lx"'
22151 u32XUformat='"lX"'
22152 ;;
22153 int_least32_t) : will not happen currently
22154 i32dformat=PRIdLEAST32
22155 u32uformat=PRIuLEAST32
22156 u32oformat=PRIoLEAST32
22157 u32xformat=PRIxLEAST32
22158 u32XUformat=PRIXLEAST32
22159 ;;
22160 int32_t)
22161 i32dformat=PRId32
22162 u32uformat=PRIu32
22163 u32oformat=PRIo32
22164 u32xformat=PRIx32
22165 u32XUformat=PRIX32
22166 ;;
22167 esac ;;
22168 esac
22169
22170 case "$i32dformat" in
22171 '') echo "$0: Fatal: failed to find format strings for 32-bit integers, cannot continue." >&4
22172 exit 1
22173 ;;
22174 esac
22175
22176 : check whether make sets MAKE
22177 echo " "
22178 echo "Checking if your $make program sets \$(MAKE)..." >&4
22179 case "$make_set_make" in
22180 '')
22181 $sed 's/^X //' > testmake.mak << 'EOF'
22182 Xall:
22183 X @echo 'maketemp="$(MAKE)"'
22184 EOF
22185 case "`$make -f testmake.mak 2>/dev/null`" in
22186 *maketemp=*) make_set_make='#' ;;
22187 *) make_set_make="MAKE=$make" ;;
22188 esac
22189 $rm -f testmake.mak
22190 ;;
22191 esac
22192 case "$make_set_make" in
22193 '#') echo "Yup, it does.";;
22194 *) echo "Nope, it doesn't.";;
22195 esac
22196
22197 : see what type is used for mode_t
22198 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
22199 set mode_t modetype int stdio.h sys/types.h
22200 eval $typedef_ask
22201
22202 : see if we need va_copy
22203 echo " "
22204 $cat >try.c <<EOCP
22205 #include <stdarg.h>
22206 #include <stdio.h>
22207 #include <stdlib.h>
22208 #include <signal.h>
22209
22210 int
22211 ivfprintf(FILE *f, const char *fmt, va_list *valp)
22212 {
22213 return vfprintf(f, fmt, *valp);
22214 }
22215
22216 int
22217 myvfprintf(FILE *f, const char *fmt, va_list val)
22218 {
22219 return ivfprintf(f, fmt, &val);
22220 }
22221
22222 int
22223 myprintf(char *fmt, ...)
22224 {
22225 va_list val;
22226 va_start(val, fmt);
22227 return myvfprintf(stdout, fmt, val);
22228 }
22229
22230 int
22231 main(int ac, char **av)
22232 {
22233 signal(SIGSEGV, exit);
22234 #ifdef SIGBUS
22235 signal(SIGBUS, exit);
22236 #endif
22237
22238 myprintf("%s%cs all right, then\n", "that", '\'');
22239 exit(0);
22240 }
22241 EOCP
22242 set try
22243 if eval $compile && $run ./try 2>&1 >/dev/null; then
22244 case "`$run ./try`" in
22245 "that's all right, then")
22246 okay=yes
22247 ;;
22248 esac
22249 fi
22250 case "$okay" in
22251 yes) echo "It seems that you don't need va_copy()." >&4
22252 need_va_copy="$undef"
22253 ;;
22254 *) echo "It seems that va_copy() or similar will be needed." >&4
22255 need_va_copy="$define"
22256 ;;
22257 esac
22258 $rm_try
22259
22260 : see what type is used for size_t
22261 rp="What is the type used for the length parameter for string functions?"
22262 set size_t sizetype 'unsigned int' stdio.h sys/types.h
22263 eval $typedef_ask
22264
22265 : check for type of arguments to gethostbyaddr.
22266 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
22267 case "$d_gethbyaddr" in
22268 $define)
22269 $cat <<EOM
22270
22271 Checking to see what type of arguments are accepted by gethostbyaddr().
22272 EOM
22273 hdrs="$define sys/types.h
22274 $d_socket sys/socket.h
22275 $i_niin netinet/in.h
22276 $i_netdb netdb.h
22277 $i_unistd unistd.h"
22278 : The first arg can 'char *' or 'void *'
22279 : The second arg is some of integral type
22280 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
22281 for yyy in size_t long int; do
22282 case "$netdb_host_type" in
22283 '') try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
22284 if ./protochk "$try" $hdrs; then
22285 echo "Your system accepts $xxx for the first arg."
22286 echo "...and $yyy for the second arg."
22287 netdb_host_type="$xxx"
22288 netdb_hlen_type="$yyy"
22289 fi
22290 ;;
22291 esac
22292 done
22293 done
22294 : In case none of those worked, prompt the user.
22295 case "$netdb_host_type" in
22296 '') rp='What is the type for the 1st argument to gethostbyaddr?'
22297 dflt='char *'
22298 . ./myread
22299 netdb_host_type=$ans
22300 rp='What is the type for the 2nd argument to gethostbyaddr?'
22301 dflt="$sizetype"
22302 . ./myread
22303 netdb_hlen_type=$ans
22304 ;;
22305 esac
22306 ;;
22307 *) : no gethostbyaddr, so pick harmless defaults
22308 netdb_host_type='char *'
22309 netdb_hlen_type="$sizetype"
22310 ;;
22311 esac
22312 # Remove the "const" if needed. -- but then we'll have a
22313 # prototype clash!
22314 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
22315 fi
22316
22317 : check for type of argument to gethostbyname.
22318 if test "X$netdb_name_type" = X ; then
22319 case "$d_gethbyname" in
22320 $define)
22321 $cat <<EOM
22322
22323 Checking to see what type of argument is accepted by gethostbyname().
22324 EOM
22325 hdrs="$define sys/types.h
22326 $d_socket sys/socket.h
22327 $i_niin netinet/in.h
22328 $i_netdb netdb.h
22329 $i_unistd unistd.h"
22330 for xxx in "const char *" "char *"; do
22331 case "$netdb_name_type" in
22332 '') try="$extern_C struct hostent *gethostbyname($xxx);"
22333 if ./protochk "$try" $hdrs; then
22334 echo "Your system accepts $xxx."
22335 netdb_name_type="$xxx"
22336 fi
22337 ;;
22338 esac
22339 done
22340 : In case none of those worked, prompt the user.
22341 case "$netdb_name_type" in
22342 '') rp='What is the type for the 1st argument to gethostbyname?'
22343 dflt='char *'
22344 . ./myread
22345 netdb_name_type=$ans
22346 ;;
22347 esac
22348 ;;
22349 *) : no gethostbyname, so pick harmless default
22350 netdb_name_type='char *'
22351 ;;
22352 esac
22353 fi
22354
22355 : check for type of 1st argument to getnetbyaddr.
22356 if test "X$netdb_net_type" = X ; then
22357 case "$d_getnbyaddr" in
22358 $define)
22359 $cat <<EOM
22360
22361 Checking to see what type of 1st argument is accepted by getnetbyaddr().
22362 EOM
22363 hdrs="$define sys/types.h
22364 $d_socket sys/socket.h
22365 $i_niin netinet/in.h
22366 $i_netdb netdb.h
22367 $i_unistd unistd.h"
22368 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
22369 case "$netdb_net_type" in
22370 '') try="$extern_C struct netent *getnetbyaddr($xxx, int);"
22371 if ./protochk "$try" $hdrs; then
22372 echo "Your system accepts $xxx."
22373 netdb_net_type="$xxx"
22374 fi
22375 ;;
22376 esac
22377 done
22378 : In case none of those worked, prompt the user.
22379 case "$netdb_net_type" in
22380 '') rp='What is the type for the 1st argument to getnetbyaddr?'
22381 dflt='long'
22382 . ./myread
22383 netdb_net_type=$ans
22384 ;;
22385 esac
22386 ;;
22387 *) : no getnetbyaddr, so pick harmless default
22388 netdb_net_type='long'
22389 ;;
22390 esac
22391 fi
22392 : locate the preferred pager for this system
22393 fn=f/
22394 case "$pager" in
22395 '')
22396 dflt=''
22397 case "$pg" in
22398 /*) dflt=$pg;;
22399 [a-zA-Z]:/*) dflt=$pg;;
22400 esac
22401 case "$more" in
22402 /*) dflt=$more;;
22403 [a-zA-Z]:/*) dflt=$more;;
22404 esac
22405 case "$less" in
22406 /*) dflt=$less;;
22407 [a-zA-Z]:/*) dflt=$less;;
22408 esac
22409 case "$dflt" in
22410 '') dflt=/usr/ucb/more;;
22411 esac
22412 ;;
22413 *) dflt="$pager"
22414 ;;
22415 esac
22416 fn="f/($dflt)"
22417 echo " "
22418 rp='What pager is used on your system?'
22419 . ./getfile
22420 pager="$ans"
22421
22422 : see if ar generates random libraries by itself
22423 echo " "
22424 echo "Checking how to generate random libraries on your machine..." >&4
22425 echo 'extern int bar2(); int bar1() { return bar2(); }' > bar1.c
22426 echo 'int bar2() { return 2; }' > bar2.c
22427 $cat > foo.c <<EOP
22428 #$i_stdlib I_STDLIB
22429 #ifdef I_STDLIB
22430 #include <stdlib.h>
22431 #endif
22432 #include <stdio.h>
22433 extern int bar1();
22434 int main() { printf("%d\n", bar1()); exit(0); }
22435 EOP
22436 $cc $ccflags -c bar1.c >/dev/null 2>&1
22437 $cc $ccflags -c bar2.c >/dev/null 2>&1
22438 $cc $ccflags -c foo.c >/dev/null 2>&1
22439 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
22440 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22441 $run ./foobar >/dev/null 2>&1; then
22442 echo "$ar appears to generate random libraries itself."
22443 orderlib=false
22444 if [ "X$ranlib" = "X" ]; then
22445 ranlib=":"
22446 fi
22447 elif $ar s bar$_a >/dev/null 2>&1 &&
22448 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22449 $run ./foobar >/dev/null 2>&1; then
22450 echo "a table of contents needs to be added with '$ar s'."
22451 orderlib=false
22452 ranlib="$ar s"
22453 elif $ar ts bar$_a >/dev/null 2>&1 &&
22454 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22455 $run ./foobar >/dev/null 2>&1; then
22456 echo "a table of contents needs to be added with '$ar ts'."
22457 orderlib=false
22458 ranlib="$ar ts"
22459 else
22460 case "$ranlib" in
22461 :) ranlib='';;
22462 '')
22463 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
22464 $test -f $ranlib || ranlib=''
22465 ;;
22466 esac
22467 if $test -n "$ranlib"; then
22468 echo "your system has '$ranlib'; we'll use that."
22469 orderlib=false
22470 else
22471 echo "your system doesn't seem to support random libraries"
22472 echo "so we'll use lorder and tsort to order the libraries."
22473 orderlib=true
22474 ranlib=":"
22475 fi
22476 fi
22477 $rm -f foo* bar*
22478
22479 : Check the max offset that gmtime and localtime accept
22480 echo "Checking max offsets that gmtime () accepts"
22481
22482 case "$sGMTIME_min/$sGMTIME_max" in
22483 0/0|/)
22484 $cat >try.c <<EOCP
22485 #include <sys/types.h>
22486 #include <stdio.h>
22487 #include <time.h>
22488
22489 int i;
22490 struct tm *tmp;
22491 time_t pt;
22492
22493 void gm_check (time_t t, int min_year, int max_year)
22494 {
22495 tmp = gmtime (&t);
22496 if ( tmp == NULL ||
22497 /* Check tm_year overflow */
22498 tmp->tm_year < min_year || tmp->tm_year > max_year)
22499 tmp = NULL;
22500 else
22501 pt = t;
22502 } /* gm_check */
22503
22504 int check_max ()
22505 {
22506 tmp = NULL;
22507 pt = 0;
22508 #ifdef MAXLONG
22509 gm_check (MAXLONG, 69, 0x7fffffff);
22510 #endif
22511 if (tmp == NULL || tmp->tm_year < 0) {
22512 for (i = 63; i >= 0; i--) {
22513 time_t x = pt | ((time_t)1 << i);
22514 if (x < 0 || x < pt) continue;
22515 gm_check (x, 69, 0x7fffffff);
22516 }
22517 }
22518 printf ("sGMTIME_max=%ld\n", pt);
22519 return (0);
22520 } /* check_max */
22521
22522 int check_min ()
22523 {
22524 tmp = NULL;
22525 pt = 0;
22526 #ifdef MINLONG
22527 gm_check (MINLONG, -1900, 70);
22528 #endif
22529 if (tmp == NULL) {
22530 for (i = 36; i >= 0; i--) {
22531 time_t x = pt - ((time_t)1 << i);
22532 if (x > 0) continue;
22533 gm_check (x, -1900, 70);
22534 }
22535 }
22536 printf ("sGMTIME_min=%ld\n", pt);
22537 return (0);
22538 } /* check_min */
22539
22540 int main (int argc, char *argv[])
22541 {
22542 /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
22543 check_max ();
22544 check_min ();
22545 return (0);
22546 } /* main */
22547 EOCP
22548 set try
22549 if eval $compile; then
22550 eval `$run ./try 2>/dev/null`
22551 else
22552 echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
22553 fi
22554 $rm_try
22555 ;;
22556 esac
22557
22558 echo "Checking max offsets that localtime () accepts"
22559
22560 case "$sLOCALTIME_min/$sLOCALTIME_max" in
22561 0/0|/)
22562 $cat >try.c <<EOCP
22563 #include <sys/types.h>
22564 #include <stdio.h>
22565 #include <time.h>
22566
22567 int i;
22568 struct tm *tmp;
22569 time_t pt;
22570
22571 void local_check (time_t t, int min_year, int max_year)
22572 {
22573 if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
22574 tmp = NULL;
22575 else
22576 tmp = localtime (&t);
22577 if ( tmp == NULL ||
22578 /* Check tm_year overflow */
22579 tmp->tm_year < min_year || tmp->tm_year > max_year)
22580 tmp = NULL;
22581 else
22582 pt = t;
22583 } /* local_check */
22584
22585 int check_max ()
22586 {
22587 tmp = NULL;
22588 pt = 0;
22589 #ifdef MAXLONG
22590 local_check (MAXLONG, 69, 0x7fffffff);
22591 #endif
22592 if (tmp == NULL || tmp->tm_year < 0) {
22593 for (i = 63; i >= 0; i--) {
22594 time_t x = pt | ((time_t)1 << i);
22595 if (x < 0 || x < pt) continue;
22596 local_check (x, 69, 0x7fffffff);
22597 }
22598 }
22599 printf ("sLOCALTIME_max=%ld\n", pt);
22600 return (0);
22601 } /* check_max */
22602
22603 int check_min ()
22604 {
22605 tmp = NULL;
22606 pt = 0;
22607 #ifdef MINLONG
22608 local_check (MINLONG, -1900, 70);
22609 #endif
22610 if (tmp == NULL) {
22611 for (i = 36; i >= 0; i--) {
22612 time_t x = pt - ((time_t)1 << i);
22613 if (x > 0) continue;
22614 local_check (x, -1900, 70);
22615 }
22616 }
22617 printf ("sLOCALTIME_min=%ld\n", pt);
22618 return (0);
22619 } /* check_min */
22620
22621 int main (int argc, char *argv[])
22622 {
22623 check_max ();
22624 check_min ();
22625 return (0);
22626 } /* main */
22627 EOCP
22628 set try
22629 if eval $compile; then
22630 eval `$run ./try 2>/dev/null`
22631 else
22632 echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
22633 fi
22634 $rm_try
22635 ;;
22636 esac
22637
22638 : check for type of arguments to select.
22639 case "$selecttype" in
22640 '') case "$d_select" in
22641 $define)
22642 echo " "
22643 $cat <<EOM
22644 Checking to see what type of arguments are accepted by select().
22645 EOM
22646 hdrs="$define sys/types.h
22647 $i_systime sys/time.h
22648 $i_sysselct sys/select.h
22649 $d_socket sys/socket.h"
22650 : The first arg can be int, unsigned, or size_t
22651 : The last arg may or may not be 'const'
22652 val=''
22653 : void pointer has been seen but using that
22654 : breaks the selectminbits test
22655 for xxx in 'fd_set *' 'int *'; do
22656 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
22657 for tmo in 'struct timeval *' 'const struct timeval *'; do
22658 case "$val" in
22659 '') try="$extern_C int select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
22660 if ./protochk "$try" $hdrs; then
22661 echo "Your system accepts $xxx."
22662 val="$xxx"
22663 fi
22664 ;;
22665 esac
22666 done
22667 done
22668 done
22669 case "$val" in
22670 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
22671 case "$d_fd_set" in
22672 $define) dflt="fd_set *" ;;
22673 *) dflt="int *" ;;
22674 esac
22675 . ./myread
22676 val=$ans
22677 ;;
22678 esac
22679 selecttype="$val"
22680 ;;
22681 *) : no select, so pick a harmless default
22682 selecttype='int *'
22683 ;;
22684 esac
22685 ;;
22686 esac
22687
22688 : check for the select 'width'
22689 case "$selectminbits" in
22690 '') safebits=`expr $ptrsize \* 8`
22691 case "$d_select" in
22692 $define)
22693 $cat <<EOM
22694
22695 Checking to see on how many bits at a time your select() operates...
22696 EOM
22697 $cat >try.c <<EOCP
22698 #include <sys/types.h>
22699 #$i_time I_TIME
22700 #$i_systime I_SYS_TIME
22701 #$i_systimek I_SYS_TIME_KERNEL
22702 #ifdef I_TIME
22703 # include <time.h>
22704 #endif
22705 #ifdef I_SYS_TIME
22706 # ifdef I_SYS_TIME_KERNEL
22707 # define KERNEL
22708 # endif
22709 # include <sys/time.h>
22710 # ifdef I_SYS_TIME_KERNEL
22711 # undef KERNEL
22712 # endif
22713 #endif
22714 #$i_sysselct I_SYS_SELECT
22715 #ifdef I_SYS_SELECT
22716 #include <sys/select.h>
22717 #endif
22718 #$d_socket HAS_SOCKET
22719 #ifdef HAS_SOCKET
22720 # include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
22721 #endif
22722 #include <stdio.h>
22723 #$i_stdlib I_STDLIB
22724 #ifdef I_STDLIB
22725 #include <stdlib.h>
22726 #endif
22727 $selecttype b;
22728 #define S sizeof(*(b))
22729 #define MINBITS 64
22730 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
22731 #define NBITS (NBYTES * 8)
22732 int main() {
22733 char *s = (char *)malloc(NBYTES);
22734 struct timeval t;
22735 int i;
22736 FILE* fp;
22737 int fd;
22738
22739 if (!s)
22740 exit(1);
22741 fclose(stdin);
22742 fp = fopen("try.c", "r");
22743 if (fp == 0)
22744 exit(2);
22745 fd = fileno(fp);
22746 if (fd < 0)
22747 exit(3);
22748 b = ($selecttype)s;
22749 for (i = 0; i < NBITS; i++)
22750 FD_SET(i, b);
22751 t.tv_sec = 0;
22752 t.tv_usec = 0;
22753 select(fd + 1, b, 0, 0, &t);
22754 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22755 free(s);
22756 printf("%d\n", i + 1);
22757 return 0;
22758 }
22759 EOCP
22760 set try
22761 if eval $compile_ok; then
22762 selectminbits=`$run ./try 2>/dev/null`
22763 case "$selectminbits" in
22764 '') cat >&4 <<EOM
22765 Cannot figure out on how many bits at a time your select() operates.
22766 I'll play safe and guess it is $safebits bits.
22767 EOM
22768 selectminbits=$safebits
22769 bits="$safebits bits"
22770 ;;
22771 1) bits="1 bit" ;;
22772 *) bits="$selectminbits bits" ;;
22773 esac
22774 echo "Your select() operates on $bits at a time." >&4
22775 else
22776 rp='What is the minimum number of bits your select() operates on?'
22777 case "$byteorder" in
22778 12345678) dflt=64 ;;
22779 1234) dflt=32 ;;
22780 *) dflt=1 ;;
22781 esac
22782 . ./myread
22783 val=$ans
22784 selectminbits="$val"
22785 fi
22786 $rm_try
22787 ;;
22788 *) : no select, so pick a harmless default
22789 selectminbits=$safebits
22790 ;;
22791 esac
22792 ;;
22793 esac
22794
22795 : Trace out the files included by signal.h, then look for SIGxxx names.
22796 case "$sig_num_init" in
22797 '')
22798 if [ "X$fieldn" = X ]; then
22799 : Just make some guesses. We check them later.
22800 xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22801 else
22802 xxx=`echo '#include <signal.h>' |
22803 $cppstdin $cppminus $cppflags 2>/dev/null |
22804 $grep '^[ ]*#.*include' |
22805 $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22806 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22807 fi
22808 xxxfiles=''
22809 for xx in $xxx /dev/null ; do
22810 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22811 done
22812 case "$xxxfiles" in
22813 '') xxxfiles=`./findhdr signal.h` ;;
22814 esac
22815 xxx=`awk '
22816 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22817 print substr($2, 4, 20)
22818 }
22819 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22820 print substr($3, 4, 20)
22821 }' $xxxfiles`
22822 : Append some common names just in case the awk scan failed.
22823 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22824 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22825 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22826 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22827 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22828
22829 : generate a few handy files for later
22830 $cat > signal.c <<EOCP
22831 #include <sys/types.h>
22832 #include <signal.h>
22833 #$i_stdlib I_STDLIB
22834 #ifdef I_STDLIB
22835 #include <stdlib.h>
22836 #endif
22837 #include <stdio.h>
22838 int main() {
22839
22840 /* Strange style to avoid deeply-nested #if/#else/#endif */
22841 #ifndef NSIG
22842 # ifdef _NSIG
22843 # define NSIG (_NSIG)
22844 # endif
22845 #endif
22846
22847 #ifndef NSIG
22848 # ifdef SIGMAX
22849 # define NSIG (SIGMAX+1)
22850 # endif
22851 #endif
22852
22853 #ifndef NSIG
22854 # ifdef SIG_MAX
22855 # define NSIG (SIG_MAX+1)
22856 # endif
22857 #endif
22858
22859 #ifndef NSIG
22860 # ifdef _SIG_MAX
22861 # define NSIG (_SIG_MAX+1)
22862 # endif
22863 #endif
22864
22865 #ifndef NSIG
22866 # ifdef MAXSIG
22867 # define NSIG (MAXSIG+1)
22868 # endif
22869 #endif
22870
22871 #ifndef NSIG
22872 # ifdef MAX_SIG
22873 # define NSIG (MAX_SIG+1)
22874 # endif
22875 #endif
22876
22877 #ifndef NSIG
22878 # ifdef SIGARRAYSIZE
22879 # define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22880 # endif
22881 #endif
22882
22883 #ifndef NSIG
22884 # ifdef _sys_nsig
22885 # define NSIG (_sys_nsig) /* Solaris 2.5 */
22886 # endif
22887 #endif
22888
22889 /* Default to some arbitrary number that's big enough to get most
22890 of the common signals.
22891 */
22892 #ifndef NSIG
22893 # define NSIG 50
22894 #endif
22895
22896 printf("NSIG %d\n", NSIG);
22897
22898 #ifndef JUST_NSIG
22899
22900 EOCP
22901
22902 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22903 {
22904 printf "#ifdef SIG"; printf $1; printf "\n"
22905 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22906 printf $1; printf ");\n"
22907 printf "#endif\n"
22908 }
22909 END {
22910 printf "#endif /* JUST_NSIG */\n";
22911 printf "exit(0);\n}\n";
22912 }
22913 ' >>signal.c
22914 $cat >signal.awk <<'EOP'
22915 BEGIN { ndups = 0 }
22916 $1 ~ /^NSIG$/ { nsig = $2 }
22917 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22918 if ($2 > maxsig) { maxsig = $2 }
22919 if (sig_name[$2]) {
22920 dup_name[ndups] = $1
22921 dup_num[ndups] = $2
22922 ndups++
22923 }
22924 else {
22925 sig_name[$2] = $1
22926 sig_num[$2] = $2
22927 }
22928 }
22929 END {
22930 if (nsig == 0) {
22931 nsig = maxsig + 1
22932 }
22933 printf("NSIG %d\n", nsig);
22934 for (n = 1; n < nsig; n++) {
22935 if (sig_name[n]) {
22936 printf("%s %d\n", sig_name[n], sig_num[n])
22937 }
22938 else {
22939 printf("NUM%d %d\n", n, n)
22940 }
22941 }
22942 for (n = 0; n < ndups; n++) {
22943 printf("%s %d\n", dup_name[n], dup_num[n])
22944 }
22945 }
22946 EOP
22947 $cat >signal_cmd <<EOS
22948 $startsh
22949 if $test -s signal.lst; then
22950 echo "Using your existing signal.lst file"
22951 exit 0
22952 fi
22953 xxx="$xxx"
22954 EOS
22955 $cat >>signal_cmd <<'EOS'
22956
22957 set signal
22958 if eval $compile_ok; then
22959 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22960 $uniq | $awk -f signal.awk >signal.lst
22961 else
22962 echo "(I can't seem be able to compile the whole test program)" >&4
22963 echo "(I'll try it in little pieces.)" >&4
22964 set signal -DJUST_NSIG
22965 if eval $compile_ok; then
22966 $run ./signal$_exe > signal.nsg
22967 $cat signal.nsg
22968 else
22969 echo "I can't seem to figure out how many signals you have." >&4
22970 echo "Guessing 50." >&4
22971 echo 'NSIG 50' > signal.nsg
22972 fi
22973 : Now look at all the signal names, one at a time.
22974 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22975 $cat > signal.c <<EOCP
22976 #include <sys/types.h>
22977 #include <signal.h>
22978 #include <stdio.h>
22979 int main() {
22980 printf("$xx %d\n", SIG${xx});
22981 return 0;
22982 }
22983 EOCP
22984 set signal
22985 if eval $compile; then
22986 echo "SIG${xx} found."
22987 $run ./signal$_exe >> signal.ls1
22988 else
22989 echo "SIG${xx} NOT found."
22990 fi
22991 done
22992 if $test -s signal.ls1; then
22993 $cat signal.nsg signal.ls1 |
22994 $sort -n | $uniq | $awk -f signal.awk >signal.lst
22995 fi
22996
22997 fi
22998 if $test -s signal.lst; then
22999 :
23000 else
23001 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
23002 echo 'kill -l' >signal
23003 set X `csh -f <signal`
23004 $rm -f signal
23005 shift
23006 case $# in
23007 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
23008 esac
23009 echo $@ | $tr ' ' $trnl | \
23010 $awk '{ printf "%s %d\n", $1, ++s; }
23011 END { printf "NSIG %d\n", ++s }' >signal.lst
23012 fi
23013 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
23014 EOS
23015 chmod a+x signal_cmd
23016 $eunicefix signal_cmd
23017 ;;
23018 esac
23019
23020 : generate list of signal names
23021 case "$sig_num_init" in
23022 '')
23023 echo " "
23024 case "$sig_name_init" in
23025 '') doinit=yes ;;
23026 *) case "$sig_num_init" in
23027 ''|*,*) doinit=yes ;;
23028 esac ;;
23029 esac
23030 case "$doinit" in
23031 yes)
23032 echo "Generating a list of signal names and numbers..." >&4
23033 . ./signal_cmd
23034 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
23035 sig_name=`$awk 'BEGIN { printf "ZERO " }
23036 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
23037 sig_num=`$awk 'BEGIN { printf "0 " }
23038 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
23039 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
23040 !/^NSIG/ { printf "\"%s\", ", $1 }
23041 END { printf "0\n" }' signal.lst`
23042 sig_num_init=`$awk 'BEGIN { printf "0, " }
23043 !/^NSIG/ { printf "%d, ", $2}
23044 END { printf "0\n"}' signal.lst`
23045 ;;
23046 esac
23047 echo "The following $sig_count signals are available:"
23048 echo " "
23049 echo $sig_name | $awk \
23050 'BEGIN { linelen = 0 }
23051 {
23052 for (i = 1; i <= NF; i++) {
23053 name = "SIG" $i " "
23054 linelen = linelen + length(name)
23055 if (linelen > 70) {
23056 printf "\n"
23057 linelen = length(name)
23058 }
23059 printf "%s", name
23060 }
23061 printf "\n"
23062 }'
23063 sig_size=`echo $sig_name | awk '{print NF}'`
23064 $rm -f signal signal.c signal.awk signal.lst signal_cmd
23065 ;;
23066 esac
23067
23068 : Check size of size
23069 echo " "
23070 case "$sizetype" in
23071 *_t) zzz="$sizetype" ;;
23072 *) zzz="filesize" ;;
23073 esac
23074 echo "Checking the size of $zzz..." >&4
23075 cat > try.c <<EOCP
23076 #include <sys/types.h>
23077 #include <stdio.h>
23078 #$i_stdlib I_STDLIB
23079 #ifdef I_STDLIB
23080 #include <stdlib.h>
23081 #endif
23082 int main() {
23083 printf("%d\n", (int)sizeof($sizetype));
23084 exit(0);
23085 }
23086 EOCP
23087 set try
23088 if eval $compile_ok; then
23089 yyy=`$run ./try`
23090 case "$yyy" in
23091 '') sizesize=4
23092 echo "(I can't execute the test program--guessing $sizesize.)" >&4
23093 ;;
23094 *) sizesize=$yyy
23095 echo "Your $zzz size is $sizesize bytes."
23096 ;;
23097 esac
23098 else
23099 sizesize=4
23100 echo "(I can't compile the test program--guessing $sizesize.)" >&4
23101 fi
23102
23103 : check for socklen_t
23104 echo " "
23105 echo "Checking to see if you have socklen_t..." >&4
23106 $cat >try.c <<EOCP
23107 #include <sys/types.h>
23108 #$d_socket HAS_SOCKET
23109 #ifdef HAS_SOCKET
23110 #include <sys/socket.h>
23111 #endif
23112 int main() { socklen_t x = 16; }
23113 EOCP
23114 set try
23115 if eval $compile; then
23116 val="$define"
23117 echo "You have socklen_t."
23118 else
23119 val="$undef"
23120 echo "You do not have socklen_t."
23121 case "$sizetype" in
23122 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
23123 esac
23124 fi
23125 $rm_try
23126 set d_socklen_t
23127 eval $setvar
23128
23129 : see if this is a socks.h system
23130 set socks.h i_socks
23131 eval $inhdr
23132
23133 : check for type of the size argument to socket calls
23134 case "$d_socket" in
23135 "$define")
23136 $cat <<EOM
23137
23138 Checking to see what type is the last argument of accept().
23139 EOM
23140 yyy=''
23141 case "$d_socklen_t" in
23142 "$define") yyy="$yyy socklen_t"
23143 esac
23144 yyy="$yyy $sizetype int long unsigned"
23145 for xxx in $yyy; do
23146 case "$socksizetype" in
23147 '') try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
23148 case "$usesocks" in
23149 "$define")
23150 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
23151 echo "Your system accepts '$xxx *' for the last argument of accept()."
23152 socksizetype="$xxx"
23153 fi
23154 ;;
23155 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
23156 echo "Your system accepts '$xxx *' for the last argument of accept()."
23157 socksizetype="$xxx"
23158 fi
23159 ;;
23160 esac
23161 ;;
23162 esac
23163 done
23164 : In case none of those worked, prompt the user.
23165 case "$socksizetype" in
23166 '') rp='What is the type for socket address structure sizes?'
23167 dflt='int'
23168 . ./myread
23169 socksizetype=$ans
23170 ;;
23171 esac
23172 ;;
23173 *) : no sockets, so pick relatively harmless default
23174 socksizetype='int'
23175 ;;
23176 esac
23177
23178 : see what type is used for signed size_t
23179 set ssize_t ssizetype int stdio.h sys/types.h
23180 eval $typedef
23181 dflt="$ssizetype"
23182 $cat > try.c <<EOM
23183 #include <stdio.h>
23184 #$i_stdlib I_STDLIB
23185 #ifdef I_STDLIB
23186 #include <stdlib.h>
23187 #endif
23188 #include <sys/types.h>
23189 #define Size_t $sizetype
23190 #define SSize_t $dflt
23191 int main()
23192 {
23193 if (sizeof(Size_t) == sizeof(SSize_t))
23194 printf("$dflt\n");
23195 else if (sizeof(Size_t) == sizeof(int))
23196 printf("int\n");
23197 else
23198 printf("long\n");
23199 exit(0);
23200 }
23201 EOM
23202 echo " "
23203 set try
23204 if eval $compile_ok && $run ./try > /dev/null; then
23205 ssizetype=`$run ./try`
23206 echo "I'll be using $ssizetype for functions returning a byte count." >&4
23207 else
23208 $cat >&4 <<EOM
23209 Help! I can't compile and run the ssize_t test program: please enlighten me!
23210 (This is probably a misconfiguration in your system or libraries, and
23211 you really ought to fix it. Still, I'll try anyway.)
23212
23213 I need a type that is the same size as $sizetype, but is guaranteed to
23214 be signed. Common values are ssize_t, int and long.
23215
23216 EOM
23217 rp="What signed type is the same size as $sizetype?"
23218 . ./myread
23219 ssizetype="$ans"
23220 fi
23221 $rm_try
23222
23223 : Check the size of st_dev
23224 $echo " "
23225 $echo "Checking the size of st_dev..." >&4
23226 $cat > try.c <<EOCP
23227 #include <sys/stat.h>
23228 #include <stdio.h>
23229 #$i_stdlib I_STDLIB
23230 #ifdef I_STDLIB
23231 #include <stdlib.h>
23232 #endif
23233 int main() {
23234 struct stat st;
23235 printf("%d\n", (int)sizeof(st.st_dev));
23236 exit(0);
23237 }
23238 EOCP
23239 set try
23240 if eval $compile_ok; then
23241 val=`$run ./try`
23242 case "$val" in
23243 '') st_dev_size=4
23244 $echo "(I can't execute the test program--guessing $st_dev_size.)" >&4
23245 ;;
23246 *) st_dev_size=$val
23247 $echo "Your st_dev is $st_dev_size bytes long."
23248 ;;
23249 esac
23250 else
23251 st_dev_size=4
23252 $echo "(I can't compile the test program--guessing $st_dev_size.)" >&4
23253 fi
23254 $rm_try
23255
23256 : Check if st_dev is signed
23257 $echo " "
23258 $echo "Checking the sign of st_dev..." >&4
23259 $cat > try.c <<EOCP
23260 #include <sys/stat.h>
23261 #include <stdio.h>
23262 int main() {
23263 struct stat foo;
23264 foo.st_dev = -1;
23265 if (foo.st_dev < 0)
23266 printf("-1\n");
23267 else
23268 printf("1\n");
23269 }
23270 EOCP
23271 set try
23272 if eval $compile; then
23273 val=`$run ./try`
23274 case "$val" in
23275 '') st_dev_sign=1
23276 $echo "(I can't execute the test program--guessing unsigned.)" >&4
23277 ;;
23278 *) st_dev_sign=$val
23279 case "$st_dev_sign" in
23280 1) $echo "Your st_dev is unsigned." ;;
23281 -1) $echo "Your st_dev is signed." ;;
23282 esac
23283 ;;
23284 esac
23285 else
23286 st_dev_sign=1
23287 $echo "(I can't compile the test program--guessing unsigned.)" >&4
23288 fi
23289 $rm_try
23290
23291 : Check the size of st_ino
23292 $echo " "
23293 $echo "Checking the size of st_ino..." >&4
23294 $cat > try.c <<EOCP
23295 #include <sys/stat.h>
23296 #include <stdio.h>
23297 #$i_stdlib I_STDLIB
23298 #ifdef I_STDLIB
23299 #include <stdlib.h>
23300 #endif
23301 int main() {
23302 struct stat st;
23303 printf("%d\n", (int)sizeof(st.st_ino));
23304 exit(0);
23305 }
23306 EOCP
23307 set try
23308 if eval $compile_ok; then
23309 val=`$run ./try`
23310 case "$val" in
23311 '') st_ino_size=4
23312 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
23313 ;;
23314 *) st_ino_size=$val
23315 $echo "Your st_ino is $st_ino_size bytes long."
23316 ;;
23317 esac
23318 else
23319 st_ino_size=4
23320 $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
23321 fi
23322 $rm_try
23323
23324 : Check if st_ino is signed
23325 $echo " "
23326 $echo "Checking the sign of st_ino..." >&4
23327 $cat > try.c <<EOCP
23328 #include <sys/stat.h>
23329 #include <stdio.h>
23330 int main() {
23331 struct stat foo;
23332 foo.st_ino = -1;
23333 if (foo.st_ino < 0)
23334 printf("-1\n");
23335 else
23336 printf("1\n");
23337 }
23338 EOCP
23339 set try
23340 if eval $compile; then
23341 val=`$run ./try`
23342 case "$val" in
23343 '') st_ino_sign=1
23344 $echo "(I can't execute the test program--guessing unsigned.)" >&4
23345 ;;
23346 *) st_ino_sign=$val
23347 case "$st_ino_sign" in
23348 1) $echo "Your st_ino is unsigned." ;;
23349 -1) $echo "Your st_ino is signed." ;;
23350 esac
23351 ;;
23352 esac
23353 else
23354 st_ino_sign=1
23355 $echo "(I can't compile the test program--guessing unsigned.)" >&4
23356 fi
23357 $rm_try
23358
23359 : see what type of char stdio uses.
23360 echo " "
23361 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
23362 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
23363 echo "Your stdio uses unsigned chars." >&4
23364 stdchar="unsigned char"
23365 else
23366 echo "Your stdio uses signed chars." >&4
23367 stdchar="char"
23368 fi
23369 $rm -f stdioh
23370
23371 : Check size of UID
23372 echo " "
23373 case "$uidtype" in
23374 *_t) zzz="$uidtype" ;;
23375 *) zzz="uid" ;;
23376 esac
23377 echo "Checking the size of $zzz..." >&4
23378 cat > try.c <<EOCP
23379 #include <sys/types.h>
23380 #include <stdio.h>
23381 #$i_stdlib I_STDLIB
23382 #ifdef I_STDLIB
23383 #include <stdlib.h>
23384 #endif
23385 int main() {
23386 printf("%d\n", (int)sizeof($uidtype));
23387 exit(0);
23388 }
23389 EOCP
23390 set try
23391 if eval $compile_ok; then
23392 yyy=`$run ./try`
23393 case "$yyy" in
23394 '') uidsize=4
23395 echo "(I can't execute the test program--guessing $uidsize.)" >&4
23396 ;;
23397 *) uidsize=$yyy
23398 echo "Your $zzz is $uidsize bytes long."
23399 ;;
23400 esac
23401 else
23402 uidsize=4
23403 echo "(I can't compile the test program--guessing $uidsize.)" >&4
23404 fi
23405
23406 : Check if UID is signed
23407 echo " "
23408 case "$uidtype" in
23409 *_t) zzz="$uidtype" ;;
23410 *) zzz="uid" ;;
23411 esac
23412 echo "Checking the sign of $zzz..." >&4
23413 cat > try.c <<EOCP
23414 #include <sys/types.h>
23415 #include <stdio.h>
23416 int main() {
23417 $uidtype foo = -1;
23418 if (foo < 0)
23419 printf("-1\n");
23420 else
23421 printf("1\n");
23422 }
23423 EOCP
23424 set try
23425 if eval $compile; then
23426 yyy=`$run ./try`
23427 case "$yyy" in
23428 '') uidsign=1
23429 echo "(I can't execute the test program--guessing unsigned.)" >&4
23430 ;;
23431 *) uidsign=$yyy
23432 case "$uidsign" in
23433 1) echo "Your $zzz is unsigned." ;;
23434 -1) echo "Your $zzz is signed." ;;
23435 esac
23436 ;;
23437 esac
23438 else
23439 uidsign=1
23440 echo "(I can't compile the test program--guessing unsigned.)" >&4
23441 fi
23442
23443 : Check format string for UID
23444 echo " "
23445 $echo "Checking the format string to be used for uids..." >&4
23446
23447 case "$uidsign" in
23448 -1) if $test X"$uidsize" = X"$ivsize"; then
23449 uidformat="$ivdformat"
23450 else
23451 if $test X"$uidsize" = X"$longsize"; then
23452 uidformat='"ld"'
23453 else
23454 if $test X"$uidsize" = X"$intsize"; then
23455 uidformat='"d"'
23456 else
23457 if $test X"$uidsize" = X"$shortsize"; then
23458 uidformat='"hd"'
23459 fi
23460 fi
23461 fi
23462 fi
23463 ;;
23464 *) if $test X"$uidsize" = X"$uvsize"; then
23465 uidformat="$uvuformat"
23466 else
23467 if $test X"$uidsize" = X"$longsize"; then
23468 uidformat='"lu"'
23469 else
23470 if $test X"$uidsize" = X"$intsize"; then
23471 uidformat='"u"'
23472 else
23473 if $test X"$uidsize" = X"$shortsize"; then
23474 uidformat='"hu"'
23475 fi
23476 fi
23477 fi
23478 fi
23479 ;;
23480 esac
23481
23482 : Ask about strict by default.
23483 case "$usedefaultstrict" in
23484 $define|true|[Yy]*)
23485 dflt="y"
23486 ;;
23487 *)
23488 dflt="n"
23489 ;;
23490 esac
23491
23492 cat <<EOM
23493
23494 EXPERIMENTAL: Perl can now be built with strict on by default when not
23495 invoked with -e or -E. This is a diagnostic tool for development.
23496
23497 Unless you are familiar with this feature, you should probably answer 'no'.
23498
23499 EOM
23500
23501 rp='Would you like to build perl with strict enabled by default?'
23502 . ./myread
23503 case "$ans" in
23504 y|Y) val="$define" ;;
23505 *) val="$undef" ;;
23506 esac
23507 set usedefaultstrict
23508 eval $setvar
23509
23510 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
23511 echo " "
23512 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
23513 $cat >try.c <<'EOM'
23514 /* Intentionally a long probe as I'd like to sanity check that the exact
23515 approach is going to work, as thinking it will work, but only having it
23516 part working at runtime is worse than not having it. */
23517
23518 #include <sys/types.h>
23519 #include <sys/sysctl.h>
23520 #include <sys/param.h>
23521 #include <stdio.h>
23522 #include <string.h>
23523 #include <stdlib.h>
23524 #include <unistd.h>
23525
23526 int
23527 main(int argc, char **argv) {
23528 char *buffer;
23529 char *argv_leaf = strrchr(argv[0], '/');
23530 char *buffer_leaf;
23531 size_t size = 0;
23532 int mib[4];
23533
23534 mib[0] = CTL_KERN;
23535 mib[1] = KERN_PROC;
23536 mib[2] = KERN_PROC_PATHNAME;
23537 mib[3] = -1;
23538
23539 if (!argv_leaf) {
23540 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23541 return 1;
23542 }
23543
23544 if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
23545 perror("sysctl");
23546 return 2;
23547 }
23548
23549 if (size < strlen(argv_leaf) + 1) {
23550 fprintf(stderr, "size %lu is too short for a path\n",
23551 (unsigned long) size);
23552 return 3;
23553 }
23554
23555 if (size > MAXPATHLEN * MAXPATHLEN) {
23556 fprintf(stderr, "size %lu is too long for a path\n",
23557 (unsigned long) size);
23558 return 4;
23559 }
23560
23561 buffer = (char *)malloc(size);
23562 if (!buffer) {
23563 perror("malloc");
23564 return 5;
23565 }
23566
23567 if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
23568 perror("sysctl");
23569 return 6;
23570 }
23571
23572 if (strlen(buffer) + 1 != size) {
23573 fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
23574 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
23575 return 7;
23576 }
23577
23578
23579 if (*buffer != '/') {
23580 fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
23581 return 8;
23582 }
23583
23584 if (strstr(buffer, "/./")) {
23585 fprintf(stderr, "Contains /./: '%s'\n", buffer);
23586 return 9;
23587 }
23588
23589 if (strstr(buffer, "/../")) {
23590 fprintf(stderr, "Contains /../: '%s'\n", buffer);
23591 return 10;
23592 }
23593
23594 buffer_leaf = strrchr(buffer, '/');
23595 if (strcmp(buffer_leaf, argv_leaf) != 0) {
23596 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
23597 return 11;
23598 }
23599
23600 free(buffer);
23601
23602 return 0;
23603 }
23604 EOM
23605
23606 val=$undef
23607 set try
23608 if eval $compile; then
23609 if $run ./try; then
23610 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
23611 val="$define"
23612 else
23613 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
23614 val="$undef"
23615 fi
23616 else
23617 echo "I'm unable to compile the test program." >&4
23618 echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
23619 val="$undef"
23620 fi
23621 $rm_try
23622 set usekernprocpathname
23623 eval $setvar
23624
23625 : Determine if we can use _NSGetExecutablePath to find executing program
23626 echo " "
23627 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
23628 $cat >try.c <<'EOM'
23629 /* Intentionally a long probe as I'd like to sanity check that the exact
23630 approach is going to work, as thinking it will work, but only having it
23631 part working at runtime is worse than not having it. */
23632 #include <mach-o/dyld.h>
23633 #include <stdio.h>
23634 #include <stdlib.h>
23635 #include <sys/param.h>
23636 #include <string.h>
23637
23638 int
23639 main(int argc, char **argv) {
23640 char buf[1];
23641 uint32_t size = sizeof(buf);
23642 int result;
23643 char *buffer;
23644 char *tidied;
23645 char *argv_leaf = strrchr(argv[0], '/');
23646 char *tidied_leaf;
23647
23648 if (!argv_leaf) {
23649 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23650 return 1;
23651 }
23652
23653 _NSGetExecutablePath(buf, &size);
23654 if (size > MAXPATHLEN * MAXPATHLEN) {
23655 fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
23656 (unsigned int) size);
23657 return 2;
23658 }
23659
23660 buffer = (char *)malloc(size);
23661 if (!buffer) {
23662 perror("malloc");
23663 return 3;
23664 }
23665
23666 result = _NSGetExecutablePath(buffer, &size);
23667 if (result != 0) {
23668 fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
23669 result, (unsigned int) size);
23670 return 4;
23671 }
23672
23673 tidied = realpath(buffer, NULL);
23674 if (!tidied) {
23675 perror("realpath");
23676 return 5;
23677 }
23678
23679 free(buffer);
23680
23681 if (*tidied != '/') {
23682 fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
23683 return 6;
23684 }
23685
23686 if (strstr(tidied, "/./")) {
23687 fprintf(stderr, "Contains /./: '%s'\n", tidied);
23688 return 7;
23689 }
23690
23691 if (strstr(tidied, "/../")) {
23692 fprintf(stderr, "Contains /../: '%s'\n", tidied);
23693 return 8;
23694 }
23695
23696 tidied_leaf = strrchr(tidied, '/');
23697 if (strcmp(tidied_leaf, argv_leaf) != 0) {
23698 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
23699 return 9;
23700 }
23701
23702 free(tidied);
23703
23704 return 0;
23705 }
23706 EOM
23707
23708 val=$undef
23709 set try
23710 if eval $compile; then
23711 if $run ./try; then
23712 echo "You can use _NSGetExecutablePath to find the executing program." >&4
23713 val="$define"
23714 else
23715 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
23716 fi
23717 else
23718 echo "I'm unable to compile the test program." >&4
23719 echo "I'll assume no _NSGetExecutablePath here." >&4
23720 fi
23721 $rm_try
23722 set usensgetexecutablepath
23723 eval $setvar
23724
23725 : Check if site customization support was requested
23726 case "$usesitecustomize" in
23727 $define|true|[Yy]*)
23728 usesitecustomize="$define"
23729 ;;
23730 *)
23731 usesitecustomize="$undef"
23732 ;;
23733 esac
23734
23735 : determine compiler compiler
23736 case "$yacc" in
23737 '')
23738 dflt=yacc;;
23739 *)
23740 dflt="$yacc";;
23741 esac
23742 echo " "
23743 comp='yacc'
23744 if $test -f "$byacc$_exe"; then
23745 dflt="$byacc"
23746 comp="byacc or $comp"
23747 fi
23748 if $test -f "$bison$_exe"; then
23749 comp="$comp or bison -y"
23750 fi
23751 rp="Which compiler compiler ($comp) shall I use?"
23752 . ./myread
23753 yacc="$ans"
23754 case "$yacc" in
23755 *bis*)
23756 case "$yacc" in
23757 *-y*) ;;
23758 *)
23759 yacc="$yacc -y"
23760 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
23761 ;;
23762 esac
23763 ;;
23764 esac
23765
23766 : see if this is a bfd.h system
23767 set bfd.h i_bfd
23768 eval $inhdr
23769
23770 : see if this is an execinfo.h system
23771 set execinfo.h i_execinfo
23772 eval $inhdr
23773
23774 : see if this is a fenv.h system
23775 set fenv.h i_fenv
23776 eval $inhdr
23777
23778 : see if this is a fp.h system
23779 set fp.h i_fp
23780 eval $inhdr
23781
23782 : see if this is a fp_class.h system
23783 set fp_class.h i_fp_class
23784 eval $inhdr
23785
23786 : see if gdbm.h is available
23787 set gdbm.h t_gdbm
23788 eval $inhdr
23789 case "$t_gdbm" in
23790 $define)
23791 : see if gdbm_open exists
23792 set gdbm_open d_gdbm_open
23793 eval $inlibc
23794 case "$d_gdbm_open" in
23795 $undef)
23796 t_gdbm="$undef"
23797 echo "We won't be including <gdbm.h>"
23798 ;;
23799 esac
23800 ;;
23801 esac
23802 val="$t_gdbm"
23803 set i_gdbm
23804 eval $setvar
23805
23806 : see if this is a ieeefp.h system
23807 case "$i_ieeefp" in
23808 '' ) set ieeefp.h i_ieeefp
23809 eval $inhdr
23810 ;;
23811 esac
23812
23813 : see if this is a libutil.h system
23814 set libutil.h i_libutil
23815 eval $inhdr
23816
23817 : see if mach cthreads are available
23818 if test "X$usethreads" = "X$define"; then
23819 set mach/cthreads.h i_machcthr
23820 eval $inhdr
23821 else
23822 i_machcthr="$undef"
23823 fi
23824
23825 : see if this is a mntent.h system
23826 set mntent.h i_mntent
23827 eval $inhdr
23828
23829 : see if net/errno.h is available
23830 val=''
23831 set net/errno.h val
23832 eval $inhdr
23833
23834 : Unfortunately, it causes problems on some systems. Arrgh.
23835 case "$val" in
23836 $define)
23837 cat > try.c <<'EOM'
23838 #include <stdio.h>
23839 #include <errno.h>
23840 #include <net/errno.h>
23841 int func()
23842 {
23843 return ENOTSOCK;
23844 }
23845 EOM
23846 if $cc $ccflags -c try.c >/dev/null 2>&1; then
23847 echo "We'll be including <net/errno.h>." >&4
23848 else
23849 echo "We won't be including <net/errno.h>." >&4
23850 val="$undef"
23851 fi
23852 $rm_try
23853 ;;
23854 esac
23855 set i_neterrno
23856 eval $setvar
23857
23858 : see if netinet/tcp.h is available
23859 set netinet/tcp.h i_netinettcp
23860 eval $inhdr
23861
23862 : see if this is a poll.h system
23863 set poll.h i_poll
23864 eval $inhdr
23865
23866 : see if this is a prot.h system
23867 set prot.h i_prot
23868 eval $inhdr
23869
23870 : Preprocessor symbols
23871 echo " "
23872 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23873 $cat <<'EOSH' > Cppsym.know
23874 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23875 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23876 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23877 arch_pwr ardent ARM ARM32 atarist att386 att3b
23878 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23879 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23880 byteorder byte_order
23881 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23882 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23883 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23884 ELF encore EPI EXTENSIONS
23885 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23886 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23887 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23888 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23889 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
23890 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23891 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23892 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23893 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23894 ksr1
23895 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23896 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23897 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23898 luna88k Lynx
23899 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23900 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23901 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23902 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23903 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
23904 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23905 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23906 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23907 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23908 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23909 ns32000 ns32016 ns32332 ns32k nsc32000
23910 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23911 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23912 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23913 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23914 QK_USER QNX
23915 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23916 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23917 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23918 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23919 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23920 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23921 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23922 SYSV4 SYSV5 sysV68 sysV88
23923 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23924 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23925 tower32_800 tower32_850 tss
23926 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23927 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23928 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23929 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23930 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23931 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23932 uxpm uxps
23933 vax venix VMESA vms
23934 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23935 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23936 z8000 zarch
23937 EOSH
23938 # Maybe put other stuff here too.
23939 ./tr '-' '_' <<EOSH >>Cppsym.know
23940 $osname
23941 EOSH
23942 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23943 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23944 $cat Cppsym.know > Cppsym.c
23945 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23946 $rm -f Cppsym.a Cppsym.b Cppsym.c
23947 cat <<EOSH > Cppsym
23948 $startsh
23949 if $test \$# -gt 0; then
23950 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23951 if $test -s Cppsym.got; then
23952 $rm -f Cppsym.got
23953 exit 0
23954 fi
23955 $rm -f Cppsym.got
23956 exit 1
23957 else
23958 $tr " " "$trnl" | ./Cppsym.try
23959 exit 0
23960 fi
23961 EOSH
23962 chmod +x Cppsym
23963 $eunicefix Cppsym
23964 cat <<EOSH > Cppsym.try
23965 $startsh
23966 cat <<'EOCP' > try.c
23967 #include <stdio.h>
23968 #if cpp_stuff == 1
23969 #define STRINGIFY(a) "a"
23970 #endif
23971 #if cpp_stuff == 42
23972 #define StGiFy(a) #a
23973 #define STRINGIFY(a) StGiFy(a)
23974 #endif
23975 #if $cpp_stuff != 1 && $cpp_stuff != 42
23976 # include "Bletch: How does this C preprocessor stringify macros?"
23977 #endif
23978 int main() {
23979 EOCP
23980 $awk \\
23981 EOSH
23982 cat <<'EOSH' >> Cppsym.try
23983 'length($1) > 0 {
23984 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23985 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23986 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23987 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23988 }' >> try.c
23989 echo 'return 0;}' >> try.c
23990 EOSH
23991 cat <<EOSH >> Cppsym.try
23992 ccflags="$ccflags"
23993 case "$osname-$gccversion" in
23994 irix-) ccflags="\$ccflags -woff 1178" ;;
23995 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23996 esac
23997 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23998 EOSH
23999 chmod +x Cppsym.try
24000 $eunicefix Cppsym.try
24001 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
24002 : Add in any Linux cpp "predefined macros":
24003 case "$osname::$gccversion" in
24004 *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
24005 tHdrH=_tmpHdr
24006 rm -f $tHdrH'.h' $tHdrH
24007 touch $tHdrH'.h'
24008 # Filter out macro arguments, such as Linux's __INT8_C(c)
24009 if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
24010 sed -e 's/#define[\ \ ]*//;s/[\ \ ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
24011 if [ -s $tHdrH'_cppsym.real' ]; then
24012 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
24013 fi
24014 fi
24015 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
24016 ;;
24017 esac
24018 : now check the C compiler for additional symbols
24019 postprocess_cc_v=''
24020 case "$osname" in
24021 aix) postprocess_cc_v="|$tr , ' '" ;;
24022 esac
24023 $cat >ccsym <<EOS
24024 $startsh
24025 $cat >tmp.c <<EOF
24026 extern int foo;
24027 EOF
24028 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
24029 do
24030 case "\$i" in
24031 -D*) echo "\$i" | $sed 's/^-D//;s/['\''\"]//g';;
24032 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
24033 esac
24034 done
24035 $rm_try
24036 EOS
24037 postprocess_cc_v=''
24038 chmod +x ccsym
24039 $eunicefix ccsym
24040 ./ccsym > ccsym1.raw
24041 if $test -s ccsym1.raw; then
24042 $sort ccsym1.raw | $uniq >ccsym.raw
24043 else
24044 mv ccsym1.raw ccsym.raw
24045 fi
24046
24047 $awk '/=/ { print $0; next }
24048 { print $0"=1" }' ccsym.raw >ccsym.list
24049 $comm -13 Cppsym.true ccsym.list >ccsym.own
24050 $comm -12 Cppsym.true ccsym.list >ccsym.com
24051 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
24052 also=''
24053 if $test -z ccsym.raw; then
24054 echo "Your C compiler doesn't seem to define any symbols!" >&4
24055 echo " "
24056 echo "However, your C preprocessor defines the following symbols:"
24057 $cat Cppsym.true
24058 ccsymbols=''
24059 cppsymbols=`$cat Cppsym.true`
24060 cppsymbols=`echo $cppsymbols`
24061 cppccsymbols="$cppsymbols"
24062 else
24063 if $test -s ccsym.com; then
24064 echo "Your C compiler and pre-processor define these symbols:"
24065 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
24066 also='also '
24067 symbols='ones'
24068 cppccsymbols=`$cat ccsym.com`
24069 cppccsymbols=`echo $cppccsymbols`
24070 $test "$silent" || sleep 1
24071 fi
24072 if $test -s ccsym.cpp; then
24073 $test "$also" && echo " "
24074 echo "Your C pre-processor ${also}defines the following symbols:"
24075 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
24076 also='further '
24077 cppsymbols=`$cat ccsym.cpp`
24078 cppsymbols=`echo $cppsymbols`
24079 $test "$silent" || sleep 1
24080 fi
24081 if $test -s ccsym.own; then
24082 $test "$also" && echo " "
24083 echo "Your C compiler ${also}defines the following cpp symbols:"
24084 $sed -e 's/\(..*\)=1/\1/' ccsym.own
24085 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
24086 ccsymbols=`$cat ccsym.own`
24087 ccsymbols=`echo $ccsymbols`
24088 $test "$silent" || sleep 1
24089 fi
24090 fi
24091
24092 : add -D_FORTIFY_SOURCE if feasible and not already there
24093 case "$gccversion" in
24094 [456789].*|[1-9][0-9]*) case "$optimize$ccflags" in
24095 *-O*) case "$ccflags$cppsymbols" in
24096 *_FORTIFY_SOURCE=*) # Don't add it again.
24097 echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
24098 ;;
24099 *) echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
24100 ccflags="$ccflags -D_FORTIFY_SOURCE=2"
24101 ;;
24102 esac
24103 ;;
24104 *) echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
24105 ;;
24106 esac
24107 ;;
24108 *) echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
24109 ;;
24110 esac
24111
24112 : script used to emit important warnings
24113 cat >warn <<EOS
24114 $startsh
24115 if test \$# -gt 0; then
24116 echo "\$@" >msg
24117 else
24118 cat >msg
24119 fi
24120 echo "*** WARNING:" >&4
24121 sed -e 's/^/*** /' <msg >&4
24122 echo "*** " >&4
24123 cat msg >>config.msg
24124 echo " " >>config.msg
24125 rm -f msg
24126 EOS
24127 chmod +x warn
24128 $eunicefix warn
24129
24130 : see if this is a termio system
24131 val="$undef"
24132 val2="$undef"
24133 val3="$undef"
24134 if $test `./findhdr termios.h`; then
24135 set tcsetattr i_termios
24136 eval $inlibc
24137 val3="$i_termios"
24138 fi
24139 echo " "
24140 case "$val3" in
24141 "$define") echo "You have POSIX termios.h... good!" >&4;;
24142 *) if ./Cppsym pyr; then
24143 case "`$run /bin/universe`" in
24144 ucb) if $test `./findhdr sgtty.h`; then
24145 val2="$define"
24146 echo "<sgtty.h> found." >&4
24147 else
24148 echo "System is pyramid with BSD universe."
24149 ./warn "<sgtty.h> not found--you could have problems."
24150 fi;;
24151 *) if $test `./findhdr termio.h`; then
24152 val="$define"
24153 echo "<termio.h> found." >&4
24154 else
24155 echo "System is pyramid with USG universe."
24156 ./warn "<termio.h> not found--you could have problems."
24157 fi;;
24158 esac
24159 elif ./usg; then
24160 if $test `./findhdr termio.h`; then
24161 echo "<termio.h> found." >&4
24162 val="$define"
24163 elif $test `./findhdr sgtty.h`; then
24164 echo "<sgtty.h> found." >&4
24165 val2="$define"
24166 else
24167 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
24168 fi
24169 else
24170 if $test `./findhdr sgtty.h`; then
24171 echo "<sgtty.h> found." >&4
24172 val2="$define"
24173 elif $test `./findhdr termio.h`; then
24174 echo "<termio.h> found." >&4
24175 val="$define"
24176 else
24177 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
24178 fi
24179 fi;;
24180 esac
24181 set i_termio; eval $setvar
24182 val=$val2; set i_sgtty; eval $setvar
24183 val=$val3; set i_termios; eval $setvar
24184
24185 : see if stdbool is available
24186 : we want a real compile instead of Inhdr because some Solaris systems
24187 : have stdbool.h, but it can only be used if the compiler indicates it
24188 : is sufficiently c99-compliant.
24189 echo " "
24190 $cat >try.c <<EOCP
24191 #include <stdio.h>
24192 #include <stdbool.h>
24193 int func(bool x)
24194 {
24195 return x ? 1 : 0;
24196 }
24197 int main(int argc, char **argv)
24198 {
24199 return func(0);
24200 }
24201 EOCP
24202 set try
24203 if eval $compile; then
24204 echo "<stdbool.h> found." >&4
24205 val="$define"
24206 else
24207 echo "<stdbool.h> NOT found." >&4
24208 val="$undef"
24209 fi
24210 $rm_try
24211 set i_stdbool
24212 eval $setvar
24213
24214 : see if stdint is available
24215 set stdint.h i_stdint
24216 eval $inhdr
24217
24218 : see if sys/access.h is available
24219 set sys/access.h i_sysaccess
24220 eval $inhdr
24221
24222 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
24223 set sys/filio.h i_sysfilio
24224 eval $inhdr
24225 echo " "
24226 if $test `./findhdr sys/ioctl.h`; then
24227 val="$define"
24228 echo '<sys/ioctl.h> found.' >&4
24229 else
24230 val="$undef"
24231 if $test $i_sysfilio = "$define"; then
24232 echo '<sys/ioctl.h> NOT found.' >&4
24233 else
24234 $test $i_sgtty = "$define" && xxx="sgtty.h"
24235 $test $i_termio = "$define" && xxx="termio.h"
24236 $test $i_termios = "$define" && xxx="termios.h"
24237 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
24238 fi
24239 fi
24240 set i_sysioctl
24241 eval $setvar
24242
24243 : see if socket ioctl defs are in sys/sockio.h
24244 echo " "
24245 xxx=`./findhdr sys/sockio.h`
24246 if $test "$xxx"; then
24247 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
24248 val="$define"
24249 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
24250 else
24251 val="$undef"
24252 echo "No socket ioctls found in <sys/sockio.h>." >&4
24253 fi
24254 else
24255 val="$undef"
24256 $cat <<EOM
24257 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
24258 EOM
24259 fi
24260 set i_syssockio
24261 eval $setvar
24262
24263 : see if this is a syslog.h system
24264 set syslog.h i_syslog
24265 eval $inhdr
24266
24267 : see if this is a sys/mode.h system
24268 set sys/mode.h i_sysmode
24269 eval $inhdr
24270
24271 : see if there is a sys/poll.h file
24272 set sys/poll.h i_syspoll
24273 eval $inhdr
24274
24275 : see if sys/resource.h has to be included
24276 set sys/resource.h i_sysresrc
24277 eval $inhdr
24278
24279 : see if sys/security.h is available
24280 set sys/security.h i_syssecrt
24281 eval $inhdr
24282
24283 : see if this is a sys/statvfs.h system
24284 set sys/statvfs.h i_sysstatvfs
24285 eval $inhdr
24286
24287 : see if this is a sys/un.h system
24288 set sys/un.h i_sysun
24289 eval $inhdr
24290
24291 : see if this is a sys/utsname.h system
24292 set sys/utsname.h i_sysutsname
24293 eval $inhdr
24294
24295 : see if this is a syswait system
24296 set sys/wait.h i_syswait
24297 eval $inhdr
24298
24299 : see if this is a ustat.h system
24300 set ustat.h i_ustat
24301 eval $inhdr
24302
24303 : see if this is an utime system
24304 set utime.h i_utime
24305 eval $inhdr
24306
24307 : see if this is a vfork system
24308 case "$d_vfork" in
24309 "$define")
24310 set vfork.h i_vfork
24311 eval $inhdr
24312 ;;
24313 *)
24314 i_vfork="$undef"
24315 ;;
24316 esac
24317
24318 : see if wchar.h is present
24319 set wchar.h i_wchar
24320 eval $inhdr
24321
24322 : Check extensions
24323 echo " "
24324 echo "Looking for extensions..." >&4
24325 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
24326 : contain old or inaccurate or duplicate values.
24327 nonxs_extensions=''
24328 xs_extensions=''
24329 : We do not use find because it might not be available.
24330 : We do not just use MANIFEST because the user may have dropped
24331 : some additional extensions into the source tree and expect them
24332 : to be built.
24333
24334 : Function to recursively find available extensions, ignoring DynaLoader
24335 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
24336 : In 5.10.1 and later, extensions are stored in directories
24337 : like File-Glob instead of the older File/Glob/.
24338 find_extensions='
24339 for xxx in *; do
24340 case "$xxx" in
24341 DynaLoader|dynaload) ;;
24342 *)
24343 this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
24344 case "$this_ext" in
24345 Scalar/List/Utils) this_ext="List/Util" ;;
24346 PathTools) this_ext="Cwd" ;;
24347 esac;
24348 echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
24349 if $contains " $this_ext " "$tdir/$$.tmp"; then
24350 echo >&4;
24351 echo "Duplicate directories detected for extension $xxx" >&4;
24352 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
24353 case "$knowitall" in
24354 "") dflt=y;;
24355 *) dflt=n;;
24356 esac;
24357 . ../UU/myread;
24358 case "$ans" in
24359 n*|N*) ;;
24360 *) echo >&4;
24361 echo "Ok. Stopping Configure." >&4;
24362 echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
24363 exit 1;;
24364 esac;
24365 echo "Ok. You will need to correct config.sh before running make." >&4;
24366 fi;
24367 $ls -1 "$xxx" > "$tdir/$$.tmp";
24368 if $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
24369 xs_extensions="$xs_extensions $this_ext";
24370 elif $contains "\.c$" "$tdir/$$.tmp" > /dev/null 2>&1; then
24371 xs_extensions="$xs_extensions $this_ext";
24372 elif $test -d "$xxx"; then
24373 nonxs_extensions="$nonxs_extensions $this_ext";
24374 fi;
24375 $rm -f "$tdir/$$.tmp";
24376 ;;
24377 esac;
24378 done'
24379 tdir=`pwd`
24380 cd "$rsrc/cpan"
24381 set X
24382 shift
24383 eval $find_extensions
24384 cd "$rsrc/dist"
24385 set X
24386 shift
24387 eval $find_extensions
24388 cd "$rsrc/ext"
24389 set X
24390 shift
24391 eval $find_extensions
24392 set X $xs_extensions
24393 shift
24394 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
24395 set X $nonxs_extensions
24396 shift
24397 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
24398 cd "$tdir"
24399 known_extensions=`echo $nonxs_extensions $xs_extensions | tr ' ' $trnl | $sort | tr $trnl ' '`
24400
24401 : Now see which are supported on this system.
24402 avail_ext=''
24403 for xxx in $xs_extensions ; do
24404 case "$xxx" in
24405 Amiga*)
24406 case "$osname" in
24407 amigaos) avail_ext="$avail_ext $xxx" ;;
24408 esac
24409 ;;
24410 DB_File|db_file)
24411 case "$i_db" in
24412 $define) avail_ext="$avail_ext $xxx" ;;
24413 esac
24414 ;;
24415 GDBM_File|gdbm_fil)
24416 case "$i_gdbm" in
24417 $define) avail_ext="$avail_ext $xxx" ;;
24418 esac
24419 ;;
24420 IPC/SysV|ipc/sysv)
24421 : XXX Do we need a useipcsysv variable here
24422 case "${d_msg}${d_sem}${d_shm}" in
24423 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
24424 esac
24425 ;;
24426 NDBM_File|ndbm_fil)
24427 case "$d_ndbm" in
24428 $define)
24429 case "$osname-$use64bitint" in
24430 hpux-define)
24431 case "$libs" in
24432 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
24433 esac
24434 ;;
24435 *) avail_ext="$avail_ext $xxx" ;;
24436 esac
24437 ;;
24438 esac
24439 ;;
24440 ODBM_File|odbm_fil)
24441 case "${i_dbm}${i_rpcsvcdbm}" in
24442 *"${define}"*)
24443 case "$d_cplusplus" in
24444 define) ;; # delete as a function name will not work
24445 *) case "$osname-$use64bitint" in
24446 hpux-define)
24447 case "$libs" in
24448 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
24449 esac
24450 ;;
24451 *) avail_ext="$avail_ext $xxx" ;;
24452 esac
24453 ;;
24454 esac
24455 ;;
24456 esac
24457 ;;
24458 Opcode|opcode)
24459 case "$useopcode" in
24460 true|define|y) avail_ext="$avail_ext $xxx" ;;
24461 esac
24462 ;;
24463 POSIX|posix)
24464 case "$useposix" in
24465 true|define|y) avail_ext="$avail_ext $xxx" ;;
24466 esac
24467 ;;
24468 Socket|socket)
24469 case "$d_socket" in
24470 true|$define|y) avail_ext="$avail_ext $xxx" ;;
24471 esac
24472 ;;
24473 I18N/Langinfo|langinfo)
24474 case "$uselanginfo" in
24475 true|define|y) avail_ext="$avail_ext $xxx" ;;
24476 esac
24477 ;;
24478 Sys/Syslog|sys/syslog)
24479 case $osname in
24480 amigaos) ;; # not really very useful on AmigaOS
24481 *)
24482 : XXX syslog requires socket
24483 case "$d_socket" in
24484 true|$define|y) avail_ext="$avail_ext $xxx" ;;
24485 esac
24486 ;;
24487 esac
24488 ;;
24489 threads|threads/shared)
24490 # threads and threads::shared are special cases.
24491 # To stop people from asking "Perl 5.8.0 was supposed
24492 # to have this new fancy threads implementation but my
24493 # perl doesn't have it" and from people trying to
24494 # (re)install the threads module using CPAN.pm and
24495 # CPAN.pm then offering to reinstall Perl 5.8.0,
24496 # the threads.pm and threads/shared.pm will always be
24497 # there, croaking informatively ("you need to rebuild
24498 # all of Perl with threads, sorry") when threads haven't
24499 # been compiled in.
24500 # --jhi
24501 avail_ext="$avail_ext $xxx"
24502 ;;
24503 VMS*)
24504 ;;
24505 Win32*)
24506 case "$osname" in
24507 cygwin) avail_ext="$avail_ext $xxx" ;;
24508 esac
24509 ;;
24510 XS/APItest|xs/apitest)
24511 # This is just for testing. Skip it unless we have dynamic loading.
24512
24513 case "$usedl" in
24514 $define) avail_ext="$avail_ext $xxx" ;;
24515 esac
24516 ;;
24517 XS/Typemap|xs/typemap)
24518 # This is just for testing. Skip it unless we have dynamic loading.
24519 case "$usedl" in
24520 $define) avail_ext="$avail_ext $xxx" ;;
24521 esac
24522 ;;
24523 *) avail_ext="$avail_ext $xxx"
24524 ;;
24525 esac
24526 done
24527
24528 set X $avail_ext
24529 shift
24530 avail_ext="$*"
24531
24532 case "$onlyextensions" in
24533 '') ;;
24534 *) keepextensions=''
24535 echo "You have requested that only certain extensions be included..." >&4
24536 for i in $onlyextensions; do
24537 case " $avail_ext " in
24538 *" $i "*)
24539 echo "Keeping extension $i."
24540 keepextensions="$keepextensions $i"
24541 ;;
24542 *) echo "Ignoring extension $i." ;;
24543 esac
24544 done
24545 avail_ext="$keepextensions"
24546 ;;
24547 esac
24548
24549 case "$noextensions" in
24550 '') ;;
24551 *) keepextensions=''
24552 echo "You have requested that certain extensions be ignored..." >&4
24553 for i in $avail_ext; do
24554 case " $noextensions " in
24555 *" $i "*) echo "Ignoring extension $i." ;;
24556 *) echo "Keeping extension $i.";
24557 keepextensions="$keepextensions $i"
24558 ;;
24559 esac
24560 done
24561 avail_ext="$keepextensions"
24562 ;;
24563 esac
24564
24565 : Now see which nonxs extensions are supported on this system.
24566 : For now assume all are.
24567 nonxs_ext=''
24568 for xxx in $nonxs_extensions ; do
24569 case "$xxx" in
24570 VMS*)
24571 ;;
24572 *) nonxs_ext="$nonxs_ext $xxx"
24573 ;;
24574 esac
24575 done
24576
24577 set X $nonxs_ext
24578 shift
24579 nonxs_ext="$*"
24580
24581 case $usedl in
24582 $define)
24583 $cat <<EOM
24584 A number of extensions are supplied with $package. You may choose to
24585 compile these extensions for dynamic loading (the default), compile
24586 them into the $package executable (static loading), or not include
24587 them at all. Answer "none" to include no extensions.
24588 Note that DynaLoader is always built and need not be mentioned here.
24589
24590 EOM
24591 case "$dynamic_ext" in
24592 '')
24593 : Exclude those listed in static_ext
24594 dflt=''
24595 for xxx in $avail_ext; do
24596 case " $static_ext " in
24597 *" $xxx "*) ;;
24598 *) dflt="$dflt $xxx" ;;
24599 esac
24600 done
24601 set X $dflt
24602 shift
24603 dflt="$*"
24604 ;;
24605 *) dflt="$dynamic_ext"
24606 # Perhaps we are reusing an old out-of-date config.sh.
24607 case "$hint" in
24608 previous)
24609 if test X"$dynamic_ext" != X"$avail_ext"; then
24610 $cat <<EOM
24611 NOTICE: Your previous config.sh list may be incorrect.
24612 The extensions now available to you are
24613 ${avail_ext}
24614 but the default list from your previous config.sh is
24615 ${dynamic_ext}
24616
24617 EOM
24618 fi
24619 ;;
24620 esac
24621 ;;
24622 esac
24623 case "$dflt" in
24624 '') dflt=none;;
24625 esac
24626 rp="What extensions do you wish to load dynamically?"
24627 . ./myread
24628 case "$ans" in
24629 none) dynamic_ext=' ' ;;
24630 *) dynamic_ext="$ans" ;;
24631 esac
24632
24633 case "$static_ext" in
24634 '')
24635 : Exclude those already listed in dynamic linking
24636 dflt=''
24637 for xxx in $avail_ext; do
24638 case " $dynamic_ext " in
24639 *" $xxx "*) ;;
24640 *) dflt="$dflt $xxx" ;;
24641 esac
24642 done
24643 set X $dflt
24644 shift
24645 dflt="$*"
24646 ;;
24647 *) dflt="$static_ext"
24648 ;;
24649 esac
24650
24651 case "$dflt" in
24652 '') dflt=none;;
24653 esac
24654 rp="What extensions do you wish to load statically?"
24655 . ./myread
24656 case "$ans" in
24657 none) static_ext=' ' ;;
24658 *) static_ext="$ans" ;;
24659 esac
24660 ;;
24661 *)
24662 $cat <<EOM
24663 A number of extensions are supplied with $package. Answer "none"
24664 to include no extensions.
24665 Note that DynaLoader is always built and need not be mentioned here.
24666
24667 EOM
24668 case "$static_ext" in
24669 '') dflt="$avail_ext" ;;
24670 *) dflt="$static_ext"
24671 # Perhaps we are reusing an old out-of-date config.sh.
24672 case "$hint" in
24673 previous)
24674 if test X"$static_ext" != X"$avail_ext"; then
24675 $cat <<EOM
24676 NOTICE: Your previous config.sh list may be incorrect.
24677 The extensions now available to you are
24678 ${avail_ext}
24679 but the default list from your previous config.sh is
24680 ${static_ext}
24681
24682 EOM
24683 fi
24684 ;;
24685 esac
24686 ;;
24687 esac
24688 : Exclude those that are not xs extensions
24689 case "$dflt" in
24690 '') dflt=none;;
24691 esac
24692 rp="What extensions do you wish to include?"
24693 . ./myread
24694 case "$ans" in
24695 none) static_ext=' ' ;;
24696 *) static_ext="$ans" ;;
24697 esac
24698 ;;
24699 esac
24700 #
24701 # Encode is a special case. If we are building Encode as a static
24702 # extension, we need to explicitly list its subextensions as well.
24703 # For other nested extensions, this is handled automatically by
24704 # the appropriate Makefile.PL.
24705 case " $static_ext " in
24706 *" Encode "*) # Add the subextensions of Encode
24707 cd "$rsrc/cpan"
24708 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
24709 static_ext="$static_ext Encode/$xxx"
24710 known_extensions="$known_extensions Encode/$xxx"
24711 done
24712 cd "$tdir"
24713 ;;
24714 esac
24715
24716 set X $dynamic_ext $static_ext $nonxs_ext
24717 shift
24718 extensions="$*"
24719
24720 # Sanity check: We require an extension suitable for use with
24721 # AnyDBM_File, as well as Fcntl and IO. (Failure to have these
24722 # should show up as failures in the test suite, but it's helpful to
24723 # catch them now.) The 'extensions' list is normally sorted
24724 # alphabetically, so we need to accept either
24725 # DB_File ... Fcntl ... IO ....
24726 # or something like
24727 # Fcntl ... NDBM_File ... IO ....
24728 case " $extensions" in
24729 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
24730 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
24731 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
24732 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
24733 echo "WARNING: The Perl you are building will be quite crippled." >&4
24734 ;;
24735 esac
24736
24737 : Remove libraries needed only for extensions
24738 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
24739 : The exception is SunOS 4.x, which needs them.
24740 case "${osname}X${osvers}" in
24741 sunos*X4*)
24742 perllibs="$libs"
24743 ;;
24744 *) case "$usedl" in
24745 $define|true|[yY]*)
24746 set X `echo " $libs " | sed -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldb @ @'`
24747 shift
24748 perllibs="$*"
24749 ;;
24750 *) perllibs="$libs"
24751 ;;
24752 esac
24753 ;;
24754 esac
24755
24756 : Remove build directory name from cppstdin so it can be used from
24757 : either the present location or the final installed location.
24758 echo " "
24759 : Get out of the UU directory to get correct path name.
24760 cd ..
24761 case "$cppstdin" in
24762 `pwd`/cppstdin)
24763 echo "Stripping down cppstdin path name"
24764 cppstdin=cppstdin
24765 ;;
24766 esac
24767 cd UU
24768
24769 : end of configuration questions
24770 echo " "
24771 echo "End of configuration questions."
24772 echo " "
24773
24774 : back to where it started
24775 if test -d ../UU; then
24776 cd ..
24777 fi
24778
24779 : configuration may be unconditionally patched via a 'config.arch' file
24780 if $test -f config.arch; then
24781 echo "I see a config.arch file, loading it." >&4
24782 . ./config.arch
24783 fi
24784
24785 : configuration may be patched via a 'config.over' file
24786 if $test -f config.over; then
24787 echo " "
24788 dflt=y
24789 rp='I see a config.over file. Do you wish to load it?'
24790 . UU/myread
24791 case "$ans" in
24792 n*) echo "OK, I'll ignore it.";;
24793 *) . ./config.over
24794 echo "Configuration override changes have been loaded."
24795 ;;
24796 esac
24797 fi
24798
24799 : in case they want portability, strip down executable paths
24800 case "$d_portable" in
24801 "$define")
24802 echo " "
24803 echo "Stripping down executable paths..." >&4
24804 for file in $loclist $trylist; do
24805 eval temp=\$$file
24806 eval $file=`basename $temp`
24807 done
24808 ;;
24809 esac
24810
24811 : create config.sh file
24812 echo " "
24813 echo "Creating config.sh..." >&4
24814 $spitshell <<EOT >config.sh
24815 $startsh
24816 #
24817 # This file was produced by running the Configure script. It holds all the
24818 # definitions figured out by Configure. Should you modify one of these values,
24819 # do not forget to propagate your changes by running "Configure -der". You may
24820 # instead choose to run each of the .SH files by yourself, or "Configure -S".
24821 #
24822
24823 # Package name : $package
24824 # Source directory : $src
24825 # Configuration time: $cf_time
24826 # Configured by : $cf_by
24827 # Target system : $myuname
24828
24829 EOT
24830 : Add in command line options if available
24831 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24832
24833 $spitshell <<EOT >>config.sh
24834
24835 Author='$Author'
24836 Date='$Date'
24837 Header='$Header'
24838 Id='$Id'
24839 Locker='$Locker'
24840 Log='$Log'
24841 RCSfile='$RCSfile'
24842 Revision='$Revision'
24843 Source='$Source'
24844 State='$State'
24845 _a='$_a'
24846 _exe='$_exe'
24847 _o='$_o'
24848 afs='$afs'
24849 afsroot='$afsroot'
24850 alignbytes='$alignbytes'
24851 aphostname='$aphostname'
24852 api_revision='$api_revision'
24853 api_subversion='$api_subversion'
24854 api_version='$api_version'
24855 api_versionstring='$api_versionstring'
24856 ar='$ar'
24857 archlib='$archlib'
24858 archlibexp='$archlibexp'
24859 archname64='$archname64'
24860 archname='$archname'
24861 archobjs='$archobjs'
24862 asctime_r_proto='$asctime_r_proto'
24863 awk='$awk'
24864 baserev='$baserev'
24865 bash='$bash'
24866 bin='$bin'
24867 bin_ELF='$bin_ELF'
24868 binexp='$binexp'
24869 bison='$bison'
24870 byacc='$byacc'
24871 byteorder='$byteorder'
24872 c='$c'
24873 castflags='$castflags'
24874 cat='$cat'
24875 cc='$cc'
24876 cccdlflags='$cccdlflags'
24877 ccdlflags='$ccdlflags'
24878 ccflags='$ccflags'
24879 ccflags_uselargefiles='$ccflags_uselargefiles'
24880 ccname='$ccname'
24881 ccsymbols='$ccsymbols'
24882 ccversion='$ccversion'
24883 cf_by='$cf_by'
24884 cf_email='$cf_email'
24885 cf_time='$cf_time'
24886 charbits='$charbits'
24887 charsize='$charsize'
24888 chgrp='$chgrp'
24889 chmod='$chmod'
24890 chown='$chown'
24891 clocktype='$clocktype'
24892 comm='$comm'
24893 compiler_warning='$compiler_warning'
24894 compress='$compress'
24895 contains='$contains'
24896 cp='$cp'
24897 cpio='$cpio'
24898 cpp='$cpp'
24899 cpp_stuff='$cpp_stuff'
24900 cppccsymbols='$cppccsymbols'
24901 cppflags='$cppflags'
24902 cpplast='$cpplast'
24903 cppminus='$cppminus'
24904 cpprun='$cpprun'
24905 cppstdin='$cppstdin'
24906 cppsymbols='$cppsymbols'
24907 crypt_r_proto='$crypt_r_proto'
24908 cryptlib='$cryptlib'
24909 csh='$csh'
24910 ctermid_r_proto='$ctermid_r_proto'
24911 ctime_r_proto='$ctime_r_proto'
24912 d_Gconvert='$d_Gconvert'
24913 d_PRIEUldbl='$d_PRIEUldbl'
24914 d_PRIFUldbl='$d_PRIFUldbl'
24915 d_PRIGUldbl='$d_PRIGUldbl'
24916 d_PRIXU64='$d_PRIXU64'
24917 d_PRId64='$d_PRId64'
24918 d_PRIeldbl='$d_PRIeldbl'
24919 d_PRIfldbl='$d_PRIfldbl'
24920 d_PRIgldbl='$d_PRIgldbl'
24921 d_PRIi64='$d_PRIi64'
24922 d_PRIo64='$d_PRIo64'
24923 d_PRIu64='$d_PRIu64'
24924 d_PRIx64='$d_PRIx64'
24925 d_SCNfldbl='$d_SCNfldbl'
24926 d__fwalk='$d__fwalk'
24927 d_accept4='$d_accept4'
24928 d_access='$d_access'
24929 d_accessx='$d_accessx'
24930 d_acosh='$d_acosh'
24931 d_aintl='$d_aintl'
24932 d_alarm='$d_alarm'
24933 d_archlib='$d_archlib'
24934 d_asctime64='$d_asctime64'
24935 d_asctime_r='$d_asctime_r'
24936 d_asinh='$d_asinh'
24937 d_atanh='$d_atanh'
24938 d_atolf='$d_atolf'
24939 d_atoll='$d_atoll'
24940 d_attribute_always_inline='$d_attribute_always_inline'
24941 d_attribute_deprecated='$d_attribute_deprecated'
24942 d_attribute_format='$d_attribute_format'
24943 d_attribute_malloc='$d_attribute_malloc'
24944 d_attribute_nonnull='$d_attribute_nonnull'
24945 d_attribute_noreturn='$d_attribute_noreturn'
24946 d_attribute_pure='$d_attribute_pure'
24947 d_attribute_unused='$d_attribute_unused'
24948 d_attribute_visibility='$d_attribute_visibility'
24949 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24950 d_backtrace='$d_backtrace'
24951 d_bsd='$d_bsd'
24952 d_bsdgetpgrp='$d_bsdgetpgrp'
24953 d_bsdsetpgrp='$d_bsdsetpgrp'
24954 d_builtin_add_overflow='$d_builtin_add_overflow'
24955 d_builtin_choose_expr='$d_builtin_choose_expr'
24956 d_builtin_expect='$d_builtin_expect'
24957 d_builtin_mul_overflow='$d_builtin_mul_overflow'
24958 d_builtin_sub_overflow='$d_builtin_sub_overflow'
24959 d_c99_variadic_macros='$d_c99_variadic_macros'
24960 d_casti32='$d_casti32'
24961 d_castneg='$d_castneg'
24962 d_cbrt='$d_cbrt'
24963 d_chown='$d_chown'
24964 d_chroot='$d_chroot'
24965 d_chsize='$d_chsize'
24966 d_class='$d_class'
24967 d_clearenv='$d_clearenv'
24968 d_closedir='$d_closedir'
24969 d_cmsghdr_s='$d_cmsghdr_s'
24970 d_copysign='$d_copysign'
24971 d_copysignl='$d_copysignl'
24972 d_cplusplus='$d_cplusplus'
24973 d_crypt='$d_crypt'
24974 d_crypt_r='$d_crypt_r'
24975 d_csh='$d_csh'
24976 d_ctermid='$d_ctermid'
24977 d_ctermid_r='$d_ctermid_r'
24978 d_ctime64='$d_ctime64'
24979 d_ctime_r='$d_ctime_r'
24980 d_cuserid='$d_cuserid'
24981 d_dbminitproto='$d_dbminitproto'
24982 d_difftime64='$d_difftime64'
24983 d_difftime='$d_difftime'
24984 d_dir_dd_fd='$d_dir_dd_fd'
24985 d_dirfd='$d_dirfd'
24986 d_dirnamlen='$d_dirnamlen'
24987 d_dladdr='$d_dladdr'
24988 d_dlerror='$d_dlerror'
24989 d_dlopen='$d_dlopen'
24990 d_dlsymun='$d_dlsymun'
24991 d_dosuid='$d_dosuid'
24992 d_double_has_inf='$d_double_has_inf'
24993 d_double_has_nan='$d_double_has_nan'
24994 d_double_has_negative_zero='$d_double_has_negative_zero'
24995 d_double_has_subnormals='$d_double_has_subnormals'
24996 d_double_style_cray='$d_double_style_cray'
24997 d_double_style_ibm='$d_double_style_ibm'
24998 d_double_style_ieee='$d_double_style_ieee'
24999 d_double_style_vax='$d_double_style_vax'
25000 d_drand48_r='$d_drand48_r'
25001 d_drand48proto='$d_drand48proto'
25002 d_dup2='$d_dup2'
25003 d_dup3='$d_dup3'
25004 d_duplocale='$d_duplocale'
25005 d_eaccess='$d_eaccess'
25006 d_endgrent='$d_endgrent'
25007 d_endgrent_r='$d_endgrent_r'
25008 d_endhent='$d_endhent'
25009 d_endhostent_r='$d_endhostent_r'
25010 d_endnent='$d_endnent'
25011 d_endnetent_r='$d_endnetent_r'
25012 d_endpent='$d_endpent'
25013 d_endprotoent_r='$d_endprotoent_r'
25014 d_endpwent='$d_endpwent'
25015 d_endpwent_r='$d_endpwent_r'
25016 d_endsent='$d_endsent'
25017 d_endservent_r='$d_endservent_r'
25018 d_eofnblk='$d_eofnblk'
25019 d_erf='$d_erf'
25020 d_erfc='$d_erfc'
25021 d_eunice='$d_eunice'
25022 d_exp2='$d_exp2'
25023 d_expm1='$d_expm1'
25024 d_faststdio='$d_faststdio'
25025 d_fchdir='$d_fchdir'
25026 d_fchmod='$d_fchmod'
25027 d_fchmodat='$d_fchmodat'
25028 d_fchown='$d_fchown'
25029 d_fcntl='$d_fcntl'
25030 d_fcntl_can_lock='$d_fcntl_can_lock'
25031 d_fd_macros='$d_fd_macros'
25032 d_fd_set='$d_fd_set'
25033 d_fdclose='$d_fdclose'
25034 d_fdim='$d_fdim'
25035 d_fds_bits='$d_fds_bits'
25036 d_fegetround='$d_fegetround'
25037 d_ffs='$d_ffs'
25038 d_ffsl='$d_ffsl'
25039 d_fgetpos='$d_fgetpos'
25040 d_finite='$d_finite'
25041 d_finitel='$d_finitel'
25042 d_flexfnam='$d_flexfnam'
25043 d_flock='$d_flock'
25044 d_flockproto='$d_flockproto'
25045 d_fma='$d_fma'
25046 d_fmax='$d_fmax'
25047 d_fmin='$d_fmin'
25048 d_fork='$d_fork'
25049 d_fp_class='$d_fp_class'
25050 d_fp_classify='$d_fp_classify'
25051 d_fp_classl='$d_fp_classl'
25052 d_fpathconf='$d_fpathconf'
25053 d_fpclass='$d_fpclass'
25054 d_fpclassify='$d_fpclassify'
25055 d_fpclassl='$d_fpclassl'
25056 d_fpgetround='$d_fpgetround'
25057 d_fpos64_t='$d_fpos64_t'
25058 d_freelocale='$d_freelocale'
25059 d_frexpl='$d_frexpl'
25060 d_fs_data_s='$d_fs_data_s'
25061 d_fseeko='$d_fseeko'
25062 d_fsetpos='$d_fsetpos'
25063 d_fstatfs='$d_fstatfs'
25064 d_fstatvfs='$d_fstatvfs'
25065 d_fsync='$d_fsync'
25066 d_ftello='$d_ftello'
25067 d_ftime='$d_ftime'
25068 d_futimes='$d_futimes'
25069 d_gai_strerror='$d_gai_strerror'
25070 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
25071 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
25072 d_getaddrinfo='$d_getaddrinfo'
25073 d_getcwd='$d_getcwd'
25074 d_getenv_preserves_other_thread='$d_getenv_preserves_other_thread'
25075 d_getespwnam='$d_getespwnam'
25076 d_getfsstat='$d_getfsstat'
25077 d_getgrent='$d_getgrent'
25078 d_getgrent_r='$d_getgrent_r'
25079 d_getgrgid_r='$d_getgrgid_r'
25080 d_getgrnam_r='$d_getgrnam_r'
25081 d_getgrps='$d_getgrps'
25082 d_gethbyaddr='$d_gethbyaddr'
25083 d_gethbyname='$d_gethbyname'
25084 d_gethent='$d_gethent'
25085 d_gethname='$d_gethname'
25086 d_gethostbyaddr_r='$d_gethostbyaddr_r'
25087 d_gethostbyname_r='$d_gethostbyname_r'
25088 d_gethostent_r='$d_gethostent_r'
25089 d_gethostprotos='$d_gethostprotos'
25090 d_getitimer='$d_getitimer'
25091 d_getlogin='$d_getlogin'
25092 d_getlogin_r='$d_getlogin_r'
25093 d_getmnt='$d_getmnt'
25094 d_getmntent='$d_getmntent'
25095 d_getnameinfo='$d_getnameinfo'
25096 d_getnbyaddr='$d_getnbyaddr'
25097 d_getnbyname='$d_getnbyname'
25098 d_getnent='$d_getnent'
25099 d_getnetbyaddr_r='$d_getnetbyaddr_r'
25100 d_getnetbyname_r='$d_getnetbyname_r'
25101 d_getnetent_r='$d_getnetent_r'
25102 d_getnetprotos='$d_getnetprotos'
25103 d_getpagsz='$d_getpagsz'
25104 d_getpbyname='$d_getpbyname'
25105 d_getpbynumber='$d_getpbynumber'
25106 d_getpent='$d_getpent'
25107 d_getpgid='$d_getpgid'
25108 d_getpgrp2='$d_getpgrp2'
25109 d_getpgrp='$d_getpgrp'
25110 d_getppid='$d_getppid'
25111 d_getprior='$d_getprior'
25112 d_getprotobyname_r='$d_getprotobyname_r'
25113 d_getprotobynumber_r='$d_getprotobynumber_r'
25114 d_getprotoent_r='$d_getprotoent_r'
25115 d_getprotoprotos='$d_getprotoprotos'
25116 d_getprpwnam='$d_getprpwnam'
25117 d_getpwent='$d_getpwent'
25118 d_getpwent_r='$d_getpwent_r'
25119 d_getpwnam_r='$d_getpwnam_r'
25120 d_getpwuid_r='$d_getpwuid_r'
25121 d_getsbyname='$d_getsbyname'
25122 d_getsbyport='$d_getsbyport'
25123 d_getsent='$d_getsent'
25124 d_getservbyname_r='$d_getservbyname_r'
25125 d_getservbyport_r='$d_getservbyport_r'
25126 d_getservent_r='$d_getservent_r'
25127 d_getservprotos='$d_getservprotos'
25128 d_getspnam='$d_getspnam'
25129 d_getspnam_r='$d_getspnam_r'
25130 d_gettimeod='$d_gettimeod'
25131 d_gmtime64='$d_gmtime64'
25132 d_gmtime_r='$d_gmtime_r'
25133 d_gnulibc='$d_gnulibc'
25134 d_grpasswd='$d_grpasswd'
25135 d_has_C_UTF8='$d_has_C_UTF8'
25136 d_hasmntopt='$d_hasmntopt'
25137 d_htonl='$d_htonl'
25138 d_hypot='$d_hypot'
25139 d_ilogb='$d_ilogb'
25140 d_ilogbl='$d_ilogbl'
25141 d_inc_version_list='$d_inc_version_list'
25142 d_inetaton='$d_inetaton'
25143 d_inetntop='$d_inetntop'
25144 d_inetpton='$d_inetpton'
25145 d_int64_t='$d_int64_t'
25146 d_ip_mreq='$d_ip_mreq'
25147 d_ip_mreq_source='$d_ip_mreq_source'
25148 d_ipv6_mreq='$d_ipv6_mreq'
25149 d_ipv6_mreq_source='$d_ipv6_mreq_source'
25150 d_isascii='$d_isascii'
25151 d_isblank='$d_isblank'
25152 d_isfinite='$d_isfinite'
25153 d_isfinitel='$d_isfinitel'
25154 d_isinf='$d_isinf'
25155 d_isinfl='$d_isinfl'
25156 d_isless='$d_isless'
25157 d_isnan='$d_isnan'
25158 d_isnanl='$d_isnanl'
25159 d_isnormal='$d_isnormal'
25160 d_j0='$d_j0'
25161 d_j0l='$d_j0l'
25162 d_killpg='$d_killpg'
25163 d_lc_monetary_2008='$d_lc_monetary_2008'
25164 d_lchown='$d_lchown'
25165 d_ldbl_dig='$d_ldbl_dig'
25166 d_ldexpl='$d_ldexpl'
25167 d_lgamma='$d_lgamma'
25168 d_lgamma_r='$d_lgamma_r'
25169 d_libm_lib_version='$d_libm_lib_version'
25170 d_libname_unique='$d_libname_unique'
25171 d_link='$d_link'
25172 d_linkat='$d_linkat'
25173 d_llrint='$d_llrint'
25174 d_llrintl='$d_llrintl'
25175 d_llround='$d_llround'
25176 d_llroundl='$d_llroundl'
25177 d_localeconv_l='$d_localeconv_l'
25178 d_localtime64='$d_localtime64'
25179 d_localtime_r='$d_localtime_r'
25180 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
25181 d_locconv='$d_locconv'
25182 d_lockf='$d_lockf'
25183 d_log1p='$d_log1p'
25184 d_log2='$d_log2'
25185 d_logb='$d_logb'
25186 d_long_double_style_ieee='$d_long_double_style_ieee'
25187 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
25188 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
25189 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
25190 d_long_double_style_vax='$d_long_double_style_vax'
25191 d_longdbl='$d_longdbl'
25192 d_longlong='$d_longlong'
25193 d_lrint='$d_lrint'
25194 d_lrintl='$d_lrintl'
25195 d_lround='$d_lround'
25196 d_lroundl='$d_lroundl'
25197 d_lseekproto='$d_lseekproto'
25198 d_lstat='$d_lstat'
25199 d_madvise='$d_madvise'
25200 d_malloc_good_size='$d_malloc_good_size'
25201 d_malloc_size='$d_malloc_size'
25202 d_malloc_usable_size='$d_malloc_usable_size'
25203 d_mblen='$d_mblen'
25204 d_mbrlen='$d_mbrlen'
25205 d_mbrtowc='$d_mbrtowc'
25206 d_mbstowcs='$d_mbstowcs'
25207 d_mbtowc='$d_mbtowc'
25208 d_memmem='$d_memmem'
25209 d_memrchr='$d_memrchr'
25210 d_mkdir='$d_mkdir'
25211 d_mkdtemp='$d_mkdtemp'
25212 d_mkfifo='$d_mkfifo'
25213 d_mkostemp='$d_mkostemp'
25214 d_mkstemp='$d_mkstemp'
25215 d_mkstemps='$d_mkstemps'
25216 d_mktime64='$d_mktime64'
25217 d_mktime='$d_mktime'
25218 d_mmap='$d_mmap'
25219 d_modfl='$d_modfl'
25220 d_modflproto='$d_modflproto'
25221 d_mprotect='$d_mprotect'
25222 d_msg='$d_msg'
25223 d_msg_ctrunc='$d_msg_ctrunc'
25224 d_msg_dontroute='$d_msg_dontroute'
25225 d_msg_oob='$d_msg_oob'
25226 d_msg_peek='$d_msg_peek'
25227 d_msg_proxy='$d_msg_proxy'
25228 d_msgctl='$d_msgctl'
25229 d_msgget='$d_msgget'
25230 d_msghdr_s='$d_msghdr_s'
25231 d_msgrcv='$d_msgrcv'
25232 d_msgsnd='$d_msgsnd'
25233 d_msync='$d_msync'
25234 d_munmap='$d_munmap'
25235 d_mymalloc='$d_mymalloc'
25236 d_nan='$d_nan'
25237 d_nanosleep='$d_nanosleep'
25238 d_ndbm='$d_ndbm'
25239 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
25240 d_nearbyint='$d_nearbyint'
25241 d_newlocale='$d_newlocale'
25242 d_nextafter='$d_nextafter'
25243 d_nexttoward='$d_nexttoward'
25244 d_nice='$d_nice'
25245 d_nl_langinfo='$d_nl_langinfo'
25246 d_nl_langinfo_l='$d_nl_langinfo_l'
25247 d_non_int_bitfields='$d_non_int_bitfields'
25248 d_nv_preserves_uv='$d_nv_preserves_uv'
25249 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
25250 d_off64_t='$d_off64_t'
25251 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
25252 d_oldpthreads='$d_oldpthreads'
25253 d_oldsock='$d_oldsock'
25254 d_open3='$d_open3'
25255 d_openat='$d_openat'
25256 d_pathconf='$d_pathconf'
25257 d_pause='$d_pause'
25258 d_perl_lc_all_category_positions_init='$d_perl_lc_all_category_positions_init'
25259 d_perl_lc_all_separator='$d_perl_lc_all_separator'
25260 d_perl_lc_all_uses_name_value_pairs='$d_perl_lc_all_uses_name_value_pairs'
25261 d_perl_otherlibdirs='$d_perl_otherlibdirs'
25262 d_phostname='$d_phostname'
25263 d_pipe2='$d_pipe2'
25264 d_pipe='$d_pipe'
25265 d_poll='$d_poll'
25266 d_portable='$d_portable'
25267 d_prctl='$d_prctl'
25268 d_prctl_set_name='$d_prctl_set_name'
25269 d_printf_format_null='$d_printf_format_null'
25270 d_procselfexe='$d_procselfexe'
25271 d_pseudofork='$d_pseudofork'
25272 d_pthread_atfork='$d_pthread_atfork'
25273 d_pthread_attr_setscope='$d_pthread_attr_setscope'
25274 d_pthread_yield='$d_pthread_yield'
25275 d_ptrdiff_t='$d_ptrdiff_t'
25276 d_pwage='$d_pwage'
25277 d_pwchange='$d_pwchange'
25278 d_pwclass='$d_pwclass'
25279 d_pwcomment='$d_pwcomment'
25280 d_pwexpire='$d_pwexpire'
25281 d_pwgecos='$d_pwgecos'
25282 d_pwpasswd='$d_pwpasswd'
25283 d_pwquota='$d_pwquota'
25284 d_qgcvt='$d_qgcvt'
25285 d_quad='$d_quad'
25286 d_querylocale='$d_querylocale'
25287 d_random_r='$d_random_r'
25288 d_re_comp='$d_re_comp'
25289 d_readdir64_r='$d_readdir64_r'
25290 d_readdir='$d_readdir'
25291 d_readdir_r='$d_readdir_r'
25292 d_readlink='$d_readlink'
25293 d_readv='$d_readv'
25294 d_recvmsg='$d_recvmsg'
25295 d_regcmp='$d_regcmp'
25296 d_regcomp='$d_regcomp'
25297 d_remainder='$d_remainder'
25298 d_remquo='$d_remquo'
25299 d_rename='$d_rename'
25300 d_renameat='$d_renameat'
25301 d_rewinddir='$d_rewinddir'
25302 d_rint='$d_rint'
25303 d_rmdir='$d_rmdir'
25304 d_round='$d_round'
25305 d_sbrkproto='$d_sbrkproto'
25306 d_scalbn='$d_scalbn'
25307 d_scalbnl='$d_scalbnl'
25308 d_sched_yield='$d_sched_yield'
25309 d_scm_rights='$d_scm_rights'
25310 d_seekdir='$d_seekdir'
25311 d_select='$d_select'
25312 d_sem='$d_sem'
25313 d_semctl='$d_semctl'
25314 d_semctl_semid_ds='$d_semctl_semid_ds'
25315 d_semctl_semun='$d_semctl_semun'
25316 d_semget='$d_semget'
25317 d_semop='$d_semop'
25318 d_sendmsg='$d_sendmsg'
25319 d_setegid='$d_setegid'
25320 d_setenv='$d_setenv'
25321 d_seteuid='$d_seteuid'
25322 d_setgrent='$d_setgrent'
25323 d_setgrent_r='$d_setgrent_r'
25324 d_setgrps='$d_setgrps'
25325 d_sethent='$d_sethent'
25326 d_sethostent_r='$d_sethostent_r'
25327 d_setitimer='$d_setitimer'
25328 d_setlinebuf='$d_setlinebuf'
25329 d_setlocale='$d_setlocale'
25330 d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
25331 d_setlocale_r='$d_setlocale_r'
25332 d_setnent='$d_setnent'
25333 d_setnetent_r='$d_setnetent_r'
25334 d_setpent='$d_setpent'
25335 d_setpgid='$d_setpgid'
25336 d_setpgrp2='$d_setpgrp2'
25337 d_setpgrp='$d_setpgrp'
25338 d_setprior='$d_setprior'
25339 d_setproctitle='$d_setproctitle'
25340 d_setprotoent_r='$d_setprotoent_r'
25341 d_setpwent='$d_setpwent'
25342 d_setpwent_r='$d_setpwent_r'
25343 d_setregid='$d_setregid'
25344 d_setresgid='$d_setresgid'
25345 d_setresuid='$d_setresuid'
25346 d_setreuid='$d_setreuid'
25347 d_setrgid='$d_setrgid'
25348 d_setruid='$d_setruid'
25349 d_setsent='$d_setsent'
25350 d_setservent_r='$d_setservent_r'
25351 d_setsid='$d_setsid'
25352 d_setvbuf='$d_setvbuf'
25353 d_shm='$d_shm'
25354 d_shmat='$d_shmat'
25355 d_shmatprototype='$d_shmatprototype'
25356 d_shmctl='$d_shmctl'
25357 d_shmdt='$d_shmdt'
25358 d_shmget='$d_shmget'
25359 d_sigaction='$d_sigaction'
25360 d_siginfo_si_addr='$d_siginfo_si_addr'
25361 d_siginfo_si_band='$d_siginfo_si_band'
25362 d_siginfo_si_errno='$d_siginfo_si_errno'
25363 d_siginfo_si_fd='$d_siginfo_si_fd'
25364 d_siginfo_si_pid='$d_siginfo_si_pid'
25365 d_siginfo_si_status='$d_siginfo_si_status'
25366 d_siginfo_si_uid='$d_siginfo_si_uid'
25367 d_siginfo_si_value='$d_siginfo_si_value'
25368 d_signbit='$d_signbit'
25369 d_sigprocmask='$d_sigprocmask'
25370 d_sigsetjmp='$d_sigsetjmp'
25371 d_sin6_scope_id='$d_sin6_scope_id'
25372 d_sitearch='$d_sitearch'
25373 d_snprintf='$d_snprintf'
25374 d_sockaddr_in6='$d_sockaddr_in6'
25375 d_sockaddr_sa_len='$d_sockaddr_sa_len'
25376 d_sockaddr_storage='$d_sockaddr_storage'
25377 d_sockatmark='$d_sockatmark'
25378 d_sockatmarkproto='$d_sockatmarkproto'
25379 d_socket='$d_socket'
25380 d_socklen_t='$d_socklen_t'
25381 d_sockpair='$d_sockpair'
25382 d_socks5_init='$d_socks5_init'
25383 d_sqrtl='$d_sqrtl'
25384 d_srand48_r='$d_srand48_r'
25385 d_srandom_r='$d_srandom_r'
25386 d_sresgproto='$d_sresgproto'
25387 d_sresuproto='$d_sresuproto'
25388 d_stat='$d_stat'
25389 d_statblks='$d_statblks'
25390 d_statfs_f_flags='$d_statfs_f_flags'
25391 d_statfs_s='$d_statfs_s'
25392 d_static_inline='$d_static_inline'
25393 d_statvfs='$d_statvfs'
25394 d_stdio_cnt_lval='$d_stdio_cnt_lval'
25395 d_stdio_ptr_lval='$d_stdio_ptr_lval'
25396 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
25397 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
25398 d_stdio_stream_array='$d_stdio_stream_array'
25399 d_stdiobase='$d_stdiobase'
25400 d_stdstdio='$d_stdstdio'
25401 d_strcoll='$d_strcoll'
25402 d_strerror_l='$d_strerror_l'
25403 d_strerror_r='$d_strerror_r'
25404 d_strftime='$d_strftime'
25405 d_strlcat='$d_strlcat'
25406 d_strlcpy='$d_strlcpy'
25407 d_strnlen='$d_strnlen'
25408 d_strtod='$d_strtod'
25409 d_strtod_l='$d_strtod_l'
25410 d_strtol='$d_strtol'
25411 d_strtold='$d_strtold'
25412 d_strtold_l='$d_strtold_l'
25413 d_strtoll='$d_strtoll'
25414 d_strtoq='$d_strtoq'
25415 d_strtoul='$d_strtoul'
25416 d_strtoull='$d_strtoull'
25417 d_strtouq='$d_strtouq'
25418 d_strxfrm='$d_strxfrm'
25419 d_strxfrm_l='$d_strxfrm_l'
25420 d_suidsafe='$d_suidsafe'
25421 d_symlink='$d_symlink'
25422 d_syscall='$d_syscall'
25423 d_syscallproto='$d_syscallproto'
25424 d_sysconf='$d_sysconf'
25425 d_sysernlst='$d_sysernlst'
25426 d_syserrlst='$d_syserrlst'
25427 d_system='$d_system'
25428 d_tcgetpgrp='$d_tcgetpgrp'
25429 d_tcsetpgrp='$d_tcsetpgrp'
25430 d_telldir='$d_telldir'
25431 d_telldirproto='$d_telldirproto'
25432 d_tgamma='$d_tgamma'
25433 d_thread_local='$d_thread_local'
25434 d_time='$d_time'
25435 d_timegm='$d_timegm'
25436 d_times='$d_times'
25437 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
25438 d_tm_tm_zone='$d_tm_tm_zone'
25439 d_tmpnam_r='$d_tmpnam_r'
25440 d_towlower='$d_towlower'
25441 d_towupper='$d_towupper'
25442 d_trunc='$d_trunc'
25443 d_truncate='$d_truncate'
25444 d_truncl='$d_truncl'
25445 d_ttyname_r='$d_ttyname_r'
25446 d_tzname='$d_tzname'
25447 d_u32align='$d_u32align'
25448 d_ualarm='$d_ualarm'
25449 d_umask='$d_umask'
25450 d_uname='$d_uname'
25451 d_union_semun='$d_union_semun'
25452 d_unlinkat='$d_unlinkat'
25453 d_unordered='$d_unordered'
25454 d_unsetenv='$d_unsetenv'
25455 d_uselocale='$d_uselocale'
25456 d_usleep='$d_usleep'
25457 d_usleepproto='$d_usleepproto'
25458 d_ustat='$d_ustat'
25459 d_vendorarch='$d_vendorarch'
25460 d_vendorbin='$d_vendorbin'
25461 d_vendorlib='$d_vendorlib'
25462 d_vendorscript='$d_vendorscript'
25463 d_vfork='$d_vfork'
25464 d_void_closedir='$d_void_closedir'
25465 d_voidsig='$d_voidsig'
25466 d_voidtty='$d_voidtty'
25467 d_vsnprintf='$d_vsnprintf'
25468 d_wait4='$d_wait4'
25469 d_waitpid='$d_waitpid'
25470 d_wcrtomb='$d_wcrtomb'
25471 d_wcscmp='$d_wcscmp'
25472 d_wcstombs='$d_wcstombs'
25473 d_wcsxfrm='$d_wcsxfrm'
25474 d_wctomb='$d_wctomb'
25475 d_writev='$d_writev'
25476 d_xenix='$d_xenix'
25477 date='$date'
25478 db_hashtype='$db_hashtype'
25479 db_prefixtype='$db_prefixtype'
25480 db_version_major='$db_version_major'
25481 db_version_minor='$db_version_minor'
25482 db_version_patch='$db_version_patch'
25483 default_inc_excludes_dot='$default_inc_excludes_dot'
25484 direntrytype='$direntrytype'
25485 dlext='$dlext'
25486 dlsrc='$dlsrc'
25487 doubleinfbytes='$doubleinfbytes'
25488 doublekind='$doublekind'
25489 doublemantbits='$doublemantbits'
25490 doublenanbytes='$doublenanbytes'
25491 doublesize='$doublesize'
25492 drand01='$drand01'
25493 drand48_r_proto='$drand48_r_proto'
25494 dtrace='$dtrace'
25495 dtraceobject='$dtraceobject'
25496 dtracexnolibs='$dtracexnolibs'
25497 dynamic_ext='$dynamic_ext'
25498 eagain='$eagain'
25499 ebcdic='$ebcdic'
25500 echo='$echo'
25501 egrep='$egrep'
25502 emacs='$emacs'
25503 endgrent_r_proto='$endgrent_r_proto'
25504 endhostent_r_proto='$endhostent_r_proto'
25505 endnetent_r_proto='$endnetent_r_proto'
25506 endprotoent_r_proto='$endprotoent_r_proto'
25507 endpwent_r_proto='$endpwent_r_proto'
25508 endservent_r_proto='$endservent_r_proto'
25509 eunicefix='$eunicefix'
25510 exe_ext='$exe_ext'
25511 expr='$expr'
25512 extensions='$extensions'
25513 extern_C='$extern_C'
25514 extras='$extras'
25515 fflushNULL='$fflushNULL'
25516 fflushall='$fflushall'
25517 find='$find'
25518 firstmakefile='$firstmakefile'
25519 flex='$flex'
25520 fpossize='$fpossize'
25521 fpostype='$fpostype'
25522 freetype='$freetype'
25523 from='$from'
25524 full_ar='$full_ar'
25525 full_csh='$full_csh'
25526 full_sed='$full_sed'
25527 gccansipedantic='$gccansipedantic'
25528 gccosandvers='$gccosandvers'
25529 gccversion='$gccversion'
25530 getgrent_r_proto='$getgrent_r_proto'
25531 getgrgid_r_proto='$getgrgid_r_proto'
25532 getgrnam_r_proto='$getgrnam_r_proto'
25533 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
25534 gethostbyname_r_proto='$gethostbyname_r_proto'
25535 gethostent_r_proto='$gethostent_r_proto'
25536 getlogin_r_proto='$getlogin_r_proto'
25537 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
25538 getnetbyname_r_proto='$getnetbyname_r_proto'
25539 getnetent_r_proto='$getnetent_r_proto'
25540 getprotobyname_r_proto='$getprotobyname_r_proto'
25541 getprotobynumber_r_proto='$getprotobynumber_r_proto'
25542 getprotoent_r_proto='$getprotoent_r_proto'
25543 getpwent_r_proto='$getpwent_r_proto'
25544 getpwnam_r_proto='$getpwnam_r_proto'
25545 getpwuid_r_proto='$getpwuid_r_proto'
25546 getservbyname_r_proto='$getservbyname_r_proto'
25547 getservbyport_r_proto='$getservbyport_r_proto'
25548 getservent_r_proto='$getservent_r_proto'
25549 getspnam_r_proto='$getspnam_r_proto'
25550 gidformat='$gidformat'
25551 gidsign='$gidsign'
25552 gidsize='$gidsize'
25553 gidtype='$gidtype'
25554 glibpth='$glibpth'
25555 gmake='$gmake'
25556 gmtime_r_proto='$gmtime_r_proto'
25557 gnulibc_version='$gnulibc_version'
25558 grep='$grep'
25559 groupcat='$groupcat'
25560 groupstype='$groupstype'
25561 gzip='$gzip'
25562 h_fcntl='$h_fcntl'
25563 h_sysfile='$h_sysfile'
25564 hint='$hint'
25565 hostcat='$hostcat'
25566 hostgenerate='$hostgenerate'
25567 hostosname='$hostosname'
25568 hostperl='$hostperl'
25569 html1dir='$html1dir'
25570 html1direxp='$html1direxp'
25571 html3dir='$html3dir'
25572 html3direxp='$html3direxp'
25573 i16size='$i16size'
25574 i16type='$i16type'
25575 i32dformat='$i32dformat'
25576 i32size='$i32size'
25577 i32type='$i32type'
25578 i64size='$i64size'
25579 i64type='$i64type'
25580 i8size='$i8size'
25581 i8type='$i8type'
25582 i_arpainet='$i_arpainet'
25583 i_bfd='$i_bfd'
25584 i_bsdioctl='$i_bsdioctl'
25585 i_crypt='$i_crypt'
25586 i_db='$i_db'
25587 i_dbm='$i_dbm'
25588 i_dirent='$i_dirent'
25589 i_dlfcn='$i_dlfcn'
25590 i_execinfo='$i_execinfo'
25591 i_fcntl='$i_fcntl'
25592 i_fenv='$i_fenv'
25593 i_fp='$i_fp'
25594 i_fp_class='$i_fp_class'
25595 i_gdbm='$i_gdbm'
25596 i_gdbm_ndbm='$i_gdbm_ndbm'
25597 i_gdbmndbm='$i_gdbmndbm'
25598 i_grp='$i_grp'
25599 i_ieeefp='$i_ieeefp'
25600 i_inttypes='$i_inttypes'
25601 i_langinfo='$i_langinfo'
25602 i_libutil='$i_libutil'
25603 i_locale='$i_locale'
25604 i_machcthr='$i_machcthr'
25605 i_malloc='$i_malloc'
25606 i_mallocmalloc='$i_mallocmalloc'
25607 i_mntent='$i_mntent'
25608 i_ndbm='$i_ndbm'
25609 i_netdb='$i_netdb'
25610 i_neterrno='$i_neterrno'
25611 i_netinettcp='$i_netinettcp'
25612 i_niin='$i_niin'
25613 i_poll='$i_poll'
25614 i_prot='$i_prot'
25615 i_pthread='$i_pthread'
25616 i_pwd='$i_pwd'
25617 i_quadmath='$i_quadmath'
25618 i_rpcsvcdbm='$i_rpcsvcdbm'
25619 i_sgtty='$i_sgtty'
25620 i_shadow='$i_shadow'
25621 i_socks='$i_socks'
25622 i_stdbool='$i_stdbool'
25623 i_stdint='$i_stdint'
25624 i_stdlib='$i_stdlib'
25625 i_sunmath='$i_sunmath'
25626 i_sysaccess='$i_sysaccess'
25627 i_sysdir='$i_sysdir'
25628 i_sysfile='$i_sysfile'
25629 i_sysfilio='$i_sysfilio'
25630 i_sysin='$i_sysin'
25631 i_sysioctl='$i_sysioctl'
25632 i_syslog='$i_syslog'
25633 i_sysmman='$i_sysmman'
25634 i_sysmode='$i_sysmode'
25635 i_sysmount='$i_sysmount'
25636 i_sysndir='$i_sysndir'
25637 i_sysparam='$i_sysparam'
25638 i_syspoll='$i_syspoll'
25639 i_sysresrc='$i_sysresrc'
25640 i_syssecrt='$i_syssecrt'
25641 i_sysselct='$i_sysselct'
25642 i_syssockio='$i_syssockio'
25643 i_sysstat='$i_sysstat'
25644 i_sysstatfs='$i_sysstatfs'
25645 i_sysstatvfs='$i_sysstatvfs'
25646 i_syssyscall='$i_syssyscall'
25647 i_systime='$i_systime'
25648 i_systimek='$i_systimek'
25649 i_systimes='$i_systimes'
25650 i_systypes='$i_systypes'
25651 i_sysuio='$i_sysuio'
25652 i_sysun='$i_sysun'
25653 i_sysutsname='$i_sysutsname'
25654 i_sysvfs='$i_sysvfs'
25655 i_syswait='$i_syswait'
25656 i_termio='$i_termio'
25657 i_termios='$i_termios'
25658 i_time='$i_time'
25659 i_unistd='$i_unistd'
25660 i_ustat='$i_ustat'
25661 i_utime='$i_utime'
25662 i_vfork='$i_vfork'
25663 i_wchar='$i_wchar'
25664 i_wctype='$i_wctype'
25665 i_xlocale='$i_xlocale'
25666 ignore_versioned_solibs='$ignore_versioned_solibs'
25667 inc_version_list='$inc_version_list'
25668 inc_version_list_init='$inc_version_list_init'
25669 incpath='$incpath'
25670 incpth='$incpth'
25671 inews='$inews'
25672 initialinstalllocation='$initialinstalllocation'
25673 installarchlib='$installarchlib'
25674 installbin='$installbin'
25675 installhtml1dir='$installhtml1dir'
25676 installhtml3dir='$installhtml3dir'
25677 installman1dir='$installman1dir'
25678 installman3dir='$installman3dir'
25679 installprefix='$installprefix'
25680 installprefixexp='$installprefixexp'
25681 installprivlib='$installprivlib'
25682 installscript='$installscript'
25683 installsitearch='$installsitearch'
25684 installsitebin='$installsitebin'
25685 installsitehtml1dir='$installsitehtml1dir'
25686 installsitehtml3dir='$installsitehtml3dir'
25687 installsitelib='$installsitelib'
25688 installsiteman1dir='$installsiteman1dir'
25689 installsiteman3dir='$installsiteman3dir'
25690 installsitescript='$installsitescript'
25691 installstyle='$installstyle'
25692 installusrbinperl='$installusrbinperl'
25693 installvendorarch='$installvendorarch'
25694 installvendorbin='$installvendorbin'
25695 installvendorhtml1dir='$installvendorhtml1dir'
25696 installvendorhtml3dir='$installvendorhtml3dir'
25697 installvendorlib='$installvendorlib'
25698 installvendorman1dir='$installvendorman1dir'
25699 installvendorman3dir='$installvendorman3dir'
25700 installvendorscript='$installvendorscript'
25701 intsize='$intsize'
25702 issymlink='$issymlink'
25703 ivdformat='$ivdformat'
25704 ivsize='$ivsize'
25705 ivtype='$ivtype'
25706 known_extensions='$known_extensions'
25707 ksh='$ksh'
25708 ld='$ld'
25709 ld_can_script='$ld_can_script'
25710 lddlflags='$lddlflags'
25711 ldflags='$ldflags'
25712 ldflags_uselargefiles='$ldflags_uselargefiles'
25713 ldlibpthname='$ldlibpthname'
25714 less='$less'
25715 lib_ext='$lib_ext'
25716 libc='$libc'
25717 libperl='$libperl'
25718 libpth='$libpth'
25719 libs='$libs'
25720 libsdirs='$libsdirs'
25721 libsfiles='$libsfiles'
25722 libsfound='$libsfound'
25723 libspath='$libspath'
25724 libswanted='$libswanted'
25725 libswanted_uselargefiles='$libswanted_uselargefiles'
25726 line='$line'
25727 lint='$lint'
25728 lkflags='$lkflags'
25729 ln='$ln'
25730 lns='$lns'
25731 localtime_r_proto='$localtime_r_proto'
25732 locincpth='$locincpth'
25733 loclibpth='$loclibpth'
25734 longdblinfbytes='$longdblinfbytes'
25735 longdblkind='$longdblkind'
25736 longdblmantbits='$longdblmantbits'
25737 longdblnanbytes='$longdblnanbytes'
25738 longdblsize='$longdblsize'
25739 longlongsize='$longlongsize'
25740 longsize='$longsize'
25741 lp='$lp'
25742 lpr='$lpr'
25743 ls='$ls'
25744 lseeksize='$lseeksize'
25745 lseektype='$lseektype'
25746 mail='$mail'
25747 mailx='$mailx'
25748 make='$make'
25749 make_set_make='$make_set_make'
25750 mallocobj='$mallocobj'
25751 mallocsrc='$mallocsrc'
25752 malloctype='$malloctype'
25753 man1dir='$man1dir'
25754 man1direxp='$man1direxp'
25755 man1ext='$man1ext'
25756 man3dir='$man3dir'
25757 man3direxp='$man3direxp'
25758 man3ext='$man3ext'
25759 mips_type='$mips_type'
25760 mistrustnm='$mistrustnm'
25761 mkdir='$mkdir'
25762 mmaptype='$mmaptype'
25763 modetype='$modetype'
25764 more='$more'
25765 multiarch='$multiarch'
25766 mv='$mv'
25767 myarchname='$myarchname'
25768 mydomain='$mydomain'
25769 myhostname='$myhostname'
25770 myuname='$myuname'
25771 n='$n'
25772 need_va_copy='$need_va_copy'
25773 netdb_hlen_type='$netdb_hlen_type'
25774 netdb_host_type='$netdb_host_type'
25775 netdb_name_type='$netdb_name_type'
25776 netdb_net_type='$netdb_net_type'
25777 nm='$nm'
25778 nm_opt='$nm_opt'
25779 nm_so_opt='$nm_so_opt'
25780 nonxs_ext='$nonxs_ext'
25781 nroff='$nroff'
25782 nvEUformat='$nvEUformat'
25783 nvFUformat='$nvFUformat'
25784 nvGUformat='$nvGUformat'
25785 nv_overflows_integers_at='$nv_overflows_integers_at'
25786 nv_preserves_uv_bits='$nv_preserves_uv_bits'
25787 nveformat='$nveformat'
25788 nvfformat='$nvfformat'
25789 nvgformat='$nvgformat'
25790 nvmantbits='$nvmantbits'
25791 nvsize='$nvsize'
25792 nvtype='$nvtype'
25793 o_nonblock='$o_nonblock'
25794 obj_ext='$obj_ext'
25795 old_pthread_create_joinable='$old_pthread_create_joinable'
25796 optimize='$optimize'
25797 orderlib='$orderlib'
25798 osname='$osname'
25799 osvers='$osvers'
25800 otherlibdirs='$otherlibdirs'
25801 package='$package'
25802 pager='$pager'
25803 passcat='$passcat'
25804 patchlevel='$patchlevel'
25805 path_sep='$path_sep'
25806 perl5='$perl5'
25807 perl='$perl'
25808 perl_lc_all_category_positions_init='$perl_lc_all_category_positions_init'
25809 perl_lc_all_separator='$perl_lc_all_separator'
25810 perl_patchlevel='$perl_patchlevel'
25811 perl_static_inline='$perl_static_inline'
25812 perl_thread_local='$perl_thread_local'
25813 perladmin='$perladmin'
25814 perllibs='$perllibs'
25815 perlpath='$perlpath'
25816 pg='$pg'
25817 phostname='$phostname'
25818 pidtype='$pidtype'
25819 plibpth='$plibpth'
25820 pmake='$pmake'
25821 pr='$pr'
25822 prefix='$prefix'
25823 prefixexp='$prefixexp'
25824 privlib='$privlib'
25825 privlibexp='$privlibexp'
25826 procselfexe='$procselfexe'
25827 ptrsize='$ptrsize'
25828 quadkind='$quadkind'
25829 quadtype='$quadtype'
25830 randbits='$randbits'
25831 randfunc='$randfunc'
25832 random_r_proto='$random_r_proto'
25833 randseedtype='$randseedtype'
25834 ranlib='$ranlib'
25835 rd_nodata='$rd_nodata'
25836 readdir64_r_proto='$readdir64_r_proto'
25837 readdir_r_proto='$readdir_r_proto'
25838 revision='$revision'
25839 rm='$rm'
25840 rm_try='$rm_try'
25841 rmail='$rmail'
25842 run='$run'
25843 runnm='$runnm'
25844 sGMTIME_max='$sGMTIME_max'
25845 sGMTIME_min='$sGMTIME_min'
25846 sLOCALTIME_max='$sLOCALTIME_max'
25847 sLOCALTIME_min='$sLOCALTIME_min'
25848 sPRIEUldbl='$sPRIEUldbl'
25849 sPRIFUldbl='$sPRIFUldbl'
25850 sPRIGUldbl='$sPRIGUldbl'
25851 sPRIXU64='$sPRIXU64'
25852 sPRId64='$sPRId64'
25853 sPRIeldbl='$sPRIeldbl'
25854 sPRIfldbl='$sPRIfldbl'
25855 sPRIgldbl='$sPRIgldbl'
25856 sPRIi64='$sPRIi64'
25857 sPRIo64='$sPRIo64'
25858 sPRIu64='$sPRIu64'
25859 sPRIx64='$sPRIx64'
25860 sSCNfldbl='$sSCNfldbl'
25861 sched_yield='$sched_yield'
25862 scriptdir='$scriptdir'
25863 scriptdirexp='$scriptdirexp'
25864 sed='$sed'
25865 seedfunc='$seedfunc'
25866 selectminbits='$selectminbits'
25867 selecttype='$selecttype'
25868 sendmail='$sendmail'
25869 setgrent_r_proto='$setgrent_r_proto'
25870 sethostent_r_proto='$sethostent_r_proto'
25871 setlocale_r_proto='$setlocale_r_proto'
25872 setnetent_r_proto='$setnetent_r_proto'
25873 setprotoent_r_proto='$setprotoent_r_proto'
25874 setpwent_r_proto='$setpwent_r_proto'
25875 setservent_r_proto='$setservent_r_proto'
25876 sh='$sh'
25877 shar='$shar'
25878 sharpbang='$sharpbang'
25879 shmattype='$shmattype'
25880 shortsize='$shortsize'
25881 shrpenv='$shrpenv'
25882 shsharp='$shsharp'
25883 sig_count='$sig_count'
25884 sig_name='$sig_name'
25885 sig_name_init='$sig_name_init'
25886 sig_num='$sig_num'
25887 sig_num_init='$sig_num_init'
25888 sig_size='$sig_size'
25889 signal_t='$signal_t'
25890 sitearch='$sitearch'
25891 sitearchexp='$sitearchexp'
25892 sitebin='$sitebin'
25893 sitebinexp='$sitebinexp'
25894 sitehtml1dir='$sitehtml1dir'
25895 sitehtml1direxp='$sitehtml1direxp'
25896 sitehtml3dir='$sitehtml3dir'
25897 sitehtml3direxp='$sitehtml3direxp'
25898 sitelib='$sitelib'
25899 sitelib_stem='$sitelib_stem'
25900 sitelibexp='$sitelibexp'
25901 siteman1dir='$siteman1dir'
25902 siteman1direxp='$siteman1direxp'
25903 siteman3dir='$siteman3dir'
25904 siteman3direxp='$siteman3direxp'
25905 siteprefix='$siteprefix'
25906 siteprefixexp='$siteprefixexp'
25907 sitescript='$sitescript'
25908 sitescriptexp='$sitescriptexp'
25909 sizesize='$sizesize'
25910 sizetype='$sizetype'
25911 sleep='$sleep'
25912 smail='$smail'
25913 so='$so'
25914 sockethdr='$sockethdr'
25915 socketlib='$socketlib'
25916 socksizetype='$socksizetype'
25917 sort='$sort'
25918 spackage='$spackage'
25919 spitshell='$spitshell'
25920 srand48_r_proto='$srand48_r_proto'
25921 srandom_r_proto='$srandom_r_proto'
25922 src='$src'
25923 ssizetype='$ssizetype'
25924 st_dev_sign='$st_dev_sign'
25925 st_dev_size='$st_dev_size'
25926 st_ino_sign='$st_ino_sign'
25927 st_ino_size='$st_ino_size'
25928 startperl='$startperl'
25929 startsh='$startsh'
25930 static_ext='$static_ext'
25931 stdchar='$stdchar'
25932 stdio_base='$stdio_base'
25933 stdio_bufsiz='$stdio_bufsiz'
25934 stdio_cnt='$stdio_cnt'
25935 stdio_filbuf='$stdio_filbuf'
25936 stdio_ptr='$stdio_ptr'
25937 stdio_stream_array='$stdio_stream_array'
25938 strerror_r_proto='$strerror_r_proto'
25939 submit='$submit'
25940 subversion='$subversion'
25941 sysman='$sysman'
25942 sysroot='$sysroot'
25943 tail='$tail'
25944 tar='$tar'
25945 targetarch='$targetarch'
25946 targetdir='$targetdir'
25947 targetenv='$targetenv'
25948 targethost='$targethost'
25949 targetmkdir='$targetmkdir'
25950 targetport='$targetport'
25951 targetsh='$targetsh'
25952 tbl='$tbl'
25953 tee='$tee'
25954 test='$test'
25955 timeincl='$timeincl'
25956 timetype='$timetype'
25957 tmpnam_r_proto='$tmpnam_r_proto'
25958 to='$to'
25959 touch='$touch'
25960 tr='$tr'
25961 trnl='$trnl'
25962 troff='$troff'
25963 ttyname_r_proto='$ttyname_r_proto'
25964 u16size='$u16size'
25965 u16type='$u16type'
25966 u32XUformat='$u32XUformat'
25967 u32oformat='$u32oformat'
25968 u32size='$u32size'
25969 u32type='$u32type'
25970 u32uformat='$u32uformat'
25971 u32xformat='$u32xformat'
25972 u64size='$u64size'
25973 u64type='$u64type'
25974 u8size='$u8size'
25975 u8type='$u8type'
25976 uidformat='$uidformat'
25977 uidsign='$uidsign'
25978 uidsize='$uidsize'
25979 uidtype='$uidtype'
25980 uname='$uname'
25981 uniq='$uniq'
25982 uquadtype='$uquadtype'
25983 use64bitall='$use64bitall'
25984 use64bitint='$use64bitint'
25985 usecbacktrace='$usecbacktrace'
25986 usecrosscompile='$usecrosscompile'
25987 usedefaultstrict='$usedefaultstrict'
25988 usedevel='$usedevel'
25989 usedl='$usedl'
25990 usedtrace='$usedtrace'
25991 usefaststdio='$usefaststdio'
25992 useithreads='$useithreads'
25993 usekernprocpathname='$usekernprocpathname'
25994 uselanginfo='$uselanginfo'
25995 uselargefiles='$uselargefiles'
25996 uselongdouble='$uselongdouble'
25997 usemallocwrap='$usemallocwrap'
25998 usemorebits='$usemorebits'
25999 usemultiplicity='$usemultiplicity'
26000 usemymalloc='$usemymalloc'
26001 usenm='$usenm'
26002 usensgetexecutablepath='$usensgetexecutablepath'
26003 useopcode='$useopcode'
26004 useperlio='$useperlio'
26005 useposix='$useposix'
26006 usequadmath='$usequadmath'
26007 usereentrant='$usereentrant'
26008 userelocatableinc='$userelocatableinc'
26009 useshrplib='$useshrplib'
26010 usesitecustomize='$usesitecustomize'
26011 usesocks='$usesocks'
26012 usethreads='$usethreads'
26013 usevendorprefix='$usevendorprefix'
26014 useversionedarchname='$useversionedarchname'
26015 usevfork='$usevfork'
26016 usrinc='$usrinc'
26017 uuname='$uuname'
26018 uvXUformat='$uvXUformat'
26019 uvoformat='$uvoformat'
26020 uvsize='$uvsize'
26021 uvtype='$uvtype'
26022 uvuformat='$uvuformat'
26023 uvxformat='$uvxformat'
26024 vendorarch='$vendorarch'
26025 vendorarchexp='$vendorarchexp'
26026 vendorbin='$vendorbin'
26027 vendorbinexp='$vendorbinexp'
26028 vendorhtml1dir='$vendorhtml1dir'
26029 vendorhtml1direxp='$vendorhtml1direxp'
26030 vendorhtml3dir='$vendorhtml3dir'
26031 vendorhtml3direxp='$vendorhtml3direxp'
26032 vendorlib='$vendorlib'
26033 vendorlib_stem='$vendorlib_stem'
26034 vendorlibexp='$vendorlibexp'
26035 vendorman1dir='$vendorman1dir'
26036 vendorman1direxp='$vendorman1direxp'
26037 vendorman3dir='$vendorman3dir'
26038 vendorman3direxp='$vendorman3direxp'
26039 vendorprefix='$vendorprefix'
26040 vendorprefixexp='$vendorprefixexp'
26041 vendorscript='$vendorscript'
26042 vendorscriptexp='$vendorscriptexp'
26043 version='$version'
26044 version_patchlevel_string='$version_patchlevel_string'
26045 versiononly='$versiononly'
26046 vi='$vi'
26047 xlibpth='$xlibpth'
26048 xlocale_needed='$xlocale_needed'
26049 yacc='$yacc'
26050 yaccflags='$yaccflags'
26051 zcat='$zcat'
26052 zip='$zip'
26053 EOT
26054
26055 : add special variables
26056 $test -f $src/patchlevel.h && \
26057 awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
26058 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
26059 echo "PERL_CONFIG_SH=true" >>config.sh
26060
26061 : propagate old symbols
26062 if $test -f UU/config.sh; then
26063 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
26064 $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
26065 config.sh config.sh UU/oldconfig.sh |\
26066 $sort | $uniq -u >UU/oldsyms
26067 set X `$cat UU/oldsyms`
26068 shift
26069 case $# in
26070 0) ;;
26071 *)
26072 $cat <<EOM
26073 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
26074 EOM
26075 echo ": Variables propagated from previous config.sh file." >>config.sh
26076 for sym in `$cat UU/oldsyms`; do
26077 echo " Propagating $hint variable "'$'"$sym..."
26078 eval 'tmp="$'"${sym}"'"'
26079 echo "$tmp" | \
26080 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
26081 done
26082 ;;
26083 esac
26084 fi
26085
26086 : preserve RCS keywords in files with variable substitution, grrr
26087 Id='$Id'
26088
26089 : Finish up by extracting the .SH files
26090 case "$alldone" in
26091 exit)
26092 echo "Stopping at your request, leaving temporary files around."
26093 exit 0
26094 ;;
26095 cont)
26096 ;;
26097 '')
26098 dflt=''
26099 nostick=true
26100 $cat <<EOM
26101
26102 If you'd like to make any changes to the config.sh file before I begin
26103 to configure things, do it as a shell escape now (e.g. !vi config.sh).
26104
26105 EOM
26106 rp="Press return or use a shell escape to edit config.sh:"
26107 . UU/myread
26108 nostick=''
26109 case "$ans" in
26110 '') ;;
26111 *) : in case they cannot read
26112 sh 1>&4 -c "$ans";;
26113 esac
26114 ;;
26115 esac
26116
26117 : if this fails, just run all the .SH files by hand
26118 . ./config.sh
26119
26120 echo " "
26121 exec 1>&4
26122 pwd=`pwd`
26123 . ./UU/extract
26124 cd "$pwd"
26125
26126 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
26127 dflt=y
26128 case "$silent" in
26129 true) ;;
26130 *)
26131 $cat <<EOM
26132
26133 Now you need to generate make dependencies by running "$make depend".
26134 You might prefer to run it in background: "$make depend > makedepend.out &"
26135 It can take a while, so you might not want to run it right now.
26136
26137 EOM
26138 ;;
26139 esac
26140 rp="Run $make depend now?"
26141 . UU/myread
26142 case "$ans" in
26143 y*)
26144 $make depend && echo "Now you must run '$make'."
26145 ;;
26146 *)
26147 echo "You must run '$make depend' then '$make'."
26148 ;;
26149 esac
26150 elif test -f [Mm]akefile; then
26151 echo " "
26152 echo "Now you must run a $make."
26153 else
26154 echo "Configure done."
26155 fi
26156
26157 if $test -f Policy.sh; then
26158 $cat <<EOM
26159
26160 If you compile $package on a different machine or from a different object
26161 directory, copy the Policy.sh file from this object directory to the
26162 new one before you run Configure -- this will help you with most of
26163 the policy defaults.
26164
26165 EOM
26166 fi
26167 if $test -f UU/config.msg; then
26168 echo "Hmm. I also noted the following information while running:"
26169 echo " "
26170 $cat UU/config.msg >&4
26171 fi
26172 $rm -f kit*isdone ark*isdone
26173 $rm -rf UU
26174
26175 : End of Configure
26176