Debian Codegraph @

Configure

raw ◀ ▶
Source reconstructed at patch state 2 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_fdopendir=''
482 d_fegetround=''
483 d_ffs=''
484 d_ffsl=''
485 d_fgetpos=''
486 d_finite=''
487 d_finitel=''
488 d_flexfnam=''
489 d_flock=''
490 d_flockproto=''
491 d_fma=''
492 d_fmax=''
493 d_fmin=''
494 d_fork=''
495 d_fp_class=''
496 d_fp_classl=''
497 d_fpclass=''
498 d_fp_classify=''
499 d_fpclassify=''
500 d_fpclassl=''
501 d_fpgetround=''
502 d_fpos64_t=''
503 d_frexpl=''
504 d_fs_data_s=''
505 d_fchmodat=''
506 d_linkat=''
507 d_openat=''
508 d_renameat=''
509 d_unlinkat=''
510 d_fseeko=''
511 d_fsetpos=''
512 d_fstatfs=''
513 d_fsync=''
514 d_ftello=''
515 d_ftime=''
516 d_gettimeod=''
517 d_futimes=''
518 d_gai_strerror=''
519 d_Gconvert=''
520 d_getaddrinfo=''
521 d_getcwd=''
522 d_getenv_preserves_other_thread=''
523 d_getespwnam=''
524 d_getfsstat=''
525 d_getgrent=''
526 d_getgrent_r=''
527 getgrent_r_proto=''
528 d_getgrgid_r=''
529 getgrgid_r_proto=''
530 d_getgrnam_r=''
531 getgrnam_r_proto=''
532 d_getgrps=''
533 d_gethbyaddr=''
534 d_gethbyname=''
535 d_gethent=''
536 aphostname=''
537 d_gethname=''
538 d_phostname=''
539 d_uname=''
540 d_gethostbyaddr_r=''
541 gethostbyaddr_r_proto=''
542 d_gethostbyname_r=''
543 gethostbyname_r_proto=''
544 d_gethostent_r=''
545 gethostent_r_proto=''
546 d_gethostprotos=''
547 d_getitimer=''
548 d_getlogin=''
549 d_getlogin_r=''
550 getlogin_r_proto=''
551 d_getmnt=''
552 d_getmntent=''
553 d_getnameinfo=''
554 d_getnbyaddr=''
555 d_getnbyname=''
556 d_getnent=''
557 d_getnetbyaddr_r=''
558 getnetbyaddr_r_proto=''
559 d_getnetbyname_r=''
560 getnetbyname_r_proto=''
561 d_getnetent_r=''
562 getnetent_r_proto=''
563 d_getnetprotos=''
564 d_getpagsz=''
565 d_getpent=''
566 d_getpgid=''
567 d_getpgrp2=''
568 d_bsdgetpgrp=''
569 d_getpgrp=''
570 d_getppid=''
571 d_getprior=''
572 d_getpbyname=''
573 d_getpbynumber=''
574 d_getprotobyname_r=''
575 getprotobyname_r_proto=''
576 d_getprotobynumber_r=''
577 getprotobynumber_r_proto=''
578 d_getprotoent_r=''
579 getprotoent_r_proto=''
580 d_getprotoprotos=''
581 d_getprpwnam=''
582 d_getpwent=''
583 d_getpwent_r=''
584 getpwent_r_proto=''
585 d_getpwnam_r=''
586 getpwnam_r_proto=''
587 d_getpwuid_r=''
588 getpwuid_r_proto=''
589 d_getsent=''
590 d_getservbyname_r=''
591 getservbyname_r_proto=''
592 d_getservbyport_r=''
593 getservbyport_r_proto=''
594 d_getservent_r=''
595 getservent_r_proto=''
596 d_getservprotos=''
597 d_getspnam=''
598 d_getspnam_r=''
599 getspnam_r_proto=''
600 d_getsbyname=''
601 d_getsbyport=''
602 d_gmtime_r=''
603 gmtime_r_proto=''
604 d_gnulibc=''
605 gnulibc_version=''
606 d_hasmntopt=''
607 d_htonl=''
608 d_hypot=''
609 d_ilogb=''
610 d_ilogbl=''
611 d_inetaton=''
612 d_inetntop=''
613 d_inetpton=''
614 d_int64_t=''
615 d_isascii=''
616 d_isblank=''
617 d_isfinite=''
618 d_isfinitel=''
619 d_isinf=''
620 d_isinfl=''
621 d_isless=''
622 d_isnan=''
623 d_isnanl=''
624 d_isnormal=''
625 d_j0=''
626 d_j0l=''
627 d_killpg=''
628 d_lc_monetary_2008=''
629 d_lchown=''
630 d_ldbl_dig=''
631 d_lgamma=''
632 d_lgamma_r=''
633 d_libm_lib_version=''
634 d_link=''
635 d_llrint=''
636 d_llrintl=''
637 d_llround=''
638 d_llroundl=''
639 d_localeconv_l=''
640 d_localtime_r=''
641 d_localtime_r_needs_tzset=''
642 localtime_r_proto=''
643 d_locconv=''
644 d_lockf=''
645 d_log1p=''
646 d_log2=''
647 d_logb=''
648 d_ldexpl=''
649 d_long_double_style_ieee=''
650 d_long_double_style_ieee_doubledouble=''
651 d_long_double_style_ieee_extended=''
652 d_long_double_style_ieee_std=''
653 d_long_double_style_vax=''
654 d_longdbl=''
655 longdblkind=''
656 longdblsize=''
657 d_longlong=''
658 longlongsize=''
659 d_lrint=''
660 d_lrintl=''
661 d_lround=''
662 d_lroundl=''
663 d_lseekproto=''
664 d_lstat=''
665 d_madvise=''
666 d_malloc_good_size=''
667 d_malloc_size=''
668 d_malloc_usable_size=''
669 d_mblen=''
670 d_mbrlen=''
671 d_mbrtowc=''
672 d_mbstowcs=''
673 d_mbtowc=''
674 d_memmem=''
675 d_memrchr=''
676 d_mkdir=''
677 d_mkdtemp=''
678 d_mkfifo=''
679 d_mkostemp=''
680 d_mkstemp=''
681 d_mkstemps=''
682 d_mktime=''
683 d_mmap=''
684 mmaptype=''
685 d_modfl=''
686 d_modflproto=''
687 d_mprotect=''
688 d_msg=''
689 d_msgctl=''
690 d_msgget=''
691 d_msghdr_s=''
692 d_msgrcv=''
693 d_msgsnd=''
694 d_msync=''
695 d_munmap=''
696 d_nan=''
697 d_nanosleep=''
698 d_nearbyint=''
699 d_duplocale=''
700 d_freelocale=''
701 d_newlocale=''
702 d_querylocale=''
703 d_uselocale=''
704 i_xlocale=''
705 xlocale_needed=''
706 d_nextafter=''
707 d_nexttoward=''
708 d_nice=''
709 d_nl_langinfo=''
710 d_nl_langinfo_l=''
711 d_off64_t=''
712 d_open3=''
713 d_fpathconf=''
714 d_pathconf=''
715 d_pause=''
716 d_pipe2=''
717 d_pipe=''
718 d_poll=''
719 d_portable=''
720 d_prctl=''
721 d_prctl_set_name=''
722 d_procselfexe=''
723 procselfexe=''
724 d_old_pthread_create_joinable=''
725 old_pthread_create_joinable=''
726 d_pthread_atfork=''
727 d_pthread_attr_setscope=''
728 d_pthread_yield=''
729 d_sched_yield=''
730 sched_yield=''
731 d_ptrdiff_t=''
732 d_qgcvt=''
733 d_random_r=''
734 random_r_proto=''
735 d_readdir64_r=''
736 readdir64_r_proto=''
737 d_readdir=''
738 d_rewinddir=''
739 d_seekdir=''
740 d_telldir=''
741 d_readdir_r=''
742 readdir_r_proto=''
743 d_readlink=''
744 d_readv=''
745 d_recvmsg=''
746 d_re_comp=''
747 d_regcmp=''
748 d_regcomp=''
749 d_remainder=''
750 d_remquo=''
751 d_rename=''
752 d_rint=''
753 d_rmdir=''
754 d_round=''
755 d_sbrkproto=''
756 d_scalbn=''
757 d_scalbnl=''
758 d_select=''
759 d_sem=''
760 d_semctl=''
761 d_semget=''
762 d_semop=''
763 d_sendmsg=''
764 d_setegid=''
765 d_setenv=''
766 d_seteuid=''
767 d_setgrent=''
768 d_setgrent_r=''
769 setgrent_r_proto=''
770 d_setgrps=''
771 d_sethent=''
772 d_sethostent_r=''
773 sethostent_r_proto=''
774 d_setitimer=''
775 d_setlinebuf=''
776 d_has_C_UTF8=''
777 d_setlocale=''
778 d_setlocale_accepts_any_locale_name=''
779 d_setlocale_r=''
780 setlocale_r_proto=''
781 d_setnent=''
782 d_setnetent_r=''
783 setnetent_r_proto=''
784 d_setpent=''
785 d_setpgid=''
786 d_setpgrp2=''
787 d_bsdsetpgrp=''
788 d_setpgrp=''
789 d_setprior=''
790 d_setproctitle=''
791 d_setprotoent_r=''
792 setprotoent_r_proto=''
793 d_setpwent=''
794 d_setpwent_r=''
795 setpwent_r_proto=''
796 d_setregid=''
797 d_setresgid=''
798 d_setresuid=''
799 d_setreuid=''
800 d_setrgid=''
801 d_setruid=''
802 d_setsent=''
803 d_setservent_r=''
804 setservent_r_proto=''
805 d_setsid=''
806 d_setvbuf=''
807 d_shm=''
808 d_shmat=''
809 d_shmatprototype=''
810 shmattype=''
811 d_shmctl=''
812 d_shmdt=''
813 d_shmget=''
814 d_sigaction=''
815 d_siginfo_si_addr=''
816 d_siginfo_si_band=''
817 d_siginfo_si_errno=''
818 d_siginfo_si_fd=''
819 d_siginfo_si_pid=''
820 d_siginfo_si_status=''
821 d_siginfo_si_uid=''
822 d_siginfo_si_value=''
823 d_signbit=''
824 d_sigprocmask=''
825 d_sigsetjmp=''
826 usesitecustomize=''
827 d_snprintf=''
828 d_vsnprintf=''
829 d_sockatmark=''
830 d_sockatmarkproto=''
831 d_ip_mreq=''
832 d_ip_mreq_source=''
833 d_ipv6_mreq=''
834 d_ipv6_mreq_source=''
835 d_msg_ctrunc=''
836 d_msg_dontroute=''
837 d_msg_oob=''
838 d_msg_peek=''
839 d_msg_proxy=''
840 d_oldsock=''
841 d_scm_rights=''
842 d_sin6_scope_id=''
843 d_sockaddr_in6=''
844 d_sockaddr_sa_len=''
845 d_sockaddr_storage=''
846 d_socket=''
847 d_sockpair=''
848 sockethdr=''
849 socketlib=''
850 d_socklen_t=''
851 d_socks5_init=''
852 d_sqrtl=''
853 d_srand48_r=''
854 srand48_r_proto=''
855 d_srandom_r=''
856 srandom_r_proto=''
857 d_sresgproto=''
858 d_sresuproto=''
859 d_stat=''
860 d_statblks=''
861 d_statfs_f_flags=''
862 d_statfs_s=''
863 d_static_inline=''
864 perl_static_inline=''
865 d_fstatvfs=''
866 d_statvfs=''
867 d_stdio_cnt_lval=''
868 d_stdio_ptr_lval=''
869 d_stdio_ptr_lval_nochange_cnt=''
870 d_stdio_ptr_lval_sets_cnt=''
871 d_stdiobase=''
872 d_stdstdio=''
873 stdio_base=''
874 stdio_bufsiz=''
875 stdio_cnt=''
876 stdio_filbuf=''
877 stdio_ptr=''
878 d_strcoll=''
879 d_sysernlst=''
880 d_syserrlst=''
881 d_strerror_l=''
882 d_strerror_r=''
883 strerror_r_proto=''
884 d_strftime=''
885 d_strlcat=''
886 d_strlcpy=''
887 d_strnlen=''
888 d_strtod=''
889 d_strtod_l=''
890 d_strtol=''
891 d_strtold=''
892 d_strtold_l=''
893 d_strtoll=''
894 d_strtoq=''
895 d_strtoul=''
896 d_strtoull=''
897 d_strtouq=''
898 d_strxfrm=''
899 d_strxfrm_l=''
900 d_symlink=''
901 d_syscall=''
902 d_syscallproto=''
903 d_sysconf=''
904 d_system=''
905 d_tcgetpgrp=''
906 d_tcsetpgrp=''
907 d_telldirproto=''
908 d_tgamma=''
909 d_thread_local=''
910 perl_thread_local=''
911 d_time=''
912 timetype=''
913 d_asctime64=''
914 d_ctime64=''
915 d_difftime64=''
916 d_gmtime64=''
917 d_localtime64=''
918 d_mktime64=''
919 d_timegm=''
920 clocktype=''
921 d_times=''
922 d_tmpnam_r=''
923 tmpnam_r_proto=''
924 d_towlower=''
925 d_towupper=''
926 d_trunc=''
927 d_truncate=''
928 d_truncl=''
929 d_ttyname_r=''
930 ttyname_r_proto=''
931 d_tzname=''
932 d_u32align=''
933 d_ualarm=''
934 d_umask=''
935 d_semctl_semid_ds=''
936 d_semctl_semun=''
937 d_union_semun=''
938 d_unordered=''
939 d_unsetenv=''
940 d_usleep=''
941 d_usleepproto=''
942 d_ustat=''
943 d_pseudofork=''
944 d_vfork=''
945 usevfork=''
946 d_voidsig=''
947 signal_t=''
948 d_wait4=''
949 d_waitpid=''
950 d_wcrtomb=''
951 d_wcscmp=''
952 d_wcstombs=''
953 d_wcsxfrm=''
954 d_wctomb=''
955 d_writev=''
956 default_inc_excludes_dot=''
957 d_perl_lc_all_category_positions_init=''
958 d_perl_lc_all_separator=''
959 d_perl_lc_all_uses_name_value_pairs=''
960 perl_lc_all_category_positions_init=''
961 perl_lc_all_separator=''
962 dlext=''
963 bin_ELF=''
964 cccdlflags=''
965 ccdlflags=''
966 dlsrc=''
967 ld=''
968 ld_can_script=''
969 lddlflags=''
970 usedl=''
971 doublesize=''
972 dtraceobject=''
973 dtracexnolibs=''
974 ebcdic=''
975 fflushNULL=''
976 fflushall=''
977 fpossize=''
978 fpostype=''
979 gccansipedantic=''
980 gccosandvers=''
981 gccversion=''
982 gidformat=''
983 gidsign=''
984 gidsize=''
985 gidtype=''
986 groupstype=''
987 h_fcntl=''
988 h_sysfile=''
989 html1dir=''
990 html1direxp=''
991 installhtml1dir=''
992 html3dir=''
993 html3direxp=''
994 installhtml3dir=''
995 i_arpainet=''
996 i_bfd=''
997 i_crypt=''
998 db_hashtype=''
999 db_prefixtype=''
1000 db_version_major=''
1001 db_version_minor=''
1002 db_version_patch=''
1003 i_db=''
1004 i_dbm=''
1005 i_rpcsvcdbm=''
1006 d_dirnamlen=''
1007 direntrytype=''
1008 i_dirent=''
1009 i_dlfcn=''
1010 i_execinfo=''
1011 i_fcntl=''
1012 i_fenv=''
1013 i_fp=''
1014 i_fp_class=''
1015 i_gdbm=''
1016 d_grpasswd=''
1017 i_grp=''
1018 i_ieeefp=''
1019 i_inttypes=''
1020 i_langinfo=''
1021 i_libutil=''
1022 i_locale=''
1023 i_machcthr=''
1024 i_malloc=''
1025 i_mallocmalloc=''
1026 i_mntent=''
1027 d_gdbm_ndbm_h_uses_prototypes=''
1028 d_gdbmndbm_h_uses_prototypes=''
1029 d_ndbm=''
1030 d_ndbm_h_uses_prototypes=''
1031 i_gdbm_ndbm=''
1032 i_gdbmndbm=''
1033 i_ndbm=''
1034 i_netdb=''
1035 i_neterrno=''
1036 i_netinettcp=''
1037 i_niin=''
1038 i_sysin=''
1039 i_poll=''
1040 i_prot=''
1041 i_pthread=''
1042 d_pwage=''
1043 d_pwchange=''
1044 d_pwclass=''
1045 d_pwcomment=''
1046 d_pwexpire=''
1047 d_pwgecos=''
1048 d_pwpasswd=''
1049 d_pwquota=''
1050 i_pwd=''
1051 i_quadmath=''
1052 i_shadow=''
1053 i_socks=''
1054 i_stdbool=''
1055 i_stdint=''
1056 i_stdlib=''
1057 i_sunmath=''
1058 i_sysaccess=''
1059 i_sysdir=''
1060 i_sysfile=''
1061 d_voidtty=''
1062 i_bsdioctl=''
1063 i_sysfilio=''
1064 i_sysioctl=''
1065 i_syssockio=''
1066 i_syslog=''
1067 i_sysmman=''
1068 i_sysmode=''
1069 i_sysmount=''
1070 i_sysndir=''
1071 i_sysparam=''
1072 i_syspoll=''
1073 i_sysresrc=''
1074 i_syssecrt=''
1075 i_sysselct=''
1076 i_sysstat=''
1077 i_sysstatfs=''
1078 i_sysstatvfs=''
1079 i_syssyscall=''
1080 i_systimes=''
1081 i_systypes=''
1082 i_sysuio=''
1083 i_sysun=''
1084 i_sysutsname=''
1085 i_sysvfs=''
1086 i_syswait=''
1087 i_sgtty=''
1088 i_termio=''
1089 i_termios=''
1090 d_tm_tm_gmtoff=''
1091 d_tm_tm_zone=''
1092 i_systime=''
1093 i_systimek=''
1094 i_time=''
1095 timeincl=''
1096 i_unistd=''
1097 i_ustat=''
1098 i_utime=''
1099 i_vfork=''
1100 i_wchar=''
1101 i_wctype=''
1102 d_inc_version_list=''
1103 inc_version_list=''
1104 inc_version_list_init=''
1105 doubleinfbytes=''
1106 doublenanbytes=''
1107 longdblinfbytes=''
1108 longdblnanbytes=''
1109 installprefix=''
1110 installprefixexp=''
1111 installstyle=''
1112 installusrbinperl=''
1113 intsize=''
1114 longsize=''
1115 shortsize=''
1116 issymlink=''
1117 libc=''
1118 ldlibpthname=''
1119 libperl=''
1120 shrpenv=''
1121 useshrplib=''
1122 glibpth=''
1123 incpth=''
1124 libpth=''
1125 loclibpth=''
1126 plibpth=''
1127 xlibpth=''
1128 ignore_versioned_solibs=''
1129 libs=''
1130 libsdirs=''
1131 libsfiles=''
1132 libsfound=''
1133 libspath=''
1134 lns=''
1135 d_PRIEUldbl=''
1136 d_PRIFUldbl=''
1137 d_PRIGUldbl=''
1138 d_PRIeldbl=''
1139 d_PRIfldbl=''
1140 d_PRIgldbl=''
1141 d_SCNfldbl=''
1142 d_double_has_inf=''
1143 d_double_has_nan=''
1144 d_double_has_negative_zero=''
1145 d_double_has_subnormals=''
1146 d_double_style_cray=''
1147 d_double_style_ibm=''
1148 d_double_style_ieee=''
1149 d_double_style_vax=''
1150 doublekind=''
1151 sPRIEUldbl=''
1152 sPRIFUldbl=''
1153 sPRIGUldbl=''
1154 sPRIeldbl=''
1155 sPRIfldbl=''
1156 sPRIgldbl=''
1157 sSCNfldbl=''
1158 lseeksize=''
1159 lseektype=''
1160 make_set_make=''
1161 d_mymalloc=''
1162 freetype=''
1163 mallocobj=''
1164 mallocsrc=''
1165 malloctype=''
1166 usemallocwrap=''
1167 usemymalloc=''
1168 installman1dir=''
1169 man1dir=''
1170 man1direxp=''
1171 man1ext=''
1172 installman3dir=''
1173 man3dir=''
1174 man3direxp=''
1175 man3ext=''
1176 doublemantbits=''
1177 longdblmantbits=''
1178 nvmantbits=''
1179 modetype=''
1180 multiarch=''
1181 mydomain=''
1182 myhostname=''
1183 phostname=''
1184 c=''
1185 n=''
1186 d_eofnblk=''
1187 eagain=''
1188 o_nonblock=''
1189 rd_nodata=''
1190 need_va_copy=''
1191 netdb_hlen_type=''
1192 netdb_host_type=''
1193 netdb_name_type=''
1194 netdb_net_type=''
1195 groupcat=''
1196 hostcat=''
1197 passcat=''
1198 orderlib=''
1199 ranlib=''
1200 d_perl_otherlibdirs=''
1201 otherlibdirs=''
1202 package=''
1203 spackage=''
1204 pager=''
1205 api_revision=''
1206 api_subversion=''
1207 api_version=''
1208 api_versionstring=''
1209 patchlevel=''
1210 perl_patchlevel=''
1211 revision=''
1212 subversion=''
1213 version=''
1214 version_patchlevel_string=''
1215 perl5=''
1216 perladmin=''
1217 perlpath=''
1218 i32dformat=''
1219 u32XUformat=''
1220 u32oformat=''
1221 u32uformat=''
1222 u32xformat=''
1223 d_nv_preserves_uv=''
1224 d_nv_zero_is_allbits_zero=''
1225 i16size=''
1226 i16type=''
1227 i32size=''
1228 i32type=''
1229 i64size=''
1230 i64type=''
1231 i8size=''
1232 i8type=''
1233 ivsize=''
1234 ivtype=''
1235 nv_overflows_integers_at=''
1236 nv_preserves_uv_bits=''
1237 nvsize=''
1238 nvtype=''
1239 u16size=''
1240 u16type=''
1241 u32size=''
1242 u32type=''
1243 u64size=''
1244 u64type=''
1245 u8size=''
1246 u8type=''
1247 uvsize=''
1248 uvtype=''
1249 ivdformat=''
1250 nvEUformat=''
1251 nvFUformat=''
1252 nvGUformat=''
1253 nveformat=''
1254 nvfformat=''
1255 nvgformat=''
1256 uvXUformat=''
1257 uvoformat=''
1258 uvuformat=''
1259 uvxformat=''
1260 pidtype=''
1261 prefix=''
1262 prefixexp=''
1263 installprivlib=''
1264 privlib=''
1265 privlibexp=''
1266 ptrsize=''
1267 d_PRIXU64=''
1268 d_PRId64=''
1269 d_PRIi64=''
1270 d_PRIo64=''
1271 d_PRIu64=''
1272 d_PRIx64=''
1273 sPRIXU64=''
1274 sPRId64=''
1275 sPRIi64=''
1276 sPRIo64=''
1277 sPRIu64=''
1278 sPRIx64=''
1279 d_quad=''
1280 quadkind=''
1281 quadtype=''
1282 uquadtype=''
1283 drand01=''
1284 randbits=''
1285 randfunc=''
1286 randseedtype=''
1287 seedfunc=''
1288 installscript=''
1289 scriptdir=''
1290 scriptdirexp=''
1291 selectminbits=''
1292 selecttype=''
1293 sh=''
1294 targetsh=''
1295 sig_count=''
1296 sig_name=''
1297 sig_name_init=''
1298 sig_num=''
1299 sig_num_init=''
1300 sig_size=''
1301 d_sitearch=''
1302 installsitearch=''
1303 sitearch=''
1304 sitearchexp=''
1305 installsitebin=''
1306 sitebin=''
1307 sitebinexp=''
1308 installsitehtml1dir=''
1309 sitehtml1dir=''
1310 sitehtml1direxp=''
1311 installsitehtml3dir=''
1312 sitehtml3dir=''
1313 sitehtml3direxp=''
1314 installsitelib=''
1315 sitelib=''
1316 sitelib_stem=''
1317 sitelibexp=''
1318 installsiteman1dir=''
1319 siteman1dir=''
1320 siteman1direxp=''
1321 installsiteman3dir=''
1322 siteman3dir=''
1323 siteman3direxp=''
1324 siteprefix=''
1325 siteprefixexp=''
1326 installsitescript=''
1327 sitescript=''
1328 sitescriptexp=''
1329 sizesize=''
1330 sizetype=''
1331 d_libname_unique=''
1332 so=''
1333 socksizetype=''
1334 sharpbang=''
1335 shsharp=''
1336 spitshell=''
1337 src=''
1338 ssizetype=''
1339 st_dev_sign=''
1340 st_dev_size=''
1341 st_ino_sign=''
1342 st_ino_size=''
1343 startperl=''
1344 startsh=''
1345 stdchar=''
1346 d_stdio_stream_array=''
1347 stdio_stream_array=''
1348 sysman=''
1349 sGMTIME_max=''
1350 sGMTIME_min=''
1351 sLOCALTIME_max=''
1352 sLOCALTIME_min=''
1353 trnl=''
1354 uidformat=''
1355 uidsign=''
1356 uidsize=''
1357 uidtype=''
1358 archname64=''
1359 use64bitall=''
1360 use64bitint=''
1361 usecbacktrace=''
1362 usedefaultstrict=''
1363 dtrace=''
1364 usedtrace=''
1365 usefaststdio=''
1366 usekernprocpathname=''
1367 ccflags_uselargefiles=''
1368 ldflags_uselargefiles=''
1369 libswanted_uselargefiles=''
1370 uselargefiles=''
1371 uselongdouble=''
1372 usemorebits=''
1373 usemultiplicity=''
1374 nm_opt=''
1375 nm_so_opt=''
1376 runnm=''
1377 usenm=''
1378 usensgetexecutablepath=''
1379 useperlio=''
1380 usequadmath=''
1381 usesocks=''
1382 d_oldpthreads=''
1383 useithreads=''
1384 usereentrant=''
1385 usethreads=''
1386 incpath=''
1387 mips_type=''
1388 usrinc=''
1389 d_vendorarch=''
1390 installvendorarch=''
1391 vendorarch=''
1392 vendorarchexp=''
1393 d_vendorbin=''
1394 installvendorbin=''
1395 vendorbin=''
1396 vendorbinexp=''
1397 installvendorhtml1dir=''
1398 vendorhtml1dir=''
1399 vendorhtml1direxp=''
1400 installvendorhtml3dir=''
1401 vendorhtml3dir=''
1402 vendorhtml3direxp=''
1403 d_vendorlib=''
1404 installvendorlib=''
1405 vendorlib=''
1406 vendorlib_stem=''
1407 vendorlibexp=''
1408 installvendorman1dir=''
1409 vendorman1dir=''
1410 vendorman1direxp=''
1411 installvendorman3dir=''
1412 vendorman3dir=''
1413 vendorman3direxp=''
1414 usevendorprefix=''
1415 vendorprefix=''
1416 vendorprefixexp=''
1417 d_vendorscript=''
1418 installvendorscript=''
1419 vendorscript=''
1420 vendorscriptexp=''
1421 versiononly=''
1422 yacc=''
1423 yaccflags=''
1424 CONFIG=''
1425
1426 : Detect odd OSs
1427 define='define'
1428 undef='undef'
1429 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1430 rmlist=''
1431
1432 : We must find out about Eunice early
1433 eunicefix=':'
1434 if test -f /etc/unixtovms; then
1435 eunicefix=/etc/unixtovms
1436 fi
1437 if test -f /etc/unixtovms.exe; then
1438 eunicefix=/etc/unixtovms.exe
1439 fi
1440
1441 : Set executable suffix now -- needed before hints available
1442 if test -f "/libs/version.library"; then
1443 : Amiga OS
1444 _exe=""
1445 elif test -f "/system/gnu_library/bin/ar.pm"; then
1446 : Stratus VOS
1447 _exe=".pm"
1448 elif test -n "$DJGPP"; then
1449 : DOS DJGPP
1450 _exe=".exe"
1451 elif test -f /kern/cookiejar; then
1452 : MiNT
1453 _exe=""
1454 elif test -d c:/. -o -n "$is_os2" ; then
1455 : OS/2 or cygwin
1456 _exe=".exe"
1457 fi
1458
1459 groupstype=''
1460 i_whoami=''
1461 : Possible local include directories to search.
1462 : Set locincpth to "" in a hint file to defeat local include searches.
1463 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1464 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1465 :
1466 : no include file wanted by default
1467 inclwanted=''
1468
1469 : Enable -DEBUGGING and -DDEBUGGING from the command line
1470 EBUGGING=''
1471 DEBUGGING=''
1472
1473 : Trailing extension. Override this in a hint file, if needed.
1474 : Extra object files, if any, needed on this platform.
1475 archobjs=''
1476 libnames=''
1477 : change the next line if compiling for Xenix/286 on Xenix/386
1478 xlibpth='/usr/lib/386 /lib/386'
1479 : Possible local library directories to search.
1480 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1481 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1482
1483 : general looking path for locating libraries
1484 glibpth="/lib /usr/lib $xlibpth"
1485 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1486 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1487 test -f /shlib/libc.so && glibpth="/shlib $glibpth"
1488
1489 : Private path used by Configure to find libraries. Its value
1490 : is prepended to libpth. This variable takes care of special
1491 : machines, like the mips. Usually, it should be empty.
1492 plibpth=''
1493
1494 : default library list
1495 libswanted=''
1496 : some systems want to use only the non-versioned libso:s
1497 ignore_versioned_solibs=''
1498 ccname=''
1499 ccversion=''
1500 perllibs=''
1501 : set useposix=false in your hint file to disable the POSIX extension.
1502 useposix=true
1503 : set useopcode=false in your hint file to disable the Opcode extension.
1504 useopcode=true
1505 : set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
1506 uselanginfo=true
1507 archname64=''
1508 ccflags_uselargefiles=''
1509 ldflags_uselargefiles=''
1510 libswanted_uselargefiles=''
1511 : set usemultiplicity on the Configure command line to enable multiplicity.
1512 : set usesocks on the Configure command line to enable socks.
1513 archname=''
1514 : set usethreads on the Configure command line to enable threads.
1515 usereentrant='undef'
1516 : List of libraries we want.
1517 : If anyone needs extra -lxxx, put those in a hint file.
1518 libswanted='gdbm gdbm_compat db dl m c crypt'
1519 : We probably want to search /usr/shlib before most other libraries.
1520 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1521 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1522 glibpth="/usr/shlib $glibpth"
1523 : Do not use vfork unless overridden by a hint file.
1524 usevfork=false
1525
1526 : Find the basic shell for Bourne shell scripts
1527 case "$sh" in
1528 '')
1529 case "$SYSTYPE" in
1530 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1531 *) xxx='/bin/sh';;
1532 esac
1533 if test -f "$xxx"; then
1534 sh="$xxx"
1535 else
1536 : Build up a list and do a single loop so we can 'break' out.
1537 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1538 for xxx in sh bash ksh pdksh ash; do
1539 for p in $pth; do
1540 try="$try ${p}/${xxx}"
1541 done
1542 done
1543 for xxx in $try; do
1544 if test -f "$xxx"; then
1545 sh="$xxx";
1546 break
1547 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1548 sh="$xxx";
1549 break
1550 elif test -f "$xxx.exe"; then
1551 sh="$xxx";
1552 break
1553 fi
1554 done
1555 fi
1556 ;;
1557 esac
1558
1559 case "$sh" in
1560 '') cat >&2 <<EOM
1561 $me: Fatal Error: I can't find a Bourne Shell anywhere.
1562
1563 Usually it's in /bin/sh. How did you even get this far?
1564 Please report this issue at https://github.com/Perl/perl5/issues
1565 and we'll try to straighten this all out.
1566 EOM
1567 exit 1
1568 ;;
1569 esac
1570
1571 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1572 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1573 targetsh=$sh
1574
1575 : see if sh knows # comments
1576 if `$sh -c '#' >/dev/null 2>&1`; then
1577 shsharp=true
1578 spitshell=cat
1579 xcat=/bin/cat
1580 test -f $xcat$_exe || xcat=/usr/bin/cat
1581 if test ! -f $xcat$_exe; then
1582 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1583 if test -f $p/cat$_exe; then
1584 xcat=$p/cat
1585 break
1586 fi
1587 done
1588 if test ! -f $xcat$_exe; then
1589 echo "Can't find cat anywhere!"
1590 exit 1
1591 fi
1592 fi
1593 echo "#!$xcat" >sharp
1594 $eunicefix sharp
1595 chmod +x sharp
1596 ./sharp > today 2>/dev/null
1597 if test -s today; then
1598 sharpbang='#!'
1599 else
1600 echo "#! $xcat" > sharp
1601 $eunicefix sharp
1602 chmod +x sharp
1603 ./sharp > today 2>/dev/null
1604 if test -s today; then
1605 sharpbang='#! '
1606 else
1607 sharpbang=': use '
1608 fi
1609 fi
1610 else
1611 echo " "
1612 echo "Your $sh doesn't grok # comments--I will strip them later on."
1613 shsharp=false
1614 cd ..
1615 echo "exec grep -v '^[ ]*#'" >spitshell
1616 chmod +x spitshell
1617 $eunicefix spitshell
1618 spitshell=`pwd`/spitshell
1619 cd UU
1620 echo "I presume that if # doesn't work, #! won't work either!"
1621 sharpbang=': use '
1622 fi
1623 rm -f sharp today
1624
1625 : figure out how to guarantee sh startup
1626 case "$startsh" in
1627 '') startsh=${sharpbang}${sh} ;;
1628 *)
1629 esac
1630 cat >sharp <<EOSS
1631 $startsh
1632 set abc
1633 test "$?abc" != 1
1634 EOSS
1635
1636 chmod +x sharp
1637 $eunicefix sharp
1638 if ./sharp; then
1639 : echo "Yup, it does."
1640 else
1641 echo "Hmm... '$startsh' does not guarantee sh startup..."
1642 echo "You may have to fix up the shell scripts to make sure $sh runs them."
1643 fi
1644 rm -f sharp
1645
1646 : Save command line options in file UU/cmdline.opt for later use in
1647 : generating config.sh.
1648 cat > cmdline.opt <<EOSH
1649 : Configure command line arguments.
1650 config_arg0='$0'
1651 config_args='$*'
1652 config_argc=$#
1653 EOSH
1654 argn=1
1655 args_exp=''
1656 args_sep=''
1657 for arg in "$@"; do
1658 cat >>cmdline.opt <<EOSH
1659 config_arg$argn='$arg'
1660 EOSH
1661 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1662 $arg
1663 EOC
1664 arg_exp=`cat cmdl.opt`
1665 args_exp="$args_exp$args_sep'$arg_exp'"
1666 argn=`expr $argn + 1`
1667 args_sep=' '
1668 done
1669 rm -f cmdl.opt
1670
1671 : produce awk script to parse command line options
1672 cat >options.awk <<'EOF'
1673 BEGIN {
1674 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
1675
1676 len = length(optstr);
1677 for (i = 1; i <= len; i++) {
1678 c = substr(optstr, i, 1);
1679 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1680 if (a == ":") {
1681 arg[c] = 1;
1682 i++;
1683 }
1684 opt[c] = 1;
1685 }
1686 }
1687 {
1688 expect = 0;
1689 str = $0;
1690 if (substr(str, 1, 1) != "-") {
1691 printf("'%s'\n", str);
1692 next;
1693 }
1694 len = length($0);
1695 for (i = 2; i <= len; i++) {
1696 c = substr(str, i, 1);
1697 if (!opt[c]) {
1698 printf("-%s\n", substr(str, i));
1699 next;
1700 }
1701 printf("-%s\n", c);
1702 if (arg[c]) {
1703 if (i < len)
1704 printf("'%s'\n", substr(str, i + 1));
1705 else
1706 expect = 1;
1707 next;
1708 }
1709 }
1710 }
1711 END {
1712 if (expect)
1713 print "?";
1714 }
1715 EOF
1716
1717 : process the command line options
1718 set X `for arg in "$@"; do echo "X$arg"; done |
1719 sed -e s/X// | awk -f options.awk`
1720 eval "set $*"
1721 shift
1722 rm -f options.awk
1723
1724 : set up default values
1725 fastread=''
1726 reuseval=false
1727 config_sh=''
1728 alldone=''
1729 error=''
1730 silent=''
1731 extractsh=''
1732 knowitall=''
1733 rm -f optdef.sh posthint.sh
1734 cat >optdef.sh <<EOS
1735 $startsh
1736 EOS
1737
1738
1739 : option parsing
1740 while test $# -gt 0; do
1741 case "$1" in
1742 -d) shift; fastread=yes;;
1743 -e) shift; alldone=cont;;
1744 -f)
1745 shift
1746 cd ..
1747 if test -r "$1"; then
1748 config_sh="$1"
1749 else
1750 echo "$me: cannot read config file $1." >&2
1751 error=true
1752 fi
1753 cd UU
1754 shift;;
1755 --help|\
1756 -h) shift; error=true;;
1757 -r) shift; reuseval=true;;
1758 -s) shift; silent=true; realsilent=true;;
1759 -E) shift; alldone=exit;;
1760 -K) shift; knowitall=true;;
1761 -O) shift;;
1762 -S) shift; silent=true; extractsh=true;;
1763 -D)
1764 shift
1765 case "$1" in
1766 *=)
1767 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1768 echo "$me: ignoring -D $1" >&2
1769 ;;
1770 *=*) echo "$1" | \
1771 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1772 *) echo "$1='define'" >> optdef.sh;;
1773 esac
1774 shift
1775 ;;
1776 -U)
1777 shift
1778 case "$1" in
1779 *=) echo "$1" >> optdef.sh;;
1780 *=*)
1781 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1782 echo "$me: ignoring -U $1" >&2
1783 ;;
1784 *) echo "$1='undef'" >> optdef.sh;;
1785 esac
1786 shift
1787 ;;
1788 -A)
1789 shift
1790 xxx=''
1791 yyy="$1"
1792 zzz=''
1793 uuu=undef
1794 case "$yyy" in
1795 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1796 case "$zzz" in
1797 *:*) zzz='' ;;
1798 *) xxx=append
1799 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1800 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1801 esac
1802 ;;
1803 esac
1804 case "$xxx" in
1805 '') case "$yyy" in
1806 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1807 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1808 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1809 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1810 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1811 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1812 esac
1813 ;;
1814 esac
1815 case "$xxx" in
1816 append)
1817 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
1818 clear)
1819 echo "$yyy=''" >> posthint.sh ;;
1820 define)
1821 case "$zzz" in
1822 '') zzz=define ;;
1823 esac
1824 echo "$yyy='$zzz'" >> posthint.sh ;;
1825 eval)
1826 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
1827 prepend)
1828 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
1829 undef)
1830 case "$zzz" in
1831 '') zzz="$uuu" ;;
1832 esac
1833 echo "$yyy=$zzz" >> posthint.sh ;;
1834 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1835 esac
1836 shift
1837 ;;
1838 -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1839 exit 0;;
1840 --) break;;
1841 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1842 *) break;;
1843 esac
1844 done
1845
1846 case "$error" in
1847 true)
1848 cat >&2 <<EOM
1849 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1850 [-U symbol] [-U symbol=] [-A command:symbol...]
1851 -d : use defaults for all answers.
1852 -e : go on without questioning past the production of config.sh.
1853 -f : specify an alternate default configuration file.
1854 -h : print this help message and exit (with an error status).
1855 -r : reuse C symbols value if possible (skips costly nm extraction).
1856 -s : silent mode, only echoes questions and essential information.
1857 -D : define symbol to have some value:
1858 -D symbol symbol gets the value 'define'
1859 -D symbol='some value' symbol is set to 'some value'
1860 common used examples (see INSTALL for more info):
1861 -Duse64bitint use 64bit integers
1862 -Duse64bitall use 64bit integers and pointers
1863 -Dusethreads use thread support
1864 -Dinc_version_list=none do not include older perl trees in @INC
1865 -DEBUGGING=none DEBUGGING options
1866 -Dcc=gcc choose your compiler
1867 -Dprefix=/opt/perl5 choose your destination
1868 -E : stop at the end of questions, after having produced config.sh.
1869 -K : do not use unless you know what you are doing.
1870 -O : ignored for backward compatibility
1871 -S : perform variable substitutions on all .SH files (can mix with -f)
1872 -U : undefine symbol:
1873 -U symbol symbol gets the value 'undef'
1874 -U symbol= symbol gets completely empty
1875 e.g.: -Uversiononly
1876 -A : manipulate symbol after the platform specific hints have been applied:
1877 -A append:symbol=value append value to symbol
1878 -A symbol=value like append:, but with a separating space
1879 -A define:symbol=value define symbol to have value
1880 -A clear:symbol define symbol to be ''
1881 -A define:symbol define symbol to be 'define'
1882 -A eval:symbol=value define symbol to be eval of value
1883 -A prepend:symbol=value prepend value to symbol
1884 -A undef:symbol define symbol to be 'undef'
1885 -A undef:symbol= define symbol to be ''
1886 e.g.: -A prepend:libswanted='cl pthread '
1887 -A ccflags=-DSOME_MACRO
1888 -V : print version number and exit (with a zero status).
1889 EOM
1890 exit 1
1891 ;;
1892 esac
1893
1894 : Sanity checks
1895 case "$fastread$alldone" in
1896 yescont|yesexit) ;;
1897 *)
1898 case "$extractsh" in
1899 true) ;;
1900 *)
1901 if test ! -t 0; then
1902 echo "Say 'sh Configure', not 'sh <Configure'"
1903 exit 1
1904 fi
1905 ;;
1906 esac
1907 ;;
1908 esac
1909
1910 exec 4>&1
1911 case "$silent" in
1912 true) exec 1>/dev/null;;
1913 esac
1914
1915 : run the defines and the undefines, if any, but leave the file out there...
1916 touch optdef.sh
1917 grep '\\' optdef.sh >/dev/null 2>&1
1918 if test $? = 0; then
1919 echo "Configure does not support \\ in -D arguments"
1920 exit 1
1921 fi
1922 . ./optdef.sh
1923 : create the posthint manipulation script and leave the file out there...
1924 touch posthint.sh
1925
1926 : set package name
1927 package='perl5'
1928 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1929 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1930 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1931 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1932 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1933 esac
1934
1935 : Some greps do not return status, grrr.
1936 echo "grimblepritz" >grimble
1937 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1938 contains=contains
1939 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1940 contains=grep
1941 else
1942 contains=contains
1943 fi
1944 rm -f grimble
1945 : the following should work in any shell
1946 case "$contains" in
1947 contains*)
1948 echo " " >&4
1949 echo "AGH! Grep doesn't return a status. Attempting remedial action." >&4
1950 cat >contains <<'EOSS'
1951 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1952 EOSS
1953 contains=./contains
1954 chmod +x $contains
1955 esac
1956
1957 : Find the path to the source tree
1958 case "$src" in
1959 '') case "$0" in
1960 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1961 case "$src" in
1962 /*) ;;
1963 .) ;;
1964 *) src=`cd ../$src && pwd` ;;
1965 esac
1966 ;;
1967 *) src='.';;
1968 esac;;
1969 esac
1970 case "$src" in
1971 '') src=/
1972 rsrc=/
1973 ;;
1974 /*) rsrc="$src";;
1975 *) rsrc="../$src";;
1976 esac
1977 if test -f $rsrc/Configure && \
1978 $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1979 then
1980 : found it, so we are ok.
1981 else
1982 rsrc=''
1983 for src in . .. ../.. ../../.. ../../../..; do
1984 if test -f ../$src/Configure && \
1985 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1986 then
1987 rsrc=../$src
1988 break
1989 fi
1990 done
1991 fi
1992 case "$rsrc" in
1993 '')
1994 cat <<EOM >&4
1995
1996 Sorry, I can't seem to locate the source dir for $package. Please start
1997 Configure with an explicit path -- i.e. /some/path/Configure.
1998
1999 EOM
2000 exit 1
2001 ;;
2002 ../.) rsrc='..';;
2003 *)
2004 echo " "
2005 echo "Sources for $package found in \"$src\"." >&4
2006 ;;
2007 esac
2008
2009 : script used to extract .SH files with variable substitutions
2010 cat >extract <<'EOS'
2011 PERL_CONFIG_SH=true
2012 echo "Doing variable substitutions on .SH files..."
2013 if test -f MANIFEST; then
2014 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
2015 else
2016 echo "(Looking for .SH files under the source directory.)"
2017 set x `(cd "$src"; find . -name "*.SH" -print)`
2018 fi
2019 shift
2020 case $# in
2021 0) set x `(cd "$src"; echo *.SH)`; shift;;
2022 esac
2023 if test ! -f "$src/$1"; then
2024 shift
2025 fi
2026 mkdir_p='
2027 name=$1;
2028 create="";
2029 while test $name; do
2030 if test ! -d "$name"; then
2031 create="$name $create";
2032 name=`echo $name | sed -e "s|^[^/]*$||"`;
2033 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2034 else
2035 name="";
2036 fi;
2037 done;
2038 for file in $create; do
2039 mkdir $file;
2040 done
2041 '
2042 for file in $*; do
2043 case "$src" in
2044 ".")
2045 case "$file" in
2046 */*)
2047 dir=`expr X$file : 'X\(.*\)/'`
2048 file=`expr X$file : 'X.*/\(.*\)'`
2049 (cd "$dir" && . ./$file)
2050 ;;
2051 *)
2052 . ./$file
2053 ;;
2054 esac
2055 ;;
2056 *)
2057 case "$file" in
2058 */*)
2059 dir=`expr X$file : 'X\(.*\)/'`
2060 file=`expr X$file : 'X.*/\(.*\)'`
2061 (set x $dir; shift; eval $mkdir_p)
2062 sh <"$src/$dir/$file"
2063 ;;
2064 *)
2065 sh <"$src/$file"
2066 ;;
2067 esac
2068 ;;
2069 esac
2070 done
2071 if test -f "$src/config_h.SH"; then
2072 if test ! -f config.h; then
2073 : oops, they left it out of MANIFEST, probably, so do it anyway.
2074 . "$src/config_h.SH"
2075 fi
2076 fi
2077 EOS
2078
2079 : extract files and exit if asked to do so
2080 case "$extractsh" in
2081 true)
2082 case "$realsilent" in
2083 true) ;;
2084 *) exec 1>&4;;
2085 esac
2086 case "$config_sh" in
2087 '') config_sh='config.sh';;
2088 esac
2089 echo " "
2090 echo "Fetching answers from $config_sh..."
2091 cd ..
2092 . $config_sh
2093 . UU/optdef.sh
2094 echo " "
2095 . UU/extract
2096 rm -rf UU
2097 echo "Extraction done."
2098 exit 0
2099 ;;
2100 esac
2101
2102 : Eunice requires " " instead of "", can you believe it
2103 echo " "
2104 : Here we go...
2105 echo "Beginning of configuration questions for $package."
2106
2107 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2108
2109 : first determine how to suppress newline on echo command
2110 echo " "
2111 echo "Checking echo to see how to suppress newlines..."
2112 (echo "hi there\c" ; echo " ") >.echotmp
2113 if $contains c .echotmp >/dev/null 2>&1 ; then
2114 echo "...using -n."
2115 n='-n'
2116 c=''
2117 else
2118 cat <<'EOM'
2119 ...using \c
2120 EOM
2121 n=''
2122 c='\c'
2123 fi
2124 echo $n "The star should be here-->$c"
2125 echo '*'
2126 rm -f .echotmp
2127
2128 : Now test for existence of everything in MANIFEST
2129 echo " "
2130 if test -f "$rsrc/MANIFEST"; then
2131 echo "First let's make sure your kit is complete. Checking..." >&4
2132 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2133 (split -l 50 2>/dev/null || split -50)
2134 rm -f missing
2135 tmppwd=`pwd`
2136 for filelist in x??; do
2137 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2138 >/dev/null 2>>"$tmppwd/missing")
2139 done
2140 if test -s missing; then
2141 cat missing >&4
2142 cat >&4 <<'EOM'
2143
2144 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2145
2146 You have the option of continuing the configuration process, despite the
2147 distinct possibility that your kit is damaged, by typing 'y'es. If you
2148 do, don't blame me if something goes wrong. I advise you to type 'n'o
2149 and contact the author (https://github.com/Perl/perl5/issues).
2150
2151 EOM
2152 echo $n "Continue? [n] $c" >&4
2153 read ans
2154 case "$ans" in
2155 y*)
2156 echo "Continuing..." >&4
2157 rm -f missing
2158 ;;
2159 *)
2160 echo "ABORTING..." >&4
2161 kill $$
2162 ;;
2163 esac
2164 else
2165 echo "Looks good..."
2166 fi
2167 else
2168 echo "There is no MANIFEST file. I hope your kit is complete !"
2169 fi
2170 rm -f missing x??
2171
2172 : Find the appropriate value for a newline for tr
2173 if test -n "$DJGPP"; then
2174 trnl='\012'
2175 fi
2176 if test X"$trnl" = X; then
2177 case "`echo foo | tr '\n' x 2>/dev/null`" in
2178 foox) trnl='\n' ;;
2179 esac
2180 fi
2181 if test X"$trnl" = X; then
2182 case "`echo foo | tr '\012' x 2>/dev/null`" in
2183 foox) trnl='\012' ;;
2184 esac
2185 fi
2186 if test X"$trnl" = X; then
2187 case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2188 fooxy) trnl='\n\r' ;;
2189 esac
2190 fi
2191 if test X"$trnl" = X; then
2192 cat <<EOM >&2
2193
2194 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2195
2196 EOM
2197 exit 1
2198 fi
2199
2200 : compute the number of columns on the terminal for proper question formatting
2201 case "$COLUMNS" in
2202 '') COLUMNS='80';;
2203 esac
2204
2205 : set up the echo used in my read
2206 myecho="case \"\$xxxm\" in
2207 '') echo $n \"\$rp $c\" >&4;;
2208 *) case \"\$rp\" in
2209 '') echo $n \"[\$xxxm] $c\";;
2210 *)
2211 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2212 echo \"\$rp\" >&4
2213 echo $n \"[\$xxxm] $c\" >&4
2214 else
2215 echo $n \"\$rp [\$xxxm] $c\" >&4
2216 fi
2217 ;;
2218 esac;;
2219 esac"
2220
2221 : now set up to do reads with possible shell escape and default assignment
2222 cat <<EOSC >myread
2223 $startsh
2224 xxxm=\$dflt
2225 $myecho
2226 ans='!'
2227 counter=42
2228 case "\$fastread" in
2229 yes) case "\$dflt" in
2230 '') ;;
2231 *) ans='';
2232 case "\$silent-\$rp" in
2233 true-) ;;
2234 *) echo " " >&4;;
2235 esac;;
2236 esac;;
2237 *) case "\$silent" in
2238 true) case "\$rp" in
2239 '') ans='';;
2240 esac;;
2241 esac;;
2242 esac
2243 while expr "X\$ans" : "X!" >/dev/null; do
2244 read answ
2245 set x \$xxxm
2246 shift
2247 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2248 case "\$answ" in
2249 "!")
2250 sh 1>&4
2251 echo " "
2252 $myecho
2253 ;;
2254 !*)
2255 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2256 shift
2257 sh 1>&4 -c "\$*"
2258 echo " "
2259 $myecho
2260 ;;
2261 "\$ans")
2262 case "\$ans" in
2263 \\&*)
2264 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2265 shift
2266 case "\$1" in
2267 -d)
2268 fastread=yes
2269 echo "(OK, I'll run with -d after this question.)" >&4
2270 ;;
2271 -*)
2272 echo "*** Sorry, \$1 not supported yet." >&4
2273 ;;
2274 esac
2275 $myecho
2276 ans=!
2277 ;;
2278 esac;;
2279 *)
2280 case "\$aok" in
2281 y)
2282 echo "*** Substitution done -- please confirm."
2283 xxxm="\$ans"
2284 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2285 xxxm="\$ans"
2286 ans=!
2287 ;;
2288 *)
2289 echo "*** Error -- try again."
2290 ans=!
2291 ;;
2292 esac
2293 $myecho
2294 ;;
2295 esac
2296 case "\$ans\$xxxm\$nostick" in
2297 '')
2298 ans=!
2299 $myecho
2300 ;;
2301 esac
2302 counter=\`echo \$counter | awk '{ print --\$0 }'\`
2303 if [ \$counter = 0 ]; then
2304 echo >&4
2305 echo >&4 Too many attempts asking the same question. Giving up.
2306 exit 1
2307 fi
2308 done
2309 case "\$ans" in
2310 '') ans="\$xxxm";;
2311 esac
2312 EOSC
2313
2314 : create .config dir to save info across Configure sessions
2315 test -d ../.config || mkdir ../.config
2316 cat >../.config/README <<EOF
2317 This directory created by Configure to save information that should
2318 persist across sessions for $package.
2319
2320 You may safely delete it if you wish.
2321 EOF
2322
2323 : See if we are using a devel version and want that
2324 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2325 case "$usedevel" in
2326 $define|true|[yY]*)
2327 usedevel="$define" ;;
2328 *) case "$xversion" in
2329 *[13579])
2330 cat >&4 <<EOH
2331 *** WHOA THERE!!! ***
2332
2333 This is an UNSTABLE DEVELOPMENT release.
2334 The version of this $package distribution is $xversion, that is, odd,
2335 (as opposed to even) and that signifies a development release.
2336 If you want a maintenance release, you want an even-numbered version.
2337
2338 Do ***NOT*** install this into production use.
2339 Data corruption and crashes are possible.
2340
2341 It is most seriously suggested that you do not continue any further
2342 unless you want to help in developing and debugging Perl.
2343
2344 If you *still* want to build perl, you can answer 'y' now,
2345 or pass -Dusedevel to Configure.
2346
2347 EOH
2348 rp='Do you really want to continue?'
2349 dflt='n'
2350 . ./myread
2351 case "$ans" in
2352 [yY]) echo >&4 "Okay, continuing."
2353 usedevel="$define" ;;
2354 *) echo >&4 "Okay, bye."
2355 exit 1
2356 ;;
2357 esac
2358 ;;
2359 esac
2360 usedevel="$undef"
2361 ;;
2362 esac
2363 case "$usedevel" in
2364 $define|true|[yY]*)
2365 case "$versiononly" in
2366 '') versiononly="$define" ;;
2367 esac
2368 case "$installusrbinperl" in
2369 '') installusrbinperl="$undef" ;;
2370 esac
2371 ;;
2372 esac
2373
2374 : general instructions
2375 needman=true
2376 firsttime=true
2377 user=`(logname) 2>/dev/null`
2378 case "$user" in
2379 '') user=`whoami 2>&1`;;
2380 esac
2381 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2382 firsttime=false
2383 echo " "
2384 rp='Would you like to see the instructions?'
2385 dflt=n
2386 . ./myread
2387 case "$ans" in
2388 [yY]*) ;;
2389 *) needman=false;;
2390 esac
2391 fi
2392 if $needman; then
2393 cat <<EOH
2394
2395 This installation shell script will examine your system and ask you questions
2396 to determine how the perl5 package should be installed. If you get
2397 stuck on a question, you may use a ! shell escape to start a subshell or
2398 execute a command. Many of the questions will have default answers in square
2399 brackets; typing carriage return will give you the default.
2400
2401 On some of the questions which ask for file or directory names you are allowed
2402 to use the ~name construct to specify the login directory belonging to "name",
2403 even if you don't have a shell which knows about that. Questions where this is
2404 allowed will be marked "(~name ok)".
2405
2406 EOH
2407 rp=''
2408 dflt='Type carriage return to continue'
2409 . ./myread
2410 cat <<'EOH'
2411
2412 The prompter used in this script allows you to use shell variables and
2413 backticks in your answers. You may use $1, $2, etc... to refer to the words
2414 in the default answer, as if the default line was a set of arguments given to a
2415 script shell. This means you may also use $* to repeat the whole default line,
2416 so you do not have to re-type everything to add something to the default.
2417
2418 Every time there is a substitution, you will have to confirm. If there is an
2419 error (e.g. an unmatched backtick), the default answer will remain unchanged
2420 and you will be prompted again.
2421
2422 If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2423 the questions and use the computed defaults (or the previous answers if there
2424 was already a config.sh file). Type 'Configure -h' for a list of options.
2425 You may also start interactively and then answer '& -d' at any prompt to turn
2426 on the non-interactive behaviour for the remainder of the execution.
2427
2428 EOH
2429 . ./myread
2430 cat <<EOH
2431
2432 Much effort has been expended to ensure that this shell script will run on any
2433 Unix system. If despite that it blows up on yours, your best bet is to edit
2434 Configure and run it again. If you can't run Configure for some reason,
2435 you'll have to generate a config.sh file by hand. Whatever problems you
2436 have, let me (https://github.com/Perl/perl5/issues) know how I blew it.
2437
2438 This installation script affects things in two ways:
2439
2440 1) it may do direct variable substitutions on some of the files included
2441 in this kit.
2442 2) it builds a config.h file for inclusion in C programs. You may edit
2443 any of these files as the need arises after running this script.
2444
2445 If you make a mistake on a question, there is no easy way to back up to it
2446 currently. The easiest thing to do is to edit config.sh and rerun all the SH
2447 files. Configure will offer to let you do this before it runs the SH files.
2448
2449 EOH
2450 dflt='Type carriage return to continue'
2451 . ./myread
2452 case "$firsttime" in
2453 true) echo $user >>../.config/instruct;;
2454 esac
2455 fi
2456
2457 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2458 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2459 if test "X$sysroot" = X; then
2460 sysroot=""
2461 else
2462 case "$cc" in
2463 *gcc*|*g++*)
2464 echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2465 # _sysroot is used in places where we need --sysroot=foo
2466 # but using the rest of the flags could cause issues.
2467 _sysroot="--sysroot=$sysroot";
2468 case "$ccflags" in
2469 *sysroot*) ;;
2470 'undef'|*)
2471 ccflags="$ccflags $_sysroot"
2472 esac
2473 case "$ldflags" in
2474 *sysroot*) ;;
2475 'undef'|*)
2476 ldflags="$ldflags $_sysroot"
2477 esac
2478 case "$cppflags" in
2479 *sysroot*) ;;
2480 'undef'|*)
2481 cppflags="$cppflags $_sysroot"
2482 esac
2483 # lddlflags updated below in lddlflags section;
2484 # same with cccdlflags
2485 ;;
2486 esac
2487
2488 # Adjust some defaults to also use $sysroot
2489 for var in xlibpth loclibpth locincpth glibpth; do
2490 eval xxx=\$$var
2491 eval $var=''
2492 for path in $xxx; do
2493 eval $var=\"\$$var $sysroot$path\"
2494 done
2495 done
2496
2497 fi
2498
2499 : find out where common programs are
2500 echo " "
2501 echo "Locating common programs..." >&4
2502 cat <<EOSC >loc
2503 $startsh
2504 case \$# in
2505 0) exit 1;;
2506 esac
2507 thing=\$1
2508 shift
2509 dflt=\$1
2510 shift
2511 for dir in \$*; do
2512 case "\$thing" in
2513 .)
2514 if test -d \$dir/\$thing; then
2515 echo \$dir
2516 exit 0
2517 fi
2518 ;;
2519 *)
2520 for thisthing in \$dir/\$thing; do
2521 : just loop through to pick last item
2522 done
2523 if test -f \$thisthing; then
2524 echo \$thisthing
2525 exit 0
2526 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2527 echo \$thisthing
2528 exit 0
2529 elif test -f \$dir/\$thing.exe; then
2530 if test -n "$DJGPP"; then
2531 echo \$dir/\$thing.exe
2532 elif test "$eunicefix" != ":"; then
2533 : on Eunice apparently
2534 echo \$dir/\$thing
2535 fi
2536 exit 0
2537 fi
2538 ;;
2539 esac
2540 done
2541 echo \$dflt
2542 exit 1
2543 EOSC
2544 chmod +x loc
2545 $eunicefix loc
2546 loclist="
2547 awk
2548 cat
2549 chmod
2550 comm
2551 cp
2552 echo
2553 expr
2554 grep
2555 ls
2556 mkdir
2557 rm
2558 sed
2559 sort
2560 touch
2561 tr
2562 uniq
2563 "
2564 trylist="
2565 ar
2566 bison
2567 byacc
2568 cpp
2569 csh
2570 date
2571 egrep
2572 gmake
2573 gzip
2574 less
2575 ln
2576 make
2577 more
2578 nm
2579 nroff
2580 perl
2581 pg
2582 test
2583 uname
2584 zip
2585 "
2586 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2587 pth="$pth $sysroot/lib $sysroot/usr/lib"
2588 for file in $loclist; do
2589 eval xxx=\$$file
2590 case "$xxx" in
2591 /*|?:[\\/]*)
2592 if test -f "$xxx"; then
2593 : ok
2594 else
2595 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2596 xxx=`./loc $file $file $pth`
2597 fi
2598 ;;
2599 '') xxx=`./loc $file $file $pth`;;
2600 *) xxx=`./loc $xxx $xxx $pth`;;
2601 esac
2602 eval $file=$xxx$_exe
2603 eval _$file=$xxx
2604 case "$xxx" in
2605 /*)
2606 echo $file is in $xxx.
2607 ;;
2608 ?:[\\/]*)
2609 echo $file is in $xxx.
2610 ;;
2611 *)
2612 echo "I don't know where '$file' is, and my life depends on it." >&4
2613 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2614
2615 test -f /etc/debian_version && echo "Run \"apt install build-essential\" to install make and friends" >&4
2616 test -f /etc/SUSE-brand && echo "Run \"zypper install 'pattern:devel_C_C++'\" to install make and friends" >&4
2617 test -f /etc/redhat-release && echo "Run \"yum groupinstall 'Development Tools'\" to install make and friends" >&4
2618 test -f /etc/fedora-release && echo "Run \"dnf group install 'Development Tools'\" to install make and friends" >&4
2619 exit 1
2620 ;;
2621 esac
2622 done
2623 echo " "
2624 echo "Don't worry if any of the following aren't found..."
2625 say=offhand
2626 for file in $trylist; do
2627 eval xxx=\$$file
2628 case "$xxx" in
2629 /*|?:[\\/]*)
2630 if test -f "$xxx"; then
2631 : ok
2632 else
2633 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2634 xxx=`./loc $file $file $pth`
2635 fi
2636 ;;
2637 '') xxx=`./loc $file $file $pth`;;
2638 *) xxx=`./loc $xxx $xxx $pth`;;
2639 esac
2640 eval $file=$xxx$_exe
2641 eval _$file=$xxx
2642 case "$xxx" in
2643 /*)
2644 echo $file is in $xxx.
2645 ;;
2646 ?:[\\/]*)
2647 echo $file is in $xxx.
2648 ;;
2649 *)
2650 echo "I don't see $file out there, $say."
2651 say=either
2652 ;;
2653 esac
2654 done
2655 case "$egrep" in
2656 egrep)
2657 echo "Substituting grep for egrep."
2658 egrep=$grep
2659 _egrep=$grep
2660 ;;
2661 esac
2662 case "$less" in
2663 '') ;;
2664 *) if $less -R </dev/null >/dev/null 2>&1; then
2665 echo "Substituting less -R for less."
2666 less="$less -R"
2667 _less=$less
2668 fi
2669 ;;
2670 esac
2671 case "$ln" in
2672 ln)
2673 echo "Substituting cp for ln."
2674 ln=$cp
2675 _ln=$cp
2676 ;;
2677 esac
2678 case "$make" in
2679 make)
2680 case "$gmake" in
2681 gmake)
2682 echo "I can't find make or gmake, and my life depends on it." >&4
2683 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2684 exit 1
2685 ;;
2686 esac
2687 ;;
2688 esac
2689 case "$gmake" in
2690 gmake) ;;
2691 *) # We can't have osname yet.
2692 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2693 # Assume that gmake, if found, is definitely GNU make
2694 # and prefer it over the system make.
2695 echo "Substituting gmake for make."
2696 make=$gmake
2697 _make=$gmake
2698 fi
2699 ;;
2700 esac
2701 case "$test" in
2702 test)
2703 echo "Hopefully test is built into your sh."
2704 ;;
2705 *)
2706 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2707 echo "Using the test built into your sh."
2708 test=test
2709 _test=test
2710 fi
2711 ;;
2712 esac
2713 case "$echo" in
2714 echo)
2715 echo "Hopefully echo is built into your sh."
2716 ;;
2717 '') ;;
2718 *)
2719 echo " "
2720 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2721 $echo $n "hi there$c" >foo1
2722 echo $n "hi there$c" >foo2
2723 if cmp foo1 foo2 >/dev/null 2>&1; then
2724 echo "They are compatible. In fact, they may be identical."
2725 else
2726 case "$n" in
2727 '-n') n='' c='\c';;
2728 *) n='-n' c='';;
2729 esac
2730 cat <<FOO
2731 They are not compatible! You are probably running ksh on a non-USG system.
2732 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2733 have echo built in and we may have to run some Bourne shell scripts. That
2734 means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2735
2736 FOO
2737 $echo $n "The star should be here-->$c"
2738 $echo "*"
2739 fi
2740 $rm -f foo1 foo2
2741 ;;
2742 esac
2743
2744 # This question was auctioned at YAPC::Europe-2007 in Vienna
2745 # I never promised you could answer it. I only auctioned the question.
2746 cat <<FOO
2747 The following message is sponsored by
2748
2749 Dresden.pm<--The stars should be here.
2750
2751 Dear Perl user, system administrator or package
2752 maintainer, the Perl community sends greetings to
2753 you. Do you (emblematical) greet back [Y/n]? n
2754
2755 FOO
2756
2757 : Check what type of C compiler we use
2758 cat <<EOS >trygcc
2759 $startsh
2760 EOS
2761 cat <<'EOSC' >>trygcc
2762 case "$cc" in
2763 '') ;;
2764 *) $rm -f try try.*
2765 $cat >try.c <<EOM
2766 int main(int argc, char *argv[]) {
2767 return 0;
2768 }
2769 EOM
2770 if $cc -o try $ccflags $ldflags try.c; then
2771 :
2772 else
2773 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2774 despair=yes
2775 trygcc=yes
2776 case "$cc" in
2777 *gcc*) trygcc=no ;;
2778 esac
2779 # Skip this test because it gives a false match on output like:
2780 # ./trygcc: line 23: cc: command not found
2781 # case "`$cc -v -c try.c 2>&1`" in
2782 # *gcc*) trygcc=no ;;
2783 # esac
2784 if $test X"$trygcc" = Xyes; then
2785 if gcc -o try -c try.c; then
2786 echo " "
2787 echo "You seem to have a working gcc, though." >&4
2788 # Switching compilers may undo the work of hints files.
2789 # The most common problem is -D_REENTRANT for threads.
2790 # This heuristic catches that case, but gets false positives
2791 # if -Dusethreads was not actually specified. Better to
2792 # bail out here with a useful message than fail
2793 # mysteriously later. Should we perhaps just try to
2794 # re-invoke Configure -Dcc=gcc config_args ?
2795 if $test -f usethreads.cbu; then
2796 $cat >&4 <<EOM
2797
2798 *** However, any setting of the C compiler flags (e.g. for thread support)
2799 *** will be lost. It may be necessary for you to restart Configure and
2800 *** add -Dcc=gcc to your Configure command line.
2801
2802 EOM
2803 rp="Would you like to go ahead and try gcc anyway?"
2804 dflt=n
2805 else
2806 rp="Would you like to use it?"
2807 dflt=y
2808 fi
2809 if $test -f myread; then
2810 . ./myread
2811 else
2812 if $test -f UU/myread; then
2813 . ./UU/myread
2814 else
2815 echo "Cannot find myread, sorry. Aborting." >&4
2816 exit 1
2817 fi
2818 fi
2819 case "$ans" in
2820 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2821 esac
2822 fi
2823 fi
2824 fi
2825 $rm -f try try.*
2826 ;;
2827 esac
2828 EOSC
2829
2830 cat <<EOS >checkcc
2831 $startsh
2832 EOS
2833 cat <<'EOSC' >>checkcc
2834 case "$cc" in
2835 '') ;;
2836 *) $rm -f try try.*
2837 $cat >try.c <<EOM
2838 int main(int argc, char *argv[]) {
2839 return 0;
2840 }
2841 EOM
2842 if $cc -o try $ccflags $ldflags try.c; then
2843 :
2844 else
2845 if $test X"$despair" = Xyes; then
2846 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2847 fi
2848 $cat >&4 <<EOM
2849 You need to find a working C compiler.
2850 Either (purchase and) install the C compiler supplied by your OS vendor,
2851 or for a free C compiler try http://gcc.gnu.org/
2852 I cannot continue any further, aborting.
2853 EOM
2854 exit 1
2855 fi
2856 $rm -f try try.*
2857 ;;
2858 esac
2859 EOSC
2860
2861 : determine whether symbolic links are supported
2862 echo " "
2863 $touch blurfl
2864 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2865 echo "Symbolic links are supported." >&4
2866 lns="$ln -s"
2867 else
2868 echo "Symbolic links are NOT supported." >&4
2869 lns="$ln"
2870 fi
2871 $rm -f blurfl sym
2872
2873 : determine whether symbolic links are supported
2874 echo " "
2875 case "$lns" in
2876 *"ln"*" -s")
2877 echo "Checking how to test for symbolic links..." >&4
2878 $lns blurfl sym
2879 if $test "X$issymlink" = X; then
2880 case "$newsh" in
2881 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2882 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2883 esac
2884 if test $? = 0; then
2885 issymlink="test -h"
2886 else
2887 echo "Your builtin 'test -h' may be broken." >&4
2888 case "$test" in
2889 /*) ;;
2890 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2891 for p in $pth
2892 do
2893 if test -f "$p/$test"; then
2894 test="$p/$test"
2895 break
2896 fi
2897 done
2898 ;;
2899 esac
2900 case "$test" in
2901 /*)
2902 echo "Trying external '$test -h'." >&4
2903 issymlink="$test -h"
2904 if $test ! -h sym >/dev/null 2>&1; then
2905 echo "External '$test -h' is broken, too." >&4
2906 issymlink=''
2907 fi
2908 ;;
2909 *) issymlink='' ;;
2910 esac
2911 fi
2912 fi
2913 if $test "X$issymlink" = X; then
2914 if $test -L sym 2>/dev/null; then
2915 issymlink="$test -L"
2916 echo "The builtin '$test -L' worked." >&4
2917 fi
2918 fi
2919 if $test "X$issymlink" != X; then
2920 echo "You can test for symbolic links with '$issymlink'." >&4
2921 else
2922 echo "I do not know how you can test for symbolic links." >&4
2923 fi
2924 $rm -f blurfl sym
2925 ;;
2926 *) echo "No symbolic links, so not testing for their testing..." >&4
2927 ;;
2928 esac
2929
2930 : Make symlinks util
2931 case "$mksymlinks" in
2932 $define|true|[yY]*)
2933 case "$src" in
2934 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2935 exit 1
2936 ;;
2937 *) case "$lns:$issymlink" in
2938 *"ln"*" -s:"*"test -"?)
2939 echo "Creating the symbolic links..." >&4
2940 cd ..
2941 awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2942 awk 'NF == 1 {
2943 dir=".";
2944 file=$1 "";
2945 }
2946 NF == 2 {
2947 dir=$1 "";
2948 file=$2 "";
2949 }
2950 {
2951 print "# dir = ", dir, "file = ", file
2952 mf[dir] = mf[dir]" "source"/"dir"/"file;
2953 } END {
2954 for (d in mf) {
2955 if (d != ".") { print("mkdir -p "d) }
2956 print("ln -sf "mf[d]" "d);
2957 }
2958 }' source="$src" > UU/mksymlinks.$$
2959 sh UU/mksymlinks.$$
2960 rm UU/mksymlinks.$$
2961 # Sanity check 1.
2962 if test ! -d t/base; then
2963 echo "Failed to create the subdirectories. Aborting." >&4
2964 exit 1
2965 fi
2966 # Sanity check 2.
2967 if test ! -f t/base/lex.t; then
2968 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
2969 exit 1
2970 fi
2971 if test ! -f win32/win32.c; then
2972 echo "Failed to create the symlinks (win32/win32.c missing). Aborting." >&4
2973 exit 1
2974 fi
2975 cd UU
2976 ;;
2977 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2978 ;;
2979 esac
2980 ;;
2981 esac
2982 ;;
2983 esac
2984
2985 : Check for Cross-Compilation
2986 if $test "X$targethost" = "X"; then
2987 targethost=""
2988 fi
2989 if $test "X$targetenv" = "X"; then
2990 targetenv=""
2991 fi
2992 case "$usecrosscompile" in
2993 $define|true|[yY]*)
2994 $echo "Cross-compiling..."
2995 croak=''
2996 case "$cc" in
2997 *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2998 # arm-linux-androideabi-gcc -> arm-linux-androideabi
2999 # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
3000 targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
3001 ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
3002 # leave out ld, choosing it is more complex
3003 nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
3004 ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
3005 # We are in a weird spot. Just before us, some values
3006 # were 'saved', to be restored after the hints are
3007 # run. This means that the changes we made to ar,
3008 # nm and ranlib will get reverted.
3009 # To avoid that, we hijack the saving mechanism and
3010 # have it save our new values.
3011 for file in ar nm ranlib; do
3012 eval xxx=\$$file
3013 eval $file=$xxx$_exe
3014 eval _$file=$xxx
3015 done
3016 ;;
3017 esac
3018 case "$targetarch" in
3019 '') echo "Targetarch not defined." >&4; croak=y ;;
3020 *) echo "Using targetarch $targetarch." >&4 ;;
3021 esac
3022 case "$targethost" in
3023 '') echo "Targethost not defined." >&4; croak=n ;;
3024 *) echo "Using targethost $targethost." >&4
3025 esac
3026 locincpth=' '
3027 loclibpth=' '
3028 case "$croak" in
3029 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
3030 esac
3031 : compile a host miniperl and generate_uudmap, unless we got passed them
3032 if $test "X$hostperl" = X; then
3033 echo "Building host miniperl and generate_uudmap binaries" >&4
3034 before_host=`pwd`
3035 cd ..
3036 cd $src
3037 src=`pwd`
3038 rm -rf $src/host
3039 mkdir $src/host
3040 cd $src/host
3041 $src/Configure -des -Dusedevel -Dmksymlinks
3042 $make miniperl
3043 case "$hostgenerate" in
3044 '') $make generate_uudmap
3045 hostgenerate=$src/host/generate_uudmap
3046 ;;
3047 "$undef") hostgenerate=''
3048 ;;
3049 esac
3050 hostperl=$src/host/miniperl
3051 cd $before_host
3052 fi
3053 hostosname=`$hostperl -le 'print $^O'`
3054 ;;
3055 *)
3056 usecrosscompile="$undef"
3057 ;;
3058 esac
3059
3060 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3061 case "$targethost" in
3062 '') echo "Checking for cross-compile" >&4
3063 case "$usecrosscompile$multiarch" in
3064 *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3065 if [ -f Makefile ]; then
3066 echo " "
3067 echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3068 else
3069 echo "Configure done."
3070 fi
3071 exit 0
3072 ;;
3073 *) echo "No targethost for running compiler tests against defined, running locally" >&4
3074 run=''
3075 to=:
3076 from=:
3077 ;;
3078 esac
3079 ;;
3080 *) echo "Using targethost $targethost." >&4
3081 case "$src" in
3082 /*) run=$src/Cross/run
3083 targetmkdir=$src/Cross/mkdir
3084 to=$src/Cross/to
3085 from=$src/Cross/from
3086 ;;
3087 *) pwd=`$test -f ../Configure & cd ..; pwd`
3088 run=$pwd/Cross/run
3089 targetmkdir=$pwd/Cross/mkdir
3090 to=$pwd/Cross/to
3091 from=$pwd/Cross/from
3092 ;;
3093 esac
3094 case "$targetrun" in
3095 '') targetrun=ssh ;;
3096 esac
3097 case "$targetto" in
3098 '') targetto=scp ;;
3099 esac
3100 case "$targetfrom" in
3101 '') targetfrom=scp ;;
3102 esac
3103 run=$run-$targetrun
3104 to=$to-$targetto
3105 from=$from-$targetfrom
3106 case "$targetdir" in
3107 '') targetdir=/tmp
3108 echo "Guessing targetdir $targetdir." >&4
3109 ;;
3110 esac
3111 case "$targetuser" in
3112 '') targetuser=root
3113 echo "Guessing targetuser $targetuser." >&4
3114 ;;
3115 esac
3116 case "$targetport" in
3117 '') targetport=22
3118 echo "Guessing targetport $targetport." >&4
3119 ;;
3120 esac
3121 case "$targetfrom" in
3122 scp) q=-q ;;
3123 *) q='' ;;
3124 esac
3125 case "$targetrun" in
3126 ssh|rsh)
3127 cat >$run <<EOF
3128 #!/bin/sh
3129 env=''
3130 case "\$1" in
3131 -cwd)
3132 shift
3133 cwd=\$1
3134 shift
3135 ;;
3136 esac
3137 case "\$1" in
3138 -env)
3139 shift
3140 env=\$1
3141 shift
3142 ;;
3143 esac
3144 case "\$cwd" in
3145 '') cwd=$targetdir ;;
3146 esac
3147 exe=\$1
3148 shift
3149 $to \$exe
3150 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3151 EOF
3152 ;;
3153 adb)
3154 $touch $run
3155 ;;
3156 *) echo "Unknown targetrun '$targetrun'" >&4
3157 exit 1
3158 ;;
3159 esac
3160 case "$targetmkdir" in
3161 */Cross/mkdir)
3162 cat >$targetmkdir <<EOF
3163 #!/bin/sh
3164 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3165 EOF
3166 $chmod a+rx $targetmkdir
3167 ;;
3168 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
3169 exit 1
3170 ;;
3171 esac
3172 case "$targetto" in
3173 scp|rcp)
3174 cat >$to <<EOF
3175 #!/bin/sh
3176 for f in \$@
3177 do
3178 case "\$f" in
3179 /*)
3180 $targetmkdir \`dirname \$f\`
3181 $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f 2>/dev/null || exit 1
3182 ;;
3183 *)
3184 $targetmkdir $targetdir/\`dirname \$f\`
3185 $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3186 ;;
3187 esac
3188 done
3189 exit 0
3190 EOF
3191 ;;
3192 cp) cat >$to <<EOF
3193 #!/bin/sh
3194 for f in \$@
3195 do
3196 case "\$f" in
3197 /*)
3198 $mkdir -p $targetdir/\`dirname \$f\`
3199 $cp \$f $targetdir/\$f || exit 1
3200 ;;
3201 *)
3202 $targetmkdir $targetdir/\`dirname \$f\`
3203 $cp \$f $targetdir/\$f || exit 1
3204 ;;
3205 esac
3206 done
3207 exit 0
3208 EOF
3209 ;;
3210 *) echo "Unknown targetto '$targetto'" >&4
3211 exit 1
3212 ;;
3213 esac
3214 case "$targetfrom" in
3215 scp|rcp)
3216 cat >$from <<EOF
3217 #!/bin/sh
3218 for f in \$@
3219 do
3220 $rm -f \$f
3221 $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3222 done
3223 exit 0
3224 EOF
3225 ;;
3226 cp) cat >$from <<EOF
3227 #!/bin/sh
3228 for f in \$@
3229 do
3230 $rm -f \$f
3231 cp $targetdir/\$f . || exit 1
3232 done
3233 exit 0
3234 EOF
3235 ;;
3236 *) echo "Unknown targetfrom '$targetfrom'" >&4
3237 exit 1
3238 ;;
3239 esac
3240 if $test ! -f $run; then
3241 echo "Target 'run' script '$run' not found." >&4
3242 else
3243 $chmod a+rx $run
3244 fi
3245 if $test ! -f $to; then
3246 echo "Target 'to' script '$to' not found." >&4
3247 else
3248 $chmod a+rx $to
3249 fi
3250 if $test ! -f $from; then
3251 echo "Target 'from' script '$from' not found." >&4
3252 else
3253 $chmod a+rx $from
3254 fi
3255 if $test ! -f $run -o ! -f $to -o ! -f $from; then
3256 exit 1
3257 fi
3258 cat >&4 <<EOF
3259 Using '$run' for remote execution,
3260 and '$from' and '$to'
3261 for remote file transfer.
3262 EOF
3263 ;;
3264 *) run=''
3265 to=:
3266 from=:
3267 usecrosscompile="$undef"
3268 targetarch=''
3269 ;;
3270 esac
3271
3272 : see whether [:lower:] and [:upper:] are supported character classes
3273 echo " "
3274 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3275 ABYZ-abyz)
3276 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3277 up='[:upper:]'
3278 low='[:lower:]'
3279 ;;
3280 *) # There is a discontinuity in EBCDIC between 'R' and 'S'
3281 # (0xd9 and 0xe2), therefore that is a nice testing point.
3282 if test "X$up" = X -o "X$low" = X; then
3283 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3284 rs) up='[A-Z]'
3285 low='[a-z]'
3286 ;;
3287 esac
3288 fi
3289 if test "X$up" = X -o "X$low" = X; then
3290 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3291 rs) up='A-Z'
3292 low='a-z'
3293 ;;
3294 esac
3295 fi
3296 if test "X$up" = X -o "X$low" = X; then
3297 case "`echo RS | od -x 2>/dev/null`" in
3298 *D9E2*|*d9e2*)
3299 echo "Hey, this might be EBCDIC." >&4
3300 if test "X$up" = X -o "X$low" = X; then
3301 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3302 rs) up='[A-IJ-RS-Z]'
3303 low='[a-ij-rs-z]'
3304 ;;
3305 esac
3306 fi
3307 if test "X$up" = X -o "X$low" = X; then
3308 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3309 rs) up='A-IJ-RS-Z'
3310 low='a-ij-rs-z'
3311 ;;
3312 esac
3313 fi
3314 ;;
3315 esac
3316 fi
3317 esac
3318 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3319 rs)
3320 echo "Using $up and $low to convert case." >&4
3321 ;;
3322 *)
3323 echo "I don't know how to translate letters from upper to lower case." >&4
3324 echo "Your tr is not acting any way I know of." >&4
3325 exit 1
3326 ;;
3327 esac
3328 : set up the translation script tr, must be called with ./tr of course
3329 cat >tr <<EOSC
3330 $startsh
3331 case "\$1\$2" in
3332 '[A-Z][a-z]') exec $tr '$up' '$low';;
3333 '[a-z][A-Z]') exec $tr '$low' '$up';;
3334 esac
3335 exec $tr "\$@"
3336 EOSC
3337 chmod +x tr
3338 $eunicefix tr
3339
3340 : Try to determine whether config.sh was made on this system
3341 case "$config_sh" in
3342 '')
3343 myuname=`$uname -a 2>/dev/null`
3344 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3345 # Downcase everything to avoid ambiguity.
3346 # Remove slashes and single quotes so we can use parts of this in
3347 # directory and file names.
3348 # Remove newlines so myuname is sane to use elsewhere.
3349 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3350 # because the A-Z/a-z are not consecutive.
3351 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3352 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3353 newmyuname="$myuname"
3354 dflt=n
3355 case "$knowitall" in
3356 '')
3357 if test -f ../config.sh; then
3358 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3359 eval "`grep myuname= ../config.sh`"
3360 fi
3361 if test "X$myuname" = "X$newmyuname"; then
3362 dflt=y
3363 fi
3364 fi
3365 ;;
3366 *) dflt=y;;
3367 esac
3368
3369 : Get old answers from old config file if Configure was run on the
3370 : same system, otherwise use the hints.
3371 hint=default
3372 cd ..
3373 if test -f config.sh; then
3374 echo " "
3375 rp="I see a config.sh file. Shall I use it to set the defaults?"
3376 . UU/myread
3377 case "$ans" in
3378 n*|N*) echo "OK, I'll ignore it."
3379 mv config.sh config.sh.old
3380 myuname="$newmyuname"
3381 ;;
3382 *) echo "Fetching default answers from your old config.sh file..." >&4
3383 tmp_n="$n"
3384 tmp_c="$c"
3385 tmp_sh="$sh"
3386 . ./config.sh
3387 cp config.sh UU
3388 n="$tmp_n"
3389 c="$tmp_c"
3390 : Older versions did not always set $sh. Catch re-use of such
3391 : an old config.sh.
3392 case "$sh" in
3393 '') sh="$tmp_sh" ;;
3394 esac
3395 hint=previous
3396 ;;
3397 esac
3398 fi
3399 . ./UU/checkcc
3400 if test ! -f config.sh; then
3401 $cat <<EOM
3402
3403 First time through, eh? I have some defaults handy for some systems
3404 that need some extra help getting the Configure answers right:
3405
3406 EOM
3407 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
3408 dflt=''
3409 : Half the following guesses are probably wrong... If you have better
3410 : tests or hints, please send them to https://github.com/Perl/perl5/issues
3411 : The metaconfig authors would also appreciate a copy...
3412 $test -f /irix && osname=irix
3413 $test -f /xenix && osname=sco_xenix
3414 $test -f /dynix && osname=dynix
3415 $test -f /dnix && osname=dnix
3416 $test -f /lynx.os && osname=lynxos
3417 $test -f /unicos && osname=unicos && osvers=`$uname -r`
3418 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3419 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3420 $test -f /bin/mips && /bin/mips && osname=mips
3421 $test -d /usr/apollo/bin && osname=apollo
3422 $test -f /etc/saf/_sactab && osname=svr4
3423 $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3424 $test -f /system/gnu_library/bin/ar.pm && osname=vos
3425 $test -f /sys/utilities/MultiView && osname=amigaos
3426 if $test -d /MachTen -o -d /MachTen_Folder; then
3427 osname=machten
3428 if $test -x /sbin/version; then
3429 osvers=`/sbin/version | $awk '{print $2}' |
3430 $sed -e 's/[A-Za-z]$//'`
3431 elif $test -x /usr/etc/version; then
3432 osvers=`/usr/etc/version | $awk '{print $2}' |
3433 $sed -e 's/[A-Za-z]$//'`
3434 else
3435 osvers="$2.$3"
3436 fi
3437 fi
3438
3439 $test -f /sys/posix.dll &&
3440 $test -f /usr/bin/what &&
3441 set X `/usr/bin/what /sys/posix.dll` &&
3442 $test "$3" = UWIN &&
3443 osname=uwin &&
3444 osvers="$5"
3445
3446 if $test -f $uname; then
3447 set X $myuname
3448 shift
3449
3450 case "$5" in
3451 fps*) osname=fps ;;
3452 mips*)
3453 case "$4" in
3454 umips) osname=umips ;;
3455 *) osname=mips ;;
3456 esac;;
3457 [23]100) osname=mips ;;
3458 i386*)
3459 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3460 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3461 osname='sco'
3462 osvers=$tmp
3463 elif $test -f /etc/kconfig; then
3464 osname=isc
3465 if test "$lns" = "$ln -s"; then
3466 osvers=4
3467 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3468 osvers=3
3469 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3470 osvers=2
3471 fi
3472 fi
3473 tmp=''
3474 ;;
3475 pc*)
3476 if test -n "$DJGPP"; then
3477 osname=dos
3478 osvers=djgpp
3479 fi
3480 ;;
3481 esac
3482
3483 case "$1" in
3484 aix) osname=aix
3485 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3486 case "$tmp" in
3487 # oslevel can fail with:
3488 # oslevel: Unable to acquire lock.
3489 *not\ found) osvers="$4"."$3" ;;
3490 '<3240'|'<>3240') osvers=3.2.0 ;;
3491 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3492 '=3250'|'>3250') osvers=3.2.5 ;;
3493 *) osvers=$tmp;;
3494 esac
3495 ;;
3496 bitrig) osname=bitrig
3497 osvers="$3"
3498 ;;
3499 bsd386) osname=bsd386
3500 osvers=`$uname -r`
3501 ;;
3502 cygwin*) osname=cygwin
3503 osvers="$3"
3504 ;;
3505 *dc.osx) osname=dcosx
3506 osvers="$3"
3507 ;;
3508 dnix) osname=dnix
3509 osvers="$3"
3510 ;;
3511 domainos) osname=apollo
3512 osvers="$3"
3513 ;;
3514 dgux) osname=dgux
3515 osvers="$3"
3516 ;;
3517 dragonfly) osname=dragonfly
3518 case "$3" in
3519 [0-9]*) osvers="$3" ;;
3520 *) osvers="$2" ;;
3521 esac
3522 ;;
3523 dynixptx*) osname=dynixptx
3524 osvers=`echo "$4"|sed 's/^v//'`
3525 ;;
3526 freebsd) osname=freebsd
3527 osvers="$3" ;;
3528 genix) osname=genix ;;
3529 gnu) osname=gnu
3530 osvers="$3" ;;
3531 hp*) osname=hpux
3532 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3533 ;;
3534 irix*) osname=irix
3535 case "$3" in
3536 4*) osvers=4 ;;
3537 5*) osvers=5 ;;
3538 *) osvers="$3" ;;
3539 esac
3540 ;;
3541 linux) osname=linux
3542 case "$3" in
3543 *) osvers="$3" ;;
3544 esac
3545 $test -f /system/lib/libandroid.so && osname=linux-android
3546 ;;
3547 MiNT) osname=mint
3548 ;;
3549 minix) osname=minix
3550 osvers=`$uname -r`
3551 ;;
3552 netbsd*) osname=netbsd
3553 osvers="$3"
3554 ;;
3555 news-os) osvers="$3"
3556 case "$3" in
3557 4*) osname=newsos4 ;;
3558 *) osname=newsos ;;
3559 esac
3560 ;;
3561 nonstop-ux) osname=nonstopux ;;
3562 openbsd) osname=openbsd
3563 osvers="$3"
3564 ;;
3565 os2) osname=os2
3566 osvers="$4"
3567 ;;
3568 POSIX-BC | posix-bc ) osname=posix-bc
3569 osvers="$3"
3570 ;;
3571 powerux | power_ux | powermax_os | powermaxos | \
3572 powerunix | power_unix) osname=powerux
3573 osvers="$3"
3574 ;;
3575 qnx) osname=qnx
3576 osvers="$4"
3577 ;;
3578 solaris) osname=solaris
3579 case "$3" in
3580 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3581 *) osvers="$3" ;;
3582 esac
3583 ;;
3584 sunos) osname=sunos
3585 case "$3" in
3586 5*) osname=solaris
3587 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3588 *) osvers="$3" ;;
3589 esac
3590 ;;
3591 titanos) osname=titanos
3592 case "$3" in
3593 1*) osvers=1 ;;
3594 2*) osvers=2 ;;
3595 3*) osvers=3 ;;
3596 4*) osvers=4 ;;
3597 *) osvers="$3" ;;
3598 esac
3599 ;;
3600 ultrix) osname=ultrix
3601 osvers="$3"
3602 ;;
3603 osf1|mls+) case "$5" in
3604 alpha)
3605 osname=dec_osf
3606 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3607 case "$osvers" in
3608 [1-9].[0-9]*) ;;
3609 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3610 esac
3611 ;;
3612 hp*) osname=hp_osf1 ;;
3613 mips) osname=mips_osf1 ;;
3614 esac
3615 ;;
3616 # UnixWare 7.1.2 is known as Open UNIX 8
3617 openunix|unixware) osname=svr5
3618 osvers="$4"
3619 ;;
3620 uts) osname=uts
3621 osvers="$3"
3622 ;;
3623 vos) osvers="$3"
3624 ;;
3625 $2) case "$osname" in
3626 *isc*) ;;
3627 *freebsd*) ;;
3628 svr*)
3629 : svr4.x or possibly later
3630 case "svr$3" in
3631 ${osname}*)
3632 osname=svr$3
3633 osvers=$4
3634 ;;
3635 esac
3636 case "$osname" in
3637 svr4.0)
3638 : Check for ESIX
3639 if test -f /stand/boot ; then
3640 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3641 if test -n "$INITPROG" -a -f "$INITPROG"; then
3642 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3643 if test -n "$isesix"; then
3644 osname=esix4
3645 fi
3646 fi
3647 fi
3648 ;;
3649 esac
3650 ;;
3651 *) if test -f /etc/systemid; then
3652 osname=sco
3653 set `echo $3 | $sed 's/\./ /g'` $4
3654 if $test -f $src/hints/sco_$1_$2_$3.sh; then
3655 osvers=$1.$2.$3
3656 elif $test -f $src/hints/sco_$1_$2.sh; then
3657 osvers=$1.$2
3658 elif $test -f $src/hints/sco_$1.sh; then
3659 osvers=$1
3660 fi
3661 else
3662 case "$osname" in
3663 '') : Still unknown. Probably a generic Sys V.
3664 osname="sysv"
3665 osvers="$3"
3666 ;;
3667 esac
3668 fi
3669 ;;
3670 esac
3671 ;;
3672 *) case "$osname" in
3673 '') : Still unknown. Probably a generic BSD.
3674 osname="$1"
3675 osvers="$3"
3676 ;;
3677 esac
3678 ;;
3679 esac
3680 else
3681 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3682 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3683 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3684 osname=news_os
3685 fi
3686 $rm -f UU/kernel.what
3687 elif test -d c:/. -o -n "$is_os2" ; then
3688 set X $myuname
3689 osname=os2
3690 osvers="$5"
3691 fi
3692 fi
3693
3694 case "$targetarch" in
3695 '') ;;
3696 *) hostarch=$osname
3697 case "$targetarch" in
3698 nto*|*-nto-*)
3699 # Will load qnx.sh, which should change osname to nto
3700 osname=qnx
3701 osvers=''
3702 ;;
3703 *linux-android*)
3704 # Catch arm-linux-androideabi, mipsel-linux-android,
3705 # and i686-linux-android
3706 osname=linux-android
3707 osvers=''
3708 ;;
3709 *linux*)
3710 # Something like arm-linux-gnueabihf is really just
3711 # plain linux.
3712 osname=linux
3713 osvers=''
3714 ;;
3715 *solaris*|*sunos*)
3716 osname=solaris
3717 # XXX perhaps we should just assume
3718 # osvers to be 2, or maybe take the value
3719 # from targetarch. Using $run before the
3720 # hints are run is somewhat icky.
3721 set X `$run $uname -a 2>/dev/null`
3722 shift
3723 case "$3" in
3724 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3725 *) osvers="$3" ;;
3726 esac
3727 ;;
3728 *)
3729 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3730 osvers=''
3731 ;;
3732 esac
3733 ;;
3734 esac
3735
3736 : Now look for a hint file osname_osvers, unless one has been
3737 : specified already.
3738 case "$hintfile" in
3739 ''|' ')
3740 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3741 : Also try without trailing minor version numbers.
3742 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3743 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3744 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3745 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3746 case "$file" in
3747 '') dflt=none ;;
3748 *) case "$osvers" in
3749 '') dflt=$file
3750 ;;
3751 *) if $test -f $src/hints/$file.sh ; then
3752 dflt=$file
3753 elif $test -f $src/hints/$xfile.sh ; then
3754 dflt=$xfile
3755 elif $test -f $src/hints/$xxfile.sh ; then
3756 dflt=$xxfile
3757 elif $test -f $src/hints/$xxxfile.sh ; then
3758 dflt=$xxxfile
3759 elif $test -f $src/hints/$xxxxfile.sh ; then
3760 dflt=$xxxxfile
3761 elif $test -f "$src/hints/${osname}.sh" ; then
3762 dflt="${osname}"
3763 else
3764 dflt=none
3765 fi
3766 ;;
3767 esac
3768 ;;
3769 esac
3770 if $test -f Policy.sh ; then
3771 case "$dflt" in
3772 *Policy*) ;;
3773 none) dflt="Policy" ;;
3774 *) dflt="Policy $dflt" ;;
3775 esac
3776 fi
3777 ;;
3778 *)
3779 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3780 ;;
3781 esac
3782
3783 if $test -f Policy.sh ; then
3784 $cat <<EOM
3785
3786 There's also a Policy hint file available, which should make the
3787 site-specific (policy) questions easier to answer.
3788 EOM
3789
3790 fi
3791
3792 $cat <<EOM
3793
3794 You may give one or more space-separated answers, or "none" if appropriate.
3795 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3796 previous run of Configure, you may specify it as well as or instead of
3797 OS-specific hints. If hints are provided for your OS, you should use them:
3798 although Perl can probably be built without hints on many platforms, using
3799 hints often improve performance and may enable features that Configure can't
3800 set up on its own. If there are no hints that match your OS, specify "none";
3801 DO NOT give a wrong version or a wrong OS.
3802
3803 EOM
3804
3805 rp="Which of these apply, if any?"
3806 . UU/myread
3807 tans=$ans
3808 for file in $tans; do
3809 if $test X$file = XPolicy -a -f Policy.sh; then
3810 . Policy.sh
3811 $cat Policy.sh >> UU/config.sh
3812 elif $test -f $src/hints/$file.sh; then
3813 . $src/hints/$file.sh
3814 $cat $src/hints/$file.sh >> UU/config.sh
3815 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3816 : nothing
3817 else
3818 : Give one chance to correct a possible typo.
3819 echo "$file.sh does not exist"
3820 dflt=$file
3821 rp="hint to use instead?"
3822 . UU/myread
3823 for file in $ans; do
3824 if $test -f "$src/hints/$file.sh"; then
3825 . $src/hints/$file.sh
3826 $cat $src/hints/$file.sh >> UU/config.sh
3827 elif $test X$ans = X -o X$ans = Xnone ; then
3828 : nothing
3829 else
3830 echo "$file.sh does not exist -- ignored."
3831 fi
3832 done
3833 fi
3834 done
3835
3836 hint=recommended
3837 : Remember our hint file for later.
3838 if $test -f "$src/hints/$file.sh" ; then
3839 hintfile="$file"
3840 else
3841 hintfile=''
3842 fi
3843 fi
3844 cd UU
3845 ;;
3846 *)
3847 echo " "
3848 echo "Fetching default answers from $config_sh..." >&4
3849 tmp_n="$n"
3850 tmp_c="$c"
3851 cd ..
3852 cp $config_sh config.sh 2>/dev/null
3853 chmod +w config.sh
3854 . ./config.sh
3855 cd UU
3856 cp ../config.sh .
3857 n="$tmp_n"
3858 c="$tmp_c"
3859 hint=previous
3860 ;;
3861 esac
3862 . ./optdef.sh
3863
3864 : Restore computed paths
3865 for file in $loclist $trylist; do
3866 eval $file="\$_$file"
3867 done
3868
3869 cat << EOM
3870
3871 Configure uses the operating system name and version to set some defaults.
3872 The default value is probably right if the name rings a bell. Otherwise,
3873 since spelling matters for me, either accept the default or answer "none"
3874 to leave it blank.
3875
3876 EOM
3877 case "$osname" in
3878 ''|' ')
3879 case "$hintfile" in
3880 ''|' '|none) dflt=none ;;
3881 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3882 esac
3883 ;;
3884 *) dflt="$osname" ;;
3885 esac
3886 rp="Operating system name?"
3887 . ./myread
3888 case "$ans" in
3889 none) osname='' ;;
3890 *) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3891 esac
3892 echo " "
3893 case "$osvers" in
3894 ''|' ')
3895 case "$hintfile" in
3896 ''|' '|none) dflt=none ;;
3897 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3898 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3899 case "$dflt" in
3900 ''|' ') dflt=none ;;
3901 esac
3902 ;;
3903 esac
3904 ;;
3905 *) dflt="$osvers" ;;
3906 esac
3907 rp="Operating system version?"
3908 . ./myread
3909 case "$ans" in
3910 none) osvers='' ;;
3911 *) osvers="$ans" ;;
3912 esac
3913
3914
3915 . ./posthint.sh
3916
3917 : who configured the system
3918 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3919 case "$cf_by" in
3920 "")
3921 cf_by=`(logname) 2>/dev/null`
3922 case "$cf_by" in
3923 "")
3924 cf_by=`(whoami) 2>/dev/null`
3925 case "$cf_by" in
3926 "") cf_by=unknown ;;
3927 esac ;;
3928 esac ;;
3929 esac
3930
3931 : decide how portable to be. Allow command line overrides.
3932 case "$d_portable" in
3933 "$undef") ;;
3934 *) d_portable="$define" ;;
3935 esac
3936
3937 : set up shell script to do ~ expansion
3938 cat >filexp <<EOSS
3939 $startsh
3940 : expand filename
3941 case "\$1" in
3942 \~/*|\~)
3943 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3944 ;;
3945 \~*)
3946 if $test -f /bin/csh; then
3947 /bin/csh -f -c "glob \$1"
3948 failed=\$?
3949 echo ""
3950 exit \$failed
3951 else
3952 name=\`$expr x\$1 : '..\([^/]*\)'\`
3953 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3954 if $test ! -d "\$dir"; then
3955 me=\`basename \$0\`
3956 echo "\$me: can't locate home directory for: \$name" >&2
3957 exit 1
3958 fi
3959 case "\$1" in
3960 */*)
3961 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3962 ;;
3963 *)
3964 echo \$dir
3965 ;;
3966 esac
3967 fi
3968 ;;
3969 *)
3970 echo \$1
3971 ;;
3972 esac
3973 EOSS
3974 chmod +x filexp
3975 $eunicefix filexp
3976
3977 : now set up to get a file name
3978 cat <<EOS >getfile
3979 $startsh
3980 EOS
3981 cat <<'EOSC' >>getfile
3982 tilde=''
3983 fullpath=''
3984 already=''
3985 skip=''
3986 none_ok=''
3987 exp_file=''
3988 nopath_ok=''
3989 orig_rp="$rp"
3990 orig_dflt="$dflt"
3991 case "$gfpth" in
3992 '') gfpth='.' ;;
3993 esac
3994
3995 case "$fn" in
3996 *\(*)
3997 : getfile will accept an answer from the comma-separated list
3998 : enclosed in parentheses even if it does not meet other criteria.
3999 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4000 fn=`echo $fn | sed 's/(.*)//'`
4001 ;;
4002 esac
4003
4004 case "$fn" in
4005 *:*)
4006 loc_file=`expr $fn : '.*:\(.*\)'`
4007 fn=`expr $fn : '\(.*\):.*'`
4008 ;;
4009 esac
4010
4011 case "$fn" in
4012 *~*) tilde=true;;
4013 esac
4014 case "$fn" in
4015 */*) fullpath=true;;
4016 esac
4017 case "$fn" in
4018 *+*) skip=true;;
4019 esac
4020 case "$fn" in
4021 *n*) none_ok=true;;
4022 esac
4023 case "$fn" in
4024 *e*) exp_file=true;;
4025 esac
4026 case "$fn" in
4027 *p*) nopath_ok=true;;
4028 esac
4029
4030 case "$fn" in
4031 *f*) type='File';;
4032 *d*) type='Directory';;
4033 *l*) type='Locate';;
4034 esac
4035
4036 what="$type"
4037 case "$what" in
4038 Locate) what='File';;
4039 esac
4040
4041 case "$exp_file" in
4042 '')
4043 case "$d_portable" in
4044 "$define") ;;
4045 *) exp_file=true;;
4046 esac
4047 ;;
4048 esac
4049
4050 cd ..
4051 while test "$type"; do
4052 redo=''
4053 rp="$orig_rp"
4054 dflt="$orig_dflt"
4055 case "$tilde" in
4056 true) rp="$rp (~name ok)";;
4057 esac
4058 . UU/myread
4059 if test -f UU/getfile.ok && \
4060 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4061 then
4062 value="$ans"
4063 ansexp="$ans"
4064 break
4065 fi
4066 case "$ans" in
4067 none)
4068 value=''
4069 ansexp=''
4070 case "$none_ok" in
4071 true) type='';;
4072 esac
4073 ;;
4074 *)
4075 case "$tilde" in
4076 '') value="$ans"
4077 ansexp="$ans";;
4078 *)
4079 value=`UU/filexp $ans`
4080 case $? in
4081 0)
4082 if test "$ans" != "$value"; then
4083 echo "(That expands to $value on this system.)"
4084 fi
4085 ;;
4086 *) value="$ans";;
4087 esac
4088 ansexp="$value"
4089 case "$exp_file" in
4090 '') value="$ans";;
4091 esac
4092 ;;
4093 esac
4094 case "$fullpath" in
4095 true)
4096 case "$ansexp" in
4097 /*) value="$ansexp" ;;
4098 [a-zA-Z]:/*) value="$ansexp" ;;
4099 *)
4100 redo=true
4101 case "$already" in
4102 true)
4103 echo "I shall only accept a full path name, as in /bin/ls." >&4
4104 echo "Use a ! shell escape if you wish to check pathnames." >&4
4105 ;;
4106 *)
4107 echo "Please give a full path name, starting with slash." >&4
4108 case "$tilde" in
4109 true)
4110 echo "Note that using ~name is ok provided it expands well." >&4
4111 already=true
4112 ;;
4113 esac
4114 esac
4115 ;;
4116 esac
4117 ;;
4118 esac
4119 case "$redo" in
4120 '')
4121 case "$type" in
4122 File)
4123 for fp in $gfpth; do
4124 if test "X$fp" = X.; then
4125 pf="$ansexp"
4126 else
4127 pf="$fp/$ansexp"
4128 fi
4129 if test -f "$pf"; then
4130 type=''
4131 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4132 then
4133 echo "($value is not a plain file, but that's ok.)"
4134 type=''
4135 fi
4136 if test X"$type" = X; then
4137 value="$pf"
4138 break
4139 fi
4140 done
4141 ;;
4142 Directory)
4143 for fp in $gfpth; do
4144 if test "X$fp" = X.; then
4145 dir="$ans"
4146 direxp="$ansexp"
4147 else
4148 dir="$fp/$ansexp"
4149 direxp="$fp/$ansexp"
4150 fi
4151 if test -d "$direxp"; then
4152 type=''
4153 value="$dir"
4154 break
4155 fi
4156 done
4157 ;;
4158 Locate)
4159 if test -d "$ansexp"; then
4160 echo "(Looking for $loc_file in directory $value.)"
4161 value="$value/$loc_file"
4162 ansexp="$ansexp/$loc_file"
4163 fi
4164 if test -f "$ansexp"; then
4165 type=''
4166 fi
4167 case "$nopath_ok" in
4168 true) case "$value" in
4169 */*) ;;
4170 *) echo "Assuming $value will be in people's path."
4171 type=''
4172 ;;
4173 esac
4174 ;;
4175 esac
4176 ;;
4177 esac
4178
4179 case "$skip" in
4180 true) type='';
4181 esac
4182
4183 case "$type" in
4184 '') ;;
4185 *)
4186 if test "$fastread" = yes; then
4187 dflt=y
4188 else
4189 dflt=n
4190 fi
4191 rp="$what $value doesn't exist. Use that name anyway?"
4192 . UU/myread
4193 dflt=''
4194 case "$ans" in
4195 y*) type='';;
4196 *) echo " ";;
4197 esac
4198 ;;
4199 esac
4200 ;;
4201 esac
4202 ;;
4203 esac
4204 done
4205 cd UU
4206 ans="$value"
4207 rp="$orig_rp"
4208 dflt="$orig_dflt"
4209 rm -f getfile.ok
4210 test "X$gfpthkeep" != Xy && gfpth=""
4211 EOSC
4212
4213 : determine root of directory hierarchy where package will be installed.
4214 case "$prefix" in
4215 '') dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4216 ;;
4217 *) dflt="$prefix"
4218 ;;
4219 esac
4220 $cat <<EOM
4221
4222 By default, $package will be installed in $dflt/bin, manual pages
4223 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4224 installation directories. Typically this is something like /usr/local.
4225 If you wish to have binaries under /usr/bin but other parts of the
4226 installation under /usr/local, that's ok: you will be prompted
4227 separately for each of the installation directories, the prefix being
4228 only used to set the defaults.
4229
4230 EOM
4231 fn=d~
4232 rp='Installation prefix to use?'
4233 . ./getfile
4234 oldprefix=''
4235 case "$prefix" in
4236 '') ;;
4237 *) case "$ans" in
4238 "$prefix") ;;
4239 *) oldprefix="$prefix";;
4240 esac
4241 ;;
4242 esac
4243
4244 case "$ans" in
4245 *?/) prefix=`echo "$ans" | sed 's/.$//'`
4246 ;;
4247 *) prefix="$ans"
4248 esac
4249
4250 case "$ansexp" in
4251 *?/) prefixexp=`echo "$ansexp" | sed 's/.$//'`
4252 ;;
4253 *) prefixexp="$ansexp"
4254 esac
4255
4256 : allow them to override the AFS root
4257 case "$afsroot" in
4258 '') afsroot=/afs ;;
4259 *) afsroot=$afsroot ;;
4260 esac
4261
4262 : is AFS running?
4263 echo " "
4264 case "$afs" in
4265 $define|true) afs=true ;;
4266 $undef|false) afs=false ;;
4267 *) if $test -d $afsroot; then
4268 afs=true
4269 else
4270 afs=false
4271 fi
4272 ;;
4273 esac
4274 if $afs; then
4275 echo "AFS may be running... I'll be extra cautious then..." >&4
4276 else
4277 echo "AFS does not seem to be running..." >&4
4278 fi
4279
4280 : determine installation prefix for where package is to be installed.
4281 if $afs; then
4282 $cat <<EOM
4283
4284 Since you are running AFS, I need to distinguish the directory in which
4285 files will reside from the directory in which they are installed (and from
4286 which they are presumably copied to the former directory by occult means).
4287
4288 EOM
4289 case "$installprefix" in
4290 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4291 *) dflt="$installprefix";;
4292 esac
4293 else
4294 $cat <<EOM
4295
4296 In some special cases, particularly when building $package for distribution,
4297 it is convenient to distinguish the directory in which files should be
4298 installed from the directory ($prefix) in which they will
4299 eventually reside. For most users, these two directories are the same.
4300
4301 EOM
4302 case "$installprefix" in
4303 '') dflt=$prefix ;;
4304 *) dflt=$installprefix;;
4305 esac
4306 fi
4307 fn=d~
4308 rp='What installation prefix should I use for installing files?'
4309 . ./getfile
4310 installprefix="$ans"
4311 installprefixexp="$ansexp"
4312
4313 : Perform the prefixexp/installprefixexp correction if necessary
4314 cat <<EOS >installprefix
4315 $startsh
4316 EOS
4317 cat <<'EOSC' >>installprefix
4318 : Change installation prefix, if necessary.
4319 if $test X"$prefix" != X"$installprefix"; then
4320 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4321 else
4322 eval "install${prefixvar}=\"\$${prefixvar}exp\""
4323 fi
4324 EOSC
4325 chmod +x installprefix
4326 $eunicefix installprefix
4327
4328 : Set variables such as privlib and privlibexp from the output of ./getfile
4329 : performing the prefixexp/installprefixexp correction if necessary.
4330 cat <<EOS >setprefixvar
4331 $startsh
4332 EOS
4333 cat <<'EOSC' >>setprefixvar
4334 eval "${prefixvar}=\"\$ans\""
4335 eval "${prefixvar}exp=\"\$ansexp\""
4336 . ./installprefix
4337 EOSC
4338 chmod +x setprefixvar
4339 $eunicefix setprefixvar
4340
4341 : set up the script used to warn in case of inconsistency
4342 cat <<EOS >whoa
4343 $startsh
4344 EOS
4345 cat <<'EOSC' >>whoa
4346 dflt=y
4347 case "$hint" in
4348 recommended)
4349 case "$hintfile" in
4350 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4351 ;;
4352 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
4353 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4354 ;;
4355 esac
4356 ;;
4357 *) echo " "
4358 echo "*** WHOA THERE!!! ***" >&4
4359 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
4360 ;;
4361 esac
4362 rp=" Keep the $hint value?"
4363 . ./myread
4364 case "$ans" in
4365 y) td=$was; tu=$was;;
4366 esac
4367 EOSC
4368
4369 : function used to set '$1' to '$val'
4370 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4371 case "$val$was" in
4372 $define$undef) . ./whoa; eval "$var=\$td";;
4373 $undef$define) . ./whoa; eval "$var=\$tu";;
4374 *) eval "$var=$val";;
4375 esac'
4376
4377 : Do we want threads support and if so, what type
4378 case "$usethreads" in
4379 $define|true|[yY]*) dflt='y';;
4380 *) # Catch case where user specified ithreads but
4381 # forgot -Dusethreads (A.D. 4/2002)
4382 case "$useithreads" in
4383 *$define*) dflt='y';;
4384 *) dflt='n';;
4385 esac
4386 ;;
4387 esac
4388 cat <<EOM
4389
4390 Perl can be built to offer a form of threading support on some systems
4391 To do so, Configure can be run with -Dusethreads.
4392
4393 Note that Perl built with threading support runs slightly slower
4394 and uses slightly more memory than plain Perl.
4395
4396 If this doesn't make any sense to you, just accept the default '$dflt'.
4397 EOM
4398 rp='Build a threading Perl?'
4399 . ./myread
4400 case "$ans" in
4401 y|Y) val="$define" ;;
4402 *) val="$undef" ;;
4403 esac
4404 set usethreads
4405 eval $setvar
4406
4407 useithreads="$usethreads"
4408
4409 case "$d_oldpthreads" in
4410 '') : Configure tests would be welcome here. For now, assume undef.
4411 val="$undef" ;;
4412 *) val="$d_oldpthreads" ;;
4413 esac
4414 set d_oldpthreads
4415 eval $setvar
4416
4417
4418 : Look for a hint-file generated 'call-back-unit'. If the
4419 : user has specified that a threading perl is to be built,
4420 : we may need to set or change some other defaults.
4421 if $test -f usethreads.cbu; then
4422 echo "Your platform has some specific hints regarding threaded builds, using them..."
4423 . ./usethreads.cbu
4424 else
4425 case "$usethreads" in
4426 "$define"|true|[yY]*)
4427 $cat <<EOM
4428 (Your platform does not have any specific hints for threaded builds.
4429 Assuming POSIX threads, then.)
4430 EOM
4431 ;;
4432 esac
4433 fi
4434
4435 : Check if multiplicity is required
4436 cat <<EOM
4437
4438 Perl can be built so that multiple Perl interpreters can coexist
4439 within the same Perl executable.
4440 EOM
4441
4442 case "$useithreads" in
4443 $define)
4444 cat <<EOM
4445 This multiple interpreter support is required for interpreter-based threads.
4446 EOM
4447 val="$define"
4448 ;;
4449 *) case "$usemultiplicity" in
4450 $define|true|[yY]*) dflt='y';;
4451 *) dflt='n';;
4452 esac
4453 echo " "
4454 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4455 rp='Build Perl for multiplicity?'
4456 . ./myread
4457 case "$ans" in
4458 y|Y) val="$define" ;;
4459 *) val="$undef" ;;
4460 esac
4461 ;;
4462 esac
4463 set usemultiplicity
4464 eval $setvar
4465
4466 : Check if morebits is requested
4467 case "$usemorebits" in
4468 "$define"|true|[yY]*)
4469 use64bitint="$define"
4470 uselongdouble="$define"
4471 usemorebits="$define"
4472 ;;
4473 *) usemorebits="$undef"
4474 ;;
4475 esac
4476
4477 : Determine the C compiler to be used
4478 echo " "
4479 case "$cc" in
4480 '') dflt=cc;;
4481 *) dflt="$cc";;
4482 esac
4483 rp="Use which C compiler?"
4484 . ./myread
4485 cc="$ans"
4486
4487 : See whether they have no cc but they do have gcc
4488 . ./trygcc
4489 if $test -f cc.cbu; then
4490 . ./cc.cbu
4491 fi
4492 . ./checkcc
4493
4494 : make some quick guesses about what we are up against
4495 echo " "
4496 $echo $n "Hmm... $c"
4497 echo exit 1 >bsd
4498 echo exit 1 >usg
4499 echo exit 1 >v7
4500 echo exit 1 >osf1
4501 echo exit 1 >eunice
4502 echo exit 1 >xenix
4503 echo exit 1 >venix
4504 echo exit 1 >os2
4505 d_bsd="$undef"
4506 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4507 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4508 then
4509 echo "Looks kind of like an OSF/1 system, but we'll see..."
4510 echo exit 0 >osf1
4511 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4512 xxx=`./loc addbib blurfl $pth`
4513 if $test -f $xxx; then
4514 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4515 echo exit 0 >bsd
4516 echo exit 0 >usg
4517 else
4518 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4519 echo "Looks kind of like an extended USG system, but we'll see..."
4520 else
4521 echo "Looks kind of like a USG system, but we'll see..."
4522 fi
4523 echo exit 0 >usg
4524 fi
4525 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4526 echo "Looks kind of like a BSD system, but we'll see..."
4527 d_bsd="$define"
4528 echo exit 0 >bsd
4529 else
4530 echo "Looks kind of like a Version 7 system, but we'll see..."
4531 echo exit 0 >v7
4532 fi
4533 case "$eunicefix" in
4534 *unixtovms*)
4535 $cat <<'EOI'
4536 There is, however, a strange, musty smell in the air that reminds me of
4537 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4538 EOI
4539 echo exit 0 >eunice
4540 d_eunice="$define"
4541 : it so happens the Eunice I know will not run shell scripts in Unix format
4542 ;;
4543 *)
4544 echo " "
4545 echo "Congratulations. You aren't running Eunice."
4546 d_eunice="$undef"
4547 ;;
4548 esac
4549 : Detect OS2. The p_ variable is set above in the Head.U unit.
4550 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4551 : semicolon as a patch separator
4552 case "$p_" in
4553 :) ;;
4554 *)
4555 $cat <<'EOI'
4556 I have the feeling something is not exactly right, however...don't tell me...
4557 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4558 (Or you may be running DOS with DJGPP.)
4559 EOI
4560 echo exit 0 >os2
4561 ;;
4562 esac
4563 if test -f /xenix; then
4564 echo "Actually, this looks more like a XENIX system..."
4565 echo exit 0 >xenix
4566 d_xenix="$define"
4567 else
4568 echo " "
4569 echo "It's not Xenix..."
4570 d_xenix="$undef"
4571 fi
4572 chmod +x xenix
4573 $eunicefix xenix
4574 if test -f /venix; then
4575 echo "Actually, this looks more like a VENIX system..."
4576 echo exit 0 >venix
4577 else
4578 echo " "
4579 if ./xenix; then
4580 : null
4581 else
4582 echo "Nor is it Venix..."
4583 fi
4584 fi
4585 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4586 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4587 $rm -f foo
4588
4589 : Check if we are using GNU gcc and what its version is
4590 echo " "
4591 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4592 $cat >try.c <<EOM
4593 #include <stdio.h>
4594 int main() {
4595 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4596 #ifdef __VERSION__
4597 printf("%s\n", __VERSION__);
4598 #else
4599 printf("%s\n", "1");
4600 #endif
4601 #endif
4602 return(0);
4603 }
4604 EOM
4605 if $cc -o try $ccflags $ldflags try.c; then
4606 gccversion=`$run ./try`
4607 case "$gccversion" in
4608 '') echo "You are not using GNU cc." ;;
4609 *) echo "You are using GNU cc $gccversion."
4610 ccname=gcc
4611 ;;
4612 esac
4613 else
4614 echo " "
4615 echo "*** WHOA THERE!!! ***" >&4
4616 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4617 case "$knowitall" in
4618 '')
4619 echo " You'd better start hunting for one and let me know about it." >&4
4620 exit 1
4621 ;;
4622 esac
4623 fi
4624 $rm -f try try.*
4625 case "$gccversion" in
4626 1.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4627 esac
4628 case "$gccversion" in
4629 '') gccosandvers='' ;;
4630 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4631 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4632 gccshortvers=''
4633 case "$gccosandvers" in
4634 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4635 $osname$osvers) ;; # looking good
4636 $osname*) cat <<EOM >&4
4637
4638 *** WHOA THERE!!! ***
4639
4640 Your gcc has not been compiled for the exact release of
4641 your operating system ($gccosandvers versus $osname$osvers).
4642
4643 In general it is a good idea to keep gcc synchronized with
4644 the operating system because otherwise serious problems
4645 may ensue when trying to compile software, like Perl.
4646
4647 I'm trying to be optimistic here, though, and will continue.
4648 If later during the configuration and build icky compilation
4649 problems appear (headerfile conflicts being the most common
4650 manifestation), I suggest reinstalling the gcc to match
4651 your operating system release.
4652
4653 EOM
4654 ;;
4655 *) gccosandvers='' ;; # failed to parse, better be silent
4656 esac
4657 ;;
4658 esac
4659 case "$ccname" in
4660 '') ccname="$cc" ;;
4661 esac
4662
4663 # gcc 3.* complain about adding -Idirectories that they already know about,
4664 # so we will take those off from locincpth.
4665 case "$gccversion" in
4666 3.*)
4667 echo "int main(){}">try.c
4668 for incdir in $locincpth; do
4669 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4670 grep '^c[cp]p*[01]: warning: changing search order '`
4671 if test "X$warn" != X; then
4672 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4673 fi
4674 done
4675 $rm -f try try.*
4676 esac
4677
4678 # gcc 4.9 by default does some optimizations that break perl.
4679 # see ticket 121505.
4680 #
4681 # The -fwrapv disables those optimizations (and probably others,) so
4682 # for gcc 4.9 (and later, since the optimizations probably won't go
4683 # away), add -fwrapv unless the user requests -fno-wrapv, which
4684 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4685 # which turns the overflows -fwrapv ignores into runtime errors.
4686 case "$gccversion" in
4687 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4688 case "$ccflags" in
4689 *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4690 *) ccflags="$ccflags -fwrapv" ;;
4691 esac
4692 esac
4693
4694 # Really old versions of gcc default to C89 and will error for this code.
4695 # See if the compiler (gcc or otherwise) needs a flag to compile C99 code
4696 # Initialisations in for loops seem to be the particular problem
4697 # (Does this syntax conflict with something else that was valid C89?)
4698 # We also add a declaration after a statement to detect whether the compiler
4699 # (or the user supplied -Accflags) consider such declarations to be errors.
4700 # This causes 'Configure with -Accflags="-Werror=declaration-after-statement"'
4701 # to fail hard and early.
4702 #
4703 # Annoyingly -std=c99 will cause gcc to tell glibc not to define prototypes for
4704 # syscall, drand48 etc when including <unistd.h>, which messes up our build.
4705 # I guess we *could* loop round trying -std=c99 first with checks both for the
4706 # prototype found and the code compiling (because -std=gnu99 might do other
4707 # things we don't want, particularly on non-GCC compilers) but
4708 # 1) We would need to check for the prototype first (without any flags)
4709 # 2) We would still end up with most Linux systems either being -std=gnu99
4710 # or "" (no flag), and so both common options would not rigorously check our
4711 # portability to other platforms.
4712 # So it doesn't seem worth the complexity and chance of different failure.
4713 $cat >try.c <<'EOCP'
4714 int main(int argc, char **argv) {
4715 argc = argc + 1;
4716 /* This is deliberately a declaration after a statement. */
4717 unsigned long long count = 0;
4718 for (char **p = argv; *p; ++p) {
4719 ++count;
4720 }
4721 return count == 1 ? 0 : argc;
4722 }
4723 EOCP
4724 c99_for=no
4725 for flag in '' '-std=gnu99' '-std=c99'; do
4726 if $cc -o try $flag $ccflags $ldflags try.c 2>/dev/null && ./try; then
4727 c99_for="$flag"
4728 break;
4729 fi
4730 done
4731 case "$c99_for" in
4732 '') echo "Your C compiler doesn't need any special flags to compile C99 code"
4733 ;;
4734 no) echo >&4 "Your C compiler doesn't seem to be able to compile C99 code"
4735 rp='Do you really want to continue?'
4736 dflt='n'
4737 . ./myread
4738 case "$ans" in
4739 [yY]) echo >&4 "Okay, continuing." ;;
4740 *) exit 1 ;;
4741 esac
4742 ;;
4743 *) echo "Your C compiler needs $c99_for to compile C99 code"
4744 ccflags="$c99_for $ccflags"
4745 ;;
4746 esac
4747 $rm -f try try.*
4748
4749 : What should the include directory be ?
4750 : Use sysroot if set, so findhdr looks in the right place.
4751 echo " "
4752 $echo $n "Hmm... $c"
4753 dflt="$sysroot/usr/include"
4754 incpath=''
4755 mips_type=''
4756 if $test -f /bin/mips && /bin/mips; then
4757 echo "Looks like a MIPS system..."
4758 $cat >usr.c <<'EOCP'
4759 #ifdef SYSTYPE_BSD43
4760 /bsd43
4761 #endif
4762 EOCP
4763 if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4764 dflt='/bsd43/usr/include'
4765 incpath='/bsd43'
4766 mips_type='BSD 4.3'
4767 else
4768 mips_type='System V'
4769 fi
4770 $rm -f usr.c usr.out
4771 echo "and you're compiling with the $mips_type compiler and libraries."
4772 xxx_prompt=y
4773 echo "exit 0" >mips
4774 else
4775 echo "Doesn't look like a MIPS system."
4776 xxx_prompt=n
4777 echo "exit 1" >mips
4778 fi
4779 chmod +x mips
4780 $eunicefix mips
4781 case "$usrinc" in
4782 '') ;;
4783 *) dflt="$usrinc";;
4784 esac
4785 case "$xxx_prompt" in
4786 y) fn=d/
4787 echo " "
4788 rp='Where are the include files you want to use?'
4789 . ./getfile
4790 usrinc="$ans"
4791 ;;
4792 *) usrinc="$dflt"
4793 ;;
4794 esac
4795
4796 : see how we invoke the C preprocessor
4797 echo " "
4798 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4799 cat <<'EOT' >testcpp.c
4800 #define ABC abc
4801 #define XYZ xyz
4802 ABC.XYZ
4803 EOT
4804 cd ..
4805 if test ! -f cppstdin; then
4806 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4807 # AIX cc -E doesn't show the absolute headerfile
4808 # locations but we'll cheat by using the -M flag.
4809 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
4810 else
4811 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4812 fi
4813 else
4814 echo "Keeping your $hint cppstdin wrapper."
4815 fi
4816 chmod 755 cppstdin
4817 wrapper=`pwd`/cppstdin
4818 ok='false'
4819 cd UU
4820
4821 if $test "X$cppstdin" != "X" && \
4822 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4823 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4824 then
4825 echo "You used to use $cppstdin $cppminus so we'll use that again."
4826 case "$cpprun" in
4827 '') echo "But let's see if we can live without a wrapper..." ;;
4828 *)
4829 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4830 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4831 then
4832 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4833 ok='true'
4834 else
4835 echo "(However, $cpprun $cpplast does not work, let's see...)"
4836 fi
4837 ;;
4838 esac
4839 else
4840 case "$cppstdin" in
4841 '') ;;
4842 *)
4843 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4844 ;;
4845 esac
4846 fi
4847
4848 if $ok; then
4849 : nothing
4850 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4851 $cc -E <testcpp.c >testcpp.out 2>&1; \
4852 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4853 echo "Yup, it does."
4854 x_cpp="$cc $cppflags -E"
4855 x_minus='';
4856 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4857 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4858 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4859 echo "Yup, it does."
4860 x_cpp="$cc $cppflags -E"
4861 x_minus='-';
4862 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4863 $cc -P <testcpp.c >testcpp.out 2>&1; \
4864 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4865 echo "Yipee, that works!"
4866 x_cpp="$cc $cppflags -P"
4867 x_minus='';
4868 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4869 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4870 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4871 echo "At long last!"
4872 x_cpp="$cc $cppflags -P"
4873 x_minus='-';
4874 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4875 $cpp <testcpp.c >testcpp.out 2>&1; \
4876 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4877 echo "It works!"
4878 x_cpp="$cpp $cppflags"
4879 x_minus='';
4880 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4881 $cpp - <testcpp.c >testcpp.out 2>&1; \
4882 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4883 echo "Hooray, it works! I was beginning to wonder."
4884 x_cpp="$cpp $cppflags"
4885 x_minus='-';
4886 elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4887 $wrapper <testcpp.c >testcpp.out 2>&1; \
4888 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4889 x_cpp="$wrapper"
4890 x_minus=''
4891 echo "Eureka!"
4892 else
4893 dflt=''
4894 rp="No dice. I can't find a C preprocessor. Name one:"
4895 . ./myread
4896 x_cpp="$ans"
4897 x_minus=''
4898 $x_cpp <testcpp.c >testcpp.out 2>&1
4899 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4900 echo "OK, that will do." >&4
4901 else
4902 echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4903 exit 1
4904 fi
4905 fi
4906
4907 case "$ok" in
4908 false)
4909 cppstdin="$x_cpp"
4910 cppminus="$x_minus"
4911 cpprun="$x_cpp"
4912 cpplast="$x_minus"
4913 set X $x_cpp
4914 shift
4915 case "$1" in
4916 "$cpp")
4917 echo "Perhaps can we force $cc -E using a wrapper..."
4918 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4919 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4920 then
4921 echo "Yup, we can."
4922 cppstdin="$wrapper"
4923 cppminus='';
4924 else
4925 echo "Nope, we'll have to live without it..."
4926 fi
4927 ;;
4928 esac
4929 case "$cpprun" in
4930 "$wrapper")
4931 cpprun=''
4932 cpplast=''
4933 ;;
4934 esac
4935 ;;
4936 esac
4937
4938 case "$cppstdin" in
4939 "$wrapper"|'cppstdin') ;;
4940 *) $rm -f $wrapper;;
4941 esac
4942 $rm -f testcpp.c testcpp.out
4943
4944 : Adjust cppfilter for path component separator
4945 case "$osname" in
4946 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4947 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4948 *) cppfilter='' ;;
4949 esac
4950
4951 : Use gcc to determine libpth and incpth
4952 # If using gcc or clang, we can get better values for libpth, incpth
4953 # and usrinc directly from the compiler.
4954 # Note that ccname for clang is also gcc.
4955 case "$ccname" in
4956 gcc)
4957 realpath=`which realpath 2>/dev/null | sed 's/no realpath in.*//'`
4958 $echo 'extern int foo;' > try.c
4959 set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4960 shift
4961 inclibpth=""
4962 if $test $# -gt 0; then
4963 for i in $*; do
4964 case $realpath in
4965 */realpath) i=`$realpath --no-symlinks $i` ;;
4966 esac
4967 incpth="$incpth $i"
4968 j="`$echo $i | $sed 's,/include[^/]*,/lib,'`"
4969 if $test -d $j; then
4970 inclibpth="$inclibpth $j"
4971 fi
4972 done
4973 incpth="`$echo $incpth | $sed 's/^ //'`"
4974 for xxx in $inclibpth $loclibpth $plibpth $glibpth; do
4975 if $test -d $xxx; then
4976 case $realpath in
4977 */realpath) xxx=`$realpath --no-symlinks $xxx` ;;
4978 esac
4979 case " $libpth " in
4980 *" $xxx "*) ;;
4981 *) libpth="$libpth $xxx";;
4982 esac
4983 fi
4984 done
4985 libpth="`$echo $libpth | $sed 's/^ //'`"
4986 fi
4987 $rm -f try.c
4988 case "$usrinc" in
4989 '') for i in $incpth; do
4990 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4991 usrinc="$i"
4992 break
4993 fi
4994 done
4995 ;;
4996 esac
4997
4998 case "$usecrosscompile" in
4999 $define|true|[yY]*)
5000 case "$incpth" in
5001 '') echo "Incpth not defined." >&4; croak=y ;;
5002 *) echo "Using incpth '$incpth'." >&4 ;;
5003 esac
5004 case "$libpth" in
5005 '') echo "Libpth not defined." >&4; croak=y ;;
5006 *) echo "Using libpth '$libpth'." >&4 ;;
5007 esac
5008 case "$usrinc" in
5009 '') echo "Usrinc not defined." >&4; croak=y ;;
5010 *) echo "Using usrinc $usrinc." >&4 ;;
5011 esac
5012 case "$croak" in
5013 y)
5014 if test "X$sysroot" = X; then
5015 echo "Cannot continue, aborting." >&4; exit 1
5016 else
5017 echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5018 fi
5019 ;;
5020 esac
5021 ;;
5022 esac
5023 ;;
5024 esac
5025
5026 : Default value for incpth is just usrinc
5027 case "$incpth" in
5028 '') incpth="$usrinc";;
5029 esac
5030
5031 : Set private lib path
5032 case "$plibpth" in
5033 '') if ./mips; then
5034 plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5035 fi;;
5036 esac
5037 case "$libpth" in
5038 ' ') dlist='';;
5039 '') dlist="$loclibpth $plibpth $glibpth";;
5040 *) dlist="$libpth";;
5041 esac
5042
5043 : Now check and see which directories actually exist, avoiding duplicates
5044 for xxx in $dlist
5045 do
5046 if $test -d $xxx; then
5047 case " $libpth " in
5048 *" $xxx "*) ;;
5049 *) libpth="$libpth $xxx";;
5050 esac
5051 fi
5052 done
5053 $cat <<'EOM'
5054
5055 Some systems have incompatible or broken versions of libraries. Among
5056 the directories listed in the question below, please remove any you
5057 know not to be holding relevant libraries, and add any that are needed.
5058 Say "none" for none.
5059
5060 EOM
5061
5062 if test "X$sysroot" != X; then
5063 $cat <<EOM
5064 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5065
5066 EOM
5067 fi
5068
5069 case "$libpth" in
5070 '') dflt='none';;
5071 *)
5072 set X $libpth
5073 shift
5074 dflt=${1+"$@"}
5075 ;;
5076 esac
5077 rp="Directories to use for library searches?"
5078 . ./myread
5079 case "$ans" in
5080 none) libpth=' ';;
5081 *) libpth="$ans";;
5082 esac
5083
5084 : compute shared library extension
5085 case "$so" in
5086 '')
5087 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5088 dflt='sl'
5089 else
5090 dflt='so'
5091 fi
5092 ;;
5093 *) dflt="$so";;
5094 esac
5095 $cat <<EOM
5096
5097 On some systems, shared libraries may be available. Answer 'none' if
5098 you want to suppress searching of shared libraries for the remainder
5099 of this configuration.
5100
5101 EOM
5102 rp='What is the file extension used for shared libraries?'
5103 . ./myread
5104 so="$ans"
5105
5106 : Does target system insist that shared library basenames are unique
5107 $cat << EOM
5108
5109 Some dynamic loaders assume that the *basename* of shared library filenames
5110 are globally unique. We'll default this to undef as we assume your system
5111 is not this weird. Set to defined if you're on one of them.
5112
5113 EOM
5114
5115 dflt='n'
5116 rp='Make shared library basenames unique?'
5117 . ./myread
5118 case "$ans" in
5119 y|Y) val="$define" ;;
5120 *) val="$undef" ;;
5121 esac
5122 set d_libname_unique
5123 eval $setvar
5124
5125 : Define several unixisms.
5126 : Hints files or command line option can be used to override them.
5127 : The convoluted testing is in case hints files set either the old
5128 : or the new name.
5129 case "$_exe" in
5130 '') case "$exe_ext" in
5131 '') ;;
5132 *) _exe="$exe_ext" ;;
5133 esac
5134 ;;
5135 esac
5136 case "$_a" in
5137 '') case "$lib_ext" in
5138 '') _a='.a';;
5139 *) _a="$lib_ext" ;;
5140 esac
5141 ;;
5142 esac
5143 case "$_o" in
5144 '') case "$obj_ext" in
5145 '') _o='.o';;
5146 *) _o="$obj_ext";;
5147 esac
5148 ;;
5149 esac
5150 case "$p_" in
5151 '') case "$path_sep" in
5152 '') p_=':';;
5153 *) p_="$path_sep";;
5154 esac
5155 ;;
5156 esac
5157 exe_ext=$_exe
5158 lib_ext=$_a
5159 obj_ext=$_o
5160 path_sep=$p_
5161
5162 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5163
5164 : Which makefile gets called first. This is used by make depend.
5165 case "$firstmakefile" in
5166 '') firstmakefile='makefile';;
5167 esac
5168
5169 : Check is we will use socks
5170 case "$usesocks" in
5171 $define|true|[yY]*) dflt='y';;
5172 *) dflt='n';;
5173 esac
5174 cat <<EOM
5175
5176 Perl can be built to use the SOCKS proxy protocol library. To do so,
5177 Configure must be run with -Dusesocks. If you use SOCKS you also need
5178 to use the PerlIO abstraction layer, this will be implicitly selected.
5179
5180 If this doesn't make any sense to you, just accept the default '$dflt'.
5181 EOM
5182 rp='Build Perl for SOCKS?'
5183 . ./myread
5184 case "$ans" in
5185 y|Y) val="$define" ;;
5186 *) val="$undef" ;;
5187 esac
5188 set usesocks
5189 eval $setvar
5190
5191 : Check for uselongdouble support
5192 case "$ccflags" in
5193 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5194 esac
5195
5196 case "$uselongdouble" in
5197 $define|true|[yY]*) dflt='y';;
5198 *) dflt='n';;
5199 esac
5200 cat <<EOM
5201
5202 Perl can be built to take advantage of long doubles which
5203 (if available) may give more accuracy and range for floating point numbers.
5204
5205 If this doesn't make any sense to you, just accept the default '$dflt'.
5206 EOM
5207 rp='Try to use long doubles if available?'
5208 . ./myread
5209 case "$ans" in
5210 y|Y) val="$define" ;;
5211 *) val="$undef" ;;
5212 esac
5213 set uselongdouble
5214 eval $setvar
5215
5216 case "$uselongdouble" in
5217 true|[yY]*) uselongdouble="$define" ;;
5218 esac
5219
5220 : Look for a hint-file generated 'call-back-unit'. If the
5221 : user has specified that long doubles should be used,
5222 : we may need to set or change some other defaults.
5223 if $test -f uselongdouble.cbu; then
5224 echo "Your platform has some specific hints regarding long doubles, using them..."
5225 . ./uselongdouble.cbu
5226 else
5227 case "$uselongdouble" in
5228 $define)
5229 $cat <<EOM
5230 (Your platform does not have any specific hints for long doubles.)
5231 EOM
5232 ;;
5233 esac
5234 fi
5235
5236 : Looking for optional libraries
5237 echo " "
5238 echo "Checking for optional libraries..." >&4
5239 case "$libs" in
5240 ' '|'') dflt='';;
5241 *) dflt="$libs";;
5242 esac
5243 case "$libswanted" in
5244 '') libswanted='c_s';;
5245 esac
5246 case "$usesocks" in
5247 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5248 esac
5249 case "$usecbacktrace" in
5250 "$define") libswanted="$libswanted bfd" ;;
5251 esac
5252 libsfound=''
5253 libsfiles=''
5254 libsdirs=''
5255 libspath=''
5256 for thisdir in $libpth $xlibpth; do
5257 test -d $thisdir && libspath="$libspath $thisdir"
5258 done
5259 for thislib in $libswanted; do
5260 for thisdir in $libspath; do
5261 xxx=''
5262 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5263 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5264 $test -f "$xxx" && eval $libscheck
5265 $test -f "$xxx" && libstyle=shared
5266 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5267 $test -f "$xxx" && eval $libscheck
5268 $test -f "$xxx" && libstyle=shared
5269 fi
5270 if test ! -f "$xxx"; then
5271 xxx=$thisdir/lib$thislib.$so$_a
5272 $test -f "$xxx" && eval $libscheck
5273 $test -f "$xxx" && libstyle="import"
5274 fi
5275 if test ! -f "$xxx"; then
5276 xxx=$thisdir/$thislib.$so$_a
5277 $test -f "$xxx" && eval $libscheck
5278 $test -f "$xxx" && libstyle="import"
5279 fi
5280 if test ! -f "$xxx"; then
5281 xxx=$thisdir/lib$thislib.$so
5282 $test -f "$xxx" && eval $libscheck
5283 $test -f "$xxx" && libstyle=shared
5284 fi
5285 if test ! -f "$xxx"; then
5286 xxx=$thisdir/lib$thislib$_a
5287 $test -f "$xxx" && eval $libscheck
5288 $test -f "$xxx" && libstyle=static
5289 fi
5290 if test ! -f "$xxx"; then
5291 xxx=$thisdir/$thislib$_a
5292 $test -f "$xxx" && eval $libscheck
5293 $test -f "$xxx" && libstyle=static
5294 fi
5295 if test ! -f "$xxx"; then
5296 xxx=$thisdir/lib${thislib}_s$_a
5297 $test -f "$xxx" && eval $libscheck
5298 $test -f "$xxx" && libstyle=static
5299 $test -f "$xxx" && thislib=${thislib}_s
5300 fi
5301 if test ! -f "$xxx"; then
5302 xxx=$thisdir/Slib$thislib$_a
5303 $test -f "$xxx" && eval $libscheck
5304 $test -f "$xxx" && libstyle=static
5305 fi
5306 if $test -f "$xxx"; then
5307 case "$libstyle" in
5308 shared) echo "Found -l$thislib (shared)." ;;
5309 static) echo "Found -l$thislib." ;;
5310 *) echo "Found -l$thislib ($libstyle)." ;;
5311 esac
5312 case " $dflt " in
5313 *"-l$thislib "*);;
5314 *) dflt="$dflt -l$thislib"
5315 libsfound="$libsfound $xxx"
5316 yyy=`basename $xxx`
5317 libsfiles="$libsfiles $yyy"
5318 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5319 case " $libsdirs " in
5320 *" $yyy "*) ;;
5321 *) libsdirs="$libsdirs $yyy" ;;
5322 esac
5323 ;;
5324 esac
5325 break
5326 fi
5327 done
5328 if $test ! -f "$xxx"; then
5329 echo "No -l$thislib."
5330 fi
5331 done
5332 set X $dflt
5333 shift
5334 dflt="$*"
5335 case "$libs" in
5336 '') dflt="$dflt";;
5337 *) dflt="$libs";;
5338 esac
5339 case "$dflt" in
5340 ' '|'') dflt='none';;
5341 esac
5342
5343 $cat <<EOM
5344
5345 In order to compile $package on your machine, a number of libraries
5346 are usually needed. Include any other special libraries here as well.
5347 Say "none" for none. The default list is almost always right.
5348 EOM
5349
5350 echo " "
5351 rp="What libraries to use?"
5352 . ./myread
5353 case "$ans" in
5354 none) libs=' ';;
5355 *) libs="$ans";;
5356 esac
5357
5358 : determine optimization, if desired, or use for debug flag also
5359 case "$optimize" in
5360 ' '|$undef) dflt='none';;
5361 '') dflt='-O';;
5362 *) dflt="$optimize";;
5363 esac
5364 $cat <<EOH
5365
5366 By default, $package compiles with the -O flag to use the optimizer.
5367 Alternately, you might want to use the symbolic debugger, which uses
5368 the -g flag (on traditional Unix systems). Either flag can be
5369 specified here. To use neither flag, specify the word "none".
5370
5371 EOH
5372 rp="What optimizer/debugger flag should be used?"
5373 . ./myread
5374 optimize="$ans"
5375 case "$optimize" in
5376 'none') optimize=" ";;
5377 esac
5378
5379 : Check what DEBUGGING is required from the command line
5380 : -DEBUGGING or -DDEBUGGING or
5381 : -DEBUGGING=both = -g + -DDEBUGGING
5382 : -DEBUGGING=-g or -Doptimize=-g = -g
5383 : -DEBUGGING=none or -UDEBUGGING =
5384 : -DEBUGGING=old or -DEBUGGING=default = ? $optimize
5385 case "$EBUGGING" in
5386 '') ;;
5387 *) DEBUGGING=$EBUGGING ;;
5388 esac
5389
5390 case "$DEBUGGING" in
5391 -g|both|$define)
5392 case "$optimize" in
5393 *-g*) ;;
5394 *) optimize="$optimize -g" ;;
5395 esac ;;
5396 none|$undef)
5397 case "$optimize" in
5398 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5399 shift
5400 optimize="$*"
5401 ;;
5402 esac ;;
5403 esac
5404
5405 dflt=''
5406 case "$DEBUGGING" in
5407 both|$define) dflt='-DDEBUGGING'
5408 esac
5409
5410 : argument order is deliberate, as the flag will start with - which set could
5411 : think is an option
5412 checkccflag='check=$1; flag=$2; callback=$3;
5413 echo " ";
5414 echo "Checking if your compiler accepts $flag" >&4;
5415 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5416 echo "int main(void) { return 0; }" > gcctest.c;
5417 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5418 echo "Yes, it does." >&4;
5419 if $test -s gcctest.out ; then
5420 echo "But your platform does not like it:";
5421 cat gcctest.out;
5422 else
5423 case "$ccflags" in
5424 *$check*)
5425 echo "Leaving current flags $ccflags alone." >&4
5426 ;;
5427 *) dflt="$dflt $flag";
5428 eval $callback
5429 ;;
5430 esac
5431 fi
5432 else
5433 echo "Nope, it does not, but that is ok." >&4;
5434 fi
5435 '
5436
5437 : We will not override a previous value, but we might want to
5438 : augment a hint file
5439 case "$hint" in
5440 default|recommended)
5441 case "$gccversion" in
5442 1.*) dflt="$dflt -fpcc-struct-return" ;;
5443 esac
5444 case "$optimize:$DEBUGGING" in
5445 *-g*:old) dflt="$dflt -DDEBUGGING";;
5446 esac
5447 case "$gccversion" in
5448 2.*) if $test -d /etc/conf/kconfig.d &&
5449 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5450 then
5451 # Interactive Systems (ISC) POSIX mode.
5452 dflt="$dflt -posix"
5453 fi
5454 ;;
5455 esac
5456 case "$gccversion" in
5457 1.*) ;;
5458 2.[0-8]*) ;;
5459 ?*) set strict-aliasing -fno-strict-aliasing
5460 eval $checkccflag
5461 ;;
5462 esac
5463 # For gcc, adding -pipe speeds up compilations for some, but apparently
5464 # some assemblers can't read from stdin. (It also slows down compilations
5465 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5466 case "$gccversion" in
5467 ?*) set pipe -pipe
5468 eval $checkccflag
5469 ;;
5470 esac
5471
5472 # on x86_64 (at least) we require an extra library (libssp) in the
5473 # link command line. This library is not named, so I infer that it is
5474 # an implementation detail that may change. Hence the safest approach
5475 # is to add the flag to the flags passed to the compiler at link time,
5476 # as that way the compiler can do the right implementation dependant
5477 # thing. (NWC)
5478 case "$ccflags" in
5479 *-fno-stack-protector*)
5480 echo "Do not add -fstack-protector nor -fstack-protector-strong" 2>&1
5481 ;;
5482 *) case "$gccversion" in
5483 ?*) set stack-protector-strong -fstack-protector-strong
5484 eval $checkccflag
5485 case "$dflt" in
5486 *-fstack-protector-strong*) ;; # It got added.
5487 *) # Try the plain/older -fstack-protector.
5488 set stack-protector -fstack-protector
5489 eval $checkccflag
5490 ;;
5491 esac
5492 ;;
5493 esac
5494 ;;
5495 esac
5496 esac
5497
5498 case "$mips_type" in
5499 *BSD*|'') inclwanted="$locincpth $usrinc";;
5500 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5501 esac
5502 for thisincl in $inclwanted; do
5503 if $test -d $thisincl; then
5504 if $test x$thisincl != x$usrinc; then
5505 case "$dflt" in
5506 *" -I$thisincl "*);;
5507 *) dflt="$dflt -I$thisincl ";;
5508 esac
5509 fi
5510 fi
5511 done
5512
5513 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5514 xxx=true;
5515 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5516 xxx=true;
5517 else
5518 xxx=false;
5519 fi;
5520 if $xxx; then
5521 case "$dflt" in
5522 *$2*);;
5523 *) dflt="$dflt -D$2";;
5524 esac;
5525 fi'
5526
5527 set signal.h LANGUAGE_C; eval $inctest
5528
5529 case "$usesocks" in
5530 $define)
5531 ccflags="$ccflags -DSOCKS"
5532 ;;
5533 esac
5534
5535 case "$hint" in
5536 default|recommended) dflt="$ccflags $dflt" ;;
5537 *) dflt="$ccflags";;
5538 esac
5539
5540 case "$dflt" in
5541 ''|' ') dflt=none;;
5542 esac
5543
5544 $cat <<EOH
5545
5546 Your C compiler may want other flags. For this question you should include
5547 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5548 but you should NOT include libraries or ld flags like -lwhatever. If you
5549 want $package to honor its debug switch, you should include -DDEBUGGING here.
5550 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5551
5552 To use no flags, specify the word "none".
5553
5554 EOH
5555 set X $dflt
5556 shift
5557 dflt=${1+"$@"}
5558 rp="Any additional cc flags?"
5559 . ./myread
5560 case "$ans" in
5561 none) ccflags='';;
5562 *) ccflags="$ans";;
5563 esac
5564
5565 : the following weeds options from ccflags that are of no interest to cpp
5566 case "$cppflags" in
5567 '') cppflags="$ccflags" ;;
5568 *) set X $ccflags; shift
5569 case " $cppflags " in
5570 *" $1 "*) ;; # Try to avoid doubling the cppflags.
5571 *) cppflags="$cppflags $ccflags" ;;
5572 esac
5573 ;;
5574 esac
5575 case "$gccversion" in
5576 1.*) cppflags="$cppflags -D__GNUC__"
5577 esac
5578 case "$mips_type" in
5579 '');;
5580 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5581 esac
5582 case "$cppflags" in
5583 '');;
5584 *)
5585 echo " "
5586 echo "Let me guess what the preprocessor flags are..." >&4
5587 set X $cppflags
5588 shift
5589 cppflags=''
5590 $cat >cpp.c <<'EOM'
5591 #define BLURFL foo
5592
5593 BLURFL xx LFRULB
5594 EOM
5595 previous=''
5596 for flag in $*
5597 do
5598 case "$flag" in
5599 -*) ftry="$flag";;
5600 *) ftry="$previous $flag";;
5601 esac
5602 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5603 >cpp1.out 2>/dev/null && \
5604 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5605 >cpp2.out 2>/dev/null && \
5606 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5607 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5608 then
5609 cppflags="$cppflags $ftry"
5610 previous=''
5611 else
5612 previous="$flag"
5613 fi
5614 done
5615 set X $cppflags
5616 shift
5617 cppflags=${1+"$@"}
5618 case "$cppflags" in
5619 *-*) echo "They appear to be: $cppflags";;
5620 esac
5621 $rm -f cpp.c cpp?.out
5622 ;;
5623 esac
5624
5625 : flags used in final linking phase
5626 case "$ldflags" in
5627 '') if ./venix; then
5628 dflt='-i -z'
5629 else
5630 dflt=''
5631 fi
5632 case "$ccflags" in
5633 *-posix*) dflt="$dflt -posix" ;;
5634 esac
5635 ;;
5636 *) dflt="$ldflags";;
5637 esac
5638 # See note above about -fstack-protector
5639 case "$ccflags" in
5640 *-fstack-protector-strong*)
5641 case "$dflt" in
5642 *-fstack-protector-strong*) ;; # Don't add it again
5643 *) dflt="$dflt -fstack-protector-strong" ;;
5644 esac
5645 ;;
5646 *-fstack-protector*)
5647 case "$dflt" in
5648 *-fstack-protector*) ;; # Don't add it again
5649 *) dflt="$dflt -fstack-protector" ;;
5650 esac
5651 ;;
5652 esac
5653
5654 : Try to guess additional flags to pick up local libraries.
5655 for thislibdir in $libpth; do
5656 case " $loclibpth " in
5657 *" $thislibdir "*)
5658 case "$dflt " in
5659 *"-L$thislibdir "*) ;;
5660 *) dflt="$dflt -L$thislibdir" ;;
5661 esac
5662 ;;
5663 esac
5664 done
5665
5666 case "$dflt" in
5667 '') dflt='none' ;;
5668 esac
5669
5670 $cat <<EOH
5671
5672 Your C linker may need flags. For this question you should
5673 include -L/whatever and any other flags used by the C linker, but you
5674 should NOT include libraries like -lwhatever.
5675
5676 Make sure you include the appropriate -L/path flags if your C linker
5677 does not normally search all of the directories you specified above,
5678 namely
5679 $libpth
5680 To use no flags, specify the word "none".
5681
5682 EOH
5683
5684 rp="Any additional ld flags (NOT including libraries)?"
5685 . ./myread
5686 case "$ans" in
5687 none) ldflags='';;
5688 *) ldflags="$ans";;
5689 esac
5690 rmlist="$rmlist pdp11"
5691
5692 : coherency check
5693 echo " "
5694 echo "Checking your choice of C compiler and flags for coherency..." >&4
5695 $cat > try.c <<'EOF'
5696 #include <stdio.h>
5697 int main() { printf("Ok\n"); return(0); }
5698 EOF
5699 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5700 shift
5701 $cat >try.msg <<'EOM'
5702 I've tried to compile and run the following simple program:
5703
5704 EOM
5705 $cat try.c >> try.msg
5706
5707 $cat >> try.msg <<EOM
5708
5709 I used the command:
5710
5711 $*
5712 $run ./try
5713
5714 and I got the following output:
5715
5716 EOM
5717 dflt=y
5718 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5719 if $sh -c "$run ./try " >>try.msg 2>&1; then
5720 xxx=`$run ./try`
5721 case "$xxx" in
5722 "Ok") dflt=n ;;
5723 *) echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5724 esac
5725 else
5726 echo "The program compiled OK, but exited with status $?." >>try.msg
5727 rp="You have a problem. Shall I abort Configure"
5728 dflt=y
5729 fi
5730 else
5731 echo "I can't compile the test program." >>try.msg
5732 rp="You have a BIG problem. Shall I abort Configure"
5733 dflt=y
5734 fi
5735 case "$dflt" in
5736 y)
5737 $cat try.msg >&4
5738 case "$knowitall" in
5739 '')
5740 echo "(The supplied flags or libraries might be incorrect.)"
5741 ;;
5742 *) dflt=n;;
5743 esac
5744 echo " "
5745 . ./myread
5746 case "$ans" in
5747 n*|N*) ;;
5748 *) echo "Ok. Stopping Configure." >&4
5749 exit 1
5750 ;;
5751 esac
5752 ;;
5753 n) echo "OK, that should do.";;
5754 esac
5755 $rm_try gcctest gcctest.out
5756
5757 : define a shorthand compile call
5758 compile='
5759 mc_file=$1;
5760 shift;
5761 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5762 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to https://github.com/Perl/perl5/issues" >&4;
5763 exit 1;
5764 fi;
5765 esac;
5766 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5767 : define a shorthand compile call for compilations that should be ok.
5768 compile_ok='
5769 mc_file=$1;
5770 shift;
5771 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5772
5773 : stub, used only to satisfy other units
5774 i_stdlib='define'
5775
5776 : check for lengths of integral types
5777 echo " "
5778 case "$intsize" in
5779 '')
5780 echo "Checking to see how big your integers are..." >&4
5781 $cat >try.c <<EOCP
5782 #include <stdio.h>
5783 #$i_stdlib I_STDLIB
5784 #ifdef I_STDLIB
5785 #include <stdlib.h>
5786 #endif
5787 #include <stdio.h>
5788 int main()
5789 {
5790 printf("intsize=%d;\n", (int)sizeof(int));
5791 printf("longsize=%d;\n", (int)sizeof(long));
5792 printf("shortsize=%d;\n", (int)sizeof(short));
5793 exit(0);
5794 }
5795 EOCP
5796 set try
5797 if eval $compile_ok && $run ./try > /dev/null; then
5798 eval `$run ./try`
5799 echo "Your integers are $intsize bytes long."
5800 echo "Your long integers are $longsize bytes long."
5801 echo "Your short integers are $shortsize bytes long."
5802 else
5803 $cat >&4 <<EOM
5804 !
5805 Help! I can't compile and run the intsize test program: please enlighten me!
5806 (This is probably a misconfiguration in your system or libraries, and
5807 you really ought to fix it. Still, I'll try anyway.)
5808 !
5809 EOM
5810 dflt=4
5811 rp="What is the size of an integer (in bytes)?"
5812 . ./myread
5813 intsize="$ans"
5814 dflt=$intsize
5815 rp="What is the size of a long integer (in bytes)?"
5816 . ./myread
5817 longsize="$ans"
5818 dflt=2
5819 rp="What is the size of a short integer (in bytes)?"
5820 . ./myread
5821 shortsize="$ans"
5822 fi
5823 ;;
5824 esac
5825 $rm_try
5826
5827 : check for long long
5828 echo " "
5829 echo "Checking to see if you have long long..." >&4
5830 echo 'int main() { long long x = 7; return 0; }' > try.c
5831 set try
5832 if eval $compile; then
5833 val="$define"
5834 echo "You have long long."
5835 else
5836 val="$undef"
5837 echo "You do not have long long."
5838 fi
5839 $rm_try
5840 set d_longlong
5841 eval $setvar
5842
5843 : check for length of long long
5844 case "${d_longlong}${longlongsize}" in
5845 $define)
5846 echo " "
5847 echo "Checking to see how big your long longs are..." >&4
5848 $cat >try.c <<'EOCP'
5849 #include <stdio.h>
5850 int main()
5851 {
5852 printf("%d\n", (int)sizeof(long long));
5853 return(0);
5854 }
5855 EOCP
5856 set try
5857 if eval $compile_ok; then
5858 longlongsize=`$run ./try`
5859 echo "Your long longs are $longlongsize bytes long."
5860 else
5861 dflt='8'
5862 echo " "
5863 echo "(I can't seem to compile the test program. Guessing...)"
5864 rp="What is the size of a long long (in bytes)?"
5865 . ./myread
5866 longlongsize="$ans"
5867 fi
5868 if $test "X$longsize" = "X$longlongsize"; then
5869 echo "(That isn't any different from an ordinary long.)"
5870 fi
5871 ;;
5872 esac
5873 $rm_try
5874
5875 : determine filename position in cpp output
5876 echo " "
5877 echo "Computing filename position in cpp output for #include directives..." >&4
5878 case "$osname" in
5879 amigaos) fieldn=3 ;; # Workaround for a bug in abc (pdksh).
5880 esac
5881 case "$fieldn" in
5882 '')
5883 case "$osname" in
5884 vos) testaccess=-e ;;
5885 *) testaccess=-r ;;
5886 esac
5887 echo '#include <stdio.h>' > foo.c
5888 $cat >fieldn <<EOF
5889 $startsh
5890 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5891 $grep '^[ ]*#.*stdio\.h' | \
5892 while read cline; do
5893 pos=1
5894 set \$cline
5895 while $test \$# -gt 0; do
5896 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5897 echo "\$pos"
5898 exit 0
5899 fi
5900 shift
5901 pos=\`expr \$pos + 1\`
5902 done
5903 done
5904 EOF
5905 chmod +x fieldn
5906 fieldn=`./fieldn`
5907 $rm -f foo.c fieldn
5908 ;;
5909 esac
5910 case $fieldn in
5911 '') pos='???';;
5912 1) pos=first;;
5913 2) pos=second;;
5914 3) pos=third;;
5915 *) pos="${fieldn}th";;
5916 esac
5917 echo "Your cpp writes the filename in the $pos field of the line."
5918
5919 : locate header file
5920 $cat >findhdr <<EOF
5921 $startsh
5922 wanted=\$1
5923 name=''
5924 for usrincdir in $incpth
5925 do
5926 if test -f \$usrincdir/\$wanted; then
5927 echo "\$usrincdir/\$wanted"
5928 exit 0
5929 fi
5930 done
5931 awkprg='{ print \$$fieldn }'
5932 echo "#include <\$wanted>" > foo\$\$.c
5933 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5934 $cppfilter $grep "^[ ]*#.*\$wanted" | \
5935 while read cline; do
5936 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5937 case "\$name" in
5938 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5939 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5940 *) exit 2;;
5941 esac;
5942 done;
5943 #
5944 # status = 0: grep returned 0 lines, case statement not executed
5945 # status = 1: headerfile found
5946 # status = 2: while loop executed, no headerfile found
5947 #
5948 status=\$?
5949 $rm -f foo\$\$.c;
5950 if test \$status -eq 1; then
5951 exit 0;
5952 fi
5953 exit 1
5954 EOF
5955 chmod +x findhdr
5956
5957 : define an alternate in-header-list? function
5958 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5959 cont=true; xxf="echo \"<\$1> found.\" >&4";
5960 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5961 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5962 esac;
5963 case $# in 4) instead=instead;; *) instead="at last";; esac;
5964 while $test "$cont"; do
5965 xxx=`./findhdr $1`
5966 var=$2; eval "was=\$$2";
5967 if $test "$xxx" && $test -r "$xxx";
5968 then eval $xxf;
5969 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5970 cont="";
5971 else eval $xxnf;
5972 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5973 set $yyy; shift; shift; yyy=$@;
5974 case $# in 0) cont="";;
5975 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5976 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5977 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5978 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5979 esac;
5980 done;
5981 while $test "$yyy";
5982 do set $yyy; var=$2; eval "was=\$$2";
5983 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5984 set $yyy; shift; shift; yyy=$@;
5985 done'
5986
5987 : see if inttypes.h is available
5988 : we want a real compile instead of Inhdr because some systems
5989 : have an inttypes.h which includes non-existent headers
5990 echo " "
5991 $cat >try.c <<EOCP
5992 #include <inttypes.h>
5993 int main() {
5994 static int32_t foo32 = 0x12345678;
5995 }
5996 EOCP
5997 set try
5998 if eval $compile; then
5999 echo "<inttypes.h> found." >&4
6000 val="$define"
6001 else
6002 echo "<inttypes.h> NOT found." >&4
6003 val="$undef"
6004 fi
6005 $rm_try
6006 set i_inttypes
6007 eval $setvar
6008
6009 : check for int64_t
6010 echo " "
6011 echo "Checking to see if you have int64_t..." >&4
6012 $cat >try.c <<EOCP
6013 #include <sys/types.h>
6014 #$i_inttypes I_INTTYPES
6015 #ifdef I_INTTYPES
6016 #include <inttypes.h>
6017 #endif
6018 int main() { int64_t x = 7; }
6019 EOCP
6020 set try
6021 if eval $compile; then
6022 val="$define"
6023 echo "You have int64_t."
6024 else
6025 val="$undef"
6026 echo "You do not have int64_t."
6027 fi
6028 $rm_try
6029 set d_int64_t
6030 eval $setvar
6031
6032 : Check if 64bit ints have a quad type
6033 echo " "
6034 echo "Checking which 64-bit integer type we could use..." >&4
6035
6036 case "$intsize" in
6037 8) val=int
6038 set quadtype
6039 eval $setvar
6040 val='"unsigned int"'
6041 set uquadtype
6042 eval $setvar
6043 quadkind=1
6044 ;;
6045 *) case "$longsize" in
6046 8) val=long
6047 set quadtype
6048 eval $setvar
6049 val='"unsigned long"'
6050 set uquadtype
6051 eval $setvar
6052 quadkind=2
6053 ;;
6054 *) case "$d_longlong:$longlongsize" in
6055 define:8)
6056 val='"long long"'
6057 set quadtype
6058 eval $setvar
6059 val='"unsigned long long"'
6060 set uquadtype
6061 eval $setvar
6062 quadkind=3
6063 ;;
6064 *) case "$d_int64_t" in
6065 define)
6066 val=int64_t
6067 set quadtype
6068 eval $setvar
6069 val=uint64_t
6070 set uquadtype
6071 eval $setvar
6072 quadkind=4
6073 ;;
6074 esac
6075 ;;
6076 esac
6077 ;;
6078 esac
6079 ;;
6080 esac
6081
6082 case "$quadtype" in
6083 '') echo "Alas, no 64-bit integer types in sight." >&4
6084 d_quad="$undef"
6085 ;;
6086 *) echo "We could use '$quadtype' for 64-bit integers." >&4
6087 d_quad="$define"
6088 ;;
6089 esac
6090
6091 : Do we want 64bit support
6092 case "$uselonglong" in
6093 "$define"|true|[yY]*)
6094 cat <<EOM >&4
6095
6096 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6097 EOM
6098 use64bitint="$define"
6099 ;;
6100 esac
6101 case "$use64bits" in
6102 "$define"|true|[yY]*)
6103 cat <<EOM >&4
6104
6105 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6106 EOM
6107 use64bitint="$define"
6108 ;;
6109 esac
6110 case "$use64bitints" in
6111 "$define"|true|[yY]*)
6112 cat <<EOM >&4
6113
6114 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6115 EOM
6116 use64bitint="$define"
6117 ;;
6118 esac
6119 case "$use64bitsint" in
6120 "$define"|true|[yY]*)
6121 cat <<EOM >&4
6122
6123 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6124 EOM
6125 use64bitint="$define"
6126 ;;
6127 esac
6128 case "$uselonglongs" in
6129 "$define"|true|[yY]*)
6130 cat <<EOM >&4
6131
6132 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6133 EOM
6134 use64bitint="$define"
6135 ;;
6136 esac
6137 case "$use64bitsall" in
6138 "$define"|true|[yY]*)
6139 cat <<EOM >&4
6140
6141 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6142 EOM
6143 use64bitall="$define"
6144 ;;
6145 esac
6146
6147 case "$ccflags" in
6148 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6149 esac
6150 case "$use64bitall" in
6151 "$define"|true|[yY]*) use64bitint="$define" ;;
6152 esac
6153
6154 case "$longsize" in
6155 8) cat <<EOM
6156
6157 You have natively 64-bit long integers.
6158 EOM
6159 val="$define"
6160 ;;
6161 *) case "$use64bitint" in
6162 "$define"|true|[yY]*) dflt='y';;
6163 *) dflt='n';;
6164 esac
6165 case "$d_quad" in
6166 "$define") ;;
6167 *) dflt='n' ;;
6168 esac
6169 cat <<EOM
6170
6171 Perl can be built to take advantage of 64-bit integer types
6172 on some systems. To do so, Configure can be run with -Duse64bitint.
6173 Choosing this option will most probably introduce binary incompatibilities.
6174
6175 If this doesn't make any sense to you, just accept the default '$dflt'.
6176 (The default has been chosen based on your configuration.)
6177 EOM
6178 rp='Try to use 64-bit integers, if available?'
6179 . ./myread
6180 case "$ans" in
6181 [yY]*) val="$define" ;;
6182 *) val="$undef" ;;
6183 esac
6184 ;;
6185 esac
6186 set use64bitint
6187 eval $setvar
6188
6189 case "$use64bitall" in
6190 "$define"|true|[yY]*) dflt='y' ;;
6191 *) case "$longsize" in
6192 8) dflt='y' ;;
6193 *) dflt='n' ;;
6194 esac
6195 ;;
6196 esac
6197 cat <<EOM
6198
6199 You may also choose to try maximal 64-bitness. It means using as much
6200 64-bitness as possible on the platform. This in turn means even more
6201 binary incompatibilities. On the other hand, your platform may not
6202 have any more 64-bitness available than what you already have chosen.
6203
6204 If this doesn't make any sense to you, just accept the default '$dflt'.
6205 (The default has been chosen based on your configuration.)
6206 EOM
6207 rp='Try to use maximal 64-bit support, if available?'
6208 . ./myread
6209 case "$ans" in
6210 [yY]*) val="$define" ;;
6211 *) val="$undef" ;;
6212 esac
6213 set use64bitall
6214 eval $setvar
6215 case "$use64bitall" in
6216 "$define")
6217 case "$use64bitint" in
6218 "$undef")
6219 cat <<EOM
6220
6221 Since you have chosen a maximally 64-bit build, I'm also turning on
6222 the use of 64-bit integers.
6223 EOM
6224 use64bitint="$define" ;;
6225 esac
6226 ;;
6227 esac
6228
6229 : Look for a hint-file generated 'call-back-unit'. If the
6230 : user has specified that a 64-bit perl is to be built,
6231 : we may need to set or change some other defaults.
6232 if $test -f use64bitint.cbu; then
6233 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6234 . ./use64bitint.cbu
6235 fi
6236 case "$use64bitint" in
6237 "$define"|true|[yY]*)
6238 : This test was common to all the OpenBSD forks, and seems harmless for
6239 : other platforms:
6240 echo " "
6241 echo "Checking if your C library has broken 64-bit functions..." >&4
6242 cat >try.c <<EOCP
6243 #include <stdio.h>
6244 typedef $uquadtype myULL;
6245 int main (void)
6246 {
6247 struct {
6248 double d;
6249 myULL u;
6250 } *p, test[] = {
6251 {4294967303.15, 4294967303ULL},
6252 {4294967294.2, 4294967294ULL},
6253 {4294967295.7, 4294967295ULL},
6254 {0.0, 0ULL}
6255 };
6256 for (p = test; p->u; p++) {
6257 myULL x = (myULL)p->d;
6258 if (x != p->u) {
6259 printf("buggy\n");
6260 return 0;
6261 }
6262 }
6263 printf("ok\n");
6264 return 0;
6265 }
6266 EOCP
6267 set try
6268 if eval $compile_ok; then
6269 libcquad=`$run ./try`
6270 echo "Your C library's 64-bit functions are $libcquad."
6271 else
6272 echo "(I can't seem to compile the test program.)"
6273 echo "Assuming that your C library's 64-bit functions are ok."
6274 libcquad="ok"
6275 fi
6276 $rm_try
6277
6278 case "$libcquad" in
6279 buggy*)
6280 cat >&4 <<EOM
6281
6282 *** You have a C library with broken 64-bit functions.
6283 *** 64-bit support does not work reliably in this configuration.
6284 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6285 *** Cannot continue, aborting.
6286
6287 EOM
6288 exit 1
6289 ;;
6290 esac
6291 case "$longsize" in
6292 4) case "$archname64" in
6293 '') archname64=64int ;;
6294 esac
6295 ;;
6296 esac
6297 ;;
6298 esac
6299
6300 : Look for a hint-file generated 'call-back-unit'. If the
6301 : user has specified that a maximally 64-bit perl is to be built,
6302 : we may need to set or change some other defaults.
6303 if $test -f use64bitall.cbu; then
6304 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6305 . ./use64bitall.cbu
6306 fi
6307 case "$use64bitall" in
6308 "$define"|true|[yY]*)
6309 case "$longsize" in
6310 4) case "$archname64" in
6311 ''|64int) archname64=64all ;;
6312 esac
6313 ;;
6314 esac
6315 ;;
6316 esac
6317
6318 case "$d_quad:$use64bitint" in
6319 $undef:$define)
6320 cat >&4 <<EOF
6321
6322 *** You have chosen to use 64-bit integers,
6323 *** but none can be found.
6324 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6325 *** Cannot continue, aborting.
6326
6327 EOF
6328 exit 1
6329 ;;
6330 esac
6331
6332 : Check if we are using the GNU C library
6333 echo " "
6334 echo "Checking for GNU C Library..." >&4
6335 cat >try.c <<'EOCP'
6336 /* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
6337 alone are insufficient to distinguish different versions, such as
6338 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
6339 libc version 2.1.0. A. Dougherty, June 3, 2002.
6340 */
6341 #include <stdio.h>
6342 int main(void)
6343 {
6344 #ifdef __GLIBC__
6345 # ifdef __GLIBC_MINOR__
6346 # if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6347 # include <gnu/libc-version.h>
6348 printf("%s\n", gnu_get_libc_version());
6349 # else
6350 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
6351 # endif
6352 # else
6353 printf("%d\n", __GLIBC__);
6354 # endif
6355 return 0;
6356 #else
6357 return 1;
6358 #endif
6359 }
6360 EOCP
6361 set try
6362 if eval $compile_ok && $run ./try > glibc.ver; then
6363 val="$define"
6364 gnulibc_version=`$cat glibc.ver`
6365 echo "You are using the GNU C Library version $gnulibc_version"
6366 else
6367 val="$undef"
6368 gnulibc_version=''
6369 echo "You are not using the GNU C Library"
6370 fi
6371 $rm_try glibc.ver
6372 set d_gnulibc
6373 eval $setvar
6374
6375 : see if nm is to be used to determine whether a symbol is defined or not
6376 case "$usenm" in
6377 '')
6378 dflt=''
6379 case "$d_gnulibc" in
6380 "$define")
6381 echo " "
6382 echo "nm probably won't work on the GNU C Library." >&4
6383 dflt=n
6384 ;;
6385 esac
6386 case "$dflt" in
6387 '')
6388 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6389 echo " "
6390 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
6391 echo "'nm' won't be sufficient on this system." >&4
6392 dflt=n
6393 fi
6394 ;;
6395 esac
6396 case "$dflt" in
6397 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6398 if $test $dflt -gt 20; then
6399 dflt=y
6400 else
6401 dflt=n
6402 fi
6403 ;;
6404 esac
6405 ;;
6406 *)
6407 case "$usenm" in
6408 true|$define) dflt=y;;
6409 *) dflt=n;;
6410 esac
6411 ;;
6412 esac
6413 $cat <<EOM
6414
6415 I can use $nm to extract the symbols from your C libraries. This
6416 is a time consuming task which may generate huge output on the disk (up
6417 to 3 megabytes) but that should make the symbols extraction faster. The
6418 alternative is to skip the 'nm' extraction part and to compile a small
6419 test program instead to determine whether each symbol is present. If
6420 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6421 this may be the best solution.
6422
6423 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6424
6425 EOM
6426 rp="Shall I use $nm to extract C symbols from the libraries?"
6427 . ./myread
6428 case "$ans" in
6429 [Nn]*) usenm=false;;
6430 *) usenm=true;;
6431 esac
6432
6433 runnm=$usenm
6434 case "$reuseval" in
6435 true) runnm=false;;
6436 esac
6437
6438 : nm options which may be necessary
6439 case "$nm_opt" in
6440 '') if $test -f /mach_boot; then
6441 nm_opt='' # Mach
6442 elif $test -d /usr/ccs/lib; then
6443 nm_opt='-p' # Solaris (and SunOS?)
6444 elif $test -f /dgux; then
6445 nm_opt='-p' # DG-UX
6446 elif $test -f /lib64/rld; then
6447 nm_opt='-p' # 64-bit Irix
6448 else
6449 nm_opt=''
6450 fi;;
6451 esac
6452
6453 : nm options which may be necessary for shared libraries but illegal
6454 : for archive libraries. Thank you, Linux.
6455 case "$nm_so_opt" in
6456 '') case "$myuname" in
6457 *linux*|gnu*)
6458 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6459 nm_so_opt='--dynamic'
6460 fi
6461 ;;
6462 esac
6463 ;;
6464 esac
6465
6466 : Figure out where the libc is located
6467 case "$runnm" in
6468 true)
6469 : get list of predefined functions in a handy place
6470 echo " "
6471 case "$libc" in
6472 '') libc=unknown
6473 case "$libs" in
6474 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6475 esac
6476 ;;
6477 esac
6478 case "$libs" in
6479 '') ;;
6480 *) for thislib in $libs; do
6481 case "$thislib" in
6482 -lc|-lc_s)
6483 : Handle C library specially below.
6484 ;;
6485 -l*)
6486 thislib=`echo $thislib | $sed -e 's/^-l//'`
6487 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6488 :
6489 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6490 :
6491 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6492 :
6493 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6494 :
6495 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6496 :
6497 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6498 :
6499 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6500 :
6501 else
6502 try=''
6503 fi
6504 libnames="$libnames $try"
6505 ;;
6506 *) libnames="$libnames $thislib" ;;
6507 esac
6508 done
6509 ;;
6510 esac
6511 xxx=normal
6512 case "$libc" in
6513 unknown)
6514 set /lib/libc.$so
6515 for xxx in $libpth; do
6516 $test -r $1 || set $xxx/libc.$so
6517 : The messy sed command sorts on library version numbers.
6518 $test -r $1 || \
6519 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6520 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6521 h
6522 s/[0-9][0-9]*/0000&/g
6523 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6524 G
6525 s/\n/ /' | \
6526 $sort | $sed -e 's/^.* //'`
6527 eval set \$$#
6528 done
6529 $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6530 $test -r $1 || set $sysroot/lib/libsys_s$_a
6531 ;;
6532 *)
6533 set blurfl
6534 ;;
6535 esac
6536 if $test -r "$1"; then
6537 echo "Your (shared) C library seems to be in $1."
6538 libc="$1"
6539 elif $test -r /lib/libc && $test -r /lib/clib; then
6540 echo "Your C library seems to be in both /lib/clib and /lib/libc."
6541 xxx=apollo
6542 libc='/lib/clib /lib/libc'
6543 if $test -r /lib/syslib; then
6544 echo "(Your math library is in /lib/syslib.)"
6545 libc="$libc /lib/syslib"
6546 fi
6547 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6548 echo "Your C library seems to be in $libc, as you said before."
6549 elif $test -r $incpath/usr/lib/libc$_a; then
6550 libc=$incpath/usr/lib/libc$_a;
6551 echo "Your C library seems to be in $libc. That's fine."
6552 elif $test -r /lib/libc$_a; then
6553 libc=/lib/libc$_a;
6554 echo "Your C library seems to be in $libc. You're normal."
6555 else
6556 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6557 :
6558 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6559 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6560 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6561 :
6562 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6563 :
6564 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6565 :
6566 else
6567 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6568 fi
6569 if $test -r "$tans"; then
6570 echo "Your C library seems to be in $tans, of all places."
6571 libc=$tans
6572 else
6573 libc='blurfl'
6574 fi
6575 fi
6576 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6577 dflt="$libc"
6578 cat <<EOM
6579
6580 If the guess above is wrong (which it might be if you're using a strange
6581 compiler, or your machine supports multiple models), you can override it here.
6582
6583 EOM
6584 else
6585 dflt=''
6586 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6587 cat >&4 <<EOM
6588 I can't seem to find your C library. I've looked in the following places:
6589
6590 EOM
6591 $sed 's/^/ /' libpath
6592 cat <<EOM
6593
6594 None of these seems to contain your C library. I need to get its name...
6595
6596 EOM
6597 fi
6598 fn=f
6599 rp='Where is your C library?'
6600 . ./getfile
6601 libc="$ans"
6602
6603 echo " "
6604 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6605 set X `cat libnames`
6606 shift
6607 xxx=files
6608 case $# in 1) xxx=file; esac
6609 echo "Extracting names from the following $xxx for later perusal:" >&4
6610 echo " "
6611 $sed 's/^/ /' libnames >&4
6612 echo " "
6613 $echo $n "This may take a while...$c" >&4
6614
6615 for file in $*; do
6616 case $file in
6617 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6618 *) $nm $nm_opt $file 2>/dev/null;;
6619 esac
6620 done >libc.tmp
6621
6622 $echo $n ".$c"
6623 $grep fprintf libc.tmp > libc.ptf
6624 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6625 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6626 xxx='[ADTSIWi]'
6627 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
6628 eval $xscan;\
6629 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6630 eval $xrun
6631 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6632 eval $xscan;\
6633 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6634 eval $xrun
6635 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6636 eval $xscan;\
6637 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6638 eval $xrun
6639 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6640 eval $xscan;\
6641 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6642 eval $xrun
6643 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6644 eval $xscan;\
6645 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6646 eval $xrun
6647 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6648 eval $xscan;\
6649 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6650 eval $xrun
6651 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6652 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
6653 eval $xscan;\
6654 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6655 eval $xrun
6656 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6657 eval $xscan;\
6658 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6659 eval $xrun
6660 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6661 eval $xscan;\
6662 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6663 eval $xrun
6664 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6665 eval $xscan;\
6666 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6667 eval $xrun
6668 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6669 eval $xscan;\
6670 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6671 eval $xrun
6672 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6673 eval $xscan;\
6674 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6675 eval $xrun
6676 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6677 eval $xscan;\
6678 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6679 eval $xrun
6680 elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
6681 eval $xscan;\
6682 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6683 eval $xrun
6684 else
6685 $nm -p $* 2>/dev/null >libc.tmp
6686 $grep fprintf libc.tmp > libc.ptf
6687 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6688 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6689 then
6690 nm_opt='-p'
6691 eval $xrun
6692 else
6693 echo " "
6694 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6695 com=''
6696 if $ar t $libc > libc.tmp && \
6697 $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6698 then
6699 for thisname in $libnames $libc; do
6700 $ar t $thisname >>libc.tmp
6701 done
6702 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6703 echo "Ok." >&4
6704 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6705 for thisname in $libnames $libc; do
6706 $ar tv $thisname >>libc.tmp
6707 emximp -o tmp.imp $thisname \
6708 2>/dev/null && \
6709 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6710 < tmp.imp >>libc.tmp
6711 $rm -f tmp.imp
6712 done
6713 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6714 echo "Ok." >&4
6715 else
6716 echo "$ar didn't seem to work right." >&4
6717 echo "Maybe this is a Cray...trying bld instead..." >&4
6718 if bld t $libc | \
6719 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6720 $test -s libc.list
6721 then
6722 for thisname in $libnames; do
6723 bld t $libnames | \
6724 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6725 $ar t $thisname >>libc.tmp
6726 done
6727 echo "Ok." >&4
6728 else
6729 echo "That didn't work either. Giving up." >&4
6730 exit 1
6731 fi
6732 fi
6733 fi
6734 fi
6735 nm_extract="$com"
6736 case "$PASE" in
6737 define)
6738 echo " "
6739 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6740 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6741 ;;
6742 *) if $test -f /lib/syscalls.exp; then
6743 echo " "
6744 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6745 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \
6746 /lib/syscalls.exp >>libc.list
6747 fi
6748 ;;
6749 esac
6750 ;;
6751 esac
6752 $rm -f libnames libpath
6753
6754 : Check if we are using C++
6755 echo " "
6756 echo "Checking for C++..." >&4
6757 $cat >try.c <<'EOCP'
6758 #include <stdio.h>
6759 int main(void)
6760 {
6761 #ifdef __cplusplus
6762 return 0;
6763 #else
6764 return 1;
6765 #endif
6766 }
6767 EOCP
6768 set try
6769 if eval $compile_ok && $run ./try; then
6770 val="$define"
6771 echo "You are using a C++ compiler."
6772 else
6773 val="$undef"
6774 echo "You are not using a C++ compiler."
6775 fi
6776 $rm_try cplusplus$$
6777 set d_cplusplus
6778 eval $setvar
6779
6780 : is a C symbol defined?
6781 csym='tlook=$1;
6782 case "$3" in
6783 -v) tf=libc.tmp; tdc="";;
6784 -a) tf=libc.tmp; tdc="[]";;
6785 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6786 esac;
6787 case "$d_cplusplus" in
6788 $define) extern_C="extern \"C\"" ;;
6789 *) extern_C="extern" ;;
6790 esac;
6791 tx=yes;
6792 case "$reuseval-$4" in
6793 true-) ;;
6794 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6795 esac;
6796 case "$tx" in
6797 yes)
6798 tval=false;
6799 if $test "$runnm" = true; then
6800 if $contains $tlook $tf >/dev/null 2>&1; then
6801 tval=true;
6802 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6803 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;
6804 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6805 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6806 $rm_try;
6807 fi;
6808 else
6809 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;
6810 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6811 $rm_try;
6812 fi;
6813 ;;
6814 *)
6815 case "$tval" in
6816 $define) tval=true;;
6817 *) tval=false;;
6818 esac;
6819 ;;
6820 esac;
6821 eval "$2=$tval"'
6822
6823 : define an is-in-libc? function
6824 inlibc='echo " "; td=$define; tu=$undef;
6825 sym=$1; var=$2; eval "was=\$$2";
6826 tx=yes;
6827 case "$reuseval$was" in
6828 true) ;;
6829 true*) tx=no;;
6830 esac;
6831 case "$tx" in
6832 yes)
6833 set $sym tres -f;
6834 eval $csym;
6835 case "$tres" in
6836 true)
6837 echo "$sym() found." >&4;
6838 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6839 *)
6840 echo "$sym() NOT found." >&4;
6841 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6842 esac;;
6843 *)
6844 case "$was" in
6845 $define) echo "$sym() found." >&4;;
6846 *) echo "$sym() NOT found." >&4;;
6847 esac;;
6848 esac'
6849
6850 : check for length of double
6851 echo " "
6852 case "$doublesize" in
6853 '')
6854 echo "Checking to see how big your double precision numbers are..." >&4
6855 $cat >try.c <<EOCP
6856 #include <stdio.h>
6857 #$i_stdlib I_STDLIB
6858 #ifdef I_STDLIB
6859 #include <stdlib.h>
6860 #endif
6861 #include <stdio.h>
6862 int main()
6863 {
6864 printf("%d\n", (int)sizeof(double));
6865 exit(0);
6866 }
6867 EOCP
6868 set try
6869 if eval $compile_ok; then
6870 doublesize=`$run ./try`
6871 echo "Your double is $doublesize bytes long."
6872 else
6873 dflt='8'
6874 echo "(I can't seem to compile the test program. Guessing...)"
6875 rp="What is the size of a double precision number (in bytes)?"
6876 . ./myread
6877 doublesize="$ans"
6878 fi
6879 ;;
6880 esac
6881 $rm_try
6882
6883 : check for long doubles
6884 echo " " >&4
6885 echo "Checking to see if you have long double..." >&4
6886 echo 'int main() { long double x = 7.0; }' > try.c
6887 set try
6888 if eval $compile; then
6889 val="$define"
6890 echo "You have long double." >&4
6891 else
6892 val="$undef"
6893 echo "You do not have long double." >&4
6894 fi
6895 $rm_try
6896 set d_longdbl
6897 eval $setvar
6898
6899 : see if ldexpl exists
6900 set ldexpl d_ldexpl
6901 eval $inlibc
6902
6903 : check for length of long double
6904 case "${d_longdbl}${longdblsize}" in
6905 $define)
6906 echo " " >&4
6907 echo "Checking to see how big your long doubles are..." >&4
6908 $cat >try.c <<'EOCP'
6909 #include <stdio.h>
6910 int main()
6911 {
6912 printf("%d\n", sizeof(long double));
6913 }
6914 EOCP
6915 set try
6916 set try
6917 if eval $compile; then
6918 longdblsize=`$run ./try`
6919 echo "Your long doubles are $longdblsize bytes long." >&4
6920 else
6921 dflt='8'
6922 echo " " >&4
6923 echo "(I can't seem to compile the test program. Guessing...)" >&4
6924 rp="What is the size of a long double (in bytes)?"
6925 . ./myread
6926 longdblsize="$ans"
6927 fi
6928 if $test "X$doublesize" = "X$longdblsize"; then
6929 echo "That isn't any different from an ordinary double." >&4
6930 echo "I'll keep your setting anyway, but you may see some" >&4
6931 echo "harmless compilation warnings." >&4
6932 fi
6933 ;;
6934 esac
6935 $rm_try
6936
6937 $echo "Checking the kind of long doubles you have..." >&4
6938 case "$d_longdbl" in
6939 define)
6940 $cat <<EOP >try.c
6941 #$i_stdlib I_STDLIB
6942 #define LONGDBLSIZE $longdblsize
6943 #define DOUBLESIZE $doublesize
6944 #include <float.h>
6945 #ifdef I_STDLIB
6946 #include <stdlib.h>
6947 #endif
6948 #include <stdio.h>
6949 static const long double d = -0.1L;
6950 int main() {
6951 unsigned const char* b = (unsigned const char*)(&d);
6952 #if DOUBLESIZE == LONGDBLSIZE
6953 printf("0\n"); /* if it floats like double */
6954 exit(0);
6955 #endif
6956 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6957 if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6958 /* IEEE 754 128-bit little-endian */
6959 printf("1\n");
6960 exit(0);
6961 }
6962 if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6963 /* IEEE 128-bit big-endian, e.g. solaris sparc */
6964 printf("2\n");
6965 exit(0);
6966 }
6967 #endif
6968 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6969 * while 64-bits platforms have it in 16 bytes. The trailing bytes
6970 * cannot be trusted. */
6971 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6972 if (b[0] == 0xCD && b[9] == 0xBF) {
6973 /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6974 * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6975 * Also known as "extended precision". */
6976 printf("3\n");
6977 exit(0);
6978 }
6979 if (b[0] == 0xBF && b[9] == 0xCD) {
6980 /* Is there ever big-endian 80-bit, really?
6981 *
6982 * The Motorola 68881 had another "extended precision" format:
6983 * sign:1 exp:15 zero:16 integer:1 mantissa:63
6984 * for total of 96 bits of bytes. The zero bits were unused.
6985 * See "M68000 FAMILY PROGRAMMER'S REFERENCE MANUAL" for more details.
6986 * If it ever becomes relevant, this format should be allocated a
6987 * new doublekind code since it is quite different from the Intel x87.
6988 */
6989 printf("4\n");
6990 exit(0);
6991 }
6992 #endif
6993 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6994 /* software "double double", the 106 is 53+53.
6995 * but irix thinks it is 107. */
6996 if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6997 /* double double 128-bit fully little-endian,
6998 * little-endian doubles in little-endian order,
6999 * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7000 printf("5\n");
7001 exit(0);
7002 }
7003 if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7004 /* double double 128-bit fully big-endian,
7005 * big-endian doubles in big-endian order,
7006 * e.g. PPC/Power and MIPS:
7007 * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7008 printf("6\n");
7009 exit(0);
7010 }
7011 if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7012 /* double double 128-bit mixed endian.
7013 * little-endian doubles in big-endian order,
7014 * e.g. ppc64el,
7015 * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7016 printf("7\n");
7017 exit(0);
7018 }
7019 if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7020 /* double double 128-bit mixed endian,
7021 * big-endian doubles in little-endian order,
7022 * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7023 printf("8\n");
7024 exit(0);
7025 }
7026 #endif
7027 /* We are largely making this up because it may well be
7028 * that the VAX format H was never made available to C,
7029 * only to Fortran. */
7030 #if LONGDBLSIZE == 16 && defined(__vax__)
7031 if (b[0] == 0xFD && b[15] == 0x99) {
7032 /* VAX format H, PDP-11 mixed endian. */
7033 printf("9\n");
7034 exit(0);
7035 }
7036 #endif
7037 printf("-1\n"); /* unknown */
7038 exit(0);
7039 }
7040 EOP
7041 set try
7042 if eval $compile; then
7043 longdblkind=`$run ./try`
7044 else
7045 longdblkind=-1
7046 fi
7047 ;;
7048 *) longdblkind=0 ;;
7049 esac
7050 case "$longdblkind" in
7051 0) echo "Your long doubles are doubles." >&4 ;;
7052 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7053 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7054 3) echo "You have x86 80-bit little endian long doubles." >&4 ;;
7055 4) echo "You have x86 80-bit big endian long doubles." >&4 ;;
7056 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >&4 ;;
7057 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >&4 ;;
7058 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >&4 ;;
7059 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >&4 ;;
7060 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >&4 ;;
7061 *) echo "Cannot figure out your long double." >&4 ;;
7062 esac
7063 d_long_double_style_ieee=$undef
7064 d_long_double_style_ieee_std=$undef
7065 d_long_double_style_ieee_extended=$undef
7066 d_long_double_style_ieee_doubledouble=$undef
7067 d_long_double_style_vax=$undef
7068 case "$longdblkind" in
7069 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7070 esac
7071 case "$longdblkind" in
7072 1|2) d_long_double_style_ieee_std=$define ;;
7073 esac
7074 case "$longdblkind" in
7075 3|4) d_long_double_style_ieee_extended=$define ;;
7076 esac
7077 case "$longdblkind" in
7078 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7079 esac
7080 case "$longdblkind" in
7081 9) d_long_double_style_vax=$define ;;
7082 esac
7083 $rm_try
7084
7085 : get the patchlevel
7086 echo " "
7087 echo "Getting the current patchlevel..." >&4
7088 if $test -r $rsrc/patchlevel.h;then
7089 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
7090 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
7091 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
7092 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
7093 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
7094 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
7095 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
7096 else
7097 revision=0
7098 patchlevel=0
7099 subversion=0
7100 api_revision=0
7101 api_version=0
7102 api_subversion=0
7103 perl_patchlevel=0
7104 $echo "(You do not have patchlevel.h. Eek.)"
7105 fi
7106 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
7107 version_patchlevel_string="version $patchlevel subversion $subversion"
7108 case "$perl_patchlevel" in
7109 0|'') ;;
7110 *) perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
7111 version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
7112 ;;
7113 esac
7114
7115 $echo "(You have $package $version_patchlevel_string.)"
7116
7117 case "$osname" in
7118 dos|vms)
7119 : XXX Should be a Configure test for double-dots in filenames.
7120 version=`echo $revision $patchlevel $subversion | \
7121 $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
7122 api_versionstring=`echo $api_revision $api_version $api_subversion | \
7123 $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
7124 ;;
7125 *)
7126 version=`echo $revision $patchlevel $subversion | \
7127 $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
7128 api_versionstring=`echo $api_revision $api_version $api_subversion | \
7129 $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
7130 ;;
7131 esac
7132 : Special case the 5.005_xx maintenance series, which used 5.005
7133 : without any subversion label as a subdirectory in $sitelib
7134 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
7135 api_versionstring='5.005'
7136 fi
7137
7138 : Check if quadmath is requested
7139 case "$usequadmath" in
7140 "$define"|true|[yY]*) usequadmath="$define" ;;
7141 *) usequadmath="$undef" ;;
7142 esac
7143
7144 : Fail if both uselongdouble and usequadmath are requested
7145 case "$usequadmath:$uselongdouble" in
7146 define:define)
7147 $cat <<EOM >&4
7148
7149 *** You requested the use of the quadmath library and use
7150 *** of long doubles.
7151 ***
7152 *** Please select one or the other.
7153 EOM
7154 exit 1
7155 ;;
7156 esac
7157
7158 : determine the architecture name
7159 echo " "
7160 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7161 tarch=`arch`"-$osname"
7162 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7163 if uname -m > tmparch 2>&1 ; then
7164 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7165 -e 's/$/'"-$osname/" tmparch`
7166 else
7167 tarch="$osname"
7168 fi
7169 $rm -f tmparch
7170 else
7171 tarch="$osname"
7172 fi
7173 case "$myarchname" in
7174 ''|"$tarch") ;;
7175 *)
7176 echo "(Your architecture name used to be $myarchname.)"
7177 archname=''
7178 ;;
7179 esac
7180 case "$targetarch" in
7181 '') ;;
7182 *) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7183 esac
7184 myarchname="$tarch"
7185 case "$archname" in
7186 '') dflt="$tarch";;
7187 *) dflt="$archname";;
7188 esac
7189 rp='What is your architecture name'
7190 . ./myread
7191 archname="$ans"
7192
7193 : optionally add API version to the architecture for versioned archlibs
7194 case "$useversionedarchname" in
7195 $define|true|[yY]*) dflt='y';;
7196 *) dflt='n';;
7197 esac
7198 rp='Add the Perl API version to your archname?'
7199 . ./myread
7200 case "$ans" in
7201 y|Y) useversionedarchname="$define" ;;
7202 *) useversionedarchname="$undef" ;;
7203 esac
7204 case "$useversionedarchname" in
7205 $define)
7206 case "$archname" in
7207 *-$api_versionstring)
7208 echo "...and architecture name already has -$api_versionstring" >&4
7209 ;;
7210 *)
7211 archname="$archname-$api_versionstring"
7212 echo "...setting architecture name to $archname." >&4
7213 ;;
7214 esac
7215 ;;
7216 esac
7217
7218 case "$usethreads" in
7219 $define)
7220 echo "Threads selected." >&4
7221 case "$archname" in
7222 *-thread*) echo "...and architecture name already has -thread." >&4
7223 ;;
7224 *) archname="$archname-thread"
7225 echo "...setting architecture name to $archname." >&4
7226 ;;
7227 esac
7228 ;;
7229 esac
7230 case "$usemultiplicity" in
7231 $define)
7232 echo "Multiplicity selected." >&4
7233 case "$archname" in
7234 *-multi*) echo "...and architecture name already has -multi." >&4
7235 ;;
7236 *) archname="$archname-multi"
7237 echo "...setting architecture name to $archname." >&4
7238 ;;
7239 esac
7240 ;;
7241 esac
7242 case "$use64bitint$use64bitall" in
7243 *"$define"*)
7244 case "$archname64" in
7245 '')
7246 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7247 ;;
7248 *)
7249 case "$use64bitint" in
7250 "$define") echo "64 bit integers selected." >&4 ;;
7251 esac
7252 case "$use64bitall" in
7253 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7254 esac
7255 case "$archname" in
7256 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7257 ;;
7258 *) archname="$archname-$archname64"
7259 echo "...setting architecture name to $archname." >&4
7260 ;;
7261 esac
7262 ;;
7263 esac
7264 esac
7265 case "$uselongdouble" in
7266 $define)
7267 echo "Long doubles selected." >&4
7268 case "$longdblsize" in
7269 $doublesize)
7270 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7271 ;;
7272 *)
7273 case "$archname" in
7274 *-ld*) echo "...and architecture name already has -ld." >&4
7275 ;;
7276 *) archname="$archname-ld"
7277 echo "...setting architecture name to $archname." >&4
7278 ;;
7279 esac
7280 ;;
7281 esac
7282 ;;
7283 esac
7284 case "$usequadmath" in
7285 $define)
7286 echo "quadmath selected." >&4
7287 case "$archname" in
7288 *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7289 ;;
7290 *) archname="$archname-quadmath"
7291 echo "...setting architecture name to $archname." >&4
7292 ;;
7293 esac
7294 ;;
7295 esac
7296 if $test -f archname.cbu; then
7297 echo "Your platform has some specific hints for architecture name, using them..."
7298 . ./archname.cbu
7299 fi
7300
7301 : set the prefixit variable, to compute a suitable default value
7302 prefixit='case "$3" in
7303 ""|none)
7304 case "$oldprefix" in
7305 "") eval "$1=\"\$$2\"";;
7306 *)
7307 case "$3" in
7308 "") eval "$1=";;
7309 none)
7310 eval "tp=\"\$$2\"";
7311 case "$tp" in
7312 ""|" "|none) eval "$1=\"\$$2\"";;
7313 *) eval "$1=";;
7314 esac;;
7315 esac;;
7316 esac;;
7317 *)
7318 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7319 case "$tp" in
7320 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7321 /*-$oldprefix/*|\~*-$oldprefix/*)
7322 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7323 *) eval "$1=\"\$$2\"";;
7324 esac;;
7325 esac'
7326
7327 : determine installation style
7328 : For now, try to deduce it from prefix unless it is already set.
7329 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7330 case "$installstyle" in
7331 '') case "$prefix" in
7332 *perl*) dflt='lib';;
7333 *) dflt='lib/perl5' ;;
7334 esac
7335 ;;
7336 *) dflt="$installstyle" ;;
7337 esac
7338 : Probably not worth prompting for this since we prompt for all
7339 : the directories individually, and the prompt would be too long and
7340 : confusing anyway.
7341 installstyle=$dflt
7342
7343 : determine where public executables go
7344 echo " "
7345 set dflt bin bin
7346 eval $prefixit
7347 fn=d~
7348 rp='Pathname where the public executables will reside?'
7349 . ./getfile
7350 if $test "X$ansexp" != "X$binexp"; then
7351 installbin=''
7352 fi
7353 prefixvar=bin
7354 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7355 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7356 : this via initialinstalllocation
7357 . ./setprefixvar
7358
7359 case "$userelocatableinc" in
7360 $define|true|[yY]*) dflt='y' ;;
7361 *) dflt='n' ;;
7362 esac
7363 cat <<EOM
7364
7365 Would you like to build Perl so that the installation is relocatable, so that
7366 library paths in @INC are determined relative to the path of the perl binary?
7367 This is not advised for system Perl installs, or if you need to run setid
7368 scripts or scripts under taint mode.
7369
7370 If this doesn't make any sense to you, just accept the default '$dflt'.
7371 EOM
7372 rp='Use relocatable @INC?'
7373 . ./myread
7374 case "$ans" in
7375 y|Y) val="$define" ;;
7376 *) val="$undef" ;;
7377 esac
7378 set userelocatableinc
7379 eval $setvar
7380
7381 initialinstalllocation="$binexp"
7382 : Default prefix is now "up one level from where the binaries are"
7383 case "$userelocatableinc" in
7384 $define|true|[yY]*)
7385 bin=".../"
7386 binexp=".../"
7387 prefix=".../.."
7388 prefixexp=".../.."
7389 installprefixexp=".../.."
7390 ;;
7391 esac
7392
7393 : determine where private library files go
7394 : Usual default is /usr/local/lib/perl5/$version.
7395 : Also allow things like /opt/perl/lib/$version, since
7396 : /opt/perl/lib/perl5... would be redundant.
7397 : The default "style" setting is made in installstyle.U
7398 case "$installstyle" in
7399 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7400 *) set dflt privlib lib/$version ;;
7401 esac
7402 eval $prefixit
7403 $cat <<EOM
7404
7405 There are some auxiliary files for $package that need to be put into a
7406 private library directory that is accessible by everyone.
7407
7408 EOM
7409 fn=$binexp
7410 fn=d~+
7411 rp='Pathname where the private library files will reside?'
7412 . ./getfile
7413 prefixvar=privlib
7414 . ./setprefixvar
7415
7416 : set the prefixup variable, to restore leading tilda escape
7417 prefixup='case "$prefixexp" in
7418 "$prefix") ;;
7419 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7420 esac'
7421
7422 : determine where public architecture dependent libraries go
7423 set archlib archlib
7424 eval $prefixit
7425 : privlib default is /usr/local/lib/$package/$version
7426 : archlib default is /usr/local/lib/$package/$version/$archname
7427 : privlib may have an optional trailing /share.
7428 tdflt=`echo $privlib | $sed 's,/share$,,'`
7429 tdflt=$tdflt/$archname
7430 case "$archlib" in
7431 '') dflt=$tdflt
7432 ;;
7433 *) dflt="$archlib"
7434 ;;
7435 esac
7436 $cat <<EOM
7437
7438 $spackage contains architecture-dependent library files. If you are
7439 sharing libraries in a heterogeneous environment, you might store
7440 these files in a separate location. Otherwise, you can just include
7441 them with the rest of the public library files.
7442
7443 EOM
7444 fn=$binexp
7445 fn=d+~
7446 rp='Where do you want to put the public architecture-dependent libraries?'
7447 . ./getfile
7448 prefixvar=archlib
7449 . ./setprefixvar
7450 if $test X"$archlib" = X"$privlib"; then
7451 d_archlib="$undef"
7452 else
7453 d_archlib="$define"
7454 fi
7455
7456 : see if setuid scripts can be secure
7457 $cat <<EOM
7458
7459 Some kernels have a bug that prevents setuid #! scripts from being
7460 secure. Some sites have disabled setuid #! scripts because of this.
7461
7462 First let's decide if your kernel supports secure setuid #! scripts.
7463 (If setuid #! scripts would be secure but have been disabled anyway,
7464 don't say that they are secure if asked.)
7465
7466 EOM
7467
7468 val="$undef"
7469 if $test -d /dev/fd; then
7470 echo "#!$ls" >reflect
7471 chmod +x,u+s reflect
7472 ./reflect >flect 2>&1
7473 if $contains "/dev/fd" flect >/dev/null; then
7474 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7475 val="$define"
7476 else
7477 $cat <<EOM
7478 If you are not sure if they are secure, I can check but I'll need a
7479 username and password different from the one you are using right now.
7480 If you don't have such a username or don't want me to test, simply
7481 enter 'none'.
7482
7483 EOM
7484 rp='Other username to test security of setuid scripts with?'
7485 dflt='none'
7486 . ./myread
7487 case "$ans" in
7488 n|none)
7489 case "$d_suidsafe" in
7490 '') echo "I'll assume setuid scripts are *not* secure." >&4
7491 dflt=n;;
7492 "$undef")
7493 echo "Well, the $hint value is *not* secure." >&4
7494 dflt=n;;
7495 *) echo "Well, the $hint value *is* secure." >&4
7496 dflt=y;;
7497 esac
7498 ;;
7499 *)
7500 $rm -f reflect flect
7501 echo "#!$ls" >reflect
7502 chmod +x,u+s reflect
7503 echo >flect
7504 chmod a+w flect
7505 echo '"su" will (probably) prompt you for '"$ans's password."
7506 su $ans -c './reflect >flect'
7507 if $contains "/dev/fd" flect >/dev/null; then
7508 echo "Okay, it looks like setuid scripts are secure." >&4
7509 dflt=y
7510 else
7511 echo "I don't think setuid scripts are secure." >&4
7512 dflt=n
7513 fi
7514 ;;
7515 esac
7516 rp='Does your kernel have *secure* setuid scripts?'
7517 . ./myread
7518 case "$ans" in
7519 [yY]*) val="$define";;
7520 *) val="$undef";;
7521 esac
7522 fi
7523 else
7524 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7525 echo "(That's for file descriptors, not floppy disks.)"
7526 val="$undef"
7527 fi
7528 set d_suidsafe
7529 eval $setvar
7530
7531 $rm -f reflect flect
7532
7533 : now see if they want to do setuid emulation
7534 if $test $patchlevel -lt 11; then
7535 echo " "
7536 val="$undef"
7537 case "$d_suidsafe" in
7538 "$define")
7539 val="$undef"
7540 echo "No need to emulate SUID scripts since they are secure here." >&4
7541 ;;
7542 *)
7543 $cat <<EOM
7544 Some systems have disabled setuid scripts, especially systems where
7545 setuid scripts cannot be secure. On systems where setuid scripts have
7546 been disabled, the setuid/setgid bits on scripts are currently
7547 useless. It is possible for $package to detect those bits and emulate
7548 setuid/setgid in a secure fashion. This emulation will only work if
7549 setuid scripts have been disabled in your kernel.
7550
7551 EOM
7552 case "$d_dosuid" in
7553 "$define") dflt=y ;;
7554 *) dflt=n ;;
7555 esac
7556 rp="Do you want to do setuid/setgid emulation?"
7557 . ./myread
7558 case "$ans" in
7559 [yY]*) val="$define";;
7560 *) val="$undef";;
7561 esac
7562 ;;
7563 esac
7564 set d_dosuid
7565 eval $setvar
7566 else
7567 case "$d_dosuid" in
7568 "$define")
7569 cat >&4 <<EOH
7570
7571 SUID emulation has been removed for 5.12
7572 Please re-run Configure without -Dd_dosuid
7573
7574 EOH
7575 exit 1;
7576 ;;
7577 esac
7578 d_dosuid=undef
7579 fi
7580
7581 : Find perl5.005 or later.
7582 echo "Looking for a previously installed perl5.005 or later... "
7583 case "$perl5" in
7584 '') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7585 : Check if this perl is recent and can load a simple module
7586 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7587 perl5=$tdir/perl
7588 break;
7589 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7590 perl5=$tdir/perl5
7591 break;
7592 fi
7593 done
7594 ;;
7595 *) perl5="$perl5"
7596 ;;
7597 esac
7598 case "$perl5" in
7599 '') echo "None found. That's ok.";;
7600 *) echo "Using $perl5." ;;
7601 esac
7602
7603 : Set the siteprefix variables
7604 $cat <<EOM
7605
7606 After $package is installed, you may wish to install various
7607 add-on modules and utilities. Typically, these add-ons will
7608 be installed under $prefix with the rest
7609 of this package. However, you may wish to install such add-ons
7610 elsewhere under a different prefix.
7611
7612 If you do not wish to put everything under a single prefix, that's
7613 ok. You will be prompted for the individual locations; this siteprefix
7614 is only used to suggest the defaults.
7615
7616 The default should be fine for most people.
7617
7618 EOM
7619 fn=d~+
7620 rp='Installation prefix to use for add-on modules and utilities?'
7621 : XXX Here might be another good place for an installstyle setting.
7622 case "$siteprefix" in
7623 '') dflt=$prefix ;;
7624 *) dflt=$siteprefix ;;
7625 esac
7626 . ./getfile
7627 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7628 oldsiteprefix=''
7629 case "$siteprefix" in
7630 '') ;;
7631 *) case "$ans" in
7632 "$prefix") ;;
7633 *) oldsiteprefix="$prefix";;
7634 esac
7635 ;;
7636 esac
7637 siteprefix="$ans"
7638 siteprefixexp="$ansexp"
7639
7640 : determine where site specific libraries go.
7641 : Usual default is /usr/local/lib/perl5/site_perl/$version
7642 : The default "style" setting is made in installstyle.U
7643 : XXX No longer works with Prefixit stuff.
7644 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7645 case "$sitelib" in
7646 '') case "$installstyle" in
7647 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7648 *) dflt=$siteprefix/lib/site_$prog/$version ;;
7649 esac
7650 ;;
7651 *) dflt="$sitelib"
7652 ;;
7653 esac
7654 $cat <<EOM
7655
7656 The installation process will create a directory for
7657 site-specific extensions and modules. Most users find it convenient
7658 to place all site-specific files in this directory rather than in the
7659 main distribution directory.
7660
7661 EOM
7662 fn=d~+
7663 rp='Pathname for the site-specific library files?'
7664 . ./getfile
7665 prefixvar=sitelib
7666 . ./setprefixvar
7667 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7668
7669 : Determine list of previous versions to include in @INC
7670 $cat > getverlist <<EOPL
7671 #!$perl5
7672 use strict;
7673 use warnings;
7674 use File::Basename;
7675 my \$api_versionstring = "$api_versionstring";
7676 my \$version = "$version";
7677 my \$stem = "$sitelib_stem";
7678 my \$archname = "$archname";
7679 EOPL
7680 $cat >> getverlist <<'EOPL'
7681 # The list found is stored twice for each entry: the original name, and
7682 # the binary broken down version into pack "s>s>s>", so sorting is easy
7683 # and unambiguous. This will work for all versions that have a maximum
7684 # of three digit per group separate by '.'s or '_'s. Names are extended
7685 # with ".0.0" to ensure at least three elements for the pack.
7686 # -- H.Merijn Brand (m)'06 23-10-2006
7687
7688 my @inc_version_list;
7689 my @candidates;
7690 # XXX Redo to do opendir/readdir?
7691 if (-d $stem) {
7692 chdir($stem);
7693 ;@candidates = map {
7694 [ $_, pack "s>s>s>", split m/[._]/, "$_.0.0" ] } glob("5.*");
7695 ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7696 }
7697 else {
7698 ;@candidates = ();
7699 }
7700
7701 my ($pversion, $aversion, $vsn5005) = map {
7702 pack "s>s>s>", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7703 foreach my $d (@candidates) {
7704 if ($d->[1] lt $pversion) {
7705 if ($d->[1] ge $aversion) {
7706 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7707 }
7708 elsif ($d->[1] ge $vsn5005) {
7709 unshift(@inc_version_list, grep { -d } $d->[0]);
7710 }
7711 }
7712 else {
7713 # Skip newer version. I.e. don't look in
7714 # 5.7.0 if we're installing 5.6.1.
7715 }
7716 }
7717
7718 if (@inc_version_list) {
7719 print join(' ', @inc_version_list);
7720 }
7721 else {
7722 # Blank space to preserve value for next Configure run.
7723 print " ";
7724 }
7725 EOPL
7726 chmod +x getverlist
7727 case "$inc_version_list" in
7728 '') if test -x "$perl5$exe_ext"; then
7729 dflt=`$perl5 getverlist`
7730 else
7731 dflt='none'
7732 fi
7733 ;;
7734 $undef) dflt='none' ;;
7735 *) eval dflt=\"$inc_version_list\" ;;
7736 esac
7737 case "$dflt" in
7738 ''|' ') dflt=none ;;
7739 esac
7740 case "$dflt" in
7741 5.005) dflt=none ;;
7742 esac
7743 $cat <<EOM
7744
7745 In order to ease the process of upgrading, this version of perl
7746 can be configured to use modules built and installed with earlier
7747 versions of perl that were installed under $prefix. Specify here
7748 the list of earlier versions that this version of perl should check.
7749 If Configure detected no earlier versions of perl installed under
7750 $prefix, then the list will be empty. Answer 'none' to tell perl
7751 to not search earlier versions.
7752
7753 The default should almost always be sensible, so if you're not sure,
7754 just accept the default.
7755 EOM
7756
7757 rp='List of earlier versions to include in @INC?'
7758 . ./myread
7759 case "$ans" in
7760 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7761 *) inc_version_list="$ans" ;;
7762 esac
7763 case "$inc_version_list" in
7764 ''|' ')
7765 inc_version_list_init='0'
7766 d_inc_version_list="$undef"
7767 ;;
7768 *) inc_version_list_init=`echo $inc_version_list |
7769 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7770 d_inc_version_list="$define"
7771 ;;
7772 esac
7773 $rm -f getverlist
7774
7775 : check for length of pointer
7776 echo " "
7777 case "$ptrsize" in
7778 '')
7779 echo "Checking to see how big your pointers are..." >&4
7780 $cat >try.c <<EOCP
7781 #include <stdio.h>
7782 #$i_stdlib I_STDLIB
7783 #ifdef I_STDLIB
7784 #include <stdlib.h>
7785 #endif
7786 int main()
7787 {
7788 printf("%d\n", (int)sizeof(void *));
7789 exit(0);
7790 }
7791 EOCP
7792 set try
7793 if eval $compile_ok; then
7794 ptrsize=`$run ./try`
7795 echo "Your pointers are $ptrsize bytes long."
7796 else
7797 dflt='4'
7798 echo "(I can't seem to compile the test program. Guessing...)" >&4
7799 rp="What is the size of a pointer (in bytes)?"
7800 . ./myread
7801 ptrsize="$ans"
7802 fi
7803 ;;
7804 esac
7805 $rm_try
7806 case "$use64bitall" in
7807 "$define"|true|[yY]*)
7808 case "$ptrsize" in
7809 4) cat <<EOM >&4
7810
7811 *** You have chosen a maximally 64-bit build,
7812 *** but your pointers are only 4 bytes wide.
7813 *** Please rerun Configure without -Duse64bitall.
7814 EOM
7815 case "$d_quad" in
7816 define)
7817 cat <<EOM >&4
7818 *** Since you have quads, you could possibly try with -Duse64bitint.
7819 EOM
7820 ;;
7821 esac
7822 cat <<EOM >&4
7823 *** Cannot continue, aborting.
7824
7825 EOM
7826
7827 exit 1
7828 ;;
7829 esac
7830 ;;
7831 esac
7832
7833 : determine whether to use malloc wrapping
7834 echo " "
7835 case "$usemallocwrap" in
7836 [yY]*|true|$define) dflt='y' ;;
7837 [nN]*|false|$undef) dflt='n' ;;
7838 *) case "$usedevel" in
7839 [yY]*|true|$define) dflt='y' ;;
7840 *) dflt='n' ;;
7841 esac
7842 ;;
7843 esac
7844 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7845 . ./myread
7846 usemallocwrap="$ans"
7847 case "$ans" in
7848 y*|true)
7849 usemallocwrap="$define" ;;
7850 *)
7851 usemallocwrap="$undef" ;;
7852 esac
7853
7854 : determine which malloc to compile in
7855 echo " "
7856 case "$usemymalloc" in
7857 [yY]*|true|$define) dflt='y' ;;
7858 [nN]*|false|$undef) dflt='n' ;;
7859 *) case "$ptrsize" in
7860 4) dflt='y' ;;
7861 *) dflt='n' ;;
7862 esac
7863 if test "$useithreads" = "$define"; then dflt='n'; fi
7864 ;;
7865 esac
7866 rp="Do you wish to attempt to use the malloc that comes with $package?"
7867 . ./myread
7868 usemymalloc="$ans"
7869 case "$ans" in
7870 y*|true)
7871 usemymalloc='y'
7872 mallocsrc='malloc.c'
7873 mallocobj="malloc$_o"
7874 d_mymalloc="$define"
7875 case "$libs" in
7876 *-lmalloc*)
7877 : Remove malloc from list of libraries to use
7878 echo "Removing unneeded -lmalloc from library list" >&4
7879 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7880 shift
7881 libs="$*"
7882 echo "libs = $libs" >&4
7883 ;;
7884 esac
7885 ;;
7886 *)
7887 usemymalloc='n'
7888 mallocsrc=''
7889 mallocobj=''
7890 d_mymalloc="$undef"
7891 ;;
7892 esac
7893
7894 : compute the return types of malloc and free
7895 echo " "
7896 case "$malloctype" in
7897 '')
7898 malloctype='void *'
7899 ;;
7900 esac
7901 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7902
7903 case "$freetype" in
7904 '')
7905 freetype='void'
7906 ;;
7907 esac
7908 echo "Your system uses $freetype free(), it would seem." >&4
7909
7910 : determine where site specific architecture-dependent libraries go.
7911 : sitelib default is /usr/local/lib/perl5/site_perl/$version
7912 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7913 : sitelib may have an optional trailing /share.
7914 case "$sitearch" in
7915 '') dflt=`echo $sitelib | $sed 's,/share$,,'`
7916 dflt="$dflt/$archname"
7917 ;;
7918 *) dflt="$sitearch"
7919 ;;
7920 esac
7921 set sitearch sitearch none
7922 eval $prefixit
7923 $cat <<EOM
7924
7925 The installation process will also create a directory for
7926 architecture-dependent site-specific extensions and modules.
7927
7928 EOM
7929 fn=d~+
7930 rp='Pathname for the site-specific architecture-dependent library files?'
7931 . ./getfile
7932 prefixvar=sitearch
7933 . ./setprefixvar
7934 if $test X"$sitearch" = X"$sitelib"; then
7935 d_sitearch="$undef"
7936 else
7937 d_sitearch="$define"
7938 fi
7939
7940 : Set the vendorprefix variables
7941 $cat <<EOM
7942
7943 The installation process will also create a directory for
7944 vendor-supplied add-ons. Vendors who supply perl with their system
7945 may find it convenient to place all vendor-supplied files in this
7946 directory rather than in the main distribution directory. This will
7947 ease upgrades between binary-compatible maintenance versions of perl.
7948
7949 Of course you may also use these directories in whatever way you see
7950 fit. For example, you might use them to access modules shared over a
7951 company-wide network.
7952
7953 The default answer should be fine for most people.
7954 This causes further questions about vendor add-ons to be skipped
7955 and no vendor-specific directories will be configured for perl.
7956
7957 EOM
7958 rp='Do you want to configure vendor-specific add-on directories?'
7959 case "$usevendorprefix" in
7960 define|true|[yY]*) dflt=y ;;
7961 *) : User may have set vendorprefix directly on Configure command line.
7962 case "$vendorprefix" in
7963 ''|' ') dflt=n ;;
7964 *) dflt=y ;;
7965 esac
7966 ;;
7967 esac
7968 . ./myread
7969 case "$ans" in
7970 [yY]*) fn=d~+
7971 rp='Installation prefix to use for vendor-supplied add-ons?'
7972 case "$vendorprefix" in
7973 '') dflt="$prefix" ;;
7974 *) dflt=$vendorprefix ;;
7975 esac
7976 . ./getfile
7977 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7978 oldvendorprefix=''
7979 case "$vendorprefix" in
7980 '') ;;
7981 *) case "$ans" in
7982 "$prefix") ;;
7983 *) oldvendorprefix="$prefix";;
7984 esac
7985 ;;
7986 esac
7987 usevendorprefix="$define"
7988 vendorprefix="$ans"
7989 vendorprefixexp="$ansexp"
7990 ;;
7991 *) usevendorprefix="$undef"
7992 vendorprefix=''
7993 vendorprefixexp=''
7994 ;;
7995 esac
7996
7997 : Set the vendorlib variables
7998 case "$vendorprefix" in
7999 '') d_vendorlib="$undef"
8000 vendorlib=''
8001 vendorlibexp=''
8002 ;;
8003 *) d_vendorlib="$define"
8004 : determine where vendor-supplied modules go.
8005 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8006 case "$vendorlib" in
8007 '')
8008 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8009 case "$installstyle" in
8010 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8011 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8012 esac
8013 ;;
8014 *) dflt="$vendorlib"
8015 ;;
8016 esac
8017 fn=d~+
8018 rp='Pathname for the vendor-supplied library files?'
8019 . ./getfile
8020 vendorlib="$ans"
8021 vendorlibexp="$ansexp"
8022 ;;
8023 esac
8024 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8025 prefixvar=vendorlib
8026 . ./installprefix
8027
8028 : Set the vendorarch variables
8029 case "$vendorprefix" in
8030 '') d_vendorarch="$undef"
8031 vendorarch=''
8032 vendorarchexp=''
8033 ;;
8034 *) d_vendorarch="$define"
8035 : determine where vendor-supplied architecture-dependent libraries go.
8036 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
8037 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8038 : vendorlib may have an optional trailing /share.
8039 case "$vendorarch" in
8040 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
8041 dflt="$dflt/$archname"
8042 ;;
8043 *) dflt="$vendorarch" ;;
8044 esac
8045 fn=d~+
8046 rp='Pathname for vendor-supplied architecture-dependent files?'
8047 . ./getfile
8048 vendorarch="$ans"
8049 vendorarchexp="$ansexp"
8050 ;;
8051 esac
8052 prefixvar=vendorarch
8053 . ./installprefix
8054 if $test X"$vendorarch" = X"$vendorlib"; then
8055 d_vendorarch="$undef"
8056 else
8057 d_vendorarch="$define"
8058 fi
8059
8060 : Final catch-all directories to search
8061 $cat <<EOM
8062
8063 Lastly, you can have perl look in other directories for extensions and
8064 modules in addition to those already specified.
8065 These directories will be searched after
8066 $sitearch
8067 $sitelib
8068 EOM
8069 test X"$vendorlib" != "X" && echo ' ' $vendorlib
8070 test X"$vendorarch" != "X" && echo ' ' $vendorarch
8071 echo ' '
8072 case "$otherlibdirs" in
8073 ''|' ') dflt='none' ;;
8074 *) dflt="$otherlibdirs" ;;
8075 esac
8076 $cat <<EOM
8077 Enter a colon-separated set of extra paths to include in perl's @INC
8078 search path, or enter 'none' for no extra paths.
8079
8080 EOM
8081
8082 rp='Colon-separated list of additional directories for perl to search?'
8083 . ./myread
8084 case "$ans" in
8085 ' '|''|none) otherlibdirs=' ' ;;
8086 *) otherlibdirs="$ans" ;;
8087 esac
8088 case "$otherlibdirs" in
8089 ' ') val=$undef ;;
8090 *) val=$define ;;
8091 esac
8092 set d_perl_otherlibdirs
8093 eval $setvar
8094
8095 : DTrace support
8096 dflt_dtrace='/usr/sbin/dtrace'
8097 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8098
8099 cat <<EOM
8100
8101 Perl can be built to support DTrace on platforms that support it.
8102 DTrace is a diagnosis and performance analysis tool from Sun.
8103
8104 If this doesn't make any sense to you, just accept the default.
8105 EOM
8106
8107 while $test 1 ; do
8108 case "$usedtrace" in
8109 $define|true|[yY]*)
8110 dflt='y'
8111 ;;
8112 $undef|false|[nN]*)
8113 dflt='n'
8114 dflt_dtrace=""
8115 ;;
8116 ?*)
8117 dflt='y'
8118 dflt_dtrace=$usedtrace
8119 ;;
8120 *)
8121 dflt='n'
8122 ;;
8123 esac
8124
8125 rp='Support DTrace if available?'
8126 . ./myread
8127 case "$ans" in
8128 y|Y) val="$define" ;;
8129 *) val="$undef" ;;
8130 esac
8131 set usedtrace
8132 eval $setvar
8133
8134 test "X$usedtrace" != "X$define" && break
8135
8136 echo " "
8137 rp='Where is the dtrace executable?'
8138 dflt=$dflt_dtrace
8139 . ./getfile
8140 val="$ans"
8141 set dtrace
8142 eval $setvar
8143
8144 if $test -f $dtrace
8145 then
8146 if $dtrace -h -s ../perldtrace.d \
8147 -o perldtrace.tmp >/dev/null 2>&1 \
8148 && rm -f perldtrace.tmp
8149 then
8150 echo " "
8151 echo "Good: your $dtrace knows about the -h flag."
8152 else
8153 cat >&2 <<EOM
8154
8155 *** $me: Fatal Error: $dtrace doesn't support -h flag
8156 ***
8157 *** Your installed dtrace doesn't support the -h switch to compile a D
8158 *** program into a C header. Can't continue.
8159
8160 EOM
8161 exit 1
8162 fi
8163 break;
8164 fi
8165
8166 case "$fastread" in
8167 yes)
8168 cat >&2 <<EOM
8169
8170 *** $me: Fatal Error: $dtrace not found.
8171 *** Can't continue.
8172
8173 EOM
8174 exit 1
8175 ;;
8176 *)
8177 echo "*** $dtrace was not found."
8178 echo " "
8179 ;;
8180 esac
8181 done
8182
8183 : See if we want extra modules installed
8184 echo " "
8185 case "$extras" in
8186 '') dflt='n';;
8187 *) dflt='y';;
8188 esac
8189 cat <<EOM
8190 Perl can be built with extra modules or bundles of modules which
8191 will be fetched from the CPAN and installed alongside Perl.
8192
8193 Notice that you will need access to the CPAN; either via the Internet,
8194 or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
8195 be asked later to configure the CPAN.pm module which will in turn do
8196 the installation of the rest of the extra modules or bundles.)
8197
8198 Notice also that if the modules require any external software such as
8199 libraries and headers (the libz library and the zlib.h header for the
8200 Compress::Zlib module, for example) you MUST have any such software
8201 already installed, this configuration process will NOT install such
8202 things for you.
8203
8204 If this doesn't make any sense to you, just accept the default '$dflt'.
8205 EOM
8206 rp='Install any extra modules (y or n)?'
8207 . ./myread
8208 case "$ans" in
8209 y|Y)
8210 cat <<EOM
8211
8212 Please list any extra modules or bundles to be installed from CPAN,
8213 with spaces between the names. The names can be in any format the
8214 'install' command of CPAN.pm will understand. (Answer 'none',
8215 without the quotes, to install no extra modules or bundles.)
8216 EOM
8217 rp='Extras?'
8218 dflt="$extras"
8219 . ./myread
8220 extras="$ans"
8221 esac
8222 case "$extras" in
8223 ''|'none')
8224 val=''
8225 $rm -f ../extras.lst
8226 ;;
8227 *) echo "(Saving the list of extras for later...)"
8228 echo "$extras" > ../extras.lst
8229 val="'$extras'"
8230 ;;
8231 esac
8232 set extras
8233 eval $setvar
8234 echo " "
8235
8236 : determine where html pages for programs go
8237 set html1dir html1dir none
8238 eval $prefixit
8239 $cat <<EOM
8240
8241 If you wish to install html files for programs in $spackage, indicate
8242 the appropriate directory here. To skip installing html files,
8243 answer "none".
8244 EOM
8245 case "$html1dir" in
8246 ''|none|$undef|' ') dflt=none ;;
8247 *) dflt=$html1dir ;;
8248 esac
8249 fn=dn+~
8250 rp="Directory for the main $spackage html pages?"
8251 . ./getfile
8252 prefixvar=html1dir
8253 . ./setprefixvar
8254 : Use ' ' for none so value is preserved next time through Configure
8255 $test X"$html1dir" = "X" && html1dir=' '
8256
8257 : determine where html pages for libraries and modules go
8258 set html3dir html3dir none
8259 eval $prefixit
8260 $cat <<EOM
8261
8262 If you wish to install html files for modules associated with $spackage,
8263 indicate the appropriate directory here. To skip installing html files,
8264 answer "none".
8265 EOM
8266 : There is no obvious default. If they have specified html1dir, then
8267 : try to key off that, possibly changing .../html1 into .../html3.
8268 case "$html3dir" in
8269 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8270 *) dflt=$html3dir ;;
8271 esac
8272 fn=dn+~
8273 rp="Directory for the $spackage module html pages?"
8274 . ./getfile
8275 prefixvar=html3dir
8276 . ./setprefixvar
8277 : Use ' ' for none so value is preserved next time through Configure
8278 $test X"$html3dir" = "X" && html3dir=' '
8279
8280 : determine whether to install perl also as /usr/bin/perl
8281
8282 echo " "
8283 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8284 $cat <<EOM
8285 Many scripts expect perl to be installed as /usr/bin/perl.
8286
8287 If you want to, I can install the perl you are about to compile
8288 as /usr/bin/perl (in addition to $bin/perl).
8289 EOM
8290 if test -f /usr/bin/perl; then
8291 $cat <<EOM
8292
8293 However, please note that because you already have a /usr/bin/perl,
8294 overwriting that with a new Perl would very probably cause problems.
8295 Therefore I'm assuming you don't want to do that (unless you insist).
8296
8297 EOM
8298 case "$installusrbinperl" in
8299 "$define"|[yY]*) dflt='y';;
8300 *) dflt='n';;
8301 esac
8302 else
8303 $cat <<EOM
8304
8305 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8306
8307 EOM
8308 case "$installusrbinperl" in
8309 "$undef"|[nN]*) dflt='n';;
8310 *) dflt='y';;
8311 esac
8312 fi
8313 rp="Do you want to install perl as /usr/bin/perl?"
8314 . ./myread
8315 case "$ans" in
8316 [yY]*) val="$define";;
8317 *) val="$undef" ;;
8318 esac
8319 else
8320 val="$undef"
8321 fi
8322 set installusrbinperl
8323 eval $setvar
8324
8325 : see if dlopen exists
8326 xxx_runnm="$runnm"
8327 xxx_ccflags="$ccflags"
8328 runnm=false
8329 : with g++ one needs -shared to get is-in-libc to work for dlopen
8330 case "$gccversion" in
8331 '') ;;
8332 *Clang*) ;;
8333 *) case "$d_cplusplus" in
8334 "$define") ccflags="$ccflags -shared" ;;
8335 esac
8336 ;;
8337 esac
8338 set dlopen d_dlopen
8339 eval $inlibc
8340 runnm="$xxx_runnm"
8341 ccflags="$xxx_ccflags"
8342
8343 : see if this is a unistd.h system
8344 set unistd.h i_unistd
8345 eval $inhdr
8346
8347 : determine which dynamic loading, if any, to compile in
8348 echo " "
8349 dldir="ext/DynaLoader"
8350 case "$usedl" in
8351 $define|y|true)
8352 dflt='y'
8353 usedl="$define"
8354 ;;
8355 $undef|n|false)
8356 dflt='n'
8357 usedl="$undef"
8358 ;;
8359 *)
8360 dflt='n'
8361 case "$d_dlopen" in
8362 $define) dflt='y' ;;
8363 esac
8364 : Does a dl_xxx.xs file exist for this operating system
8365 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8366 ;;
8367 esac
8368 rp="Do you wish to use dynamic loading?"
8369 . ./myread
8370 usedl="$ans"
8371 bin_ELF="$undef"
8372 case "$ans" in
8373 y*) usedl="$define"
8374 case "$dlsrc" in
8375 '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8376 dflt="$dldir/dl_${osname}.xs"
8377 elif $test "$d_dlopen" = "$define" ; then
8378 dflt="$dldir/dl_dlopen.xs"
8379 else
8380 dflt=''
8381 fi
8382 ;;
8383 *) dflt="$dldir/$dlsrc"
8384 ;;
8385 esac
8386 echo "The following dynamic loading files are available:"
8387 : Can not go over to $dldir because getfile has path hard-coded in.
8388 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8389 rp="Source file to use for dynamic loading"
8390 fn="fne"
8391 gfpth="$src"
8392 . ./getfile
8393 usedl="$define"
8394 : emulate basename
8395 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8396
8397 $cat << EOM
8398
8399 Some systems may require passing special flags to $cc -c to
8400 compile modules that will be used to create a shared library.
8401 To use no flags, say "none".
8402
8403 EOM
8404 case "$cccdlflags" in
8405 '') case "$gccversion" in
8406 '') case "$osname" in
8407 hpux) dflt='+z' ;;
8408 irix*) dflt='-KPIC' ;;
8409 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8410 sunos) dflt='-pic' ;;
8411 *) dflt='none' ;;
8412 esac
8413 ;;
8414 *) case "$osname" in
8415 darwin) dflt='none' ;;
8416 *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8417 *) dflt='-fpic' ;;
8418 esac ;;
8419 esac ;;
8420 ' ') dflt='none' ;;
8421 *) dflt="$cccdlflags" ;;
8422 esac
8423
8424 case "$dflt" in
8425 none) dflt='' ;;
8426 esac
8427
8428 # If -Dsysroot was specified, now's the time to add it
8429 # to cccdlflags
8430 if test "X$sysroot" != X; then
8431 case "$gccversion" in
8432 '') ;;
8433 *) case "$dflt" in
8434 *sysroot*) ;;
8435 'undef'|*)
8436 dflt="$dflt --sysroot=$sysroot" ;;
8437 esac
8438 ;;
8439 esac
8440 fi
8441
8442 case "$dflt" in
8443 '') dflt='none';;
8444 esac
8445
8446 rp="Any special flags to pass to $cc -c to compile shared library modules?"
8447 . ./myread
8448 case "$ans" in
8449 none) cccdlflags=' ' ;;
8450 *) cccdlflags="$ans" ;;
8451 esac
8452
8453 cat << EOM
8454
8455 Some systems use ld to create libraries that can be dynamically loaded,
8456 while other systems (such as those using ELF) use $cc.
8457
8458 EOM
8459
8460 : Determine if this is ELF
8461 $cat >try.c <<EOM
8462 /* Test for whether ELF binaries are produced */
8463 #include <fcntl.h>
8464 #$i_stdlib I_STDLIB
8465 #ifdef I_STDLIB
8466 #include <stdlib.h>
8467 #endif
8468 #$i_unistd I_UNISTD
8469 #ifdef I_UNISTD
8470 #include <unistd.h>
8471 #endif
8472 int main() {
8473 char b[4];
8474 int i = open("a.out",O_RDONLY);
8475 if(i == -1)
8476 exit(1); /* fail */
8477 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8478 exit(0); /* succeed (yes, it is ELF) */
8479 exit(1); /* fail */
8480 }
8481 EOM
8482 if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8483 bin_ELF="$define"
8484 fi
8485 $rm_try
8486
8487 case "$ld" in
8488 '') if $test $bin_ELF = "$define"; then
8489 cat <<EOM
8490 You appear to have ELF support. I'll use $cc to build dynamic libraries.
8491 EOM
8492 dflt="$cc"
8493 else
8494 echo "I'll use ld to build dynamic libraries."
8495 dflt='ld'
8496 fi
8497 ;;
8498 *) dflt="$ld"
8499 ;;
8500 esac
8501
8502 rp="What command should be used to create dynamic libraries?"
8503 . ./myread
8504 ld="$ans"
8505
8506 cat << EOM
8507
8508 Some systems may require passing special flags to $ld to create a
8509 library that can be dynamically loaded. If your ld flags include
8510 -L/other/path options to locate libraries outside your loader's normal
8511 search path, you may need to specify those -L options here as well. To
8512 use no flags, say "none".
8513
8514 EOM
8515 case "$lddlflags" in
8516 '') case "$osname" in
8517 haiku) dflt='-shared' ;;
8518 hpux) dflt='-b';
8519 case "$gccversion" in
8520 '') dflt="$dflt +vnocompatwarnings" ;;
8521 esac
8522 ;;
8523 *linux*|irix*|gnu*) dflt="-shared $optimize" ;;
8524 solaris) # See [perl #66604].
8525 # On Solaris 11, gcc -m64 on amd64
8526 # appears not to understand -G. gcc versions at
8527 # least as old as 3.4.3 support -shared, so just
8528 # use that with Solaris 11 and later, but keep
8529 # the old behavior for older Solaris versions.
8530 case "$gccversion" in
8531 '') dflt='-G' ;;
8532 *) case "$osvers" in
8533 2.?|2.10) dflt='-G' ;;
8534 *) dflt='-shared' ;;
8535 esac
8536 ;;
8537 esac
8538 ;;
8539 sunos) dflt='-assert nodefinitions' ;;
8540 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8541 *) dflt='none' ;;
8542 esac
8543 ;;
8544 *) dflt="$lddlflags" ;;
8545 esac
8546
8547 : Only do this for gcc, since, for example, qcc has no concept
8548 : of --sysroot.
8549 if $test "X$sysroot" != X; then
8550 case "$gccversion" in
8551 '') ;;
8552 *) dflt="$dflt --sysroot=$sysroot" ;;
8553 esac
8554 fi
8555
8556 : Try to guess additional flags to pick up local libraries.
8557 : Be careful not to append to a plain 'none'
8558 case "$dflt" in
8559 none) dflt='' ;;
8560 esac
8561 for thisflag in $ldflags; do
8562 case "$thisflag" in
8563 -L*|-R*|-Wl,-R*)
8564 case " $dflt " in
8565 *" $thisflag "*) ;;
8566 *) dflt="$dflt $thisflag" ;;
8567 esac
8568 ;;
8569 esac
8570 done
8571
8572 case "$dflt" in
8573 ''|' ') dflt='none' ;;
8574 esac
8575
8576 case "$ldflags" in
8577 *-fstack-protector-strong*)
8578 case "$dflt" in
8579 *-fstack-protector-strong*) ;; # Don't add it again
8580 *) dflt="$dflt -fstack-protector-strong" ;;
8581 esac
8582 ;;
8583 *-fstack-protector*)
8584 case "$dflt" in
8585 *-fstack-protector*) ;; # Don't add it again
8586 *) dflt="$dflt -fstack-protector" ;;
8587 esac
8588 ;;
8589 esac
8590
8591 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8592 . ./myread
8593 case "$ans" in
8594 none) lddlflags=' ' ;;
8595 *) lddlflags="$ans" ;;
8596 esac
8597
8598 cat <<EOM
8599
8600 Some systems may require passing special flags to $cc to indicate that
8601 the resulting executable will use dynamic linking. To use no flags,
8602 say "none".
8603
8604 EOM
8605 case "$ccdlflags" in
8606 '') case "$osname" in
8607 *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8608 sunos) dflt='none' ;;
8609 *) dflt='none' ;;
8610 esac ;;
8611 ' ') dflt='none' ;;
8612 *) dflt="$ccdlflags" ;;
8613 esac
8614 rp="Any special flags to pass to $cc to use dynamic linking?"
8615 . ./myread
8616 case "$ans" in
8617 none) ccdlflags=' ' ;;
8618 *) ccdlflags="$ans" ;;
8619 esac
8620 ;;
8621
8622 *) usedl="$undef"
8623 ld='ld'
8624 dlsrc='dl_none.xs'
8625 lddlflags=''
8626 ccdlflags=''
8627 ;;
8628 esac
8629
8630 ld_can_script="$undef"
8631 case "$bin_ELF$usedl" in
8632 $define$define)
8633 # Abuse try.h and a.out names for neat cleanup
8634 $cat >try.c <<EOM
8635 void foo() {}
8636 void bar() {}
8637 EOM
8638 $cat >try.h <<EOM
8639 LIBTEST_42 {
8640 global:
8641 foo;
8642 local: *;
8643 };
8644 EOM
8645 if $cc $cccdlflags $ccdlflags $ccflags \
8646 $ldflags $lddlflags -o a.out try.c \
8647 -Wl,--version-script=try.h >/dev/null 2>&1 \
8648 && $test -s a.out ; then
8649 echo "ld supports scripting" >&4
8650 ld_can_script="$define"
8651 else
8652 echo "ld does not support scripting" >&4
8653 fi
8654 $rm_try
8655 ;;
8656 esac
8657
8658 : Do we want a shared libperl?
8659 also=''
8660 case "$usedl" in
8661 $undef)
8662 # No dynamic loading being used, so don't bother even to prompt.
8663 useshrplib='false'
8664 ;;
8665 *) case "$useshrplib" in
8666 '') case "$osname" in
8667 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8668 dflt=y
8669 also='Building a shared libperl is required for dynamic loading to work on your system.'
8670 ;;
8671 *) dflt=n
8672 ;;
8673 esac
8674 ;;
8675 $define|true|[Yy]*)
8676 dflt=y
8677 ;;
8678 *) dflt=n
8679 ;;
8680 esac
8681 $cat << EOM
8682
8683 The perl executable is normally obtained by linking perlmain.c with
8684 libperl${_a}, any static extensions (usually just DynaLoader), and
8685 any other libraries needed on this system (such as -lm, etc.). Since
8686 your system supports dynamic loading, it is probably possible to build
8687 a shared libperl.$so. If you will have more than one executable linked
8688 to libperl.$so, this will significantly reduce the size of each
8689 executable, but it may have a noticeable effect on performance. The
8690 default is probably sensible for your system.
8691 $also
8692
8693 EOM
8694 rp="Build a shared libperl.$so (y/n)"
8695 . ./myread
8696 case "$ans" in
8697 true|$define|[Yy]*)
8698 useshrplib='true' ;;
8699 *) useshrplib='false' ;;
8700 esac
8701 ;;
8702 esac
8703
8704 case "$useshrplib" in
8705 true)
8706 case "$userelocatableinc" in
8707 true|define)
8708 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8709 echo "See INSTALL for an explanation why that won't work." >&4
8710 exit 4
8711 ;;
8712 esac
8713 case "$libperl" in
8714 '')
8715 # Figure out a good name for libperl.so. Since it gets stored in
8716 # a version-specific architecture-dependent library, the version
8717 # number isn't really that important, except for making cc/ld happy.
8718 #
8719 # A name such as libperl.so.10.1
8720 majmin="libperl.$so.$patchlevel.$subversion"
8721 # A name such as libperl.so.100
8722 majonly=`echo $patchlevel $subversion |
8723 $awk '{printf "%d%02d", $1, $2}'`
8724 majonly=libperl.$so.$majonly
8725 # I'd prefer to keep the os-specific stuff here to a minimum, and
8726 # rely on figuring it out from the naming of libc.
8727 case "${osname}${osvers}" in
8728 *linux*|gnu*) # ld won't link with a bare -lperl otherwise.
8729 dflt=libperl.$so
8730 ;;
8731 cygwin*) # ld links now against the dll directly
8732 majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8733 majonly=`echo $patchlevel $subversion |
8734 $awk '{printf "%03d%03d", $1, $2}'`
8735 majonly=cygperl5.$majonly.$so
8736 dflt=$majmin
8737 ;;
8738 *) # Try to guess based on whether libc has major.minor.
8739 case "$libc" in
8740 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8741 *libc.$so.[0-9]*) dflt=$majonly ;;
8742 *) dflt=libperl.$so ;;
8743 esac
8744 ;;
8745 esac
8746 ;;
8747 *) dflt=$libperl
8748 ;;
8749 esac
8750 cat << EOM
8751
8752 I need to select a good name for the shared libperl. If your system uses
8753 library names with major and minor numbers, then you might want something
8754 like $majmin. Alternatively, if your system uses a single version
8755 number for shared libraries, then you might want to use $majonly.
8756 Or, your system might be quite happy with a simple libperl.$so.
8757
8758 Since the shared libperl will get installed into a version-specific
8759 architecture-dependent directory, the version number of the shared perl
8760 library probably isn't important, so the default should be o.k.
8761
8762 EOM
8763 rp='What name do you want to give to the shared libperl?'
8764 . ./myread
8765 libperl=$ans
8766 echo "Ok, I'll use $libperl"
8767 ;;
8768 *)
8769 libperl="libperl${_a}"
8770 ;;
8771 esac
8772
8773 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8774 case "$shrpdir" in
8775 '') ;;
8776 *) $cat >&4 <<EOM
8777 WARNING: Use of the shrpdir variable for the installation location of
8778 the shared $libperl is not supported. It was never documented and
8779 will not work in this version. Let me (https://github.com/Perl/perl5/issues)
8780 know of any problems this may cause.
8781
8782 EOM
8783 case "$shrpdir" in
8784 "$archlibexp/CORE")
8785 $cat >&4 <<EOM
8786 But your current setting of $shrpdir is
8787 the default anyway, so it's harmless.
8788 EOM
8789 ;;
8790 *)
8791 $cat >&4 <<EOM
8792 Further, your current attempted setting of $shrpdir
8793 conflicts with the value of $archlibexp/CORE
8794 that installperl will use.
8795 EOM
8796 ;;
8797 esac
8798 ;;
8799 esac
8800
8801 # How will the perl executable find the installed shared $libperl?
8802 # Add $xxx to ccdlflags.
8803 # If we can't figure out a command-line option, use $shrpenv to
8804 # set env LD_RUN_PATH. The main perl makefile uses this.
8805 shrpdir=$archlibexp/CORE
8806 xxx=''
8807 tmp_shrpenv=''
8808 if "$useshrplib"; then
8809 case "$osname" in
8810 aix)
8811 # We'll set it in Makefile.SH...
8812 ;;
8813 solaris)
8814 xxx="-R $shrpdir"
8815 ;;
8816 freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8817 xxx="-Wl,-R$shrpdir"
8818 ;;
8819 bsdos|linux|irix*|dec_osf|gnu*|haiku)
8820 xxx="-Wl,-rpath,$shrpdir"
8821 ;;
8822 hpux*)
8823 # hpux doesn't like the default, either.
8824 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8825 ;;
8826 cygwin)
8827 # cygwin needs only ldlibpth
8828 ;;
8829 *)
8830 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8831 ;;
8832 esac
8833 case "$xxx" in
8834 '') ;;
8835 *)
8836 # Only add $xxx if it isn't already in ccdlflags.
8837 case " $ccdlflags " in
8838 *" $xxx "*) ;;
8839 *) ccdlflags="$ccdlflags $xxx"
8840 cat <<EOM >&4
8841
8842 Adding $xxx to the flags
8843 passed to $ld so that the perl executable will find the
8844 installed shared $libperl.
8845
8846 EOM
8847 ;;
8848 esac
8849 ;;
8850 esac
8851 fi
8852 # Fix ccdlflags in AIX for building external extensions.
8853 # (For building Perl itself bare -bE:perl.exp is needed,
8854 # Makefile.SH takes care of this.)
8855 case "$osname" in
8856 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8857 esac
8858 # Respect a hint or command-line value.
8859 case "$shrpenv" in
8860 '') shrpenv="$tmp_shrpenv" ;;
8861 esac
8862 case "$ldlibpthname" in
8863 '') ldlibpthname=LD_LIBRARY_PATH ;;
8864 none) ldlibpthname='' ;;
8865 esac
8866
8867 : determine where manual pages are on this system
8868 echo " "
8869 case "$sysman" in
8870 '')
8871 syspath='/usr/share/man/man1 /usr/man/man1'
8872 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8873 syspath="$syspath /usr/man/u_man/man1"
8874 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8875 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8876 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8877 sysman=`./loc . /usr/man/man1 $syspath`
8878 ;;
8879 esac
8880 if $test -d "$sysman"; then
8881 echo "System manual is in $sysman." >&4
8882 else
8883 echo "Could not find manual pages in source form." >&4
8884 fi
8885
8886 : determine where manual pages go
8887 set man1dir man1dir none
8888 eval $prefixit
8889 $cat <<EOM
8890
8891 $spackage has manual pages available in source form.
8892 EOM
8893 case "$nroff" in
8894 nroff)
8895 echo "However, you don't have nroff, so they're probably useless to you."
8896 case "$man1dir" in
8897 '') man1dir="none";;
8898 esac;;
8899 esac
8900 echo "If you don't want the manual sources installed, answer 'none'."
8901 case "$man1dir" in
8902 ' ') dflt=none
8903 ;;
8904 '')
8905 lookpath="$prefixexp/share/man/man1"
8906 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8907 lookpath="$lookpath $prefixexp/man/p_man/man1"
8908 lookpath="$lookpath $prefixexp/man/u_man/man1"
8909 lookpath="$lookpath $prefixexp/man/man.1"
8910 case "$sysman" in
8911 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8912 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8913 esac
8914 set dflt
8915 eval $prefixup
8916 ;;
8917 *) dflt="$man1dir"
8918 ;;
8919 esac
8920 echo " "
8921 fn=dn+~
8922 rp="Where do the main $spackage manual pages (source) go?"
8923 . ./getfile
8924 if $test "X$man1direxp" != "X$ansexp"; then
8925 installman1dir=''
8926 fi
8927 prefixvar=man1dir
8928 . ./setprefixvar
8929
8930 case "$man1dir" in
8931 '') man1dir=' '
8932 installman1dir='';;
8933 esac
8934
8935 : What suffix to use on installed man pages
8936
8937 case "$man1dir" in
8938 ' ')
8939 man1ext='0'
8940 ;;
8941 *)
8942 rp="What suffix should be used for the main $spackage man pages?"
8943 case "$man1ext" in
8944 '') case "$man1dir" in
8945 *1) dflt=1 ;;
8946 *1p) dflt=1p ;;
8947 *1pm) dflt=1pm ;;
8948 *l) dflt=l;;
8949 *n) dflt=n;;
8950 *o) dflt=o;;
8951 *p) dflt=p;;
8952 *C) dflt=C;;
8953 *L) dflt=L;;
8954 *L1) dflt=L1;;
8955 *) dflt=1;;
8956 esac
8957 ;;
8958 *) dflt="$man1ext";;
8959 esac
8960 . ./myread
8961 man1ext="$ans"
8962 ;;
8963 esac
8964
8965 : see if we can have long filenames
8966 echo " "
8967 first=123456789abcdef
8968 $rm -f $first
8969 if (echo hi >$first) 2>/dev/null; then
8970 if $test -f 123456789abcde; then
8971 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8972 val="$undef"
8973 else
8974 echo 'You can have filenames longer than 14 characters.'>&4
8975 val="$define"
8976 fi
8977 else
8978 $cat <<'EOM'
8979 You can't have filenames longer than 14 chars.
8980 You can't even think about them!
8981 EOM
8982 val="$undef"
8983 fi
8984 set d_flexfnam
8985 eval $setvar
8986 $rm -rf 123456789abcde*
8987
8988 : determine where library module manual pages go
8989 set man3dir man3dir none
8990 eval $prefixit
8991 $cat <<EOM
8992
8993 $spackage has manual pages for many of the library modules.
8994 EOM
8995
8996 case "$nroff" in
8997 nroff)
8998 $cat <<'EOM'
8999 However, you don't have nroff, so they're probably useless to you.
9000 EOM
9001 case "$man3dir" in
9002 '') man3dir="none";;
9003 esac;;
9004 esac
9005
9006 case "$d_flexfnam" in
9007 undef)
9008 $cat <<'EOM'
9009 However, your system can't handle the long file names like File::Basename.3.
9010 EOM
9011 case "$man3dir" in
9012 '') man3dir="none";;
9013 esac;;
9014 esac
9015
9016 echo "If you don't want the manual sources installed, answer 'none'."
9017 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9018 case "$man3dir" in
9019 '') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9020 if $test -d "$privlib/man/man3"; then
9021 cat <<EOM >&4
9022
9023 WARNING: Previous versions of perl installed man3 pages into
9024 $privlib/man/man3. This version will suggest a
9025 new default of $dflt.
9026 EOM
9027 tdflt=$dflt
9028 dflt='n'
9029 rp='Do you wish to preserve the old behavior?(y/n)'
9030 . ./myread
9031 case "$ans" in
9032 y*) dflt="$privlib/man/man3" ;;
9033 *) dflt=$tdflt ;;
9034 esac
9035 fi
9036 ;;
9037 *) dflt="$man3dir" ;;
9038 esac
9039 case "$dflt" in
9040 ' ') dflt=none ;;
9041 esac
9042 echo " "
9043 fn=dn+~
9044 rp="Where do the $package library man pages (source) go?"
9045 . ./getfile
9046 prefixvar=man3dir
9047 . ./setprefixvar
9048
9049 case "$man3dir" in
9050 '') man3dir=' '
9051 installman3dir='';;
9052 esac
9053
9054 : What suffix to use on installed man pages
9055 case "$man3dir" in
9056 ' ')
9057 man3ext='0'
9058 ;;
9059 *)
9060 rp="What suffix should be used for the $package library man pages?"
9061 case "$man3ext" in
9062 '') case "$man3dir" in
9063 *3) dflt=3 ;;
9064 *3p) dflt=3p ;;
9065 *3pm) dflt=3pm ;;
9066 *l) dflt=l;;
9067 *n) dflt=n;;
9068 *o) dflt=o;;
9069 *p) dflt=p;;
9070 *C) dflt=C;;
9071 *L) dflt=L;;
9072 *L3) dflt=L3;;
9073 *) dflt=3;;
9074 esac
9075 ;;
9076 *) dflt="$man3ext";;
9077 esac
9078 . ./myread
9079 man3ext="$ans"
9080 ;;
9081 esac
9082
9083 : see if we have to deal with yellow pages, now NIS.
9084 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9085 case "$hostcat" in
9086 nidump*) ;;
9087 *)
9088 case "$hostcat" in
9089 *ypcat*) dflt=y;;
9090 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9091 dflt=y
9092 else
9093 dflt=n
9094 fi;;
9095 *) dflt=n;;
9096 esac
9097 echo " "
9098 rp='Are you getting the hosts file via yellow pages?'
9099 . ./myread
9100 case "$ans" in
9101 y*) hostcat='ypcat hosts';;
9102 *) hostcat='cat /etc/hosts';;
9103 esac
9104 ;;
9105 esac
9106 fi
9107 case "$hostcat" in
9108 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9109 esac
9110 case "$groupcat" in
9111 '') test -f /etc/group && groupcat='cat /etc/group';;
9112 esac
9113 case "$passcat" in
9114 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9115 esac
9116
9117 : now get the host name
9118 echo " "
9119 echo "Figuring out host name..." >&4
9120 case "$myhostname" in
9121 '') cont=true
9122 echo 'Maybe "hostname" will work...'
9123 if tans=`sh -c hostname 2>&1` ; then
9124 myhostname=$tans
9125 phostname=hostname
9126 cont=''
9127 fi
9128 ;;
9129 *) cont='';;
9130 esac
9131 if $test "$cont"; then
9132 if ./xenix; then
9133 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
9134 if tans=`cat /etc/systemid 2>&1` ; then
9135 myhostname=$tans
9136 phostname='cat /etc/systemid'
9137 echo "Whadyaknow. Xenix always was a bit strange..."
9138 cont=''
9139 fi
9140 elif $test -r /etc/systemid; then
9141 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9142 fi
9143 fi
9144 if $test "$cont"; then
9145 echo 'No, maybe "uuname -l" will work...'
9146 if tans=`sh -c 'uuname -l' 2>&1` ; then
9147 myhostname=$tans
9148 phostname='uuname -l'
9149 else
9150 echo 'Strange. Maybe "uname -n" will work...'
9151 if tans=`sh -c 'uname -n' 2>&1` ; then
9152 myhostname=$tans
9153 phostname='uname -n'
9154 else
9155 echo 'Oh well, maybe I can mine it out of whoami.h...'
9156 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9157 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9158 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9159 else
9160 case "$myhostname" in
9161 '') echo "Does this machine have an identity crisis or something?"
9162 phostname='';;
9163 *)
9164 echo "Well, you said $myhostname before..."
9165 phostname='echo $myhostname';;
9166 esac
9167 fi
9168 fi
9169 fi
9170 fi
9171 case "$myhostname" in
9172 '') myhostname=noname ;;
9173 esac
9174 : you do not want to know about this
9175 set $myhostname
9176 myhostname=$1
9177
9178 : verify guess
9179 if $test "$myhostname" ; then
9180 dflt=y
9181 rp='Your host name appears to be "'$myhostname'".'" Right?"
9182 . ./myread
9183 case "$ans" in
9184 y*) ;;
9185 *) myhostname='';;
9186 esac
9187 fi
9188
9189 : bad guess or no guess
9190 while $test "X$myhostname" = X ; do
9191 dflt=''
9192 rp="Please type the (one word) name of your host:"
9193 . ./myread
9194 myhostname="$ans"
9195 done
9196
9197 : translate upper to lower if necessary
9198 case "$myhostname" in
9199 *[A-Z]*)
9200 echo "(Normalizing case in your host name)"
9201 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9202 ;;
9203 esac
9204
9205 case "$myhostname" in
9206 *.*)
9207 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9208 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9209 echo "(Trimming domain name from host name--host name is now $myhostname)"
9210 ;;
9211 *) case "$mydomain" in
9212 '')
9213 {
9214 test "X$hostcat" = "Xypcat hosts" &&
9215 ypmatch "$myhostname" hosts 2>/dev/null |\
9216 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
9217 $test -s hosts
9218 } || {
9219 test "X$hostcat" != "X" &&
9220 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
9221 /[ ]$myhostname[ . ]/p" > hosts
9222 }
9223 tmp_re="[ . ]"
9224 if $test -f hosts; then
9225 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
9226 END { print sum }" hosts` = x1 || tmp_re="[ ]"
9227 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9228 hosts | $sort | $uniq | \
9229 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9230 case `$echo X$dflt` in
9231 X*\ *) echo "(Several hosts in the database matched hostname)"
9232 dflt=.
9233 ;;
9234 X.) echo "(You do not have fully-qualified names in the hosts database)"
9235 ;;
9236 esac
9237 else
9238 echo "(I cannot locate a hosts database anywhere)"
9239 dflt=.
9240 fi
9241 case "$dflt" in
9242 .)
9243 tans=`./loc resolv.conf X /etc /usr/etc`
9244 if $test -f "$tans"; then
9245 echo "(Attempting domain name extraction from $tans)"
9246 dflt=.`$sed -n -e 's/ / /g' \
9247 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
9248 -e 1q 2>/dev/null`
9249 case "$dflt" in
9250 .) dflt=.`$sed -n -e 's/ / /g' \
9251 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
9252 -e 1q 2>/dev/null`
9253 ;;
9254 esac
9255 fi
9256 ;;
9257 esac
9258 case "$dflt" in
9259 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9260 dflt=.`sh -c domainname 2>/dev/null`
9261 case "$dflt" in
9262 '') dflt='.';;
9263 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9264 esac
9265 ;;
9266 esac
9267 case "$dflt$osname" in
9268 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9269 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9270 ;;
9271 esac
9272 case "$dflt" in
9273 .) echo "(Lost all hope -- silly guess then)"
9274 dflt='.nonet'
9275 ;;
9276 esac
9277 $rm -f hosts
9278 ;;
9279 *) dflt="$mydomain";;
9280 esac;;
9281 esac
9282 echo " "
9283 rp="What is your domain name?"
9284 . ./myread
9285 tans="$ans"
9286 case "$ans" in
9287 '') ;;
9288 .*) ;;
9289 *) tans=".$tans";;
9290 esac
9291 mydomain="$tans"
9292
9293 : translate upper to lower if necessary
9294 case "$mydomain" in
9295 *[A-Z]*)
9296 echo "(Normalizing case in your domain name)"
9297 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9298 ;;
9299 esac
9300
9301 : a little sanity check here
9302 case "$phostname" in
9303 '') ;;
9304 *)
9305 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9306 $myhostname$mydomain|$myhostname) ;;
9307 *)
9308 case "$phostname" in
9309 sed*)
9310 echo "(That doesn't agree with your whoami.h file, by the way.)"
9311 ;;
9312 *)
9313 echo "(That doesn't agree with your $phostname command, by the way.)"
9314 ;;
9315 esac
9316 ;;
9317 esac
9318 ;;
9319 esac
9320
9321 : determine the e-mail address of the user who is running us
9322 $cat <<EOM
9323
9324 I need to get your e-mail address in Internet format if possible, i.e.
9325 something like [email protected]. Please answer accurately since I have
9326 no easy means to double check it. The default value provided below
9327 is most probably close to reality but may not be valid from outside
9328 your organization...
9329
9330 EOM
9331 cont=x
9332 while test "$cont"; do
9333 case "$MAILDOMAIN" in
9334 '')
9335 if $test -s /etc/mailname; then
9336 maildomain=`$cat /etc/mailname`
9337 else
9338 maildomain="$myhostname$mydomain"
9339 fi
9340 ;;
9341 *) maildomain="$MAILDOMAIN";;
9342 esac
9343 case "$cf_email" in
9344 '') dflt="$cf_by@$maildomain";;
9345 *) dflt="$cf_email";;
9346 esac
9347 rp='What is your e-mail address?'
9348 . ./myread
9349 cf_email="$ans"
9350 case "$cf_email" in
9351 *@*.*) cont='' ;;
9352 *)
9353 rp='Address does not look like an Internet one. Use it anyway?'
9354 case "$fastread" in
9355 yes) dflt=y ;;
9356 *) dflt=n ;;
9357 esac
9358 . ./myread
9359 case "$ans" in
9360 y*) cont='' ;;
9361 *) echo " " ;;
9362 esac
9363 ;;
9364 esac
9365 done
9366
9367 : Ask e-mail of administrator
9368 $cat <<EOM
9369
9370 If you or somebody else will be maintaining perl at your site, please
9371 fill in the correct e-mail address here so that they may be contacted
9372 if necessary. You may enter "none" for no administrator.
9373
9374 EOM
9375 case "$perladmin" in
9376 '') dflt="$cf_email";;
9377 *) dflt="$perladmin";;
9378 esac
9379 rp='Perl administrator e-mail address'
9380 . ./myread
9381 perladmin="$ans"
9382
9383 : determine whether to use a version number suffix for installed binaries
9384 echo " "
9385 $cat <<EOM
9386 Do you want to use a version number suffix for installed binaries? This
9387 will install 'perl$version' instead of 'perl', and likewise for other
9388 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9389 to be installed side-by-side. Unless you are a developer, you probably
9390 do *not* want to do this.
9391 EOM
9392 case "$versiononly" in
9393 "$define"|[Yy]*|true) dflt='y' ;;
9394 *) dflt='n';
9395 esac
9396 rp="Do you want to use a version number suffix for installed binaries?"
9397 . ./myread
9398 case "$ans" in
9399 [yY]*) val="$define";;
9400 *) val="$undef" ;;
9401 esac
9402 set versiononly
9403 eval $setvar
9404
9405 case "$versiononly" in
9406 "$define") inc_version_list=''
9407 inc_version_list_init=0
9408 ;;
9409 esac
9410
9411 : figure out how to guarantee perl startup
9412 : XXX Note that this currently takes advantage of the bug that binexp ignores
9413 : the Configure -Dinstallprefix setting, which in turn means that under
9414 : relocatable @INC, initialinstalllocation is what binexp started as.
9415 case "$startperl" in
9416 '')
9417 case "$sharpbang" in
9418 *!)
9419 $cat <<EOH
9420
9421 I can use the #! construct to start perl on your system. This will
9422 make startup of perl scripts faster, but may cause problems if you
9423 want to share those scripts and perl is not in a standard place
9424 ($initialinstalllocation/perl) on all your platforms. The alternative
9425 is to force a shell by starting the script with a single ':' character.
9426
9427 EOH
9428 case "$versiononly" in
9429 "$define") dflt="$initialinstalllocation/perl$version";;
9430 *) dflt="$initialinstalllocation/perl";;
9431 esac
9432 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9433 . ./myread
9434 case "$ans" in
9435 none) startperl=": # use perl";;
9436 *) startperl="#!$ans"
9437 if $test 30 -lt `echo "$ans" | wc -c`; then
9438 $cat >&4 <<EOM
9439
9440 WARNING: Some systems limit the #! command to 32 characters.
9441 If you experience difficulty running Perl scripts with #!, try
9442 installing Perl in a directory with a shorter pathname.
9443
9444 EOM
9445 fi ;;
9446 esac
9447 ;;
9448 *) startperl=": # use perl"
9449 ;;
9450 esac
9451 ;;
9452 esac
9453 echo "I'll use $startperl to start perl scripts."
9454
9455 : figure best path for perl in scripts
9456 case "$perlpath" in
9457 '')
9458 case "$versiononly" in
9459 "$define") perlpath="$initialinstalllocation/perl$version";;
9460 *) perlpath="$initialinstalllocation/perl";;
9461 esac
9462 case "$startperl" in
9463 *!*) ;;
9464 *)
9465 $cat <<EOH
9466
9467 I will use the "eval 'exec'" idiom to start Perl on your system.
9468 I can use the full path of your Perl binary for this purpose, but
9469 doing so may cause problems if you want to share those scripts and
9470 Perl is not always in a standard place ($initialinstalllocation/perl).
9471
9472 EOH
9473 dflt="$initialinstalllocation/perl"
9474 rp="What path shall I use in \"eval 'exec'\"?"
9475 . ./myread
9476 perlpath="$ans"
9477 ;;
9478 esac
9479 ;;
9480 esac
9481 case "$startperl" in
9482 *!*) ;;
9483 *) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9484 esac
9485
9486 : determine where public executable scripts go
9487 set scriptdir scriptdir
9488 eval $prefixit
9489 case "$scriptdir" in
9490 '')
9491 dflt="$bin"
9492 : guess some guesses
9493 $test -d /usr/share/scripts && dflt=/usr/share/scripts
9494 $test -d /usr/share/bin && dflt=/usr/share/bin
9495 $test -d /usr/local/script && dflt=/usr/local/script
9496 $test -d /usr/local/scripts && dflt=/usr/local/scripts
9497 $test -d $prefixexp/script && dflt=$prefixexp/script
9498 set dflt
9499 eval $prefixup
9500 ;;
9501 *) dflt="$scriptdir"
9502 ;;
9503 esac
9504 $cat <<EOM
9505
9506 Some installations have a separate directory just for executable scripts so
9507 that they can mount it across multiple architectures but keep the scripts in
9508 one spot. You might, for example, have a subdirectory of /usr/share for this.
9509 Or you might just lump your scripts in with all your other executables.
9510
9511 EOM
9512 fn=d~
9513 rp='Where do you keep publicly executable scripts?'
9514 . ./getfile
9515 if $test "X$ansexp" != "X$scriptdirexp"; then
9516 installscript=''
9517 fi
9518 installscriptdir=''
9519 prefixvar=scriptdir
9520 . ./setprefixvar
9521 : A little fix up for an irregularly named variable.
9522 installscript="$installscriptdir"
9523
9524 : determine where add-on public executables go
9525 case "$sitebin" in
9526 '') dflt=$siteprefix/bin ;;
9527 *) dflt=$sitebin ;;
9528 esac
9529 fn=d~
9530 rp='Pathname where the add-on public executables should be installed?'
9531 . ./getfile
9532 prefixvar=sitebin
9533 . ./setprefixvar
9534
9535 : determine where add-on html pages go
9536 : There is no standard location, so try to copy the previously-selected
9537 : directory structure for the core html pages.
9538 case "$sitehtml1dir" in
9539 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9540 *) dflt=$sitehtml1dir ;;
9541 esac
9542 case "$dflt" in
9543 ''|' ') dflt=none ;;
9544 esac
9545 fn=dn+~
9546 rp='Pathname where the site-specific html pages should be installed?'
9547 . ./getfile
9548 prefixvar=sitehtml1dir
9549 . ./setprefixvar
9550
9551 : determine where add-on library html pages go
9552 : There is no standard location, so try to copy the previously-selected
9553 : directory structure for the core html pages.
9554 case "$sitehtml3dir" in
9555 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9556 *) dflt=$sitehtml3dir ;;
9557 esac
9558 case "$dflt" in
9559 ''|' ') dflt=none ;;
9560 esac
9561 fn=dn+~
9562 rp='Pathname where the site-specific library html pages should be installed?'
9563 . ./getfile
9564 prefixvar=sitehtml3dir
9565 . ./setprefixvar
9566
9567 : determine where add-on manual pages go
9568 case "$siteman1dir" in
9569 '') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9570 *) dflt=$siteman1dir ;;
9571 esac
9572 case "$dflt" in
9573 ''|' ') dflt=none ;;
9574 esac
9575 fn=dn+~
9576 rp='Pathname where the site-specific manual pages should be installed?'
9577 . ./getfile
9578 prefixvar=siteman1dir
9579 . ./setprefixvar
9580
9581 : determine where add-on library man pages go
9582 case "$siteman3dir" in
9583 '') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9584 *) dflt=$siteman3dir ;;
9585 esac
9586 case "$dflt" in
9587 ''|' ') dflt=none ;;
9588 esac
9589 fn=dn+~
9590 rp='Pathname where the site-specific library manual pages should be installed?'
9591 . ./getfile
9592 prefixvar=siteman3dir
9593 . ./setprefixvar
9594
9595 : determine where add-on public executable scripts go
9596 case "$sitescript" in
9597 '') dflt=$siteprefix/script
9598 $test -d $dflt || dflt=$sitebin ;;
9599 *) dflt="$sitescript" ;;
9600 esac
9601 fn=d~+
9602 rp='Pathname where add-on public executable scripts should be installed?'
9603 . ./getfile
9604 prefixvar=sitescript
9605 . ./setprefixvar
9606
9607 : see if backtrace exists
9608 set backtrace d_backtrace
9609 eval $inlibc
9610
9611 : Check if C backtrace is actually supported.
9612 case "$usecbacktrace" in
9613 "") usecbacktrace=$undef ;;
9614 [yY]*|true|$define)
9615 case "$d_backtrace" in
9616 [yY]*|true|$define)
9617 ;;
9618 *)
9619 echo "This system does not support backtrace" >&4
9620 usecbacktrace=$undef
9621 ;;
9622 esac
9623 ;;
9624 esac
9625
9626 : Check if faststdio is requested and available
9627 case "$usefaststdio" in
9628 $define|true|[yY]*|'')
9629 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9630 case "$xversion" in
9631 [68]) dflt='y' ;;
9632 *) dflt='n' ;;
9633 esac
9634 ;;
9635 *) dflt='n';;
9636 esac
9637 cat <<EOM
9638
9639 Perl can be built to use 'fast stdio', which means using the stdio
9640 library but also directly manipulating the stdio buffers to enable
9641 faster I/O. Using stdio is better for backward compatibility (especially
9642 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9643 interface has been preferred instead of stdio.
9644
9645 If this doesn't make any sense to you, just accept the default '$dflt'.
9646 EOM
9647 rp='Use the "fast stdio" if available?'
9648 . ./myread
9649 case "$ans" in
9650 y|Y) val="$define" ;;
9651 *) val="$undef" ;;
9652 esac
9653 set usefaststdio
9654 eval $setvar
9655
9656 : define an is-a-typedef? function
9657 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9658 case "$inclist" in
9659 "") inclist="sys/types.h";;
9660 esac;
9661 eval "varval=\$$var";
9662 case "$varval" in
9663 "")
9664 $rm -f temp.c;
9665 for inc in $inclist; do
9666 echo "#include <$inc>" >>temp.c;
9667 done;
9668 echo "#ifdef $type" >> temp.c;
9669 echo "printf(\"We have $type\");" >> temp.c;
9670 echo "#endif" >> temp.c;
9671 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9672 if $contains $type temp.E >/dev/null 2>&1; then
9673 eval "$var=\$type";
9674 else
9675 eval "$var=\$def";
9676 fi;
9677 $rm -f temp.?;;
9678 *) eval "$var=\$varval";;
9679 esac'
9680
9681 : define an is-a-typedef? function that prompts if the type is not available.
9682 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9683 case "$inclist" in
9684 "") inclist="sys/types.h";;
9685 esac;
9686 eval "varval=\$$var";
9687 case "$varval" in
9688 "")
9689 $rm -f temp.c;
9690 for inc in $inclist; do
9691 echo "#include <$inc>" >>temp.c;
9692 done;
9693 echo "#ifdef $type" >> temp.c;
9694 echo "printf(\"We have $type\");" >> temp.c;
9695 echo "#endif" >> temp.c;
9696 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9697 echo " " ;
9698 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9699 if $contains $type temp.E >/dev/null 2>&1; then
9700 echo "$type found." >&4;
9701 eval "$var=\$type";
9702 else
9703 echo "$type NOT found." >&4;
9704 dflt="$def";
9705 . ./myread ;
9706 eval "$var=\$ans";
9707 fi;
9708 $rm -f temp.?;;
9709 *) eval "$var=\$varval";;
9710 esac'
9711
9712 : see what type lseek is declared as in the kernel
9713 rp="What is the type used for lseek's offset on this system?"
9714 set off_t lseektype long stdio.h sys/types.h
9715 eval $typedef_ask
9716
9717 echo " "
9718 echo "Checking to see how big your file offsets are..." >&4
9719 $cat >try.c <<EOCP
9720 #include <sys/types.h>
9721 #include <stdio.h>
9722 int main()
9723 {
9724 printf("%d\n", (int)sizeof($lseektype));
9725 return(0);
9726 }
9727 EOCP
9728 set try
9729 if eval $compile_ok; then
9730 lseeksize=`$run ./try`
9731 echo "Your file offsets are $lseeksize bytes long."
9732 else
9733 dflt=$longsize
9734 echo " "
9735 echo "(I can't seem to compile the test program. Guessing...)"
9736 rp="What is the size of your file offsets (in bytes)?"
9737 . ./myread
9738 lseeksize="$ans"
9739 fi
9740 $rm_try
9741
9742 : see what type file positions are declared as in the library
9743 rp="What is the type for file position used by fsetpos()?"
9744 set fpos_t fpostype long stdio.h sys/types.h
9745 eval $typedef_ask
9746
9747 : Check size for Fpos_t
9748 echo " "
9749 case "$fpostype" in
9750 *_t) zzz="$fpostype" ;;
9751 *) zzz="fpos_t" ;;
9752 esac
9753 echo "Checking the size of $zzz..." >&4
9754 cat > try.c <<EOCP
9755 #include <sys/types.h>
9756 #include <stdio.h>
9757 #$i_stdlib I_STDLIB
9758 #ifdef I_STDLIB
9759 #include <stdlib.h>
9760 #endif
9761 int main() {
9762 printf("%d\n", (int)sizeof($fpostype));
9763 exit(0);
9764 }
9765 EOCP
9766 set try
9767 if eval $compile_ok; then
9768 yyy=`$run ./try`
9769 case "$yyy" in
9770 '') fpossize=4
9771 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9772 ;;
9773 *) fpossize=$yyy
9774 echo "Your $zzz is $fpossize bytes long."
9775 ;;
9776 esac
9777 else
9778 dflt="$longsize"
9779 echo " " >&4
9780 echo "(I can't compile the test program. Guessing...)" >&4
9781 rp="What is the size of your file positions (in bytes)?"
9782 . ./myread
9783 fpossize="$ans"
9784 fi
9785
9786 : Check for large file support
9787 # Backward compatibility (uselfs is deprecated).
9788 case "$uselfs" in
9789 "$define"|true|[yY]*)
9790 cat <<EOM >&4
9791
9792 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9793 EOM
9794 uselargefiles="$define"
9795 ;;
9796 esac
9797
9798 case "$lseeksize:$fpossize" in
9799 8:8) cat <<EOM
9800
9801 You can have files larger than 2 gigabytes.
9802 EOM
9803 val="$define" ;;
9804 *) case "$uselargefiles" in
9805 "$undef"|false|[nN]*) dflt='n' ;;
9806 *) dflt='y' ;;
9807 esac
9808 cat <<EOM
9809
9810 Perl can be built to understand large files (files larger than 2 gigabytes)
9811 on some systems. To do so, Configure can be run with -Duselargefiles.
9812
9813 If this doesn't make any sense to you, just accept the default '$dflt'.
9814 EOM
9815 rp='Try to understand large files, if available?'
9816 . ./myread
9817 case "$ans" in
9818 y|Y) val="$define" ;;
9819 *) val="$undef" ;;
9820 esac
9821 ;;
9822 esac
9823 set uselargefiles
9824 eval $setvar
9825 : Look for a hint-file generated 'call-back-unit'. If the
9826 : user has specified that a large files perl is to be built,
9827 : we may need to set or change some other defaults.
9828 if $test -f uselargefiles.cbu; then
9829 echo "Your platform has some specific hints regarding large file builds, using them..."
9830 . ./uselargefiles.cbu
9831 fi
9832 case "$uselargefiles" in
9833 "$define")
9834 if $test -f uselargefiles.cbu; then
9835 echo " "
9836 echo "Rechecking to see how big your file offsets are..." >&4
9837 $cat >try.c <<EOCP
9838 #include <sys/types.h>
9839 #include <stdio.h>
9840 int main()
9841 {
9842 printf("%d\n", (int)sizeof($lseektype));
9843 return(0);
9844 }
9845 EOCP
9846 set try
9847 if eval $compile_ok; then
9848 lseeksize=`$run ./try`
9849 $echo "Your file offsets are now $lseeksize bytes long."
9850 else
9851 dflt="$lseeksize"
9852 echo " "
9853 echo "(I can't seem to compile the test program. Guessing...)"
9854 rp="What is the size of your file offsets (in bytes)?"
9855 . ./myread
9856 lseeksize="$ans"
9857 fi
9858 case "$fpostype" in
9859 *_t) zzz="$fpostype" ;;
9860 *) zzz="fpos_t" ;;
9861 esac
9862 $echo $n "Rechecking the size of $zzz...$c" >&4
9863 $cat > try.c <<EOCP
9864 #include <sys/types.h>
9865 #include <stdio.h>
9866 #$i_stdlib I_STDLIB
9867 #ifdef I_STDLIB
9868 #include <stdlib.h>
9869 #endif
9870 int main() {
9871 printf("%d\n", (int)sizeof($fpostype));
9872 return(0);
9873 }
9874 EOCP
9875 set try
9876 if eval $compile_ok; then
9877 yyy=`$run ./try`
9878 dflt="$lseeksize"
9879 case "$yyy" in
9880 '') echo " "
9881 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9882 ;;
9883 *) fpossize=$yyy
9884 echo " $fpossize bytes." >&4
9885 ;;
9886 esac
9887 else
9888 dflt="$fpossize"
9889 echo " "
9890 echo "(I can't compile the test program. Guessing...)" >&4
9891 rp="What is the size of your file positions (in bytes)?"
9892 . ./myread
9893 fpossize="$ans"
9894 fi
9895 $rm_try
9896 fi
9897 ;;
9898 esac
9899
9900 : Check if we want perlio
9901 useperlio="$define"
9902
9903 : Set the vendorbin variables
9904 case "$vendorprefix" in
9905 '') d_vendorbin="$undef"
9906 vendorbin=''
9907 vendorbinexp=''
9908 ;;
9909 *) d_vendorbin="$define"
9910 : determine where vendor-supplied executables go.
9911 case "$vendorbin" in
9912 '') dflt=$vendorprefix/bin ;;
9913 *) dflt="$vendorbin" ;;
9914 esac
9915 fn=d~+
9916 rp='Pathname for the vendor-supplied executables directory?'
9917 . ./getfile
9918 vendorbin="$ans"
9919 vendorbinexp="$ansexp"
9920 ;;
9921 esac
9922 prefixvar=vendorbin
9923 . ./installprefix
9924
9925 : Set the vendorhtml1dir variables
9926 case "$vendorprefix" in
9927 '') vendorhtml1dir=''
9928 vendorhtml1direxp=''
9929 ;;
9930 *) : determine where vendor-supplied html pages go.
9931 : There is no standard location, so try to copy the previously-selected
9932 : directory structure for the core html pages.
9933 : XXX Better default suggestions would be welcome.
9934 case "$vendorhtml1dir" in
9935 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9936 *) dflt=$vendorhtml1dir ;;
9937 esac
9938 case "$dflt" in
9939 ''|' ') dflt=none ;;
9940 esac
9941 fn=dn+~
9942 rp='Pathname for the vendor-supplied html pages?'
9943 . ./getfile
9944 vendorhtml1dir="$ans"
9945 vendorhtml1direxp="$ansexp"
9946 ;;
9947 esac
9948 : Use ' ' for none so value is preserved next time through Configure
9949 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9950 prefixvar=vendorhtml1dir
9951 . ./installprefix
9952
9953 : Set the vendorhtml3dir variables
9954 case "$vendorprefix" in
9955 '') vendorhtml3dir=''
9956 vendorhtml3direxp=''
9957 ;;
9958 *) : determine where vendor-supplied module html pages go.
9959 : There is no standard location, so try to copy the previously-selected
9960 : directory structure for the core html pages.
9961 : XXX Better default suggestions would be welcome.
9962 case "$vendorhtml3dir" in
9963 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9964 *) dflt=$vendorhtml3dir ;;
9965 esac
9966 case "$dflt" in
9967 ''|' ') dflt=none ;;
9968 esac
9969 fn=dn+~
9970 rp='Pathname for the vendor-supplied html pages?'
9971 . ./getfile
9972 vendorhtml3dir="$ans"
9973 vendorhtml3direxp="$ansexp"
9974 ;;
9975 esac
9976 : Use ' ' for none so value is preserved next time through Configure
9977 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9978 prefixvar=vendorhtml3dir
9979 . ./installprefix
9980
9981 : Set the vendorman1dir variables
9982 case "$vendorprefix" in
9983 '') vendorman1dir=''
9984 vendorman1direxp=''
9985 ;;
9986 *) : determine where vendor-supplied manual pages go.
9987 case "$vendorman1dir" in
9988 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9989 *) dflt=$vendorman1dir ;;
9990 esac
9991 case "$dflt" in
9992 ''|' ') dflt=none ;;
9993 esac
9994 fn=nd~+
9995 rp='Pathname for the vendor-supplied manual section 1 pages?'
9996 . ./getfile
9997 vendorman1dir="$ans"
9998 vendorman1direxp="$ansexp"
9999 ;;
10000 esac
10001 : Use ' ' for none so value is preserved next time through Configure
10002 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10003 prefixvar=vendorman1dir
10004 . ./installprefix
10005
10006 : Set the vendorman3dir variables
10007 case "$vendorprefix" in
10008 '') vendorman3dir=''
10009 vendorman3direxp=''
10010 ;;
10011 *) : determine where vendor-supplied module manual pages go.
10012 case "$vendorman3dir" in
10013 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10014 *) dflt=$vendorman3dir ;;
10015 esac
10016 case "$dflt" in
10017 ''|' ') dflt=none ;;
10018 esac
10019 fn=nd~+
10020 rp='Pathname for the vendor-supplied manual section 3 pages?'
10021 . ./getfile
10022 vendorman3dir="$ans"
10023 vendorman3direxp="$ansexp"
10024 ;;
10025 esac
10026 : Use ' ' for none so value is preserved next time through Configure
10027 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10028 prefixvar=vendorman3dir
10029 . ./installprefix
10030
10031 : Set the vendorscript variables
10032 case "$vendorprefix" in
10033 '') d_vendorscript="$undef"
10034 vendorscript=''
10035 vendorscriptexp=''
10036 ;;
10037 *) d_vendorscript="$define"
10038 : determine where vendor-supplied scripts go.
10039 case "$vendorscript" in
10040 '') dflt=$vendorprefix/script
10041 $test -d $dflt || dflt=$vendorbin ;;
10042 *) dflt="$vendorscript" ;;
10043 esac
10044 $cat <<EOM
10045
10046 The installation process will create a directory for
10047 vendor-supplied scripts.
10048
10049 EOM
10050 fn=d~+
10051 rp='Pathname for the vendor-supplied scripts directory?'
10052 . ./getfile
10053 vendorscript="$ans"
10054 vendorscriptexp="$ansexp"
10055 ;;
10056 esac
10057 prefixvar=vendorscript
10058 . ./installprefix
10059
10060 : see if qgcvt exists
10061 set qgcvt d_qgcvt
10062 eval $inlibc
10063
10064 : Check what kind of doubles your system has
10065 $echo "Checking the kind of doubles you have..." >&4
10066 $cat >try.c <<EOP
10067 #$i_stdlib I_STDLIB
10068 #define DOUBLESIZE $doublesize
10069 #ifdef I_STDLIB
10070 #include <stdlib.h>
10071 #endif
10072 #include <stdio.h>
10073 static const double d = -0.1;
10074 int main() {
10075 unsigned const char* b = (unsigned const char*)(&d);
10076 #if DOUBLESIZE == 4
10077 if (b[0] == 0xCD && b[3] == 0xBD) {
10078 /* IEEE 754 32-bit little-endian */
10079 printf("1\n");
10080 exit(0);
10081 }
10082 if (b[0] == 0xBD && b[3] == 0xCD) {
10083 /* IEEE 754 32-bit big-endian */
10084 printf("2\n");
10085 exit(0);
10086 }
10087 if (b[0] == 0xCC && b[3] == 0xCC) {
10088 /* VAX format F, 32-bit PDP-style mixed endian. */
10089 printf("9\n");
10090 exit(0);
10091 }
10092 if (b[0] == 0xC0 && b[3] == 0x9A) {
10093 /* IBM single 32-bit */
10094 printf("12\n");
10095 exit(0);
10096 }
10097 #endif
10098 #if DOUBLESIZE == 8
10099 if (b[0] == 0x9A && b[7] == 0xBF) {
10100 /* IEEE 754 64-bit little-endian */
10101 printf("3\n");
10102 exit(0);
10103 }
10104 if (b[0] == 0xBF && b[7] == 0x9A) {
10105 /* IEEE 754 64-bit big-endian */
10106 printf("4\n");
10107 exit(0);
10108 }
10109 if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10110 /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10111 * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10112 * 99 99 b9 bf 9a 99 99 99 */
10113 printf("7\n");
10114 exit(0);
10115 }
10116 if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10117 /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10118 * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10119 * 99 99 99 9a bf b9 99 99 */
10120 printf("8\n");
10121 exit(0);
10122 }
10123 if (b[0] == 0xCC && b[7] == 0xCC) {
10124 /* VAX format D, 64-bit PDP-style mixed endian. */
10125 printf("10\n");
10126 exit(0);
10127 }
10128 if (b[0] == 0xD9 && b[7] == 0x99) {
10129 /* VAX format G, 64-bit PDP-style mixed endian. */
10130 printf("11\n");
10131 exit(0);
10132 }
10133 if (b[0] == 0xC0 && b[7] == 0x9A) {
10134 /* IBM double 64-bit */
10135 printf("13\n");
10136 exit(0);
10137 }
10138 if (b[0] == 0xBF && b[7] == 0xCD) {
10139 /* CRAY single 64-bit */
10140 printf("14\n");
10141 exit(0);
10142 }
10143 #endif
10144 #if DOUBLESIZE == 16
10145 if (b[0] == 0x9A && b[15] == 0xBF) {
10146 /* IEEE 754 128-bit little-endian */
10147 printf("5\n");
10148 exit(0);
10149 }
10150 if (b[0] == 0xBF && b[15] == 0x9A) {
10151 /* IEEE 754 128-bit big-endian */
10152 printf("6\n");
10153 exit(0);
10154 }
10155 #endif
10156 /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10157 * Whether those environments can still build Perl is debatable. */
10158 printf("-1\n"); /* unknown */
10159 exit(0);
10160 }
10161 EOP
10162 set try
10163 if eval $compile; then
10164 doublekind=`$run ./try`
10165 else
10166 doublekind=-1
10167 fi
10168 case "$doublekind" in
10169 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10170 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10171 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10172 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10173 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10174 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10175 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10176 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10177 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10178 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10179 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10180 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10181 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10182 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10183 *) echo "Cannot figure out your double. You Cyber, or something?" >&4 ;;
10184 esac
10185 d_double_style_ieee=$undef
10186 d_double_style_vax=$undef
10187 d_double_style_ibm=$undef
10188 d_double_style_cray=$undef
10189 case "$doublekind" in
10190 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10191 9|10|11) d_double_style_vax=$define ;;
10192 12|13) d_double_style_ibm=$define ;;
10193 14) d_double_style_cray=$define ;;
10194 esac
10195 case "$d_double_style_ieee" in
10196 $define)
10197 d_double_has_inf=$define
10198 d_double_has_nan=$define
10199 d_double_has_negative_zero=$define
10200 d_double_has_subnormals=$define
10201 ;;
10202 *)
10203 d_double_has_inf=$undef
10204 d_double_has_nan=$undef
10205 d_double_has_negative_zero=$undef
10206 d_double_has_subnormals=$undef
10207 ;;
10208 esac
10209 $rm_try
10210
10211 : Check print/scan long double stuff
10212 echo " "
10213
10214 if $test X"$d_longdbl" = X"$define"; then
10215
10216 echo "Checking how to print long doubles..." >&4
10217
10218 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10219 $cat >try.c <<'EOCP'
10220 #include <sys/types.h>
10221 #include <stdio.h>
10222 int main() {
10223 double d = 123.456;
10224 printf("%.3f\n", d);
10225 }
10226 EOCP
10227 set try
10228 if eval $compile; then
10229 yyy=`$run ./try`
10230 case "$yyy" in
10231 123.456)
10232 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10233 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10234 echo "We will use %f."
10235 ;;
10236 esac
10237 fi
10238 fi
10239
10240 if $test X"$sPRIfldbl" = X; then
10241 $cat >try.c <<'EOCP'
10242 #include <sys/types.h>
10243 #include <stdio.h>
10244 int main() {
10245 long double d = 123.456;
10246 printf("%.3Lf\n", d);
10247 }
10248 EOCP
10249 set try
10250 if eval $compile; then
10251 yyy=`$run ./try`
10252 case "$yyy" in
10253 123.456)
10254 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10255 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10256 echo "We will use %Lf."
10257 ;;
10258 esac
10259 fi
10260 fi
10261
10262 if $test X"$sPRIfldbl" = X; then
10263 $cat >try.c <<'EOCP'
10264 #include <sys/types.h>
10265 #include <stdio.h>
10266 int main() {
10267 long double d = 123.456;
10268 printf("%.3llf\n", d);
10269 }
10270 EOCP
10271 set try
10272 if eval $compile; then
10273 yyy=`$run ./try`
10274 case "$yyy" in
10275 123.456)
10276 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10277 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10278 echo "We will use %llf."
10279 ;;
10280 esac
10281 fi
10282 fi
10283
10284 if $test X"$sPRIfldbl" = X; then
10285 $cat >try.c <<'EOCP'
10286 #include <sys/types.h>
10287 #include <stdio.h>
10288 int main() {
10289 long double d = 123.456;
10290 printf("%.3lf\n", d);
10291 }
10292 EOCP
10293 set try
10294 if eval $compile; then
10295 yyy=`$run ./try`
10296 case "$yyy" in
10297 123.456)
10298 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10299 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10300 echo "We will use %lf."
10301 ;;
10302 esac
10303 fi
10304 fi
10305
10306 if $test X"$sPRIfldbl" = X; then
10307 echo "Cannot figure out how to print long doubles." >&4
10308 else
10309 sSCNfldbl=$sPRIfldbl # expect consistency
10310 fi
10311
10312 $rm_try
10313
10314 fi # d_longdbl
10315
10316 case "$sPRIfldbl" in
10317 '') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10318 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10319 d_SCNfldbl="$undef";
10320 ;;
10321 *) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10322 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10323 d_SCNfldbl="$define";
10324 ;;
10325 esac
10326
10327 : Before committing on uselongdouble, see whether that looks sane.
10328 if $test "$uselongdouble" = "$define"; then
10329 message=""
10330 echo " "
10331 echo "Checking if your long double math functions work right..." >&4
10332 $cat > try.c <<EOF
10333 #include <math.h>
10334 #include <stdio.h>
10335 int main() {
10336 printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10337 }
10338 EOF
10339 case "$osname:$gccversion" in
10340 aix:) saveccflags="$ccflags"
10341 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10342 esac
10343 set try
10344 if eval $compile_ok; then
10345 yyy=`$run ./try`
10346 fi
10347 case "$yyy" in
10348 3) echo "Your long double math functions are working correctly." >&4 ;;
10349 *) echo "Your long double math functions are broken, not using long doubles." >&4
10350 uselongdouble=$undef
10351 ;;
10352 esac
10353 $rm_try
10354 case "$osname:$gccversion" in
10355 aix:) ccflags="$saveccflags" ;; # restore
10356 esac
10357 fi
10358
10359 : Check how to convert floats to strings.
10360
10361 if test "X$d_Gconvert" = X; then
10362
10363 echo " "
10364 echo "Checking for an efficient way to convert floats to strings."
10365 echo " " > try.c
10366 case "$uselongdouble" in
10367 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10368 esac
10369 case "$d_longdbl" in
10370 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10371 esac
10372 case "$d_PRIgldbl" in
10373 "$define") echo "#define HAS_PRIgldbl" >>try.c ;;
10374 esac
10375 $cat >>try.c <<EOP
10376 #ifdef TRY_gconvert
10377 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10378 const char *myname = "gconvert";
10379 #endif
10380 #ifdef TRY_gcvt
10381 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10382 const char *myname = "gcvt";
10383 #endif
10384 #ifdef TRY_qgcvt
10385 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10386 const char *myname = "qgcvt";
10387 #define DOUBLETYPE long double
10388 #endif
10389 #ifdef TRY_sprintf
10390 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10391 #ifdef HAS_PRIgldbl
10392 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10393 #else
10394 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10395 #endif
10396 #else
10397 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10398 #endif
10399 const char *myname = "sprintf";
10400 #endif
10401
10402 #ifndef DOUBLETYPE
10403 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10404 #define DOUBLETYPE long double
10405 #else
10406 #define DOUBLETYPE double
10407 #endif
10408 #endif
10409
10410 #include <stdio.h>
10411
10412 #$i_stdlib I_STDLIB
10413 #ifdef I_STDLIB
10414 #include <stdlib.h>
10415 #endif
10416 #include <string.h>
10417
10418 void checkit(const char *expect, char *got)
10419 {
10420 if (strcmp(expect, got)) {
10421 printf("%s oddity: Expected %s, got %s\n",
10422 myname, expect, got);
10423 exit(1);
10424 }
10425 }
10426
10427 void lencheck(int expect, int got)
10428 {
10429 if (expect != got) {
10430 printf("%s length mismatch: Expected %d, got %d\n",
10431 myname, expect, got);
10432 exit(1);
10433 }
10434 }
10435
10436 int main()
10437 {
10438 char buf[64];
10439 buf[63] = '\0';
10440
10441 /* This must be 1st test on (which?) platform */
10442 /* Alan Burlison <[email protected]> */
10443 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10444 checkit("0.1", buf);
10445
10446 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10447 checkit("0.01", buf);
10448
10449 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10450 checkit("0.001", buf);
10451
10452 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10453 checkit("0.0001", buf);
10454
10455 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10456 if (strlen(buf) > 5)
10457 checkit("9e-005", buf); /* for Microsoft ?? */
10458 else
10459 checkit("9e-05", buf);
10460
10461 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10462 checkit("1", buf);
10463
10464 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10465 checkit("1.1", buf);
10466
10467 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10468 checkit("1.01", buf);
10469
10470 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10471 checkit("1.001", buf);
10472
10473 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10474 checkit("1.0001", buf);
10475
10476 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10477 checkit("1.00001", buf);
10478
10479 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10480 checkit("1.000001", buf);
10481
10482 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10483 checkit("0", buf);
10484
10485 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10486 checkit("-1", buf);
10487
10488 /* Some Linux gcvt's give 1.e+5 here. */
10489 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10490 checkit("100000", buf);
10491
10492 /* Some Linux gcvt's give -1.e+5 here. */
10493 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10494 checkit("-100000", buf);
10495
10496 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10497 checkit("123.456", buf);
10498
10499 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10500 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10501 /* 34 should be enough to scare even long double
10502 * places into using the e notation. */
10503 if (strlen(buf) > 5)
10504 checkit("1e+034", buf); /* for Microsoft */
10505 else
10506 checkit("1e+34", buf);
10507
10508 /* Test for an Ubuntu/Debian bug in gcvt and qgcvt. See: *
10509 * https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1899553 */
10510
10511 Gconvert((DOUBLETYPE)0.4, 53, 0, buf);
10512 lencheck(55, (int)strlen(buf));
10513
10514 /* For Perl, if you add additional tests here, also add them to
10515 * t/base/num.t for benefit of platforms not using Configure or
10516 * overriding d_Gconvert */
10517
10518 exit(0);
10519 }
10520 EOP
10521 : first add preferred functions to our list
10522 xxx_list=""
10523 for xxx_convert in $gconvert_preference; do
10524 case $xxx_convert in
10525 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10526 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10527 esac
10528 done
10529 : then add any others
10530 for xxx_convert in gconvert gcvt sprintf; do
10531 case "$xxx_list" in
10532 *$xxx_convert*) ;;
10533 *) xxx_list="$xxx_list $xxx_convert" ;;
10534 esac
10535 done
10536
10537 case "$d_longdbl$uselongdouble" in
10538 "$define$define")
10539 : again, add preferred functions to our list first
10540 xxx_ld_list=""
10541 for xxx_convert in $gconvert_ld_preference; do
10542 case $xxx_convert in
10543 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10544 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10545 esac
10546 done
10547 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10548 for xxx_convert in qgcvt sprintf $xxx_list; do
10549 case "$xxx_ld_list" in
10550 $xxx_convert*|*" $xxx_convert"*) ;;
10551 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10552 esac
10553 done
10554 : if sprintf cannot do long doubles, move it to the end
10555 if test "$d_PRIgldbl" != "$define"; then
10556 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10557 fi
10558 : if no qgcvt, remove it
10559 if test "$d_qgcvt" != "$define"; then
10560 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10561 fi
10562 : use the ld_list
10563 xxx_list="$xxx_ld_list"
10564 ;;
10565 esac
10566
10567 for xxx_convert in $xxx_list; do
10568 echo "Trying $xxx_convert..."
10569 $rm -f try try$_o core
10570 set try -DTRY_$xxx_convert
10571 if eval $compile; then
10572 echo "$xxx_convert() found." >&4
10573 if $run ./try; then
10574 echo "I'll use $xxx_convert to convert floats into a string." >&4
10575 break;
10576 else
10577 echo "...But $xxx_convert didn't work as I expected."
10578 xxx_convert=''
10579 fi
10580 else
10581 echo "$xxx_convert NOT found." >&4
10582 xxx_convert=''
10583 fi
10584 done
10585
10586 if test X$xxx_convert = X; then
10587 echo "*** WHOA THERE!!! ***" >&4
10588 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
10589 xxx_convert=sprintf
10590 fi
10591
10592 case "$xxx_convert" in
10593 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10594 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10595 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10596 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10597 "$define$define$define")
10598 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10599 "$define$define$undef")
10600 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10601 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10602 esac
10603 ;;
10604 esac
10605
10606 fi
10607 $rm_try
10608
10609 : see if _fwalk exists
10610 set fwalk d__fwalk
10611 eval $inlibc
10612
10613 : see if accept4 exists
10614 set accept4 d_accept4
10615 eval $inlibc
10616
10617 : Initialize h_fcntl
10618 h_fcntl=false
10619
10620 : Initialize h_sysfile
10621 h_sysfile=false
10622
10623 : access call always available on UNIX
10624 set access d_access
10625 eval $inlibc
10626
10627 : locate the flags for 'access()'
10628 case "$d_access" in
10629 "$define")
10630 echo " "
10631 $cat >access.c <<EOCP
10632 #include <sys/types.h>
10633 #ifdef I_FCNTL
10634 #include <fcntl.h>
10635 #endif
10636 #ifdef I_SYS_FILE
10637 #include <sys/file.h>
10638 #endif
10639 #ifdef I_UNISTD
10640 #include <unistd.h>
10641 #endif
10642 #$i_stdlib I_STDLIB
10643 #ifdef I_STDLIB
10644 #include <stdlib.h>
10645 #endif
10646 int main() {
10647 exit(R_OK);
10648 }
10649 EOCP
10650 : check sys/file.h first, no particular reason here
10651 if $test `./findhdr sys/file.h` && \
10652 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10653 h_sysfile=true;
10654 echo "<sys/file.h> defines the *_OK access constants." >&4
10655 elif $test `./findhdr fcntl.h` && \
10656 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10657 h_fcntl=true;
10658 echo "<fcntl.h> defines the *_OK access constants." >&4
10659 elif $test `./findhdr unistd.h` && \
10660 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10661 echo "<unistd.h> defines the *_OK access constants." >&4
10662 else
10663 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10664 fi
10665 ;;
10666 esac
10667 $rm -f access*
10668
10669 : see if accessx exists
10670 set accessx d_accessx
10671 eval $inlibc
10672
10673 : see if acosh exists
10674 set acosh d_acosh
10675 eval $inlibc
10676
10677 : see if aintl exists
10678 set aintl d_aintl
10679 eval $inlibc
10680
10681 : see if alarm exists
10682 set alarm d_alarm
10683 eval $inlibc
10684
10685 : see if 64bit time functions exists
10686
10687 set ctime64 d_ctime64
10688 eval $inlibc
10689
10690 set localtime64 d_localtime64
10691 eval $inlibc
10692
10693 set gmtime64 d_gmtime64
10694 eval $inlibc
10695
10696 set mktime64 d_mktime64
10697 eval $inlibc
10698
10699 set difftime64 d_difftime64
10700 eval $inlibc
10701
10702 set asctime64 d_asctime64
10703 eval $inlibc
10704
10705 : see if POSIX threads are available
10706 set pthread.h i_pthread
10707 eval $inhdr
10708
10709 : define a function to check prototypes
10710 $cat > protochk <<EOSH
10711 $startsh
10712 cc="$cc"
10713 optimize="$optimize"
10714 ccflags="$ccflags"
10715 define="$define"
10716 rm_try="$rm_try"
10717 usethreads=$usethreads
10718 i_pthread=$i_pthread
10719 pthread_h_first=$pthread_h_first
10720 EOSH
10721
10722 $cat >> protochk <<'EOSH'
10723
10724 $rm_try
10725 foo="$1"
10726 shift
10727 while test $# -ge 2; do
10728 case "$1" in
10729 $define) echo "#include <$2>" >> try.c ;;
10730 literal) echo "$2" >> try.c ;;
10731 esac
10732 # Extra magic for the benefit of systems that need pthread.h
10733 # to be included early to correctly detect threadsafe functions.
10734 # Such functions must guarantee themselves, though, that the usethreads
10735 # and i_pthread have been defined, before calling protochk.
10736 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10737 echo "#include <pthread.h>" >> try.c
10738 pthread_h_done=yes
10739 fi
10740 shift 2
10741 done
10742 cat >> try.c <<'EOCP'
10743 #define _(args) args
10744 EOCP
10745 echo "$foo" >> try.c
10746 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10747 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10748 status=$?
10749 $rm_try
10750 exit $status
10751 EOSH
10752 chmod +x protochk
10753 $eunicefix protochk
10754
10755 : Define hasproto macro for Configure internal use
10756 hasproto='varname=$1; func=$2; shift; shift;
10757 while $test $# -ge 2; do
10758 case "$1" in
10759 $define) echo "#include <$2>";;
10760 literal) echo "$2" ;;
10761 esac ;
10762 shift 2;
10763 done > try.c;
10764 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10765 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10766 echo "$func() prototype found.";
10767 val="$define";
10768 else
10769 echo "$func() prototype NOT found.";
10770 val="$undef";
10771 fi;
10772 set $varname;
10773 eval $setvar;
10774 $rm_try tryout.c'
10775
10776 : see if sys/types.h has to be included
10777 set sys/types.h i_systypes
10778 eval $inhdr
10779
10780 : see if sys/select.h has to be included
10781 set sys/select.h i_sysselct
10782 eval $inhdr
10783
10784 : Define hasfield macro for Configure internal use
10785 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10786 while $test $# -ge 2; do
10787 case "$1" in
10788 $define) echo "#include <$2>";;
10789 esac ;
10790 shift 2;
10791 done > try.c;
10792 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10793 set try;
10794 if eval $compile; then
10795 val="$define";
10796 else
10797 val="$undef";
10798 fi;
10799 set $varname;
10800 eval $setvar;
10801 $rm_try'
10802
10803 : see if we should include sys/time.h
10804 echo " "
10805 i_time='define'
10806 if test "X$timeincl" = X; then
10807 echo "Testing to see if we should include <sys/time.h>." >&4
10808 $echo $n "I'm now running the test program...$c"
10809 $cat >try.c <<EOCP
10810 #include <sys/types.h>
10811 #include <time.h>
10812 #ifdef I_SYSTIME
10813 #ifdef SYSTIMEKERNEL
10814 #define KERNEL
10815 #endif
10816 #include <sys/time.h>
10817 #endif
10818 #ifdef I_SYSSELECT
10819 #include <sys/select.h>
10820 #endif
10821 #$i_stdlib I_STDLIB
10822 #ifdef I_STDLIB
10823 #include <stdlib.h>
10824 #endif
10825 int main()
10826 {
10827 struct tm foo;
10828 #ifdef S_TIMEVAL
10829 struct timeval bar;
10830 #endif
10831 #ifdef S_TIMEZONE
10832 struct timezone tzp;
10833 #endif
10834 if (foo.tm_sec == foo.tm_sec)
10835 exit(0);
10836 #ifdef S_TIMEVAL
10837 if (bar.tv_sec == bar.tv_sec)
10838 exit(0);
10839 #endif
10840 exit(1);
10841 }
10842 EOCP
10843 flags=''
10844 for s_timezone in '-DS_TIMEZONE' ''; do
10845 sysselect=''
10846 for s_timeval in '-DS_TIMEVAL' ''; do
10847 for i_systimek in '' '-DSYSTIMEKERNEL'; do
10848 for i_systime in '-DI_SYSTIME' ''; do
10849 case "$flags" in
10850 '') $echo $n ".$c"
10851 set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10852 if eval $compile; then
10853 set X $i_systime $i_systimek $sysselect $s_timeval
10854 shift
10855 flags="$*"
10856 echo " "
10857 $echo $n "Succeeded with $flags$c"
10858 fi
10859 ;;
10860 esac
10861 done
10862 done
10863 done
10864 done
10865 timeincl=''
10866 echo " "
10867 case "$flags" in
10868 *SYSTIMEKERNEL*) i_systimek="$define"
10869 timeincl=`./findhdr sys/time.h`
10870 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10871 *) i_systimek="$undef";;
10872 esac
10873 case "$flags" in
10874 *I_SYSTIME*) i_systime="$define"
10875 timeincl=`./findhdr sys/time.h`" $timeincl"
10876 echo "We'll include <sys/time.h>." >&4;;
10877 *) i_systime="$undef";;
10878 esac
10879 $rm_try
10880 fi
10881 : see if struct tm knows about tm_zone
10882 case "$i_systime$i_time" in
10883 *$define*)
10884 echo " "
10885 echo "Checking to see if your struct tm has tm_zone field..." >&4
10886 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10887 eval $hasfield
10888 ;;
10889 *) val="$undef"
10890 set d_tm_tm_zone
10891 eval $setvar
10892 ;;
10893 esac
10894 case "$d_tm_tm_zone" in
10895 "$define") echo "Yes, it does." ;;
10896 *) echo "No, it doesn't." ;;
10897 esac
10898 : see if struct tm knows about tm_gmtoff
10899 case "$i_systime$i_time" in
10900 *$define*)
10901 echo " "
10902 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10903 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10904 eval $hasfield
10905 ;;
10906 *) val="$undef"
10907 set d_tm_tm_gmtoff
10908 eval $setvar
10909 ;;
10910 esac
10911 case "$d_tm_tm_gmtoff" in
10912 "$define") echo "Yes, it does." ;;
10913 *) echo "No, it doesn't." ;;
10914 esac
10915
10916 : see if asctime_r exists
10917 set asctime_r d_asctime_r
10918 eval $inlibc
10919 case "$d_asctime_r" in
10920 "$define")
10921 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10922 case "$d_asctime_r_proto:$usethreads" in
10923 ":define") d_asctime_r_proto=define
10924 set d_asctime_r_proto asctime_r $hdrs
10925 eval $hasproto ;;
10926 *) ;;
10927 esac
10928 case "$d_asctime_r_proto" in
10929 define)
10930 case "$asctime_r_proto" in
10931 ''|0) try='char* asctime_r(const struct tm*, char*);'
10932 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10933 esac
10934 case "$asctime_r_proto" in
10935 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10936 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10937 esac
10938 case "$asctime_r_proto" in
10939 ''|0) try='int asctime_r(const struct tm*, char*);'
10940 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10941 esac
10942 case "$asctime_r_proto" in
10943 ''|0) try='int asctime_r(const struct tm*, char*, int);'
10944 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10945 esac
10946 case "$asctime_r_proto" in
10947 ''|0) d_asctime_r=undef
10948 asctime_r_proto=0
10949 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10950 * ) case "$asctime_r_proto" in
10951 REENTRANT_PROTO*) ;;
10952 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10953 esac
10954 echo "Prototype: $try" ;;
10955 esac
10956 ;;
10957 *) case "$usethreads" in
10958 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10959 esac
10960 d_asctime_r=undef
10961 asctime_r_proto=0
10962 ;;
10963 esac
10964 ;;
10965 *) asctime_r_proto=0
10966 ;;
10967 esac
10968
10969 : see if asinh exists
10970 set asinh d_asinh
10971 eval $inlibc
10972
10973 : see if atanh exists
10974 set atanh d_atanh
10975 eval $inlibc
10976
10977 : see if atolf exists
10978 set atolf d_atolf
10979 eval $inlibc
10980
10981 : see if atoll exists
10982 set atoll d_atoll
10983 eval $inlibc
10984
10985 : See if a file contains compiler warnings
10986 case "$osname" in
10987 'aix')
10988 cat >compiler_warning <<EOSS
10989 # Sample for aix ('.5' indicates the column number in the line):
10990 # "op.h", line 203.5: 1506-159 (E) Bit field type specified for op_type
10991 # Since the word 'warning' isn't present, use a fairly rigorous match of what
10992 # warning messages look like
10993 # " o p . h ", line 203 . 5 : 1506 - 159 ( E )
10994 $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"
10995 EOSS
10996 compiler_warning=./compiler_warning
10997 chmod +x $compiler_warning
10998 ;;
10999 # Maybe a colon after the 'warning' would be appropriate
11000 *) compiler_warning="$contains -i warning"
11001 ;;
11002 esac
11003
11004 : Look for GCC-style attribute format
11005 case "$d_attribute_format" in
11006 '')
11007 echo " "
11008 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
11009 $cat >attrib.c <<'EOCP'
11010 #include <stdio.h>
11011 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
11012 EOCP
11013 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11014 if $compiler_warning attrib.out >/dev/null 2>&1; then
11015 echo "Your C compiler doesn't support __attribute__((format))."
11016 val="$undef"
11017 else
11018 echo "Your C compiler supports __attribute__((format))."
11019 val="$define"
11020 fi
11021 else
11022 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11023 val="$undef"
11024 fi
11025 ;;
11026 *) val="$d_attribute_format" ;;
11027 esac
11028 set d_attribute_format
11029 eval $setvar
11030 $rm -f attrib*
11031
11032 : Look for GCC-style attribute format with null format allowed
11033 case "$d_printf_format_null" in
11034 '') case "$d_attribute_format" in
11035 $define)
11036 echo " "
11037 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11038 $cat >attrib.c <<EOCP
11039 #include <stdio.h>
11040 #$i_stdlib I_STDLIB
11041 #ifdef I_STDLIB
11042 #include <stdlib.h>
11043 #endif
11044 #$i_inttypes I_INTTYPES
11045 #ifdef I_INTTYPES
11046 #include <inttypes.h>
11047 #endif
11048 #ifndef INTPTR_MAX
11049 #define intptr_t int
11050 #endif
11051 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11052 int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
11053 int main () { exit(null_printf(NULL)); }
11054 EOCP
11055 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11056 : run the executable in case it produces a run-time warning
11057 if $run ./attrib >>attrib.out 2>&1; then
11058 if $compiler_warning attrib.out >/dev/null 2>&1; then
11059 echo "Your C compiler doesn't allow __printf__ format to be null."
11060 val="$undef"
11061 else
11062 echo "Your C compiler allows __printf__ format to be null."
11063 val="$define"
11064 fi
11065 else
11066 echo "Your C compiler executable failed with __printf__ format null."
11067 val="$undef"
11068 fi
11069 else
11070 echo "Your C compiler fails with __printf__ format null."
11071 val="$undef"
11072 fi
11073 ;;
11074 *) val="$undef" ;;
11075 esac
11076 ;;
11077 *) val="$d_printf_format_null" ;;
11078 esac
11079 set d_printf_format_null
11080 eval $setvar
11081 $rm -f attrib*
11082
11083 : Look for GCC-style attribute malloc
11084 case "$d_attribute_malloc" in
11085 '')
11086 echo " "
11087 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11088 $cat >attrib.c <<'EOCP'
11089 #include <stdio.h>
11090 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11091 EOCP
11092 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11093 if $compiler_warning attrib.out >/dev/null 2>&1; then
11094 echo "Your C compiler doesn't support __attribute__((malloc))."
11095 val="$undef"
11096 else
11097 echo "Your C compiler supports __attribute__((malloc))."
11098 val="$define"
11099 fi
11100 else
11101 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11102 val="$undef"
11103 fi
11104 ;;
11105 *) val="$d_attribute_malloc" ;;
11106 esac
11107 set d_attribute_malloc
11108 eval $setvar
11109 $rm -f attrib*
11110
11111 : Look for GCC-style attribute nonnull
11112 case "$d_attribute_nonnull" in
11113 '')
11114 echo " "
11115 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11116 $cat >attrib.c <<'EOCP'
11117 #include <stdio.h>
11118 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11119 EOCP
11120 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11121 if $compiler_warning attrib.out >/dev/null 2>&1; then
11122 echo "Your C compiler doesn't support __attribute__((nonnull))."
11123 val="$undef"
11124 else
11125 echo "Your C compiler supports __attribute__((nonnull))."
11126 val="$define"
11127 fi
11128 else
11129 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11130 val="$undef"
11131 fi
11132 ;;
11133 *) val="$d_attribute_nonnull" ;;
11134 esac
11135 set d_attribute_nonnull
11136 eval $setvar
11137 $rm -f attrib*
11138
11139 : Look for GCC-style attribute noreturn
11140 case "$d_attribute_noreturn" in
11141 '')
11142 echo " "
11143 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11144 $cat >attrib.c <<'EOCP'
11145 #include <stdio.h>
11146 void fall_over_dead( void ) __attribute__((noreturn));
11147 EOCP
11148 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11149 if $compiler_warning attrib.out >/dev/null 2>&1; then
11150 echo "Your C compiler doesn't support __attribute__((noreturn))."
11151 val="$undef"
11152 else
11153 echo "Your C compiler supports __attribute__((noreturn))."
11154 val="$define"
11155 fi
11156 else
11157 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11158 val="$undef"
11159 fi
11160 ;;
11161 *) val="$d_attribute_noreturn" ;;
11162 esac
11163 set d_attribute_noreturn
11164 eval $setvar
11165 $rm -f attrib*
11166
11167 : Look for GCC-style attribute pure
11168 case "$d_attribute_pure" in
11169 '')
11170 echo " "
11171 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11172 $cat >attrib.c <<'EOCP'
11173 #include <stdio.h>
11174 int square( int n ) __attribute__((pure));
11175 EOCP
11176 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11177 if $compiler_warning attrib.out >/dev/null 2>&1; then
11178 echo "Your C compiler doesn't support __attribute__((pure))."
11179 val="$undef"
11180 else
11181 echo "Your C compiler supports __attribute__((pure))."
11182 val="$define"
11183 fi
11184 else
11185 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11186 val="$undef"
11187 fi
11188 ;;
11189 *) val="$d_attribute_pure" ;;
11190 esac
11191 set d_attribute_pure
11192 eval $setvar
11193 $rm -f attrib*
11194
11195 : Look for GCC-style attribute unused
11196 case "$d_attribute_unused" in
11197 '')
11198 echo " "
11199 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11200 $cat >attrib.c <<'EOCP'
11201 #include <stdio.h>
11202 int do_something( int dummy __attribute__((unused)), int n );
11203 EOCP
11204 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11205 if $compiler_warning attrib.out >/dev/null 2>&1; then
11206 echo "Your C compiler doesn't support __attribute__((unused))."
11207 val="$undef"
11208 else
11209 echo "Your C compiler supports __attribute__((unused))."
11210 val="$define"
11211 fi
11212 else
11213 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11214 val="$undef"
11215 fi
11216 ;;
11217 *) val="$d_attribute_unused" ;;
11218 esac
11219 set d_attribute_unused
11220 eval $setvar
11221 $rm -f attrib*
11222
11223 : Look for GCC-style attribute deprecated
11224 case "$d_attribute_deprecated" in
11225 '')
11226 echo " "
11227 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11228 $cat >attrib.c <<'EOCP'
11229 #include <stdio.h>
11230 int I_am_deprecated(void) __attribute__((deprecated));
11231 EOCP
11232 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11233 if $compiler_warning attrib.out >/dev/null 2>&1; then
11234 echo "Your C compiler doesn't support __attribute__((deprecated))."
11235 val="$undef"
11236 else
11237 echo "Your C compiler supports __attribute__((deprecated))."
11238 val="$define"
11239 fi
11240 else
11241 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11242 val="$undef"
11243 fi
11244 ;;
11245 *) val="$d_attribute_deprecated" ;;
11246 esac
11247 set d_attribute_deprecated
11248 eval $setvar
11249 $rm -f attrib*
11250
11251 : Look for GCC-style attribute warn_unused_result
11252 case "$d_attribute_warn_unused_result" in
11253 '')
11254 echo " "
11255 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11256 $cat >attrib.c <<'EOCP'
11257 #include <stdio.h>
11258 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11259 EOCP
11260 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11261 if $compiler_warning attrib.out >/dev/null 2>&1; then
11262 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11263 val="$undef"
11264 else
11265 echo "Your C compiler supports __attribute__((warn_unused_result))."
11266 val="$define"
11267 fi
11268 else
11269 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11270 val="$undef"
11271 fi
11272 ;;
11273 *) val="$d_attribute_warn_unused_result" ;;
11274 esac
11275 set d_attribute_warn_unused_result
11276 eval $setvar
11277 $rm -f attrib*
11278
11279 : Look for GCC-style attribute always_inline
11280 case "$d_attribute_always_inline" in
11281 '')
11282 echo " "
11283 echo "Checking whether your compiler can handle __attribute__((always_inline)) ..." >&4
11284 $cat >attrib.c <<'EOCP'
11285 #include <stdio.h>
11286 static __inline__ __attribute__((always_inline)) int I_will_always_be_inlined(void);
11287 EOCP
11288 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11289 if $compiler_warning attrib.out >/dev/null 2>&1; then
11290 echo "Your C compiler doesn't support __attribute__((always_inline))."
11291 val="$undef"
11292 else
11293 echo "Your C compiler supports __attribute__((always_inline))."
11294 val="$define"
11295 fi
11296 else
11297 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11298 val="$undef"
11299 fi
11300 ;;
11301 *) val="$d_attribute_always_inline" ;;
11302 esac
11303 set d_attribute_always_inline
11304 eval $setvar
11305 $rm -f attrib*
11306
11307 : Look for GCC-style attribute visibility
11308 case "$d_attribute_visibility" in
11309 '')
11310 echo " "
11311 echo "Checking whether your compiler can handle __attribute__((visibility)) ..." >&4
11312 $cat >attrib.c <<'EOCP'
11313 #include <stdio.h>
11314 __attribute__((visibility("hidden"))) int I_will_be_hidden(void);
11315 EOCP
11316 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11317 if $compiler_warning attrib.out >/dev/null 2>&1; then
11318 echo "Your C compiler doesn't support __attribute__((visibility))."
11319 val="$undef"
11320 else
11321 echo "Your C compiler supports __attribute__((visibility))."
11322 val="$define"
11323 fi
11324 else
11325 echo "Your C compiler doesn't seem to understand __attribute__ at all."
11326 val="$undef"
11327 fi
11328 ;;
11329 *) val="$d_attribute_visibility" ;;
11330 esac
11331 set d_attribute_visibility
11332 eval $setvar
11333 $rm -f attrib*
11334
11335 : see if getpgrp exists
11336 set getpgrp d_getpgrp
11337 eval $inlibc
11338
11339 case "$d_getpgrp" in
11340 "$define")
11341 echo " "
11342 echo "Checking to see which flavor of getpgrp is in use..."
11343 $cat >try.c <<EOP
11344 #include <stdio.h>
11345 #$i_unistd I_UNISTD
11346 #include <sys/types.h>
11347 #ifdef I_UNISTD
11348 # include <unistd.h>
11349 #endif
11350 #$i_stdlib I_STDLIB
11351 #ifdef I_STDLIB
11352 #include <stdlib.h>
11353 #endif
11354 int main()
11355 {
11356 if (getuid() == 0) {
11357 printf("(I see you are running Configure as super-user...)\n");
11358 setuid(1);
11359 }
11360 #ifdef TRY_BSD_PGRP
11361 if (getpgrp(1) == 0)
11362 exit(0);
11363 #else
11364 if (getpgrp() > 0)
11365 exit(0);
11366 #endif
11367 exit(1);
11368 }
11369 EOP
11370 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11371 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11372 val="$define"
11373 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11374 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11375 val="$undef"
11376 else
11377 echo "I can't seem to compile and run the test program."
11378 if ./usg; then
11379 xxx="a USG one, i.e. you use getpgrp()."
11380 else
11381 # SVR4 systems can appear rather BSD-ish.
11382 case "$i_unistd" in
11383 $undef)
11384 xxx="a BSD one, i.e. you use getpgrp(pid)."
11385 val="$define"
11386 ;;
11387 $define)
11388 xxx="probably a USG one, i.e. you use getpgrp()."
11389 val="$undef"
11390 ;;
11391 esac
11392 fi
11393 echo "Assuming your getpgrp is $xxx" >&4
11394 fi
11395 ;;
11396 *) val="$undef";;
11397 esac
11398 set d_bsdgetpgrp
11399 eval $setvar
11400 $rm_try
11401
11402 : see if setpgrp exists
11403 set setpgrp d_setpgrp
11404 eval $inlibc
11405
11406 case "$d_setpgrp" in
11407 "$define")
11408 echo " "
11409 echo "Checking to see which flavor of setpgrp is in use..."
11410 $cat >try.c <<EOP
11411 #include <stdio.h>
11412 #$i_unistd I_UNISTD
11413 #include <sys/types.h>
11414 #ifdef I_UNISTD
11415 # include <unistd.h>
11416 #endif
11417 #$i_stdlib I_STDLIB
11418 #ifdef I_STDLIB
11419 #include <stdlib.h>
11420 #endif
11421 int main()
11422 {
11423 if (getuid() == 0) {
11424 printf("(I see you are running Configure as super-user...)\n");
11425 setuid(1);
11426 }
11427 #ifdef TRY_BSD_PGRP
11428 if (-1 == setpgrp(1, 1))
11429 exit(0);
11430 #else
11431 if (setpgrp() != -1)
11432 exit(0);
11433 #endif
11434 exit(1);
11435 }
11436 EOP
11437 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11438 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11439 val="$define"
11440 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11441 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11442 val="$undef"
11443 else
11444 echo "(I can't seem to compile and run the test program.)"
11445 if ./usg; then
11446 xxx="a USG one, i.e. you use setpgrp()."
11447 else
11448 # SVR4 systems can appear rather BSD-ish.
11449 case "$i_unistd" in
11450 $undef)
11451 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11452 val="$define"
11453 ;;
11454 $define)
11455 xxx="probably a USG one, i.e. you use setpgrp()."
11456 val="$undef"
11457 ;;
11458 esac
11459 fi
11460 echo "Assuming your setpgrp is $xxx" >&4
11461 fi
11462 ;;
11463 *) val="$undef";;
11464 esac
11465 set d_bsdsetpgrp
11466 eval $setvar
11467 $rm_try
11468
11469 : Look for GCC-style __builtin_add_overflow
11470 case "$d_builtin_add_overflow" in
11471 '')
11472 echo " "
11473 echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11474 $cat >try.c <<'EOCP'
11475 int main(void) {
11476 const unsigned int uint_max = ~0u;
11477 int target_int = 0;
11478 if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11479 return 1;
11480 }
11481 if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11482 return 1;
11483 }
11484 if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11485 return 1;
11486 }
11487 return 0;
11488 }
11489 EOCP
11490 set try
11491 if eval $compile && $run ./try; then
11492 echo "Your C compiler supports __builtin_add_overflow."
11493 val="$define"
11494 else
11495 echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11496 val="$undef"
11497 fi
11498 ;;
11499 *) val="$d_builtin_add_overflow" ;;
11500 esac
11501
11502 set d_builtin_add_overflow
11503 eval $setvar
11504 $rm_try
11505
11506 : Look for GCC-style __builtin_sub_overflow
11507 case "$d_builtin_sub_overflow" in
11508 '')
11509 echo " "
11510 echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11511 $cat >try.c <<'EOCP'
11512 int main(void) {
11513 const unsigned int uint_max = ~0u;
11514 int target_int = 0;
11515 if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11516 return 1;
11517 }
11518 if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11519 return 1;
11520 }
11521 if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11522 return 1;
11523 }
11524 return 0;
11525 }
11526 EOCP
11527 set try
11528 if eval $compile && $run ./try; then
11529 echo "Your C compiler supports __builtin_sub_overflow."
11530 val="$define"
11531 else
11532 echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11533 val="$undef"
11534 fi
11535 ;;
11536 *) val="$d_builtin_sub_overflow" ;;
11537 esac
11538
11539 set d_builtin_sub_overflow
11540 eval $setvar
11541 $rm_try
11542
11543 : Look for GCC-style __builtin_mul_overflow
11544 case "$d_builtin_mul_overflow" in
11545 '')
11546 echo " "
11547 echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11548 $cat >try.c <<'EOCP'
11549 int main(void) {
11550 const unsigned int uint_max = ~0u;
11551 int target_int = 0;
11552 if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11553 return 1;
11554 }
11555 if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11556 return 1;
11557 }
11558 if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11559 return 1;
11560 }
11561 return 0;
11562 }
11563 EOCP
11564 set try
11565 if eval $compile && $run ./try; then
11566 echo "Your C compiler supports __builtin_mul_overflow."
11567 val="$define"
11568 else
11569 echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11570 val="$undef"
11571 fi
11572 ;;
11573 *) val="$d_builtin_mul_overflow" ;;
11574 esac
11575
11576 set d_builtin_mul_overflow
11577 eval $setvar
11578 $rm_try
11579
11580 : Look for GCC-style __builtin_choose_expr
11581 case "$d_builtin_choose_expr" in
11582 '')
11583 echo " "
11584 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11585 $cat >try.c <<'EOCP'
11586 #include <assert.h>
11587 #include <stdlib.h>
11588 #include <stdio.h>
11589
11590 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11591
11592 int main(void) {
11593 assert( SYRINX(1) == 2112 );
11594 assert( SYRINX(1) != 5150 );
11595 assert( SYRINX(0) == 5150 );
11596 assert( SYRINX(0) != 2112 );
11597 puts( "All good!" );
11598 exit(0);
11599 }
11600
11601 EOCP
11602 set try
11603 if eval $compile && $run ./try; then
11604 echo "Your C compiler supports __builtin_choose_expr."
11605 val="$define"
11606 else
11607 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11608 val="$undef"
11609 fi
11610 ;;
11611 *) val="$d_builtin_choose_expr" ;;
11612 esac
11613
11614 set d_builtin_choose_expr
11615 eval $setvar
11616 $rm_try
11617
11618 : Look for GCC-style __builtin_expect
11619 case "$d_builtin_expect" in
11620 '')
11621 echo " "
11622 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11623 $cat >try.c <<'EOCP'
11624 int main(void) {
11625 int n = 50;
11626 if ( __builtin_expect(n, 0) ) n = 1;
11627 /* Remember shell exit code truth is 0, C truth is non-zero */
11628 return !(n == 1);
11629 }
11630 EOCP
11631 set try
11632 if eval $compile && $run ./try; then
11633 echo "Your C compiler supports __builtin_expect."
11634 val="$define"
11635 else
11636 echo "Your C compiler doesn't seem to understand __builtin_expect."
11637 val="$undef"
11638 fi
11639 ;;
11640 *) val="$d_builtin_expect" ;;
11641 esac
11642
11643 set d_builtin_expect
11644 eval $setvar
11645 $rm_try
11646
11647 : see if the Compiler supports C99 variadic macros
11648 echo "Checking for C99 variadic macros." >&4
11649 $cat >try.c <<EOCP
11650 #include <stdio.h>
11651 #include <stdarg.h>
11652
11653 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11654
11655 int main() {
11656 char buf[20];
11657 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11658 puts(buf);
11659 return 0;
11660 }
11661 EOCP
11662 set try
11663 if eval $compile && $run ./try 2>&1 >/dev/null; then
11664 case "`$run ./try`" in
11665 "123 456 789")
11666 echo "You have C99 variadic macros." >&4
11667 d_c99_variadic_macros="$define"
11668 ;;
11669 *)
11670 echo "You don't have functional C99 variadic macros." >&4
11671 d_c99_variadic_macros="$undef"
11672 ;;
11673 esac
11674 else
11675 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11676 d_c99_variadic_macros="$undef"
11677 fi
11678 $rm_try
11679
11680 : see if signal is declared as pointer to function returning int or void
11681 echo " "
11682 xxx=`./findhdr signal.h`
11683 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11684 if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
11685 echo "You have int (*signal())() instead of void." >&4
11686 val="$undef"
11687 elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
11688 echo "You have void (*signal())()." >&4
11689 val="$define"
11690 elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11691 echo "You have int (*signal())() instead of void." >&4
11692 val="$undef"
11693 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11694 echo "You have void (*signal())()." >&4
11695 val="$define"
11696 else
11697 case "$d_voidsig" in
11698 '')
11699 echo "I can't determine whether signal handler returns void or int..." >&4
11700 dflt=void
11701 rp="What type does your signal handler return?"
11702 . ./myread
11703 case "$ans" in
11704 v*) val="$define";;
11705 *) val="$undef";;
11706 esac;;
11707 "$define")
11708 echo "As you already told me, signal handler returns void." >&4
11709 val="$define"
11710 ;;
11711 *) echo "As you already told me, signal handler returns int." >&4
11712 val="$undef"
11713 ;;
11714 esac
11715 fi
11716 set d_voidsig
11717 eval $setvar
11718 case "$d_voidsig" in
11719 "$define") signal_t="void";;
11720 *) signal_t="int";;
11721 esac
11722 $rm -f $$.tmp
11723
11724 : check for ability to cast large floats to 32-bit ints.
11725 echo " "
11726 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11727 if $test "$intsize" -ge 4; then
11728 xxx=int
11729 else
11730 xxx=long
11731 fi
11732 $cat >try.c <<EOCP
11733 #include <stdio.h>
11734 #$i_stdlib I_STDLIB
11735 #ifdef I_STDLIB
11736 #include <stdlib.h>
11737 #endif
11738 #include <sys/types.h>
11739 #include <signal.h>
11740 $signal_t blech(int s) { exit(3); }
11741 int main()
11742 {
11743 $xxx i32;
11744 double f, g;
11745 int result = 0;
11746 char str[16];
11747 signal(SIGFPE, blech);
11748
11749 /* Don't let compiler optimize the test away. Store the number
11750 in a writable string for gcc to pass to sscanf under HP-UX.
11751 */
11752 sprintf(str, "2147483647");
11753 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11754 g = 10 * f;
11755 i32 = ($xxx) g;
11756
11757 /* x86 processors will probably give 0x8000 0000, which is a
11758 sign change. We don't want that. We want to mimic SPARC
11759 behavior here, which is to preserve the sign and give
11760 back 0x7fff ffff.
11761 */
11762 if (i32 != ($xxx) f)
11763 result |= 1;
11764 exit(result);
11765 }
11766 EOCP
11767 set try
11768 if eval $compile_ok; then
11769 $run ./try 2>/dev/null
11770 yyy=$?
11771 else
11772 echo "(I can't seem to compile the test program--assuming it can't)"
11773 yyy=1
11774 fi
11775 case "$yyy" in
11776 0) val="$define"
11777 echo "Yup, it can."
11778 ;;
11779 *) val="$undef"
11780 echo "Nope, it can't."
11781 ;;
11782 esac
11783 set d_casti32
11784 eval $setvar
11785 $rm_try
11786
11787 : check for ability to cast negative floats to unsigned
11788 echo " "
11789 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11790 $cat >try.c <<EOCP
11791 #include <stdio.h>
11792 #$i_stdlib I_STDLIB
11793 #ifdef I_STDLIB
11794 #include <stdlib.h>
11795 #endif
11796 #include <sys/types.h>
11797 #include <signal.h>
11798 $signal_t blech(int s) { exit(7); }
11799 $signal_t blech_in_list(int s) { exit(4); }
11800 unsigned long dummy_long(unsigned long p) { return p; }
11801 unsigned int dummy_int(unsigned int p) { return p; }
11802 unsigned short dummy_short(unsigned short p) { return p; }
11803 int main()
11804 {
11805 double f;
11806 unsigned long along;
11807 unsigned int aint;
11808 unsigned short ashort;
11809 int result = 0;
11810 char str[16];
11811
11812 /* Frustrate gcc-2.7.2's optimizer which failed this test with
11813 a direct f = -123. assignment. gcc-2.8.0 reportedly
11814 optimized the whole file away
11815 */
11816 /* Store the number in a writable string for gcc to pass to
11817 sscanf under HP-UX.
11818 */
11819 sprintf(str, "-123");
11820 sscanf(str, "%lf", &f); /* f = -123.; */
11821
11822 signal(SIGFPE, blech);
11823 along = (unsigned long)f;
11824 aint = (unsigned int)f;
11825 ashort = (unsigned short)f;
11826 if (along != (unsigned long)-123)
11827 result |= 1;
11828 if (aint != (unsigned int)-123)
11829 result |= 1;
11830 if (ashort != (unsigned short)-123)
11831 result |= 1;
11832 sprintf(str, "1073741824.");
11833 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11834 f = f + f;
11835 along = 0;
11836 along = (unsigned long)f;
11837 if (along != 0x80000000)
11838 result |= 2;
11839 f -= 1.;
11840 along = 0;
11841 along = (unsigned long)f;
11842 if (along != 0x7fffffff)
11843 result |= 1;
11844 f += 2.;
11845 along = 0;
11846 along = (unsigned long)f;
11847 if (along != 0x80000001)
11848 result |= 2;
11849 if (result)
11850 exit(result);
11851 signal(SIGFPE, blech_in_list);
11852 sprintf(str, "123.");
11853 sscanf(str, "%lf", &f); /* f = 123.; */
11854 along = dummy_long((unsigned long)f);
11855 aint = dummy_int((unsigned int)f);
11856 ashort = dummy_short((unsigned short)f);
11857 if (along != (unsigned long)123)
11858 result |= 4;
11859 if (aint != (unsigned int)123)
11860 result |= 4;
11861 if (ashort != (unsigned short)123)
11862 result |= 4;
11863 exit(result);
11864
11865 }
11866 EOCP
11867 set try
11868 if eval $compile_ok; then
11869 $run ./try 2>/dev/null
11870 castflags=$?
11871 else
11872 echo "(I can't seem to compile the test program--assuming it can't)"
11873 castflags=7
11874 fi
11875 case "$castflags" in
11876 0) val="$define"
11877 echo "Yup, it can."
11878 ;;
11879 *) val="$undef"
11880 echo "Nope, it can't."
11881 ;;
11882 esac
11883 set d_castneg
11884 eval $setvar
11885 $rm_try
11886
11887 : see if cbrt exists
11888 set cbrt d_cbrt
11889 eval $inlibc
11890
11891 : see if chown exists
11892 set chown d_chown
11893 eval $inlibc
11894
11895 : see if chroot exists
11896 set chroot d_chroot
11897 eval $inlibc
11898
11899 : see if chsize exists
11900 set chsize d_chsize
11901 eval $inlibc
11902
11903 : see if class exists
11904 set class d_class
11905 eval $inlibc
11906
11907 : see if clearenv exists
11908 set clearenv d_clearenv
11909 eval $inlibc
11910
11911 : Define hasstruct macro for Configure internal use
11912 hasstruct='varname=$1; struct=$2; shift; shift;
11913 while $test $# -ge 2; do
11914 case "$1" in
11915 $define) echo "#include <$2>";;
11916 esac ;
11917 shift 2;
11918 done > try.c;
11919 echo "int main () { struct $struct foo; }" >> try.c;
11920 set try;
11921 if eval $compile; then
11922 val="$define";
11923 else
11924 val="$undef";
11925 fi;
11926 set $varname;
11927 eval $setvar;
11928 $rm_try'
11929
11930 : see whether socket exists
11931 socketlib=''
11932 sockethdr=''
11933 echo " "
11934 $echo $n "Hmm... $c" >&4
11935 if set socket val -f d_socket; eval $csym; $val; then
11936 echo "Looks like you have Berkeley networking support." >&4
11937 d_socket="$define"
11938 if set setsockopt val -f; eval $csym; $val; then
11939 d_oldsock="$undef"
11940 else
11941 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11942 d_oldsock="$define"
11943 fi
11944 else
11945 if $contains socklib libc.list >/dev/null 2>&1; then
11946 echo "Looks like you have Berkeley networking support." >&4
11947 d_socket="$define"
11948 : we will have to assume that it supports the 4.2 BSD interface
11949 d_oldsock="$undef"
11950 else
11951 echo "You don't have Berkeley networking in libc$_a..." >&4
11952 if test "X$d_socket" = "X$define"; then
11953 echo "...but you seem to believe that you have sockets." >&4
11954 else
11955 for net in net socket
11956 do
11957 if test -f $sysroot/usr/lib/lib$net$_a; then
11958 ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) || \
11959 $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11960 if $contains socket libc.list >/dev/null 2>&1; then
11961 d_socket="$define"
11962 socketlib="-l$net"
11963 case "$net" in
11964 net)
11965 echo "...but the Wollongong group seems to have hacked it in." >&4
11966 sockethdr="-I$sysroot/usr/netinclude"
11967 ;;
11968 esac
11969 echo "Found Berkeley sockets interface in lib$net." >&4
11970 if $contains setsockopt libc.list >/dev/null 2>&1; then
11971 d_oldsock="$undef"
11972 else
11973 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11974 d_oldsock="$define"
11975 fi
11976 break
11977 fi
11978 fi
11979 done
11980 if test "X$d_socket" != "X$define"; then
11981 echo "or anywhere else I see." >&4
11982 d_socket="$undef"
11983 d_oldsock="$undef"
11984 fi
11985 fi
11986 fi
11987 fi
11988
11989 : see if socketpair exists
11990 set socketpair d_sockpair
11991 eval $inlibc
11992
11993
11994 echo "Checking the availability sa_len in the sock struct ..." >&4
11995 $cat >try.c <<EOF
11996 #include <sys/types.h>
11997 #include <sys/socket.h>
11998 int main() {
11999 struct sockaddr sa;
12000 return (sa.sa_len);
12001 }
12002 EOF
12003 val="$undef"
12004 set try; if eval $compile; then
12005 val="$define"
12006 fi
12007 set d_sockaddr_sa_len; eval $setvar
12008 $rm_try
12009
12010 echo "Checking the availability struct sockaddr_in6 ..." >&4
12011 $cat >try.c <<EOF
12012 #include <sys/types.h>
12013 #include <sys/socket.h>
12014 #include <netinet/in.h>
12015 int main() {
12016 struct sockaddr_in6 sin6;
12017 return (sin6.sin6_family);
12018 }
12019 EOF
12020 val="$undef"
12021 set try; if eval $compile; then
12022 val="$define"
12023 fi
12024 set d_sockaddr_in6; eval $setvar
12025 $rm_try
12026
12027 echo "Checking the availability struct sockaddr_storage ..." >&4
12028 $cat >try.c <<EOF
12029 #include <sys/types.h>
12030 #include <sys/socket.h>
12031 #include <netinet/in.h>
12032 int main() {
12033 struct sockaddr_storage sastor;
12034 return (sastor.ss_family);
12035 }
12036 EOF
12037 val="$undef"
12038 set try; if eval $compile; then
12039 val="$define"
12040 fi
12041 set d_sockaddr_storage; eval $setvar
12042 $rm_try
12043
12044 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
12045 $cat >try.c <<EOF
12046 #include <sys/types.h>
12047 #include <sys/socket.h>
12048 #include <netinet/in.h>
12049 int main() {
12050 struct sockaddr_in6 sin6;
12051 return (sin6.sin6_scope_id);
12052 }
12053 EOF
12054 val="$undef"
12055 set try; if eval $compile; then
12056 val="$define"
12057 fi
12058 set d_sin6_scope_id; eval $setvar
12059 $rm_try
12060
12061 echo "Checking the availability struct ip_mreq ..." >&4
12062 $cat >try.c <<EOF
12063 #include <sys/types.h>
12064 #include <sys/socket.h>
12065 #include <netinet/in.h>
12066 int main() {
12067 struct ip_mreq mreq;
12068 return (mreq.imr_multiaddr.s_addr);
12069 }
12070 EOF
12071 val="$undef"
12072 set try; if eval $compile; then
12073 val="$define"
12074 fi
12075 set d_ip_mreq; eval $setvar
12076 $rm_try
12077
12078 echo "Checking the availability struct ip_mreq_source ..." >&4
12079 $cat >try.c <<EOF
12080 #include <sys/types.h>
12081 #include <sys/socket.h>
12082 #include <netinet/in.h>
12083 int main() {
12084 struct ip_mreq_source mreq;
12085 return (mreq.imr_multiaddr.s_addr);
12086 }
12087 EOF
12088 val="$undef"
12089 set try; if eval $compile; then
12090 val="$define"
12091 fi
12092 set d_ip_mreq_source; eval $setvar
12093 $rm_try
12094
12095 echo "Checking the availability struct ipv6_mreq ..." >&4
12096 $cat >try.c <<EOF
12097 #include <sys/types.h>
12098 #include <sys/socket.h>
12099 #include <netinet/in.h>
12100 int main() {
12101 struct ipv6_mreq mreq;
12102 return (mreq.ipv6mr_interface);
12103 }
12104 EOF
12105 val="$undef"
12106 set try; if eval $compile; then
12107 val="$define"
12108 fi
12109 set d_ipv6_mreq; eval $setvar
12110 $rm_try
12111
12112 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12113 $cat >try.c <<EOF
12114 #include <sys/types.h>
12115 #include <sys/socket.h>
12116 #include <netinet/in.h>
12117 int main() {
12118 struct ipv6_mreq_source mreq;
12119 return (mreq.imr_multiaddr.s_addr);
12120 }
12121 EOF
12122 val="$undef"
12123 set try; if eval $compile; then
12124 val="$define"
12125 fi
12126 set d_ipv6_mreq_source; eval $setvar
12127 $rm_try
12128
12129 echo "Checking the availability of certain socket constants..." >&4
12130 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12131 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12132 $cat >try.c <<EOF
12133 #include <sys/types.h>
12134 #include <sys/socket.h>
12135 int main() {
12136 int i = $ENUM;
12137 }
12138 EOF
12139 val="$undef"
12140 set try; if eval $compile; then
12141 val="$define"
12142 fi
12143 set d_${enum}; eval $setvar
12144 $rm_try
12145 done
12146
12147 : see if this is a sys/uio.h system
12148 set sys/uio.h i_sysuio
12149 eval $inhdr
12150
12151 : Check for cmsghdr support
12152 echo " "
12153 echo "Checking to see if your system supports struct cmsghdr..." >&4
12154 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12155 eval $hasstruct
12156 case "$d_cmsghdr_s" in
12157 "$define") echo "Yes, it does." ;;
12158 *) echo "No, it doesn't." ;;
12159 esac
12160
12161 : see if copysign exists
12162 set copysign d_copysign
12163 eval $inlibc
12164
12165 : see if copysignl exists
12166 set copysignl d_copysignl
12167 eval $inlibc
12168
12169 : see if crypt exists
12170 echo " "
12171 set crypt d_crypt
12172 eval $inlibc
12173 case "$d_crypt" in
12174 $define) cryptlib='' ;;
12175 *) if set crypt val -f d_crypt; eval $csym; $val; then
12176 echo 'crypt() found.' >&4
12177 val="$define"
12178 cryptlib=''
12179 else
12180 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12181 if $test -z "$cryptlib"; then
12182 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12183 else
12184 cryptlib=-lcrypt
12185 fi
12186 if $test -z "$cryptlib"; then
12187 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12188 else
12189 cryptlib=-lcrypt
12190 fi
12191 if $test -z "$cryptlib"; then
12192 cryptlib=`./loc libcrypt$_a "" $libpth`
12193 else
12194 cryptlib=-lcrypt
12195 fi
12196 if $test -z "$cryptlib"; then
12197 echo 'crypt() NOT found.' >&4
12198 val="$undef"
12199 else
12200 val="$define"
12201 fi
12202 fi
12203 set d_crypt
12204 eval $setvar
12205 ;;
12206 esac
12207
12208 : see if this is a crypt.h system
12209 set crypt.h i_crypt
12210 eval $inhdr
12211
12212 : see if crypt_r exists
12213 set crypt_r d_crypt_r
12214 eval $inlibc
12215 case "$d_crypt_r" in
12216 "$define")
12217 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12218 case "$d_crypt_r_proto:$usethreads" in
12219 ":define") d_crypt_r_proto=define
12220 set d_crypt_r_proto crypt_r $hdrs
12221 eval $hasproto ;;
12222 *) ;;
12223 esac
12224 case "$d_crypt_r_proto" in
12225 define)
12226 case "$crypt_r_proto" in
12227 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12228 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12229 esac
12230 case "$crypt_r_proto" in
12231 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12232 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12233 esac
12234 case "$crypt_r_proto" in
12235 ''|0) d_crypt_r=undef
12236 crypt_r_proto=0
12237 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12238 * ) case "$crypt_r_proto" in
12239 REENTRANT_PROTO*) ;;
12240 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12241 esac
12242 echo "Prototype: $try" ;;
12243 esac
12244 ;;
12245 *) case "$usethreads" in
12246 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12247 esac
12248 d_crypt_r=undef
12249 crypt_r_proto=0
12250 ;;
12251 esac
12252 ;;
12253 *) crypt_r_proto=0
12254 ;;
12255 esac
12256
12257 : get csh whereabouts
12258 case "$csh" in
12259 'csh') val="$undef" ;;
12260 *) val="$define" ;;
12261 esac
12262 set d_csh
12263 eval $setvar
12264 : Respect a hint or command line value for full_csh.
12265 case "$full_csh" in
12266 '') full_csh=$csh ;;
12267 esac
12268
12269 : see if ctermid exists
12270 set ctermid d_ctermid
12271 eval $inlibc
12272
12273 : see if ctermid_r exists
12274 set ctermid_r d_ctermid_r
12275 eval $inlibc
12276 case "$d_ctermid_r" in
12277 "$define")
12278 hdrs="$i_systypes sys/types.h define stdio.h "
12279 case "$d_ctermid_r_proto:$usethreads" in
12280 ":define") d_ctermid_r_proto=define
12281 set d_ctermid_r_proto ctermid_r $hdrs
12282 eval $hasproto ;;
12283 *) ;;
12284 esac
12285 case "$d_ctermid_r_proto" in
12286 define)
12287 case "$ctermid_r_proto" in
12288 ''|0) try='char* ctermid_r(char*);'
12289 ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12290 esac
12291 case "$ctermid_r_proto" in
12292 ''|0) d_ctermid_r=undef
12293 ctermid_r_proto=0
12294 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12295 * ) case "$ctermid_r_proto" in
12296 REENTRANT_PROTO*) ;;
12297 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12298 esac
12299 echo "Prototype: $try" ;;
12300 esac
12301 ;;
12302 *) case "$usethreads" in
12303 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12304 esac
12305 d_ctermid_r=undef
12306 ctermid_r_proto=0
12307 ;;
12308 esac
12309 ;;
12310 *) ctermid_r_proto=0
12311 ;;
12312 esac
12313
12314 : see if ctime_r exists
12315 set ctime_r d_ctime_r
12316 eval $inlibc
12317 case "$d_ctime_r" in
12318 "$define")
12319 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12320 case "$d_ctime_r_proto:$usethreads" in
12321 ":define") d_ctime_r_proto=define
12322 set d_ctime_r_proto ctime_r $hdrs
12323 eval $hasproto ;;
12324 *) ;;
12325 esac
12326 case "$d_ctime_r_proto" in
12327 define)
12328 case "$ctime_r_proto" in
12329 ''|0) try='char* ctime_r(const time_t*, char*);'
12330 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12331 esac
12332 case "$ctime_r_proto" in
12333 ''|0) try='char* ctime_r(const time_t*, char*, int);'
12334 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12335 esac
12336 case "$ctime_r_proto" in
12337 ''|0) try='int ctime_r(const time_t*, char*);'
12338 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12339 esac
12340 case "$ctime_r_proto" in
12341 ''|0) try='int ctime_r(const time_t*, char*, int);'
12342 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12343 esac
12344 case "$ctime_r_proto" in
12345 ''|0) d_ctime_r=undef
12346 ctime_r_proto=0
12347 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12348 * ) case "$ctime_r_proto" in
12349 REENTRANT_PROTO*) ;;
12350 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12351 esac
12352 echo "Prototype: $try" ;;
12353 esac
12354 ;;
12355 *) case "$usethreads" in
12356 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12357 esac
12358 d_ctime_r=undef
12359 ctime_r_proto=0
12360 ;;
12361 esac
12362 ;;
12363 *) ctime_r_proto=0
12364 ;;
12365 esac
12366
12367 : see if cuserid exists
12368 set cuserid d_cuserid
12369 eval $inlibc
12370
12371 : see if dbm.h is available
12372 : see if dbmclose exists
12373 set dbmclose d_dbmclose
12374 eval $inlibc
12375
12376 case "$d_dbmclose" in
12377 $define)
12378 set dbm.h i_dbm
12379 eval $inhdr
12380 case "$i_dbm" in
12381 $define)
12382 val="$undef"
12383 set i_rpcsvcdbm
12384 eval $setvar
12385 ;;
12386 *) set rpcsvc/dbm.h i_rpcsvcdbm
12387 eval $inhdr
12388 ;;
12389 esac
12390 ;;
12391 *) echo "We won't be including <dbm.h>"
12392 val="$undef"
12393 set i_dbm
12394 eval $setvar
12395 val="$undef"
12396 set i_rpcsvcdbm
12397 eval $setvar
12398 ;;
12399 esac
12400
12401 : see if prototype for dbminit is available
12402 echo " "
12403 set d_dbminitproto dbminit $i_dbm dbm.h
12404 eval $hasproto
12405
12406 : see if difftime exists
12407 set difftime d_difftime
12408 eval $inlibc
12409
12410 : see if this is a dirent system
12411 echo " "
12412 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12413 val="$define"
12414 echo "<dirent.h> found." >&4
12415 else
12416 val="$undef"
12417 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12418 echo "<sys/dir.h> found." >&4
12419 echo " "
12420 else
12421 xinc=`./findhdr sys/ndir.h`
12422 fi
12423 echo "<dirent.h> NOT found." >&4
12424 fi
12425 set i_dirent
12426 eval $setvar
12427
12428 : Look for type of directory structure.
12429 echo " "
12430 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12431
12432 case "$direntrytype" in
12433 ''|' ')
12434 case "$i_dirent" in
12435 $define) guess1='struct dirent' ;;
12436 *) guess1='struct direct' ;;
12437 esac
12438 ;;
12439 *) guess1="$direntrytype"
12440 ;;
12441 esac
12442
12443 case "$guess1" in
12444 'struct dirent') guess2='struct direct' ;;
12445 *) guess2='struct dirent' ;;
12446 esac
12447
12448 if $contains "$guess1" try.c >/dev/null 2>&1; then
12449 direntrytype="$guess1"
12450 echo "Your directory entries are $direntrytype." >&4
12451 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12452 direntrytype="$guess2"
12453 echo "Your directory entries seem to be $direntrytype." >&4
12454 else
12455 echo "I don't recognize your system's directory entries." >&4
12456 rp="What type is used for directory entries on this system?"
12457 dflt="$guess1"
12458 . ./myread
12459 direntrytype="$ans"
12460 fi
12461 $rm_try
12462
12463 : see if the directory entry stores field length
12464 echo " "
12465 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12466 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12467 echo "Good, your directory entry keeps length information in d_namlen." >&4
12468 val="$define"
12469 else
12470 echo "Your directory entry does not know about the d_namlen field." >&4
12471 val="$undef"
12472 fi
12473 set d_dirnamlen
12474 eval $setvar
12475 $rm_try
12476
12477 : Look for DIR.dd_fd
12478 case "$i_dirent" in
12479 "$define")
12480 echo "Checking to see if DIR has a dd_fd member variable" >&4
12481 $cat >try.c <<EOCP
12482 #$i_stdlib I_STDLIB
12483 #ifdef I_STDLIB
12484 #include <stdlib.h>
12485 #endif
12486 #include <dirent.h>
12487
12488 int main() {
12489 DIR dir;
12490 dir.dd_fd = 1;
12491 return 0;
12492 }
12493 EOCP
12494 val=$undef
12495 set try
12496 if eval $compile; then
12497 echo "Yes, it does."
12498 val="$define"
12499 else
12500 echo "No, it does not."
12501 val="$undef"
12502 fi
12503 ;;
12504 *)
12505 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12506 val="$undef"
12507 ;;
12508 esac
12509 set d_dir_dd_fd
12510 eval $setvar
12511 $rm_try
12512
12513 : see if this is an sysdir system
12514 set sys/dir.h i_sysdir
12515 eval $inhdr
12516
12517 : see if this is an sysndir system
12518 set sys/ndir.h i_sysndir
12519 eval $inhdr
12520
12521 : Look for dirfd
12522 echo " "
12523 $cat >dirfd.c <<EOM
12524 #include <stdio.h>
12525 #$i_stdlib I_STDLIB
12526 #ifdef I_STDLIB
12527 #include <stdlib.h>
12528 #endif
12529 #$i_dirent I_DIRENT /**/
12530 #$i_sysdir I_SYS_DIR /**/
12531 #$i_sysndir I_SYS_NDIR /**/
12532 #$i_systypes I_SYS_TYPES /**/
12533 #if defined(I_SYS_TYPES)
12534 #include <sys/types.h>
12535 #endif
12536 #if defined(I_DIRENT)
12537 #include <dirent.h>
12538 #else
12539 #ifdef I_SYS_NDIR
12540 #include <sys/ndir.h>
12541 #else
12542 #ifdef I_SYS_DIR
12543 #include <sys/dir.h>
12544 #endif
12545 #endif
12546 #endif
12547 int main() {
12548 DIR *dirp = opendir(".");
12549 if (dirfd(dirp) >= 0)
12550 exit(0);
12551 else
12552 exit(1);
12553 }
12554 EOM
12555 val=$undef
12556 set dirfd
12557 if eval $compile; then
12558 val="$define"
12559 fi
12560 case "$val" in
12561 $define) echo "dirfd() found." >&4 ;;
12562 *) echo "dirfd() NOT found." >&4 ;;
12563 esac
12564 set d_dirfd
12565 eval $setvar
12566 $rm -f dirfd*
12567
12568 : see if dladdr exists
12569 set dladdr d_dladdr
12570 eval $inlibc
12571
12572 : see if dlerror exists
12573 xxx_runnm="$runnm"
12574 runnm=false
12575 set dlerror d_dlerror
12576 eval $inlibc
12577 runnm="$xxx_runnm"
12578
12579 : see if dlfcn is available
12580 set dlfcn.h i_dlfcn
12581 eval $inhdr
12582
12583 : Check what extension to use for shared libs
12584 case "$usedl" in
12585 $define|y|true)
12586 $cat << EOM
12587
12588 On a few systems, the dynamically loaded modules that perl generates and uses
12589 will need a different extension than shared libs. The default will probably
12590 be appropriate.
12591
12592 EOM
12593 case "$dlext" in
12594 '') dflt="$so" ;;
12595 *) dflt="$dlext" ;;
12596 esac
12597 rp='What is the extension of dynamically loaded modules'
12598 . ./myread
12599 dlext="$ans"
12600 ;;
12601 *)
12602 dlext="none"
12603 ;;
12604 esac
12605
12606 : Check if dlsym need a leading underscore
12607 echo " "
12608 val="$undef"
12609
12610 case "$dlsrc" in
12611 dl_dlopen.xs)
12612 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12613 $cat >dyna.c <<'EOM'
12614 void fred (void) { }
12615 EOM
12616
12617 $cat >fred.c<<EOM
12618
12619 #include <stdio.h>
12620 #$i_stdlib I_STDLIB
12621 #ifdef I_STDLIB
12622 #include <stdlib.h>
12623 #endif
12624 #$i_dlfcn I_DLFCN
12625 #ifdef I_DLFCN
12626 #include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
12627 #else
12628 #include <sys/types.h>
12629 #include <nlist.h>
12630 #include <link.h>
12631 #endif
12632
12633 extern void fred(void) ;
12634
12635 int main()
12636 {
12637 void * handle ;
12638 void * symbol ;
12639 #ifndef RTLD_LAZY
12640 int mode = 1 ;
12641 #else
12642 int mode = RTLD_LAZY ;
12643 #endif
12644 handle = dlopen("./dyna.$dlext", mode) ;
12645 if (handle == NULL) {
12646 printf ("1\n") ;
12647 fflush (stdout) ;
12648 exit(0);
12649 }
12650 symbol = dlsym(handle, "fred") ;
12651 if (symbol == NULL) {
12652 /* try putting a leading underscore */
12653 symbol = dlsym(handle, "_fred") ;
12654 if (symbol == NULL) {
12655 printf ("2\n") ;
12656 fflush (stdout) ;
12657 exit(0);
12658 }
12659 printf ("3\n") ;
12660 }
12661 else
12662 printf ("4\n") ;
12663 fflush (stdout) ;
12664 exit(0);
12665 }
12666 EOM
12667 : Call the object file tmp-dyna.o in case dlext=o.
12668 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12669 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12670 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12671 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12672 xxx=`$run ./fred`
12673 case $xxx in
12674 1) echo "Test program failed using dlopen." >&4
12675 echo "Perhaps you should not use dynamic loading." >&4;;
12676 2) echo "Test program failed using dlsym." >&4
12677 echo "Perhaps you should not use dynamic loading." >&4;;
12678 3) echo "dlsym needs a leading underscore" >&4
12679 val="$define" ;;
12680 4) echo "dlsym doesn't need a leading underscore." >&4;;
12681 esac
12682 else
12683 echo "I can't compile and run the test program." >&4
12684 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12685 fi
12686 ;;
12687 esac
12688
12689 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12690
12691 set d_dlsymun
12692 eval $setvar
12693
12694 : see if drand48_r exists
12695 set drand48_r d_drand48_r
12696 eval $inlibc
12697 case "$d_drand48_r" in
12698 "$define")
12699 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12700 case "$d_drand48_r_proto:$usethreads" in
12701 ":define") d_drand48_r_proto=define
12702 set d_drand48_r_proto drand48_r $hdrs
12703 eval $hasproto ;;
12704 *) ;;
12705 esac
12706 case "$d_drand48_r_proto" in
12707 define)
12708 case "$drand48_r_proto" in
12709 ''|0) try='int drand48_r(struct drand48_data*, double*);'
12710 ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12711 esac
12712 case "$drand48_r_proto" in
12713 ''|0) d_drand48_r=undef
12714 drand48_r_proto=0
12715 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12716 * ) case "$drand48_r_proto" in
12717 REENTRANT_PROTO*) ;;
12718 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12719 esac
12720 echo "Prototype: $try" ;;
12721 esac
12722 ;;
12723 *) case "$usethreads" in
12724 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12725 esac
12726 d_drand48_r=undef
12727 drand48_r_proto=0
12728 ;;
12729 esac
12730 ;;
12731 *) drand48_r_proto=0
12732 ;;
12733 esac
12734
12735 : see if prototype for drand48 is available
12736 echo " "
12737 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12738 eval $hasproto
12739
12740 : see if dup2 exists
12741 set dup2 d_dup2
12742 eval $inlibc
12743
12744 : see if dup3 exists
12745 set dup3 d_dup3
12746 eval $inlibc
12747
12748 : see if localeconv_l exists
12749 set localeconv_l d_localeconv_l
12750 eval $inlibc
12751
12752 : see if this is an xlocale.h system
12753 set xlocale.h i_xlocale
12754 eval $inhdr
12755
12756 : see if newlocale exists
12757 set newlocale d_newlocale
12758 eval $inlibc
12759
12760 : see if freelocale exists
12761 set freelocale d_freelocale
12762 eval $inlibc
12763
12764 : see if uselocale exists
12765 set uselocale d_uselocale
12766 eval $inlibc
12767
12768 : see if duplocale exists
12769 set duplocale d_duplocale
12770 eval $inlibc
12771
12772 : see if querylocale exists
12773 set querylocale d_querylocale
12774 eval $inlibc
12775
12776 : if we have xlocale.h, check whether it is needed
12777 case "$i_xlocale$d_newlocale$xlocale_needed" in
12778 "$define$define")
12779 echo "Checking if xlocale.h is needed..." >&4
12780 $cat >try.c <<EOF
12781 #include <locale.h>
12782 #include <stdio.h>
12783 #ifdef TRY_XLOCALE
12784 #include <xlocale.h>
12785 #endif
12786 #$d_localeconv_l HAVE_LOCALECONV_L
12787
12788 #ifdef HAVE_LOCALECONV_L
12789 struct lconv *(*lcptr)(locale_t) = localeconv_l;
12790 #endif
12791
12792 int main(void) {
12793 locale_t lc = newlocale(LC_ALL_MASK, "C", (locale_t)0);
12794
12795 #ifdef HAVE_LOCALECONV_L
12796 /* FreeBSD hides only localeconv_l() in xlocale.h */
12797 struct lconv *lcbuf = localeconv_l(lc);
12798 printf("decimal: %s\n", lcbuf->decimal_point);
12799 #endif
12800
12801 freelocale(lc);
12802 return 0;
12803 }
12804 EOF
12805 set try
12806 if eval $compile && $run ./try > /dev/null 2>&1 ; then
12807 echo "xlocale.h isn't needed" >&4
12808 xlocale_needed=$undef
12809 else
12810 set try -DTRY_XLOCALE
12811 if eval $compile && $run ./try > /dev/null 2>&1 ; then
12812 xlocale_needed=$define
12813 echo "xlocale.h is needed" >&4
12814 else
12815 echo "I can't build my test either way" >&4
12816 xlocale_needed=$undef
12817 fi
12818 fi
12819 $rm_try
12820 ;;
12821 *) xlocale_needed=$undef ;;
12822 esac
12823
12824 : see if eaccess exists
12825 set eaccess d_eaccess
12826 eval $inlibc
12827
12828 : see if endgrent exists
12829 set endgrent d_endgrent
12830 eval $inlibc
12831
12832 : see if this is an grp system
12833 set grp.h i_grp
12834 eval $inhdr
12835
12836 case "$i_grp" in
12837 $define)
12838 xxx=`./findhdr grp.h`
12839 $cppstdin $cppflags $cppminus < $xxx >$$.h
12840
12841 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12842 val="$define"
12843 else
12844 val="$undef"
12845 fi
12846 set d_grpasswd
12847 eval $setvar
12848
12849 $rm -f $$.h
12850 ;;
12851 *)
12852 val="$undef";
12853 set d_grpasswd; eval $setvar
12854 ;;
12855 esac
12856
12857 : see if endgrent_r exists
12858 set endgrent_r d_endgrent_r
12859 eval $inlibc
12860 case "$d_endgrent_r" in
12861 "$define")
12862 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12863 case "$d_endgrent_r_proto:$usethreads" in
12864 ":define") d_endgrent_r_proto=define
12865 set d_endgrent_r_proto endgrent_r $hdrs
12866 eval $hasproto ;;
12867 *) ;;
12868 esac
12869 case "$d_endgrent_r_proto" in
12870 define)
12871 case "$endgrent_r_proto" in
12872 ''|0) try='int endgrent_r(FILE**);'
12873 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12874 esac
12875 case "$endgrent_r_proto" in
12876 ''|0) try='void endgrent_r(FILE**);'
12877 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12878 esac
12879 case "$endgrent_r_proto" in
12880 ''|0) d_endgrent_r=undef
12881 endgrent_r_proto=0
12882 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12883 * ) case "$endgrent_r_proto" in
12884 REENTRANT_PROTO*) ;;
12885 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12886 esac
12887 echo "Prototype: $try" ;;
12888 esac
12889 ;;
12890 *) case "$usethreads" in
12891 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12892 esac
12893 d_endgrent_r=undef
12894 endgrent_r_proto=0
12895 ;;
12896 esac
12897 ;;
12898 *) endgrent_r_proto=0
12899 ;;
12900 esac
12901
12902 : see if endhostent exists
12903 set endhostent d_endhent
12904 eval $inlibc
12905
12906 : see if this is a netdb.h system
12907 set netdb.h i_netdb
12908 eval $inhdr
12909
12910 : see if endhostent_r exists
12911 set endhostent_r d_endhostent_r
12912 eval $inlibc
12913 case "$d_endhostent_r" in
12914 "$define")
12915 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12916 case "$d_endhostent_r_proto:$usethreads" in
12917 ":define") d_endhostent_r_proto=define
12918 set d_endhostent_r_proto endhostent_r $hdrs
12919 eval $hasproto ;;
12920 *) ;;
12921 esac
12922 case "$d_endhostent_r_proto" in
12923 define)
12924 case "$endhostent_r_proto" in
12925 ''|0) try='int endhostent_r(struct hostent_data*);'
12926 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12927 esac
12928 case "$endhostent_r_proto" in
12929 ''|0) try='void endhostent_r(struct hostent_data*);'
12930 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12931 esac
12932 case "$endhostent_r_proto" in
12933 ''|0) d_endhostent_r=undef
12934 endhostent_r_proto=0
12935 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12936 * ) case "$endhostent_r_proto" in
12937 REENTRANT_PROTO*) ;;
12938 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12939 esac
12940 echo "Prototype: $try" ;;
12941 esac
12942 ;;
12943 *) case "$usethreads" in
12944 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12945 esac
12946 d_endhostent_r=undef
12947 endhostent_r_proto=0
12948 ;;
12949 esac
12950 ;;
12951 *) endhostent_r_proto=0
12952 ;;
12953 esac
12954
12955 : see if endnetent exists
12956 set endnetent d_endnent
12957 eval $inlibc
12958
12959 : see if endnetent_r exists
12960 set endnetent_r d_endnetent_r
12961 eval $inlibc
12962 case "$d_endnetent_r" in
12963 "$define")
12964 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12965 case "$d_endnetent_r_proto:$usethreads" in
12966 ":define") d_endnetent_r_proto=define
12967 set d_endnetent_r_proto endnetent_r $hdrs
12968 eval $hasproto ;;
12969 *) ;;
12970 esac
12971 case "$d_endnetent_r_proto" in
12972 define)
12973 case "$endnetent_r_proto" in
12974 ''|0) try='int endnetent_r(struct netent_data*);'
12975 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12976 esac
12977 case "$endnetent_r_proto" in
12978 ''|0) try='void endnetent_r(struct netent_data*);'
12979 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12980 esac
12981 case "$endnetent_r_proto" in
12982 ''|0) d_endnetent_r=undef
12983 endnetent_r_proto=0
12984 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12985 * ) case "$endnetent_r_proto" in
12986 REENTRANT_PROTO*) ;;
12987 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12988 esac
12989 echo "Prototype: $try" ;;
12990 esac
12991 ;;
12992 *) case "$usethreads" in
12993 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12994 esac
12995 d_endnetent_r=undef
12996 endnetent_r_proto=0
12997 ;;
12998 esac
12999 ;;
13000 *) endnetent_r_proto=0
13001 ;;
13002 esac
13003
13004 : see if endprotoent exists
13005 set endprotoent d_endpent
13006 eval $inlibc
13007
13008 : see if endprotoent_r exists
13009 set endprotoent_r d_endprotoent_r
13010 eval $inlibc
13011 case "$d_endprotoent_r" in
13012 "$define")
13013 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13014 case "$d_endprotoent_r_proto:$usethreads" in
13015 ":define") d_endprotoent_r_proto=define
13016 set d_endprotoent_r_proto endprotoent_r $hdrs
13017 eval $hasproto ;;
13018 *) ;;
13019 esac
13020 case "$d_endprotoent_r_proto" in
13021 define)
13022 case "$endprotoent_r_proto" in
13023 ''|0) try='int endprotoent_r(struct protoent_data*);'
13024 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
13025 esac
13026 case "$endprotoent_r_proto" in
13027 ''|0) try='void endprotoent_r(struct protoent_data*);'
13028 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
13029 esac
13030 case "$endprotoent_r_proto" in
13031 ''|0) d_endprotoent_r=undef
13032 endprotoent_r_proto=0
13033 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
13034 * ) case "$endprotoent_r_proto" in
13035 REENTRANT_PROTO*) ;;
13036 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
13037 esac
13038 echo "Prototype: $try" ;;
13039 esac
13040 ;;
13041 *) case "$usethreads" in
13042 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
13043 esac
13044 d_endprotoent_r=undef
13045 endprotoent_r_proto=0
13046 ;;
13047 esac
13048 ;;
13049 *) endprotoent_r_proto=0
13050 ;;
13051 esac
13052
13053 : see if endpwent exists
13054 set endpwent d_endpwent
13055 eval $inlibc
13056
13057 : see if this is a pwd.h system
13058 set pwd.h i_pwd
13059 eval $inhdr
13060
13061 case "$i_pwd" in
13062 $define)
13063 xxx=`./findhdr pwd.h`
13064 $cppstdin $cppflags $cppminus < $xxx >$$.h
13065
13066 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
13067 val="$define"
13068 else
13069 val="$undef"
13070 fi
13071 set d_pwquota
13072 eval $setvar
13073
13074 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13075 val="$define"
13076 else
13077 val="$undef"
13078 fi
13079 set d_pwage
13080 eval $setvar
13081
13082 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13083 val="$define"
13084 else
13085 val="$undef"
13086 fi
13087 set d_pwchange
13088 eval $setvar
13089
13090 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13091 val="$define"
13092 else
13093 val="$undef"
13094 fi
13095 set d_pwclass
13096 eval $setvar
13097
13098 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13099 val="$define"
13100 else
13101 val="$undef"
13102 fi
13103 set d_pwexpire
13104 eval $setvar
13105
13106 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13107 val="$define"
13108 else
13109 val="$undef"
13110 fi
13111 set d_pwcomment
13112 eval $setvar
13113
13114 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13115 val="$define"
13116 else
13117 val="$undef"
13118 fi
13119 set d_pwgecos
13120 eval $setvar
13121
13122 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13123 val="$define"
13124 else
13125 val="$undef"
13126 fi
13127 set d_pwpasswd
13128 eval $setvar
13129
13130 $rm -f $$.h
13131 ;;
13132 *)
13133 val="$undef";
13134 set d_pwquota; eval $setvar
13135 set d_pwage; eval $setvar
13136 set d_pwchange; eval $setvar
13137 set d_pwclass; eval $setvar
13138 set d_pwexpire; eval $setvar
13139 set d_pwcomment; eval $setvar
13140 set d_pwgecos; eval $setvar
13141 set d_pwpasswd; eval $setvar
13142 ;;
13143 esac
13144
13145 : see if endpwent_r exists
13146 set endpwent_r d_endpwent_r
13147 eval $inlibc
13148 case "$d_endpwent_r" in
13149 "$define")
13150 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13151 case "$d_endpwent_r_proto:$usethreads" in
13152 ":define") d_endpwent_r_proto=define
13153 set d_endpwent_r_proto endpwent_r $hdrs
13154 eval $hasproto ;;
13155 *) ;;
13156 esac
13157 case "$d_endpwent_r_proto" in
13158 define)
13159 case "$endpwent_r_proto" in
13160 ''|0) try='int endpwent_r(FILE**);'
13161 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13162 esac
13163 case "$endpwent_r_proto" in
13164 ''|0) try='void endpwent_r(FILE**);'
13165 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13166 esac
13167 case "$endpwent_r_proto" in
13168 ''|0) d_endpwent_r=undef
13169 endpwent_r_proto=0
13170 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13171 * ) case "$endpwent_r_proto" in
13172 REENTRANT_PROTO*) ;;
13173 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13174 esac
13175 echo "Prototype: $try" ;;
13176 esac
13177 ;;
13178 *) case "$usethreads" in
13179 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13180 esac
13181 d_endpwent_r=undef
13182 endpwent_r_proto=0
13183 ;;
13184 esac
13185 ;;
13186 *) endpwent_r_proto=0
13187 ;;
13188 esac
13189
13190 : see if endservent exists
13191 set endservent d_endsent
13192 eval $inlibc
13193
13194 : see if endservent_r exists
13195 set endservent_r d_endservent_r
13196 eval $inlibc
13197 case "$d_endservent_r" in
13198 "$define")
13199 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13200 case "$d_endservent_r_proto:$usethreads" in
13201 ":define") d_endservent_r_proto=define
13202 set d_endservent_r_proto endservent_r $hdrs
13203 eval $hasproto ;;
13204 *) ;;
13205 esac
13206 case "$d_endservent_r_proto" in
13207 define)
13208 case "$endservent_r_proto" in
13209 ''|0) try='int endservent_r(struct servent_data*);'
13210 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13211 esac
13212 case "$endservent_r_proto" in
13213 ''|0) try='void endservent_r(struct servent_data*);'
13214 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13215 esac
13216 case "$endservent_r_proto" in
13217 ''|0) d_endservent_r=undef
13218 endservent_r_proto=0
13219 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13220 * ) case "$endservent_r_proto" in
13221 REENTRANT_PROTO*) ;;
13222 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13223 esac
13224 echo "Prototype: $try" ;;
13225 esac
13226 ;;
13227 *) case "$usethreads" in
13228 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13229 esac
13230 d_endservent_r=undef
13231 endservent_r_proto=0
13232 ;;
13233 esac
13234 ;;
13235 *) endservent_r_proto=0
13236 ;;
13237 esac
13238
13239 : Locate the flags for 'open()'
13240 echo " "
13241 $cat >try.c <<EOCP
13242 #include <sys/types.h>
13243 #ifdef I_FCNTL
13244 #include <fcntl.h>
13245 #endif
13246 #ifdef I_SYS_FILE
13247 #include <sys/file.h>
13248 #endif
13249 #$i_stdlib I_STDLIB
13250 #ifdef I_STDLIB
13251 #include <stdlib.h>
13252 #endif
13253 int main() {
13254 if(O_RDONLY);
13255 #ifdef O_TRUNC
13256 exit(0);
13257 #else
13258 exit(1);
13259 #endif
13260 }
13261 EOCP
13262 : check sys/file.h first to get FREAD on Sun
13263 if $test `./findhdr sys/file.h` && \
13264 set try -DI_SYS_FILE && eval $compile; then
13265 h_sysfile=true;
13266 echo "<sys/file.h> defines the O_* constants..." >&4
13267 if $run ./try; then
13268 echo "and you have the 3 argument form of open()." >&4
13269 val="$define"
13270 else
13271 echo "but not the 3 argument form of open(). Oh, well." >&4
13272 val="$undef"
13273 fi
13274 elif $test `./findhdr fcntl.h` && \
13275 set try -DI_FCNTL && eval $compile; then
13276 h_fcntl=true;
13277 echo "<fcntl.h> defines the O_* constants..." >&4
13278 if $run ./try; then
13279 echo "and you have the 3 argument form of open()." >&4
13280 val="$define"
13281 else
13282 echo "but not the 3 argument form of open(). Oh, well." >&4
13283 val="$undef"
13284 fi
13285 else
13286 val="$undef"
13287 echo "I can't find the O_* constant definitions! You got problems." >&4
13288 fi
13289 set d_open3
13290 eval $setvar
13291 $rm_try
13292
13293 : see if this is a sys/file.h system
13294 val=''
13295 set sys/file.h val
13296 eval $inhdr
13297
13298 : do we need to include sys/file.h ?
13299 case "$val" in
13300 "$define")
13301 echo " "
13302 if $h_sysfile; then
13303 val="$define"
13304 echo "We'll be including <sys/file.h>." >&4
13305 else
13306 val="$undef"
13307 echo "We won't be including <sys/file.h>." >&4
13308 fi
13309 ;;
13310 *)
13311 h_sysfile=false
13312 ;;
13313 esac
13314 set i_sysfile
13315 eval $setvar
13316
13317 : see if fcntl.h is there
13318 val=''
13319 set fcntl.h val
13320 eval $inhdr
13321
13322 : see if we can include fcntl.h
13323 case "$val" in
13324 "$define")
13325 echo " "
13326 if $h_fcntl; then
13327 val="$define"
13328 echo "We'll be including <fcntl.h>." >&4
13329 else
13330 val="$undef"
13331 if $h_sysfile; then
13332 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13333 else
13334 echo "We won't be including <fcntl.h>." >&4
13335 fi
13336 fi
13337 ;;
13338 *)
13339 h_fcntl=false
13340 val="$undef"
13341 ;;
13342 esac
13343 set i_fcntl
13344 eval $setvar
13345
13346 : see if fdopendir exists
13347 set fdopendir d_fdopendir
13348 eval $inlibc
13349
13350 : see if fork exists
13351 set fork d_fork
13352 eval $inlibc
13353
13354 : see if pipe exists
13355 set pipe d_pipe
13356 eval $inlibc
13357
13358 : check for non-blocking I/O stuff
13359 case "$h_sysfile" in
13360 true) echo "#include <sys/file.h>" > head.c;;
13361 *)
13362 case "$h_fcntl" in
13363 true) echo "#include <fcntl.h>" > head.c;;
13364 *) echo "#include <sys/fcntl.h>" > head.c;;
13365 esac
13366 ;;
13367 esac
13368 echo " "
13369 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13370 case "$o_nonblock" in
13371 '')
13372 $cat head.c > try.c
13373 $cat >>try.c <<EOCP
13374 #include <stdio.h>
13375 #$i_stdlib I_STDLIB
13376 #ifdef I_STDLIB
13377 #include <stdlib.h>
13378 #endif
13379 #$i_fcntl I_FCNTL
13380 #ifdef I_FCNTL
13381 #include <fcntl.h>
13382 #endif
13383 int main() {
13384 #ifdef O_NONBLOCK
13385 printf("O_NONBLOCK\n");
13386 exit(0);
13387 #endif
13388 #ifdef O_NDELAY
13389 printf("O_NDELAY\n");
13390 exit(0);
13391 #endif
13392 #ifdef FNDELAY
13393 printf("FNDELAY\n");
13394 exit(0);
13395 #endif
13396 exit(0);
13397 }
13398 EOCP
13399 set try
13400 if eval $compile_ok; then
13401 o_nonblock=`$run ./try`
13402 case "$o_nonblock" in
13403 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13404 *) echo "Seems like we can use $o_nonblock.";;
13405 esac
13406 else
13407 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13408 fi
13409 ;;
13410 *) echo "Using $hint value $o_nonblock.";;
13411 esac
13412 $rm_try
13413
13414 echo " "
13415 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13416 case "$eagain" in
13417 '')
13418 case "$d_fork:$d_pipe:$d_alarm" in
13419 define:define:define)
13420 $cat head.c > try.c
13421 $cat >>try.c <<EOCP
13422 #include <errno.h>
13423 #include <sys/types.h>
13424 #include <signal.h>
13425 #include <stdio.h>
13426 #$i_stdlib I_STDLIB
13427 #ifdef I_STDLIB
13428 #include <stdlib.h>
13429 #endif
13430 #$i_fcntl I_FCNTL
13431 #ifdef I_FCNTL
13432 #include <fcntl.h>
13433 #endif
13434 #define MY_O_NONBLOCK $o_nonblock
13435 #ifndef errno /* XXX need better Configure test */
13436 extern int errno;
13437 #endif
13438 #$i_unistd I_UNISTD
13439 #ifdef I_UNISTD
13440 #include <unistd.h>
13441 #endif
13442 #include <string.h>
13443 $signal_t blech(int x) { exit(3); }
13444 EOCP
13445 $cat >> try.c <<'EOCP'
13446 int main()
13447 {
13448 int pd[2];
13449 int pu[2];
13450 char buf[1];
13451 char string[100];
13452 int ret;
13453
13454 ret = pipe(pd); /* Down: child -> parent */
13455 if (ret != 0)
13456 exit(3);
13457 ret = pipe(pu); /* Up: parent -> child */
13458 if (ret != 0)
13459 exit(3);
13460 if (0 != fork()) {
13461 close(pd[1]); /* Parent reads from pd[0] */
13462 close(pu[0]); /* Parent writes (blocking) to pu[1] */
13463 #ifdef F_SETFL
13464 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13465 exit(1);
13466 #else
13467 exit(4);
13468 #endif
13469 signal(SIGALRM, blech);
13470 alarm(5);
13471 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
13472 exit(2);
13473 sprintf(string, "%d\n", ret);
13474 ret = write(2, string, strlen(string));
13475 if (ret != strlen(string))
13476 exit(3);
13477 alarm(0);
13478 #ifdef EAGAIN
13479 if (errno == EAGAIN) {
13480 printf("EAGAIN\n");
13481 goto ok;
13482 }
13483 #endif
13484 #ifdef EWOULDBLOCK
13485 if (errno == EWOULDBLOCK)
13486 printf("EWOULDBLOCK\n");
13487 #endif
13488 ok:
13489 ret = write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
13490 if (ret != 1)
13491 exit(3);
13492 sleep(2); /* Give it time to close our pipe */
13493 alarm(5);
13494 ret = read(pd[0], buf, 1); /* Should read EOF */
13495 alarm(0);
13496 sprintf(string, "%d\n", ret);
13497 ret = write(4, string, strlen(string));
13498 if (ret != strlen(string))
13499 exit(3);
13500 exit(0);
13501 }
13502
13503 close(pd[0]); /* We write to pd[1] */
13504 close(pu[1]); /* We read from pu[0] */
13505 ret = read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
13506 if (ret != 1)
13507 exit(3);
13508 close(pd[1]); /* Pipe pd is now fully closed! */
13509 exit(0); /* Bye bye, thank you for playing! */
13510 }
13511 EOCP
13512 set try
13513 if eval $compile_ok; then
13514 echo "$startsh" >mtry
13515 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13516 chmod +x mtry
13517 $run ./mtry >/dev/null 2>&1
13518 case $? in
13519 0) eagain=`$cat try.out`;;
13520 1) echo "Could not perform non-blocking setting!";;
13521 2) echo "I did a successful read() for something that was not there!";;
13522 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13523 4) echo "Could not find F_SETFL!";;
13524 *) echo "Something terribly wrong happened during testing.";;
13525 esac
13526 rd_nodata=`$cat try.ret`
13527 echo "A read() system call with no data present returns $rd_nodata."
13528 case "$rd_nodata" in
13529 0|-1) ;;
13530 *)
13531 echo "(That's peculiar, fixing that to be -1.)"
13532 rd_nodata=-1
13533 ;;
13534 esac
13535 case "$eagain" in
13536 '')
13537 echo "Forcing errno EAGAIN on read() with no data available."
13538 eagain=EAGAIN
13539 ;;
13540 *)
13541 echo "Your read() sets errno to $eagain when no data is available."
13542 ;;
13543 esac
13544 status=`$cat try.err`
13545 case "$status" in
13546 0) echo "And it correctly returns 0 to signal EOF.";;
13547 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13548 *) echo "However, your read() returns '$status' on EOF??";;
13549 esac
13550 val="$define"
13551 if test "$status" = "$rd_nodata"; then
13552 echo "WARNING: you can't distinguish between EOF and no data!"
13553 val="$undef"
13554 fi
13555 else
13556 echo "I can't compile the test program--assuming errno EAGAIN will do."
13557 eagain=EAGAIN
13558 fi
13559 ;;
13560 *) echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13561 eagain=EAGAIN
13562 val="$define"
13563 ;;
13564 esac
13565 set d_eofnblk
13566 eval $setvar
13567 ;;
13568 *)
13569 echo "Using $hint value $eagain."
13570 echo "Your read() returns $rd_nodata when no data is present."
13571 case "$d_eofnblk" in
13572 "$define") echo "And you can see EOF because read() returns 0.";;
13573 "$undef") echo "But you can't see EOF status from read() returned value.";;
13574 *)
13575 echo "(Assuming you can't see EOF status from read anyway.)"
13576 d_eofnblk=$undef
13577 ;;
13578 esac
13579 ;;
13580 esac
13581 $rm_try head.c mtry
13582
13583 : see if erf exists
13584 set erf d_erf
13585 eval $inlibc
13586
13587 : see if erfc exists
13588 set erfc d_erfc
13589 eval $inlibc
13590
13591 : see if exp2 exists
13592 set exp2 d_exp2
13593 eval $inlibc
13594
13595 : see if expm1 exists
13596 set expm1 d_expm1
13597 eval $inlibc
13598
13599 : see if _ptr and _cnt from stdio act std
13600 echo " "
13601
13602 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13603 echo "(Looks like you have stdio.h from BSD.)"
13604 case "$stdio_ptr" in
13605 '') stdio_ptr='((fp)->_p)'
13606 ptr_lval=$define
13607 ;;
13608 *) ptr_lval=$d_stdio_ptr_lval;;
13609 esac
13610 case "$stdio_cnt" in
13611 '') stdio_cnt='((fp)->_r)'
13612 cnt_lval=$define
13613 ;;
13614 *) cnt_lval=$d_stdio_cnt_lval;;
13615 esac
13616 case "$stdio_base" in
13617 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13618 esac
13619 case "$stdio_bufsiz" in
13620 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13621 esac
13622 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13623 echo "(Looks like you have stdio.h from Linux.)"
13624 case "$stdio_ptr" in
13625 '') stdio_ptr='((fp)->_IO_read_ptr)'
13626 ptr_lval=$define
13627 ;;
13628 *) ptr_lval=$d_stdio_ptr_lval;;
13629 esac
13630 case "$stdio_cnt" in
13631 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13632 cnt_lval=$undef
13633 ;;
13634 *) cnt_lval=$d_stdio_cnt_lval;;
13635 esac
13636 case "$stdio_base" in
13637 '') stdio_base='((fp)->_IO_read_base)';;
13638 esac
13639 case "$stdio_bufsiz" in
13640 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13641 esac
13642 else
13643 case "$stdio_ptr" in
13644 '') stdio_ptr='((fp)->_ptr)'
13645 ptr_lval=$define
13646 ;;
13647 *) ptr_lval=$d_stdio_ptr_lval;;
13648 esac
13649 case "$stdio_cnt" in
13650 '') stdio_cnt='((fp)->_cnt)'
13651 cnt_lval=$define
13652 ;;
13653 *) cnt_lval=$d_stdio_cnt_lval;;
13654 esac
13655 case "$stdio_base" in
13656 '') stdio_base='((fp)->_base)';;
13657 esac
13658 case "$stdio_bufsiz" in
13659 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13660 esac
13661 fi
13662
13663 : test whether _ptr and _cnt really work
13664 echo "Checking how std your stdio is..." >&4
13665 $cat >try.c <<EOP
13666 #include <stdio.h>
13667 #$i_stdlib I_STDLIB
13668 #ifdef I_STDLIB
13669 #include <stdlib.h>
13670 #endif
13671 #include <string.h>
13672 #define FILE_ptr(fp) $stdio_ptr
13673 #define FILE_cnt(fp) $stdio_cnt
13674 int main() {
13675 FILE *fp = fopen("try.c", "r");
13676 char c = getc(fp);
13677 if (
13678 18 <= FILE_cnt(fp) &&
13679 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13680 )
13681 exit(0);
13682 exit(1);
13683 }
13684 EOP
13685 val="$undef"
13686 set try
13687 if eval $compile && $to try.c; then
13688 if $run ./try; then
13689 echo "Your stdio acts pretty std."
13690 val="$define"
13691 else
13692 echo "Your stdio isn't very std."
13693 fi
13694 else
13695 echo "Your stdio doesn't appear very std."
13696 fi
13697 $rm_try
13698
13699 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13700 # direct buffer manipulation no longer works. The Configure tests
13701 # should be changed to correctly detect this, but until then,
13702 # the following check should at least let perl compile and run.
13703 # (This quick fix should be updated before 5.8.1.)
13704 # To be defensive, reject all unknown versions, and all versions > 2.2.9.
13705 # A. Dougherty, June 3, 2002.
13706 case "$d_gnulibc" in
13707 $define)
13708 case "$gnulibc_version" in
13709 2.[01]*) ;;
13710 2.2) ;;
13711 2.2.[0-9]) ;;
13712 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13713 val="$undef"
13714 ;;
13715 esac
13716 ;;
13717 esac
13718 set d_stdstdio
13719 eval $setvar
13720
13721 : Can _ptr be used as an lvalue?
13722 case "$d_stdstdio$ptr_lval" in
13723 $define$define) val=$define ;;
13724 *) val=$undef ;;
13725 esac
13726 set d_stdio_ptr_lval
13727 eval $setvar
13728
13729 : Can _cnt be used as an lvalue?
13730 case "$d_stdstdio$cnt_lval" in
13731 $define$define) val=$define ;;
13732 *) val=$undef ;;
13733 esac
13734 set d_stdio_cnt_lval
13735 eval $setvar
13736
13737
13738 : test whether setting _ptr sets _cnt as a side effect
13739 d_stdio_ptr_lval_sets_cnt="$undef"
13740 d_stdio_ptr_lval_nochange_cnt="$undef"
13741 case "$d_stdio_ptr_lval$d_stdstdio" in
13742 $define$define)
13743 echo "Checking to see what happens if we set the stdio ptr..." >&4
13744 $cat >try.c <<EOP
13745 #include <stdio.h>
13746 /* Can we scream? */
13747 /* Eat dust sed :-) */
13748 /* In the buffer space, no one can hear you scream. */
13749 #$i_stdlib I_STDLIB
13750 #ifdef I_STDLIB
13751 #include <stdlib.h>
13752 #endif
13753 #define FILE_ptr(fp) $stdio_ptr
13754 #define FILE_cnt(fp) $stdio_cnt
13755 #include <sys/types.h>
13756 int main() {
13757 FILE *fp = fopen("try.c", "r");
13758 int c;
13759 char *ptr;
13760 size_t cnt;
13761 if (!fp) {
13762 puts("Fail even to read");
13763 exit(1);
13764 }
13765 c = getc(fp); /* Read away the first # */
13766 if (c == EOF) {
13767 puts("Fail even to read");
13768 exit(1);
13769 }
13770 if (!(
13771 18 <= FILE_cnt(fp) &&
13772 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13773 )) {
13774 puts("Fail even to read");
13775 exit (1);
13776 }
13777 ptr = (char*) FILE_ptr(fp);
13778 cnt = (size_t)FILE_cnt(fp);
13779
13780 FILE_ptr(fp) += 42;
13781
13782 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13783 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13784 exit (1);
13785 }
13786 if (FILE_cnt(fp) <= 20) {
13787 printf ("Fail (<20 chars to test)");
13788 exit (1);
13789 }
13790 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13791 puts("Fail compare");
13792 exit (1);
13793 }
13794 if (cnt == FILE_cnt(fp)) {
13795 puts("Pass_unchanged");
13796 exit (0);
13797 }
13798 if (FILE_cnt(fp) == (cnt - 42)) {
13799 puts("Pass_changed");
13800 exit (0);
13801 }
13802 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13803 return 1;
13804
13805 }
13806 EOP
13807 set try
13808 if eval $compile && $to try.c; then
13809 case `$run ./try` in
13810 Pass_changed)
13811 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
13812 d_stdio_ptr_lval_sets_cnt="$define" ;;
13813 Pass_unchanged)
13814 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
13815 d_stdio_ptr_lval_nochange_cnt="$define" ;;
13816 Fail*)
13817 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
13818 *)
13819 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13820 esac
13821 else
13822 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
13823 fi
13824 $rm_try
13825 ;;
13826 esac
13827
13828 : see if _base is also standard
13829 val="$undef"
13830 case "$d_stdstdio" in
13831 $define)
13832 $cat >try.c <<EOP
13833 #include <stdio.h>
13834 #$i_stdlib I_STDLIB
13835 #ifdef I_STDLIB
13836 #include <stdlib.h>
13837 #endif
13838 #define FILE_base(fp) $stdio_base
13839 #define FILE_bufsiz(fp) $stdio_bufsiz
13840 int main() {
13841 FILE *fp = fopen("try.c", "r");
13842 char c = getc(fp);
13843 if (
13844 19 <= FILE_bufsiz(fp) &&
13845 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13846 )
13847 exit(0);
13848 exit(1);
13849 }
13850 EOP
13851 set try
13852 if eval $compile && $to try.c; then
13853 if $run ./try; then
13854 echo "And its _base field acts std."
13855 val="$define"
13856 else
13857 echo "But its _base field isn't std."
13858 fi
13859 else
13860 echo "However, it seems to be lacking the _base field."
13861 fi
13862 $rm_try
13863 ;;
13864 esac
13865 set d_stdiobase
13866 eval $setvar
13867
13868 : see if fast_stdio exists
13869 val="$undef"
13870 case "$d_stdstdio:$d_stdio_ptr_lval" in
13871 "$define:$define")
13872 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13873 *$define*)
13874 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >&4
13875 val="$define"
13876 ;;
13877 esac
13878 ;;
13879 esac
13880 set d_faststdio
13881 eval $setvar
13882
13883 : see if fchdir exists
13884 set fchdir d_fchdir
13885 eval $inlibc
13886
13887 : see if fchmod exists
13888 set fchmod d_fchmod
13889 eval $inlibc
13890
13891 : check for openat, unlinkat, renameat, linkat, fchmodat
13892 set openat d_openat
13893 eval $inlibc
13894
13895 set unlinkat d_unlinkat
13896 eval $inlibc
13897
13898 set renameat d_renameat
13899 eval $inlibc
13900
13901 set linkat d_linkat
13902 eval $inlibc
13903
13904 set fchmodat d_fchmodat
13905 eval $inlibc
13906
13907 : see if fchown exists
13908 set fchown d_fchown
13909 eval $inlibc
13910
13911 : see if this is an fcntl system
13912 set fcntl d_fcntl
13913 eval $inlibc
13914
13915 : See if fcntl-based locking works.
13916 echo " "
13917 $cat >try.c <<EOCP
13918 #$i_stdlib I_STDLIB
13919 #ifdef I_STDLIB
13920 #include <stdlib.h>
13921 #endif
13922 #include <unistd.h>
13923 #include <fcntl.h>
13924 #include <signal.h>
13925 $signal_t blech(int x) { exit(3); }
13926 int main() {
13927 #if defined(F_SETLK) && defined(F_SETLKW)
13928 struct flock flock;
13929 int retval, fd;
13930 fd = open("try.c", O_RDONLY);
13931 flock.l_type = F_RDLCK;
13932 flock.l_whence = SEEK_SET;
13933 flock.l_start = flock.l_len = 0;
13934 signal(SIGALRM, blech);
13935 alarm(10);
13936 retval = fcntl(fd, F_SETLK, &flock);
13937 close(fd);
13938 (retval < 0 ? exit(2) : exit(0));
13939 #else
13940 exit(2);
13941 #endif
13942 }
13943 EOCP
13944 echo "Checking if fcntl-based file locking works... "
13945 case "$d_fcntl" in
13946 "$define")
13947 set try
13948 if eval $compile_ok; then
13949 if $run ./try; then
13950 echo "Yes, it seems to work."
13951 val="$define"
13952 else
13953 echo "Nope, it didn't work."
13954 val="$undef"
13955 case "$?" in
13956 3) $cat >&4 <<EOM
13957 ***
13958 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13959 *** This is (almost) impossible.
13960 *** If your NFS lock daemons are not feeling well, something like
13961 *** this may happen, please investigate. Cannot continue, aborting.
13962 ***
13963 EOM
13964 exit 1
13965 ;;
13966 esac
13967 fi
13968 else
13969 echo "I'm unable to compile the test program, so I'll assume not."
13970 val="$undef"
13971 fi
13972 ;;
13973 *) val="$undef";
13974 echo "Nope, since you don't even have fcntl()."
13975 ;;
13976 esac
13977 set d_fcntl_can_lock
13978 eval $setvar
13979 $rm_try
13980
13981 : check for fd_set items
13982 $cat <<EOM
13983
13984 Checking to see how well your C compiler handles fd_set and friends ...
13985 EOM
13986 $cat >try.c <<EOCP
13987 #$i_stdlib I_STDLIB
13988 #ifdef I_STDLIB
13989 #include <stdlib.h>
13990 #endif
13991 #$i_systime I_SYS_TIME
13992 #$i_sysselct I_SYS_SELECT
13993 #$d_socket HAS_SOCKET
13994 #include <sys/types.h>
13995 #ifdef HAS_SOCKET
13996 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13997 #endif
13998 #ifdef I_SYS_TIME
13999 #include <sys/time.h>
14000 #endif
14001 #ifdef I_SYS_SELECT
14002 #include <sys/select.h>
14003 #endif
14004 int main() {
14005 fd_set fds;
14006
14007 #ifdef TRYBITS
14008 if(fds.fds_bits);
14009 #endif
14010
14011 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
14012 exit(0);
14013 #else
14014 exit(1);
14015 #endif
14016 }
14017 EOCP
14018 set try -DTRYBITS
14019 if eval $compile; then
14020 d_fds_bits="$define"
14021 d_fd_set="$define"
14022 echo "Well, your system knows about the normal fd_set typedef..." >&4
14023 if $run ./try; then
14024 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
14025 d_fd_macros="$define"
14026 else
14027 $cat >&4 <<'EOM'
14028 but not the normal fd_set macros! Gaaack! I'll have to cover for you.
14029 EOM
14030 d_fd_macros="$undef"
14031 fi
14032 else
14033 $cat <<'EOM'
14034 Hmm, your compiler has some difficulty with fd_set. Checking further...
14035 EOM
14036 set try
14037 if eval $compile; then
14038 d_fds_bits="$undef"
14039 d_fd_set="$define"
14040 echo "Well, your system has some sort of fd_set available..." >&4
14041 if $run ./try; then
14042 echo "and you have the normal fd_set macros." >&4
14043 d_fd_macros="$define"
14044 else
14045 $cat <<'EOM'
14046 but not the normal fd_set macros! Gross! More work for me...
14047 EOM
14048 d_fd_macros="$undef"
14049 fi
14050 else
14051 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
14052 d_fd_set="$undef"
14053 d_fds_bits="$undef"
14054 d_fd_macros="$undef"
14055 fi
14056 fi
14057 $rm_try
14058
14059 : see if fdclose exists
14060 set fdclose d_fdclose
14061 eval $inlibc
14062
14063 : see if fdim exists
14064 set fdim d_fdim
14065 eval $inlibc
14066
14067 : see if fegetround exists
14068 set fegetround d_fegetround
14069 eval $inlibc
14070
14071 : see if ffs exists
14072 set ffs d_ffs
14073 eval $inlibc
14074 : see if ffsl exists
14075 set ffsl d_ffsl
14076 eval $inlibc
14077
14078 : see if fgetpos exists
14079 set fgetpos d_fgetpos
14080 eval $inlibc
14081
14082 : see if finite exists
14083 set finite d_finite
14084 eval $inlibc
14085
14086 : see if finitel exists
14087 set finitel d_finitel
14088 eval $inlibc
14089
14090 : see if flock exists
14091 set flock d_flock
14092 eval $inlibc
14093
14094 : see if prototype for flock is available
14095 echo " "
14096 set d_flockproto flock $i_sysfile sys/file.h
14097 eval $hasproto
14098
14099 : see if fma exists
14100 set fma d_fma
14101 eval $inlibc
14102
14103 : see if fmax exists
14104 set fmax d_fmax
14105 eval $inlibc
14106
14107 : see if fmin exists
14108 set fmin d_fmin
14109 eval $inlibc
14110
14111 : see if fp_class exists
14112 set fp_class d_fp_class
14113 eval $inlibc
14114
14115 : check for fpclassify
14116 echo "Checking to see if you have fpclassify..." >&4
14117 $cat >try.c <<EOCP
14118 #include <math.h>
14119 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14120 EOCP
14121 set try
14122 if eval $compile; then
14123 val="$define"
14124 echo "You have fpclassify."
14125 else
14126 val="$undef"
14127 echo "You do not have fpclassify."
14128 fi
14129 $rm_try
14130 set d_fpclassify
14131 eval $setvar
14132
14133 : see if fp_classify exists
14134 set fp_classify d_fp_classify
14135 eval $inlibc
14136
14137 : see if fp_classl exists
14138 set fp_classl d_fp_classl
14139 eval $inlibc
14140
14141 : see if pathconf exists
14142 set pathconf d_pathconf
14143 eval $inlibc
14144
14145 : see if fpathconf exists
14146 set fpathconf d_fpathconf
14147 eval $inlibc
14148
14149 : see if fpclass exists
14150 set fpclass d_fpclass
14151 eval $inlibc
14152
14153 : see if fpclassl exists
14154 set fpclassl d_fpclassl
14155 eval $inlibc
14156
14157 : see if fpgetround exists
14158 set fpgetround d_fpgetround
14159 eval $inlibc
14160
14161 : check for fpos64_t
14162 echo " "
14163 echo "Checking to see if you have fpos64_t..." >&4
14164 $cat >try.c <<EOCP
14165 #include <stdio.h>
14166 int main() { fpos64_t x = 7; }
14167 EOCP
14168 set try
14169 if eval $compile; then
14170 val="$define"
14171 echo "You have fpos64_t."
14172 else
14173 val="$undef"
14174 echo "You do not have fpos64_t."
14175 case "$fpossize" in
14176 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14177 esac
14178 fi
14179 $rm_try
14180 set d_fpos64_t
14181 eval $setvar
14182
14183 : see if frexpl exists
14184 set frexpl d_frexpl
14185 eval $inlibc
14186
14187 : see if this is a sys/param system
14188 set sys/param.h i_sysparam
14189 eval $inhdr
14190
14191 : see if this is a sys/mount.h system
14192 set sys/mount.h i_sysmount
14193 eval $inhdr
14194
14195 : Check for fs_data_s
14196 echo " "
14197 echo "Checking to see if your system supports struct fs_data..." >&4
14198 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14199 eval $hasstruct
14200 case "$d_fs_data_s" in
14201 "$define") echo "Yes, it does." ;;
14202 *) echo "No, it doesn't." ;;
14203 esac
14204
14205 : see if fseeko exists
14206 set fseeko d_fseeko
14207 eval $inlibc
14208 case "$longsize" in
14209 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14210 esac
14211
14212 : see if fsetpos exists
14213 set fsetpos d_fsetpos
14214 eval $inlibc
14215
14216 : see if fstatfs exists
14217 set fstatfs d_fstatfs
14218 eval $inlibc
14219
14220 : see if statvfs exists
14221 set statvfs d_statvfs
14222 eval $inlibc
14223
14224 : see if fstatvfs exists
14225 set fstatvfs d_fstatvfs
14226 eval $inlibc
14227
14228 : see if fsync exists
14229 set fsync d_fsync
14230 eval $inlibc
14231
14232 : see if ftello exists
14233 set ftello d_ftello
14234 eval $inlibc
14235 case "$longsize" in
14236 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14237 esac
14238
14239 : check for a working futimes
14240 d_futimes="$undef"
14241 echo " "
14242 echo "Checking if you have a working futimes()" >&4
14243 $cat >try.c <<EOCP
14244 #include <stdio.h>
14245 #include <stdlib.h>
14246 #include <sys/time.h>
14247 #include <errno.h>
14248 #include <fcntl.h>
14249 #include <stdlib.h>
14250
14251 int main ()
14252 {
14253 int fd, rv;
14254 fd = open ("try.c", O_RDWR);
14255 if (-1 == fd) exit (1);
14256 rv = futimes (fd, NULL);
14257 exit (rv == -1 ? errno : 0);
14258 }
14259 EOCP
14260 set try
14261 if eval $compile; then
14262 `$run ./try`
14263 rc=$?
14264 case "$rc" in
14265 0) echo "Yes, you have" >&4
14266 d_futimes="$define"
14267 ;;
14268 *) echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14269 ;;
14270 esac
14271 else
14272 echo "No, it does not (probably harmless)" >&4
14273 fi
14274 $rm_try
14275
14276 : look for gai_strerror
14277 echo " "
14278 $cat >try.c <<'EOCP'
14279 #include <sys/types.h>
14280 #include <sys/socket.h>
14281 #include <netdb.h>
14282 int main ()
14283 {
14284 return (gai_strerror (0) ? 0 : 1);
14285 }
14286 EOCP
14287 set try
14288 val="$undef"
14289 if eval $compile; then
14290 `$run ./try`
14291 case "$?" in
14292 0) echo "A working gai_strerror() found." >&4
14293 val="$define" ;;
14294 *) echo "gai_strerror() found, but it doesn't work" >&4
14295 ;;
14296 esac
14297 else
14298 echo "gai_strerror() NOT found." >&4
14299 fi
14300 set d_gai_strerror
14301 eval $setvar
14302 $rm_try
14303
14304 : see if ndbm.h is available
14305 set ndbm.h i_ndbm
14306 eval $inhdr
14307 : Compatibility location for RedHat 7.1
14308 set gdbm/ndbm.h i_gdbmndbm
14309 eval $inhdr
14310 : Compatibility location for Debian 4.0
14311 set gdbm-ndbm.h i_gdbm_ndbm
14312 eval $inhdr
14313
14314 val="$undef"
14315 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14316 : see if dbm_open exists
14317 set dbm_open d_dbm_open
14318 eval $inlibc
14319 case "$d_dbm_open" in
14320 $undef)
14321 i_ndbm="$undef"
14322 i_gdbmndbm="$undef"
14323 i_gdbm_ndbm="$undef"
14324 echo "We won't be including <ndbm.h>"
14325 val="$undef"
14326 ;;
14327 *) val="$define"
14328 ;;
14329 esac
14330 fi
14331 set d_ndbm
14332 eval $setvar
14333
14334 ndbm_hdr_protochk='name=$1; hdr=$2;
14335 eval "ihdr=\$""i_$name";
14336 val="$undef";
14337 if $test "$ihdr" = "$define"; then
14338 $echo "Checking if your <$hdr> uses prototypes..." >&4;
14339 case "$d_cplusplus" in
14340 $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14341 *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14342 esac;
14343 case "$val" in
14344 $define) $echo "Your <$hdr> seems to have prototypes";;
14345 *) $echo "Your <$hdr> does not seem to have prototypes";;
14346 esac;
14347 fi;
14348 set "d_${name}_h_uses_prototypes";
14349 eval $setvar'
14350
14351 set ndbm ndbm.h
14352 eval $ndbm_hdr_protochk
14353 set gdbmndbm gdbm/ndbm.h
14354 eval $ndbm_hdr_protochk
14355 set gdbm_ndbm gdbm-ndbm.h
14356 eval $ndbm_hdr_protochk
14357
14358 : see if getaddrinfo exists
14359 set getaddrinfo d_getaddrinfo
14360 eval $inlibc
14361
14362 : see if getcwd exists
14363 set getcwd d_getcwd
14364 eval $inlibc
14365
14366 : check for getenv behavior
14367 case "$d_getenv_preserves_other_thread" in
14368 '')
14369 $echo "Checking to see if getenv() preserves a different thread's results" >&4
14370 $cat >try.c <<EOCP
14371 #$i_stdlib I_STDLIB
14372 #ifdef I_STDLIB
14373 # include <stdlib.h>
14374 #endif
14375 #include <stdio.h>
14376 #include <string.h>
14377 #$i_pthread I_PTHREAD
14378 #ifdef I_PTHREAD
14379 # include <pthread.h>
14380 #endif
14381
14382 void *
14383 thread_start(void * arg)
14384 {
14385 return (void *) getenv("HOME");
14386 }
14387
14388 int main() {
14389 char * main_buffer;
14390 char save_main_buffer[1000];
14391 pthread_t subthread;
14392 pthread_attr_t attr;
14393
14394 main_buffer = getenv("PATH");
14395
14396 /* If too large for our generous allowance, return we couldn't figure it
14397 * out. */
14398 if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
14399 exit(2);
14400 }
14401
14402 strcpy(save_main_buffer, main_buffer);
14403
14404 if (pthread_attr_init(&attr) != 0) {
14405 exit(2);
14406 }
14407
14408 if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
14409 exit(2);
14410 }
14411
14412 if (pthread_join(subthread, NULL) != 0) {
14413 exit(2);
14414 }
14415
14416 exit(! (strcmp(main_buffer, save_main_buffer) == 0));
14417 }
14418 EOCP
14419 val=
14420 set try
14421 if eval $compile_ok; then
14422 $run ./try
14423 rc=$?
14424 case "$rc" in
14425 0) echo "getenv() didn't destroy another thread's buffer" >&4
14426 val=$define
14427 ;;
14428 1) echo "getenv() does destroy another thread's buffer" >&4
14429 val=$undef
14430 ;;
14431 *) echo "Couldn't determine if getenv() destroys another thread's return value (code=$rc); assuming it does" >&4
14432 val=$undef
14433 ;;
14434 esac
14435 else
14436 echo "(I can't seem to compile the test program.)" >&4
14437 echo "Assuming that your C library's getenv destroys another thread's return value." >&4
14438 val=$undef
14439 fi
14440 set d_getenv_preserves_other_thread
14441 eval $setvar
14442 $rm_try
14443 ;;
14444 esac
14445
14446 : see if getespwnam exists
14447 set getespwnam d_getespwnam
14448 eval $inlibc
14449
14450 : see if getfsstat exists
14451 set getfsstat d_getfsstat
14452 eval $inlibc
14453
14454 : see if getgrent exists
14455 set getgrent d_getgrent
14456 eval $inlibc
14457
14458 : see if getgrent_r exists
14459 set getgrent_r d_getgrent_r
14460 eval $inlibc
14461 case "$d_getgrent_r" in
14462 "$define")
14463 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14464 case "$d_getgrent_r_proto:$usethreads" in
14465 ":define") d_getgrent_r_proto=define
14466 set d_getgrent_r_proto getgrent_r $hdrs
14467 eval $hasproto ;;
14468 *) ;;
14469 esac
14470 case "$d_getgrent_r_proto" in
14471 define)
14472 case "$getgrent_r_proto" in
14473 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14474 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14475 esac
14476 case "$getgrent_r_proto" in
14477 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14478 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14479 esac
14480 case "$getgrent_r_proto" in
14481 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14482 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14483 esac
14484 case "$getgrent_r_proto" in
14485 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14486 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14487 esac
14488 case "$getgrent_r_proto" in
14489 ''|0) try='int getgrent_r(struct group*, char*, int);'
14490 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14491 esac
14492 case "$getgrent_r_proto" in
14493 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14494 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14495 esac
14496 case "$getgrent_r_proto" in
14497 ''|0) d_getgrent_r=undef
14498 getgrent_r_proto=0
14499 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14500 * ) case "$getgrent_r_proto" in
14501 REENTRANT_PROTO*) ;;
14502 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14503 esac
14504 echo "Prototype: $try" ;;
14505 esac
14506 ;;
14507 *) case "$usethreads" in
14508 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14509 esac
14510 d_getgrent_r=undef
14511 getgrent_r_proto=0
14512 ;;
14513 esac
14514 ;;
14515 *) getgrent_r_proto=0
14516 ;;
14517 esac
14518
14519 : see if getgrgid_r exists
14520 set getgrgid_r d_getgrgid_r
14521 eval $inlibc
14522 case "$d_getgrgid_r" in
14523 "$define")
14524 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14525 case "$d_getgrgid_r_proto:$usethreads" in
14526 ":define") d_getgrgid_r_proto=define
14527 set d_getgrgid_r_proto getgrgid_r $hdrs
14528 eval $hasproto ;;
14529 *) ;;
14530 esac
14531 case "$d_getgrgid_r_proto" in
14532 define)
14533 case "$getgrgid_r_proto" in
14534 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14535 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14536 esac
14537 case "$getgrgid_r_proto" in
14538 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14539 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14540 esac
14541 case "$getgrgid_r_proto" in
14542 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14543 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14544 esac
14545 case "$getgrgid_r_proto" in
14546 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14547 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14548 esac
14549 case "$getgrgid_r_proto" in
14550 ''|0) d_getgrgid_r=undef
14551 getgrgid_r_proto=0
14552 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14553 * ) case "$getgrgid_r_proto" in
14554 REENTRANT_PROTO*) ;;
14555 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14556 esac
14557 echo "Prototype: $try" ;;
14558 esac
14559 ;;
14560 *) case "$usethreads" in
14561 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14562 esac
14563 d_getgrgid_r=undef
14564 getgrgid_r_proto=0
14565 ;;
14566 esac
14567 ;;
14568 *) getgrgid_r_proto=0
14569 ;;
14570 esac
14571
14572 : see if getgrnam_r exists
14573 set getgrnam_r d_getgrnam_r
14574 eval $inlibc
14575 case "$d_getgrnam_r" in
14576 "$define")
14577 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14578 case "$d_getgrnam_r_proto:$usethreads" in
14579 ":define") d_getgrnam_r_proto=define
14580 set d_getgrnam_r_proto getgrnam_r $hdrs
14581 eval $hasproto ;;
14582 *) ;;
14583 esac
14584 case "$d_getgrnam_r_proto" in
14585 define)
14586 case "$getgrnam_r_proto" in
14587 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14588 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14589 esac
14590 case "$getgrnam_r_proto" in
14591 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14592 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14593 esac
14594 case "$getgrnam_r_proto" in
14595 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14596 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14597 esac
14598 case "$getgrnam_r_proto" in
14599 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14600 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14601 esac
14602 case "$getgrnam_r_proto" in
14603 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14604 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14605 esac
14606 case "$getgrnam_r_proto" in
14607 ''|0) d_getgrnam_r=undef
14608 getgrnam_r_proto=0
14609 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14610 * ) case "$getgrnam_r_proto" in
14611 REENTRANT_PROTO*) ;;
14612 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14613 esac
14614 echo "Prototype: $try" ;;
14615 esac
14616 ;;
14617 *) case "$usethreads" in
14618 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14619 esac
14620 d_getgrnam_r=undef
14621 getgrnam_r_proto=0
14622 ;;
14623 esac
14624 ;;
14625 *) getgrnam_r_proto=0
14626 ;;
14627 esac
14628
14629 : see if gethostbyaddr exists
14630 set gethostbyaddr d_gethbyaddr
14631 eval $inlibc
14632
14633 : see if gethostbyname exists
14634 set gethostbyname d_gethbyname
14635 eval $inlibc
14636
14637 : see if gethostent exists
14638 set gethostent d_gethent
14639 eval $inlibc
14640
14641 : see how we will look up host name
14642 echo " "
14643 call=''
14644 if set gethostname val -f d_gethname; eval $csym; $val; then
14645 echo 'gethostname() found.' >&4
14646 d_gethname="$define"
14647 call=gethostname
14648 fi
14649 if set uname val -f d_uname; eval $csym; $val; then
14650 if ./xenix; then
14651 $cat <<'EOM'
14652 uname() was found, but you're running xenix, and older versions of xenix
14653 have a broken uname(). If you don't really know whether your xenix is old
14654 enough to have a broken system call, use the default answer.
14655
14656 EOM
14657 dflt=y
14658 case "$d_uname" in
14659 "$define") dflt=n;;
14660 esac
14661 rp='Is your uname() broken?'
14662 . ./myread
14663 case "$ans" in
14664 n*) d_uname="$define"; call=uname;;
14665 esac
14666 else
14667 echo 'uname() found.' >&4
14668 d_uname="$define"
14669 case "$call" in
14670 '') call=uname ;;
14671 esac
14672 fi
14673 fi
14674 case "$d_gethname" in
14675 '') d_gethname="$undef";;
14676 esac
14677 case "$d_uname" in
14678 '') d_uname="$undef";;
14679 esac
14680 case "$d_uname$d_gethname" in
14681 *define*)
14682 dflt=n
14683 cat <<EOM
14684
14685 Every now and then someone has a $call() that lies about the hostname
14686 but can't be fixed for political or economic reasons. If you wish, I can
14687 pretend $call() isn't there and maybe compute hostname at run-time
14688 thanks to the '$phostname' command.
14689
14690 EOM
14691 rp="Shall I ignore $call() from now on?"
14692 . ./myread
14693 case "$ans" in
14694 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14695 esac;;
14696 esac
14697 case "$phostname" in
14698 '') aphostname='';;
14699 *) case "$aphostname" in
14700 /*) ;;
14701 *) set X $phostname
14702 shift
14703 file=$1
14704 shift
14705 file=`./loc $file $file $pth`
14706 aphostname=`echo $file $*`
14707 ;;
14708 esac
14709 ;;
14710 esac
14711 case "$d_uname$d_gethname" in
14712 *define*) ;;
14713 *)
14714 case "$phostname" in
14715 '')
14716 echo "There will be no way for $package to get your hostname." >&4;;
14717 *)
14718 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14719 ;;
14720 esac;;
14721 esac
14722 case "$d_phostname" in
14723 '') d_phostname="$undef";;
14724 esac
14725
14726 : see if gethostbyaddr_r exists
14727 set gethostbyaddr_r d_gethostbyaddr_r
14728 eval $inlibc
14729 case "$d_gethostbyaddr_r" in
14730 "$define")
14731 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14732 case "$d_gethostbyaddr_r_proto:$usethreads" in
14733 ":define") d_gethostbyaddr_r_proto=define
14734 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14735 eval $hasproto ;;
14736 *) ;;
14737 esac
14738 case "$d_gethostbyaddr_r_proto" in
14739 define)
14740 case "$gethostbyaddr_r_proto" in
14741 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14742 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14743 esac
14744 case "$gethostbyaddr_r_proto" in
14745 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14746 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14747 esac
14748 case "$gethostbyaddr_r_proto" in
14749 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14750 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14751 esac
14752 case "$gethostbyaddr_r_proto" in
14753 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14754 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14755 esac
14756 case "$gethostbyaddr_r_proto" in
14757 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14758 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14759 esac
14760 case "$gethostbyaddr_r_proto" in
14761 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14762 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14763 esac
14764 case "$gethostbyaddr_r_proto" in
14765 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14766 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14767 esac
14768 case "$gethostbyaddr_r_proto" in
14769 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14770 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14771 esac
14772 case "$gethostbyaddr_r_proto" in
14773 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14774 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14775 esac
14776 case "$gethostbyaddr_r_proto" in
14777 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14778 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14779 esac
14780 case "$gethostbyaddr_r_proto" in
14781 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14782 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14783 esac
14784 case "$gethostbyaddr_r_proto" in
14785 ''|0) d_gethostbyaddr_r=undef
14786 gethostbyaddr_r_proto=0
14787 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14788 * ) case "$gethostbyaddr_r_proto" in
14789 REENTRANT_PROTO*) ;;
14790 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14791 esac
14792 echo "Prototype: $try" ;;
14793 esac
14794 ;;
14795 *) case "$usethreads" in
14796 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14797 esac
14798 d_gethostbyaddr_r=undef
14799 gethostbyaddr_r_proto=0
14800 ;;
14801 esac
14802 ;;
14803 *) gethostbyaddr_r_proto=0
14804 ;;
14805 esac
14806
14807 : see if gethostbyname_r exists
14808 set gethostbyname_r d_gethostbyname_r
14809 eval $inlibc
14810 case "$d_gethostbyname_r" in
14811 "$define")
14812 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14813 case "$d_gethostbyname_r_proto:$usethreads" in
14814 ":define") d_gethostbyname_r_proto=define
14815 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14816 eval $hasproto ;;
14817 *) ;;
14818 esac
14819 case "$d_gethostbyname_r_proto" in
14820 define)
14821 case "$gethostbyname_r_proto" in
14822 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14823 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14824 esac
14825 case "$gethostbyname_r_proto" in
14826 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14827 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14828 esac
14829 case "$gethostbyname_r_proto" in
14830 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14831 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14832 esac
14833 case "$gethostbyname_r_proto" in
14834 ''|0) d_gethostbyname_r=undef
14835 gethostbyname_r_proto=0
14836 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14837 * ) case "$gethostbyname_r_proto" in
14838 REENTRANT_PROTO*) ;;
14839 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14840 esac
14841 echo "Prototype: $try" ;;
14842 esac
14843 ;;
14844 *) case "$usethreads" in
14845 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14846 esac
14847 d_gethostbyname_r=undef
14848 gethostbyname_r_proto=0
14849 ;;
14850 esac
14851 ;;
14852 *) gethostbyname_r_proto=0
14853 ;;
14854 esac
14855
14856 : see if gethostent_r exists
14857 set gethostent_r d_gethostent_r
14858 eval $inlibc
14859 case "$d_gethostent_r" in
14860 "$define")
14861 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14862 case "$d_gethostent_r_proto:$usethreads" in
14863 ":define") d_gethostent_r_proto=define
14864 set d_gethostent_r_proto gethostent_r $hdrs
14865 eval $hasproto ;;
14866 *) ;;
14867 esac
14868 case "$d_gethostent_r_proto" in
14869 define)
14870 case "$gethostent_r_proto" in
14871 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14872 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14873 esac
14874 case "$gethostent_r_proto" in
14875 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14876 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14877 esac
14878 case "$gethostent_r_proto" in
14879 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14880 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14881 esac
14882 case "$gethostent_r_proto" in
14883 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14884 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14885 esac
14886 case "$gethostent_r_proto" in
14887 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14888 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14889 esac
14890 case "$gethostent_r_proto" in
14891 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14892 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14893 esac
14894 case "$gethostent_r_proto" in
14895 ''|0) d_gethostent_r=undef
14896 gethostent_r_proto=0
14897 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14898 * ) case "$gethostent_r_proto" in
14899 REENTRANT_PROTO*) ;;
14900 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14901 esac
14902 echo "Prototype: $try" ;;
14903 esac
14904 ;;
14905 *) case "$usethreads" in
14906 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14907 esac
14908 d_gethostent_r=undef
14909 gethostent_r_proto=0
14910 ;;
14911 esac
14912 ;;
14913 *) gethostent_r_proto=0
14914 ;;
14915 esac
14916
14917 : see if prototypes for various gethostxxx netdb.h functions are available
14918 echo " "
14919 set d_gethostprotos gethostent $i_netdb netdb.h
14920 eval $hasproto
14921
14922 : see if getitimer exists
14923 set getitimer d_getitimer
14924 eval $inlibc
14925
14926 : see if getlogin exists
14927 set getlogin d_getlogin
14928 eval $inlibc
14929
14930 : see if getlogin_r exists
14931 set getlogin_r d_getlogin_r
14932 eval $inlibc
14933 case "$d_getlogin_r" in
14934 "$define")
14935 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14936 case "$d_getlogin_r_proto:$usethreads" in
14937 ":define") d_getlogin_r_proto=define
14938 set d_getlogin_r_proto getlogin_r $hdrs
14939 eval $hasproto ;;
14940 *) ;;
14941 esac
14942 case "$d_getlogin_r_proto" in
14943 define)
14944 case "$getlogin_r_proto" in
14945 ''|0) try='int getlogin_r(char*, size_t);'
14946 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14947 esac
14948 case "$getlogin_r_proto" in
14949 ''|0) try='int getlogin_r(char*, int);'
14950 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14951 esac
14952 case "$getlogin_r_proto" in
14953 ''|0) try='char* getlogin_r(char*, size_t);'
14954 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14955 esac
14956 case "$getlogin_r_proto" in
14957 ''|0) try='char* getlogin_r(char*, int);'
14958 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14959 esac
14960 case "$getlogin_r_proto" in
14961 ''|0) d_getlogin_r=undef
14962 getlogin_r_proto=0
14963 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14964 * ) case "$getlogin_r_proto" in
14965 REENTRANT_PROTO*) ;;
14966 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14967 esac
14968 echo "Prototype: $try" ;;
14969 esac
14970 ;;
14971 *) case "$usethreads" in
14972 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14973 esac
14974 d_getlogin_r=undef
14975 getlogin_r_proto=0
14976 ;;
14977 esac
14978 ;;
14979 *) getlogin_r_proto=0
14980 ;;
14981 esac
14982
14983 : see if getmnt exists
14984 set getmnt d_getmnt
14985 eval $inlibc
14986
14987 : see if getmntent exists
14988 set getmntent d_getmntent
14989 eval $inlibc
14990
14991 : see if getnameinfo exists
14992 set getnameinfo d_getnameinfo
14993 eval $inlibc
14994
14995 : see if getnetbyaddr exists
14996 set getnetbyaddr d_getnbyaddr
14997 eval $inlibc
14998
14999 : see if getnetbyname exists
15000 set getnetbyname d_getnbyname
15001 eval $inlibc
15002
15003 : see if getnetent exists
15004 set getnetent d_getnent
15005 eval $inlibc
15006
15007 : see if getnetbyaddr_r exists
15008 set getnetbyaddr_r d_getnetbyaddr_r
15009 eval $inlibc
15010 case "$d_getnetbyaddr_r" in
15011 "$define")
15012 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15013 case "$d_getnetbyaddr_r_proto:$usethreads" in
15014 ":define") d_getnetbyaddr_r_proto=define
15015 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
15016 eval $hasproto ;;
15017 *) ;;
15018 esac
15019 case "$d_getnetbyaddr_r_proto" in
15020 define)
15021 case "$getnetbyaddr_r_proto" in
15022 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
15023 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
15024 esac
15025 case "$getnetbyaddr_r_proto" in
15026 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
15027 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
15028 esac
15029 case "$getnetbyaddr_r_proto" in
15030 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
15031 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
15032 esac
15033 case "$getnetbyaddr_r_proto" in
15034 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
15035 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
15036 esac
15037 case "$getnetbyaddr_r_proto" in
15038 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
15039 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
15040 esac
15041 case "$getnetbyaddr_r_proto" in
15042 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
15043 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
15044 esac
15045 case "$getnetbyaddr_r_proto" in
15046 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
15047 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
15048 esac
15049 case "$getnetbyaddr_r_proto" in
15050 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
15051 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
15052 esac
15053 case "$getnetbyaddr_r_proto" in
15054 ''|0) d_getnetbyaddr_r=undef
15055 getnetbyaddr_r_proto=0
15056 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
15057 * ) case "$getnetbyaddr_r_proto" in
15058 REENTRANT_PROTO*) ;;
15059 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
15060 esac
15061 echo "Prototype: $try" ;;
15062 esac
15063 ;;
15064 *) case "$usethreads" in
15065 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
15066 esac
15067 d_getnetbyaddr_r=undef
15068 getnetbyaddr_r_proto=0
15069 ;;
15070 esac
15071 ;;
15072 *) getnetbyaddr_r_proto=0
15073 ;;
15074 esac
15075
15076 : see if getnetbyname_r exists
15077 set getnetbyname_r d_getnetbyname_r
15078 eval $inlibc
15079 case "$d_getnetbyname_r" in
15080 "$define")
15081 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15082 case "$d_getnetbyname_r_proto:$usethreads" in
15083 ":define") d_getnetbyname_r_proto=define
15084 set d_getnetbyname_r_proto getnetbyname_r $hdrs
15085 eval $hasproto ;;
15086 *) ;;
15087 esac
15088 case "$d_getnetbyname_r_proto" in
15089 define)
15090 case "$getnetbyname_r_proto" in
15091 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
15092 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
15093 esac
15094 case "$getnetbyname_r_proto" in
15095 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
15096 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
15097 esac
15098 case "$getnetbyname_r_proto" in
15099 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
15100 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
15101 esac
15102 case "$getnetbyname_r_proto" in
15103 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
15104 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
15105 esac
15106 case "$getnetbyname_r_proto" in
15107 ''|0) d_getnetbyname_r=undef
15108 getnetbyname_r_proto=0
15109 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
15110 * ) case "$getnetbyname_r_proto" in
15111 REENTRANT_PROTO*) ;;
15112 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
15113 esac
15114 echo "Prototype: $try" ;;
15115 esac
15116 ;;
15117 *) case "$usethreads" in
15118 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
15119 esac
15120 d_getnetbyname_r=undef
15121 getnetbyname_r_proto=0
15122 ;;
15123 esac
15124 ;;
15125 *) getnetbyname_r_proto=0
15126 ;;
15127 esac
15128
15129 : see if getnetent_r exists
15130 set getnetent_r d_getnetent_r
15131 eval $inlibc
15132 case "$d_getnetent_r" in
15133 "$define")
15134 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15135 case "$d_getnetent_r_proto:$usethreads" in
15136 ":define") d_getnetent_r_proto=define
15137 set d_getnetent_r_proto getnetent_r $hdrs
15138 eval $hasproto ;;
15139 *) ;;
15140 esac
15141 case "$d_getnetent_r_proto" in
15142 define)
15143 case "$getnetent_r_proto" in
15144 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
15145 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
15146 esac
15147 case "$getnetent_r_proto" in
15148 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
15149 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
15150 esac
15151 case "$getnetent_r_proto" in
15152 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
15153 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
15154 esac
15155 case "$getnetent_r_proto" in
15156 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
15157 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
15158 esac
15159 case "$getnetent_r_proto" in
15160 ''|0) try='int getnetent_r(struct netent*, char*, int);'
15161 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
15162 esac
15163 case "$getnetent_r_proto" in
15164 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
15165 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
15166 esac
15167 case "$getnetent_r_proto" in
15168 ''|0) d_getnetent_r=undef
15169 getnetent_r_proto=0
15170 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
15171 * ) case "$getnetent_r_proto" in
15172 REENTRANT_PROTO*) ;;
15173 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15174 esac
15175 echo "Prototype: $try" ;;
15176 esac
15177 ;;
15178 *) case "$usethreads" in
15179 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15180 esac
15181 d_getnetent_r=undef
15182 getnetent_r_proto=0
15183 ;;
15184 esac
15185 ;;
15186 *) getnetent_r_proto=0
15187 ;;
15188 esac
15189
15190 : see if prototypes for various getnetxxx netdb.h functions are available
15191 echo " "
15192 set d_getnetprotos getnetent $i_netdb netdb.h
15193 eval $hasproto
15194
15195 : see if getpagesize exists
15196 set getpagesize d_getpagsz
15197 eval $inlibc
15198
15199 : Optional checks for getprotobyname and getprotobynumber
15200
15201 : see if getprotobyname exists
15202 set getprotobyname d_getpbyname
15203 eval $inlibc
15204
15205 : see if getprotobynumber exists
15206 set getprotobynumber d_getpbynumber
15207 eval $inlibc
15208
15209 : see if getprotoent exists
15210 set getprotoent d_getpent
15211 eval $inlibc
15212
15213 : see if getpgid exists
15214 set getpgid d_getpgid
15215 eval $inlibc
15216
15217 : see if getpgrp2 exists
15218 set getpgrp2 d_getpgrp2
15219 eval $inlibc
15220
15221 : see if getppid exists
15222 set getppid d_getppid
15223 eval $inlibc
15224
15225 : see if getpriority exists
15226 set getpriority d_getprior
15227 eval $inlibc
15228
15229 : see if getprotobyname_r exists
15230 set getprotobyname_r d_getprotobyname_r
15231 eval $inlibc
15232 case "$d_getprotobyname_r" in
15233 "$define")
15234 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15235 case "$d_getprotobyname_r_proto:$usethreads" in
15236 ":define") d_getprotobyname_r_proto=define
15237 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15238 eval $hasproto ;;
15239 *) ;;
15240 esac
15241 case "$d_getprotobyname_r_proto" in
15242 define)
15243 case "$getprotobyname_r_proto" in
15244 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15245 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15246 esac
15247 case "$getprotobyname_r_proto" in
15248 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15249 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15250 esac
15251 case "$getprotobyname_r_proto" in
15252 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15253 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15254 esac
15255 case "$getprotobyname_r_proto" in
15256 ''|0) d_getprotobyname_r=undef
15257 getprotobyname_r_proto=0
15258 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15259 * ) case "$getprotobyname_r_proto" in
15260 REENTRANT_PROTO*) ;;
15261 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15262 esac
15263 echo "Prototype: $try" ;;
15264 esac
15265 ;;
15266 *) case "$usethreads" in
15267 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15268 esac
15269 d_getprotobyname_r=undef
15270 getprotobyname_r_proto=0
15271 ;;
15272 esac
15273 ;;
15274 *) getprotobyname_r_proto=0
15275 ;;
15276 esac
15277
15278 : see if getprotobynumber_r exists
15279 set getprotobynumber_r d_getprotobynumber_r
15280 eval $inlibc
15281 case "$d_getprotobynumber_r" in
15282 "$define")
15283 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15284 case "$d_getprotobynumber_r_proto:$usethreads" in
15285 ":define") d_getprotobynumber_r_proto=define
15286 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15287 eval $hasproto ;;
15288 *) ;;
15289 esac
15290 case "$d_getprotobynumber_r_proto" in
15291 define)
15292 case "$getprotobynumber_r_proto" in
15293 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15294 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15295 esac
15296 case "$getprotobynumber_r_proto" in
15297 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15298 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15299 esac
15300 case "$getprotobynumber_r_proto" in
15301 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15302 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15303 esac
15304 case "$getprotobynumber_r_proto" in
15305 ''|0) d_getprotobynumber_r=undef
15306 getprotobynumber_r_proto=0
15307 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15308 * ) case "$getprotobynumber_r_proto" in
15309 REENTRANT_PROTO*) ;;
15310 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15311 esac
15312 echo "Prototype: $try" ;;
15313 esac
15314 ;;
15315 *) case "$usethreads" in
15316 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15317 esac
15318 d_getprotobynumber_r=undef
15319 getprotobynumber_r_proto=0
15320 ;;
15321 esac
15322 ;;
15323 *) getprotobynumber_r_proto=0
15324 ;;
15325 esac
15326
15327 : see if getprotoent_r exists
15328 set getprotoent_r d_getprotoent_r
15329 eval $inlibc
15330 case "$d_getprotoent_r" in
15331 "$define")
15332 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15333 case "$d_getprotoent_r_proto:$usethreads" in
15334 ":define") d_getprotoent_r_proto=define
15335 set d_getprotoent_r_proto getprotoent_r $hdrs
15336 eval $hasproto ;;
15337 *) ;;
15338 esac
15339 case "$d_getprotoent_r_proto" in
15340 define)
15341 case "$getprotoent_r_proto" in
15342 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15343 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15344 esac
15345 case "$getprotoent_r_proto" in
15346 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15347 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15348 esac
15349 case "$getprotoent_r_proto" in
15350 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15351 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15352 esac
15353 case "$getprotoent_r_proto" in
15354 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15355 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15356 esac
15357 case "$getprotoent_r_proto" in
15358 ''|0) d_getprotoent_r=undef
15359 getprotoent_r_proto=0
15360 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15361 * ) case "$getprotoent_r_proto" in
15362 REENTRANT_PROTO*) ;;
15363 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15364 esac
15365 echo "Prototype: $try" ;;
15366 esac
15367 ;;
15368 *) case "$usethreads" in
15369 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15370 esac
15371 d_getprotoent_r=undef
15372 getprotoent_r_proto=0
15373 ;;
15374 esac
15375 ;;
15376 *) getprotoent_r_proto=0
15377 ;;
15378 esac
15379
15380 : see if prototypes for various getprotoxxx netdb.h functions are available
15381 echo " "
15382 set d_getprotoprotos getprotoent $i_netdb netdb.h
15383 eval $hasproto
15384
15385 : see if getprpwnam exists
15386 set getprpwnam d_getprpwnam
15387 eval $inlibc
15388
15389 : see if getpwent exists
15390 set getpwent d_getpwent
15391 eval $inlibc
15392
15393 : see if getpwent_r exists
15394 set getpwent_r d_getpwent_r
15395 eval $inlibc
15396 case "$d_getpwent_r" in
15397 "$define")
15398 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15399 case "$d_getpwent_r_proto:$usethreads" in
15400 ":define") d_getpwent_r_proto=define
15401 set d_getpwent_r_proto getpwent_r $hdrs
15402 eval $hasproto ;;
15403 *) ;;
15404 esac
15405 case "$d_getpwent_r_proto" in
15406 define)
15407 case "$getpwent_r_proto" in
15408 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15409 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15410 esac
15411 case "$getpwent_r_proto" in
15412 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15413 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15414 esac
15415 case "$getpwent_r_proto" in
15416 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15417 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15418 esac
15419 case "$getpwent_r_proto" in
15420 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15421 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15422 esac
15423 case "$getpwent_r_proto" in
15424 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15425 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15426 esac
15427 case "$getpwent_r_proto" in
15428 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15429 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15430 esac
15431 case "$getpwent_r_proto" in
15432 ''|0) d_getpwent_r=undef
15433 getpwent_r_proto=0
15434 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15435 * ) case "$getpwent_r_proto" in
15436 REENTRANT_PROTO*) ;;
15437 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15438 esac
15439 echo "Prototype: $try" ;;
15440 esac
15441 ;;
15442 *) case "$usethreads" in
15443 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15444 esac
15445 d_getpwent_r=undef
15446 getpwent_r_proto=0
15447 ;;
15448 esac
15449 ;;
15450 *) getpwent_r_proto=0
15451 ;;
15452 esac
15453
15454 : see if getpwnam_r exists
15455 set getpwnam_r d_getpwnam_r
15456 eval $inlibc
15457 case "$d_getpwnam_r" in
15458 "$define")
15459 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15460 case "$d_getpwnam_r_proto:$usethreads" in
15461 ":define") d_getpwnam_r_proto=define
15462 set d_getpwnam_r_proto getpwnam_r $hdrs
15463 eval $hasproto ;;
15464 *) ;;
15465 esac
15466 case "$d_getpwnam_r_proto" in
15467 define)
15468 case "$getpwnam_r_proto" in
15469 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15470 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15471 esac
15472 case "$getpwnam_r_proto" in
15473 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15474 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15475 esac
15476 case "$getpwnam_r_proto" in
15477 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15478 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15479 esac
15480 case "$getpwnam_r_proto" in
15481 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15482 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15483 esac
15484 case "$getpwnam_r_proto" in
15485 ''|0) d_getpwnam_r=undef
15486 getpwnam_r_proto=0
15487 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15488 * ) case "$getpwnam_r_proto" in
15489 REENTRANT_PROTO*) ;;
15490 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15491 esac
15492 echo "Prototype: $try" ;;
15493 esac
15494 ;;
15495 *) case "$usethreads" in
15496 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15497 esac
15498 d_getpwnam_r=undef
15499 getpwnam_r_proto=0
15500 ;;
15501 esac
15502 ;;
15503 *) getpwnam_r_proto=0
15504 ;;
15505 esac
15506
15507 : see if getpwuid_r exists
15508 set getpwuid_r d_getpwuid_r
15509 eval $inlibc
15510 case "$d_getpwuid_r" in
15511 "$define")
15512 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15513 case "$d_getpwuid_r_proto:$usethreads" in
15514 ":define") d_getpwuid_r_proto=define
15515 set d_getpwuid_r_proto getpwuid_r $hdrs
15516 eval $hasproto ;;
15517 *) ;;
15518 esac
15519 case "$d_getpwuid_r_proto" in
15520 define)
15521 case "$getpwuid_r_proto" in
15522 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15523 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15524 esac
15525 case "$getpwuid_r_proto" in
15526 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15527 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15528 esac
15529 case "$getpwuid_r_proto" in
15530 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15531 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15532 esac
15533 case "$getpwuid_r_proto" in
15534 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15535 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15536 esac
15537 case "$getpwuid_r_proto" in
15538 ''|0) d_getpwuid_r=undef
15539 getpwuid_r_proto=0
15540 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15541 * ) case "$getpwuid_r_proto" in
15542 REENTRANT_PROTO*) ;;
15543 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15544 esac
15545 echo "Prototype: $try" ;;
15546 esac
15547 ;;
15548 *) case "$usethreads" in
15549 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15550 esac
15551 d_getpwuid_r=undef
15552 getpwuid_r_proto=0
15553 ;;
15554 esac
15555 ;;
15556 *) getpwuid_r_proto=0
15557 ;;
15558 esac
15559
15560 : Optional checks for getsbyname and getsbyport
15561
15562 : see if getservbyname exists
15563 set getservbyname d_getsbyname
15564 eval $inlibc
15565
15566 : see if getservbyport exists
15567 set getservbyport d_getsbyport
15568 eval $inlibc
15569
15570 : see if getservent exists
15571 set getservent d_getsent
15572 eval $inlibc
15573
15574 : see if getservbyname_r exists
15575 set getservbyname_r d_getservbyname_r
15576 eval $inlibc
15577 case "$d_getservbyname_r" in
15578 "$define")
15579 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15580 case "$d_getservbyname_r_proto:$usethreads" in
15581 ":define") d_getservbyname_r_proto=define
15582 set d_getservbyname_r_proto getservbyname_r $hdrs
15583 eval $hasproto ;;
15584 *) ;;
15585 esac
15586 case "$d_getservbyname_r_proto" in
15587 define)
15588 case "$getservbyname_r_proto" in
15589 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15590 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15591 esac
15592 case "$getservbyname_r_proto" in
15593 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15594 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15595 esac
15596 case "$getservbyname_r_proto" in
15597 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15598 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15599 esac
15600 case "$getservbyname_r_proto" in
15601 ''|0) d_getservbyname_r=undef
15602 getservbyname_r_proto=0
15603 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15604 * ) case "$getservbyname_r_proto" in
15605 REENTRANT_PROTO*) ;;
15606 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15607 esac
15608 echo "Prototype: $try" ;;
15609 esac
15610 ;;
15611 *) case "$usethreads" in
15612 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15613 esac
15614 d_getservbyname_r=undef
15615 getservbyname_r_proto=0
15616 ;;
15617 esac
15618 ;;
15619 *) getservbyname_r_proto=0
15620 ;;
15621 esac
15622
15623 : see if getservbyport_r exists
15624 set getservbyport_r d_getservbyport_r
15625 eval $inlibc
15626 case "$d_getservbyport_r" in
15627 "$define")
15628 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15629 case "$d_getservbyport_r_proto:$usethreads" in
15630 ":define") d_getservbyport_r_proto=define
15631 set d_getservbyport_r_proto getservbyport_r $hdrs
15632 eval $hasproto ;;
15633 *) ;;
15634 esac
15635 case "$d_getservbyport_r_proto" in
15636 define)
15637 case "$getservbyport_r_proto" in
15638 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15639 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15640 esac
15641 case "$getservbyport_r_proto" in
15642 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15643 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15644 esac
15645 case "$getservbyport_r_proto" in
15646 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15647 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15648 esac
15649 case "$getservbyport_r_proto" in
15650 ''|0) d_getservbyport_r=undef
15651 getservbyport_r_proto=0
15652 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15653 * ) case "$getservbyport_r_proto" in
15654 REENTRANT_PROTO*) ;;
15655 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15656 esac
15657 echo "Prototype: $try" ;;
15658 esac
15659 ;;
15660 *) case "$usethreads" in
15661 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15662 esac
15663 d_getservbyport_r=undef
15664 getservbyport_r_proto=0
15665 ;;
15666 esac
15667 ;;
15668 *) getservbyport_r_proto=0
15669 ;;
15670 esac
15671
15672 : see if getservent_r exists
15673 set getservent_r d_getservent_r
15674 eval $inlibc
15675 case "$d_getservent_r" in
15676 "$define")
15677 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15678 case "$d_getservent_r_proto:$usethreads" in
15679 ":define") d_getservent_r_proto=define
15680 set d_getservent_r_proto getservent_r $hdrs
15681 eval $hasproto ;;
15682 *) ;;
15683 esac
15684 case "$d_getservent_r_proto" in
15685 define)
15686 case "$getservent_r_proto" in
15687 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15688 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15689 esac
15690 case "$getservent_r_proto" in
15691 ''|0) try='int getservent_r(struct servent*, char*, int);'
15692 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15693 esac
15694 case "$getservent_r_proto" in
15695 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15696 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15697 esac
15698 case "$getservent_r_proto" in
15699 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15700 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15701 esac
15702 case "$getservent_r_proto" in
15703 ''|0) d_getservent_r=undef
15704 getservent_r_proto=0
15705 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15706 * ) case "$getservent_r_proto" in
15707 REENTRANT_PROTO*) ;;
15708 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15709 esac
15710 echo "Prototype: $try" ;;
15711 esac
15712 ;;
15713 *) case "$usethreads" in
15714 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15715 esac
15716 d_getservent_r=undef
15717 getservent_r_proto=0
15718 ;;
15719 esac
15720 ;;
15721 *) getservent_r_proto=0
15722 ;;
15723 esac
15724
15725 : see if prototypes for various getservxxx netdb.h functions are available
15726 echo " "
15727 set d_getservprotos getservent $i_netdb netdb.h
15728 eval $hasproto
15729
15730 : see if getspnam exists
15731 set getspnam d_getspnam
15732 eval $inlibc
15733
15734 : see if this is a shadow.h system
15735 set shadow.h i_shadow
15736 eval $inhdr
15737
15738 : see if getspnam_r exists
15739 set getspnam_r d_getspnam_r
15740 eval $inlibc
15741 case "$d_getspnam_r" in
15742 "$define")
15743 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15744 case "$d_getspnam_r_proto:$usethreads" in
15745 ":define") d_getspnam_r_proto=define
15746 set d_getspnam_r_proto getspnam_r $hdrs
15747 eval $hasproto ;;
15748 *) ;;
15749 esac
15750 case "$d_getspnam_r_proto" in
15751 define)
15752 case "$getspnam_r_proto" in
15753 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15754 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15755 esac
15756 case "$getspnam_r_proto" in
15757 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15758 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15759 esac
15760 case "$getspnam_r_proto" in
15761 ''|0) d_getspnam_r=undef
15762 getspnam_r_proto=0
15763 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15764 * ) case "$getspnam_r_proto" in
15765 REENTRANT_PROTO*) ;;
15766 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15767 esac
15768 echo "Prototype: $try" ;;
15769 esac
15770 ;;
15771 *) case "$usethreads" in
15772 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15773 esac
15774 d_getspnam_r=undef
15775 getspnam_r_proto=0
15776 ;;
15777 esac
15778 ;;
15779 *) getspnam_r_proto=0
15780 ;;
15781 esac
15782
15783 : see if gettimeofday or ftime exists
15784 set gettimeofday d_gettimeod
15785 eval $inlibc
15786 case "$d_gettimeod" in
15787 "$undef")
15788 set ftime d_ftime
15789 eval $inlibc
15790 ;;
15791 *)
15792 val="$undef"; set d_ftime; eval $setvar
15793 ;;
15794 esac
15795 case "$d_gettimeod$d_ftime" in
15796 "$undef$undef")
15797 echo " "
15798 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15799 ;;
15800 esac
15801
15802 : see if gmtime_r exists
15803 set gmtime_r d_gmtime_r
15804 eval $inlibc
15805 case "$d_gmtime_r" in
15806 "$define")
15807 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15808 case "$d_gmtime_r_proto:$usethreads" in
15809 ":define") d_gmtime_r_proto=define
15810 set d_gmtime_r_proto gmtime_r $hdrs
15811 eval $hasproto ;;
15812 *) ;;
15813 esac
15814 case "$d_gmtime_r_proto" in
15815 define)
15816 case "$gmtime_r_proto" in
15817 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15818 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15819 esac
15820 case "$gmtime_r_proto" in
15821 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15822 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15823 esac
15824 case "$gmtime_r_proto" in
15825 ''|0) d_gmtime_r=undef
15826 gmtime_r_proto=0
15827 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15828 * ) case "$gmtime_r_proto" in
15829 REENTRANT_PROTO*) ;;
15830 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15831 esac
15832 echo "Prototype: $try" ;;
15833 esac
15834 ;;
15835 *) case "$usethreads" in
15836 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15837 esac
15838 d_gmtime_r=undef
15839 gmtime_r_proto=0
15840 ;;
15841 esac
15842 ;;
15843 *) gmtime_r_proto=0
15844 ;;
15845 esac
15846
15847 : see if hasmntopt exists
15848 set hasmntopt d_hasmntopt
15849 eval $inlibc
15850
15851 : see if this is a netinet/in.h or sys/in.h system
15852 set netinet/in.h i_niin sys/in.h i_sysin
15853 eval $inhdr
15854
15855 : see if arpa/inet.h has to be included
15856 set arpa/inet.h i_arpainet
15857 eval $inhdr
15858
15859 : see if htonl --and friends-- exists
15860 val=''
15861 set htonl val
15862 eval $inlibc
15863
15864 : Maybe they are macros.
15865 case "$val" in
15866 $undef)
15867 $cat >htonl.c <<EOM
15868 #include <stdio.h>
15869 #include <sys/types.h>
15870 #$i_niin I_NETINET_IN
15871 #$i_sysin I_SYS_IN
15872 #$i_arpainet I_ARPA_INET
15873 #ifdef I_NETINET_IN
15874 #include <netinet/in.h>
15875 #endif
15876 #ifdef I_SYS_IN
15877 #include <sys/in.h>
15878 #endif
15879 #ifdef I_ARPA_INET
15880 #include <arpa/inet.h>
15881 #endif
15882 #ifdef htonl
15883 printf("Defined as a macro.");
15884 #endif
15885 EOM
15886 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15887 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15888 val="$define"
15889 echo "But it seems to be defined as a macro." >&4
15890 fi
15891 $rm -f htonl.?
15892 ;;
15893 esac
15894 set d_htonl
15895 eval $setvar
15896
15897 : see if hypot exists
15898 set hypot d_hypot
15899 eval $inlibc
15900
15901 : see if ilogb exists
15902 set ilogb d_ilogb
15903 eval $inlibc
15904
15905 : see if ilogbl exists
15906 set ilogbl d_ilogbl
15907 eval $inlibc
15908
15909 : check whether inet_aton exists
15910 set inet_aton d_inetaton
15911 eval $inlibc
15912
15913 : see if inet_ntop exists
15914 set inet_ntop d_inetntop
15915 eval $inlibc
15916
15917 : see if inet_pton exists
15918 set inet_pton d_inetpton
15919 eval $inlibc
15920
15921 : Look for isascii
15922 echo " "
15923 $cat >isascii.c <<EOCP
15924 #include <stdio.h>
15925 #include <ctype.h>
15926 #$i_stdlib I_STDLIB
15927 #ifdef I_STDLIB
15928 #include <stdlib.h>
15929 #endif
15930 int main() {
15931 int c = 'A';
15932 if (isascii(c))
15933 exit(0);
15934 else
15935 exit(1);
15936 }
15937 EOCP
15938 set isascii
15939 if eval $compile; then
15940 echo "isascii() found." >&4
15941 val="$define"
15942 else
15943 echo "isascii() NOT found." >&4
15944 val="$undef"
15945 fi
15946 set d_isascii
15947 eval $setvar
15948 $rm -f isascii*
15949
15950 : Look for isblank
15951 echo " "
15952 $cat >isblank.c <<'EOCP'
15953 #include <stdio.h>
15954 #include <ctype.h>
15955 int main() {
15956 int c = ' ';
15957 if (isblank(c))
15958 return 0 ;
15959 else
15960 return 1 ;
15961 }
15962 EOCP
15963 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15964 echo "isblank() found." >&4
15965 val="$define"
15966 else
15967 echo "isblank() NOT found." >&4
15968 val="$undef"
15969 fi
15970 set d_isblank
15971 eval $setvar
15972 $rm -f isblank*
15973
15974 : check for isfinite
15975 echo "Checking to see if you have isfinite..." >&4
15976 $cat >try.c <<EOCP
15977 #include <math.h>
15978 int main() { return isfinite(0.0); }
15979 EOCP
15980 set try
15981 if eval $compile; then
15982 val="$define"
15983 echo "You have isfinite."
15984 else
15985 val="$undef"
15986 echo "You do not have isfinite."
15987 fi
15988 $rm_try
15989 set d_isfinite
15990 eval $setvar
15991
15992 : see if isfinitel exists
15993 set isfinitel d_isfinitel
15994 eval $inlibc
15995
15996 : check for isinf
15997 echo "Checking to see if you have isinf..." >&4
15998 $cat >try.c <<EOCP
15999 #include <math.h>
16000 int main() { return isinf(0.0); }
16001 EOCP
16002 set try
16003 if eval $compile; then
16004 val="$define"
16005 echo "You have isinf."
16006 else
16007 val="$undef"
16008 echo "You do not have isinf."
16009 fi
16010 $rm_try
16011 set d_isinf
16012 eval $setvar
16013
16014 : see if isinfl exists
16015 set isinfl d_isinfl
16016 eval $inlibc
16017
16018 : check for isless
16019 echo "Checking to see if you have isless..." >&4
16020 $cat >try.c <<EOCP
16021 #include <math.h>
16022 int main() { return isless(2.0, 1.0); }
16023 EOCP
16024 set try
16025 if eval $compile; then
16026 val="$define"
16027 echo "You have isless."
16028 else
16029 val="$undef"
16030 echo "You do not have isless."
16031 fi
16032 $rm_try
16033 set d_isless
16034 eval $setvar
16035
16036 : check for isnan
16037 echo "Checking to see if you have isnan..." >&4
16038 $cat >try.c <<EOCP
16039 #include <math.h>
16040 int main() { return isnan(0.0); }
16041 EOCP
16042 set try
16043 if eval $compile; then
16044 val="$define"
16045 echo "You have isnan."
16046 else
16047 val="$undef"
16048 echo "You do not have isnan."
16049 fi
16050 $rm_try
16051 set d_isnan
16052 eval $setvar
16053
16054 : see if isnanl exists
16055 set isnanl d_isnanl
16056 eval $inlibc
16057
16058 : check for isnormal
16059 echo "Checking to see if you have isnormal..." >&4
16060 $cat >try.c <<EOCP
16061 #include <math.h>
16062 int main() { return isnormal(0.0); }
16063 EOCP
16064 set try
16065 if eval $compile; then
16066 val="$define"
16067 echo "You have isnormal."
16068 else
16069 val="$undef"
16070 echo "You do not have isnormal."
16071 fi
16072 $rm_try
16073 set d_isnormal
16074 eval $setvar
16075
16076 : see if j0 exists
16077 set j0 d_j0
16078 eval $inlibc
16079
16080 : see if j0l exists
16081 set j0l d_j0l
16082 eval $inlibc
16083
16084 : see if killpg exists
16085 set killpg d_killpg
16086 eval $inlibc
16087
16088 : see if localeconv exists
16089 set localeconv d_locconv
16090 eval $inlibc
16091
16092 : see if libc has the POSIX.1-2008 currency locale rules
16093 case "$d_locconv:$d_lc_monetary_2008" in
16094 $define:)
16095 $cat >try.c <<EOCP
16096 #include <locale.h>
16097 int main() {
16098 struct lconv *lc = localeconv();
16099 char int_p_cs_precedes = lc->int_p_cs_precedes;
16100 return 0;
16101 }
16102 EOCP
16103 set try
16104 if eval $compile; then
16105 d_lc_monetary_2008="$define"
16106 else
16107 d_lc_monetary_2008="$undef"
16108 fi;
16109 $rm_try
16110 ;;
16111 *) d_lc_monetary_2008="$undef"
16112 ;;
16113 esac
16114
16115 : see if lchown exists
16116 echo " "
16117 $cat > try.c <<EOCP
16118 #include <pwd.h>
16119 #include <stdio.h>
16120 #include <stdlib.h>
16121 #$i_unistd I_UNISTD
16122 #ifdef I_UNISTD
16123 # include <unistd.h>
16124 #endif
16125 int main(int argc, char *argv[])
16126 {
16127 if (lchown("./try.c", -1, getgid()) == -1) {
16128 exit(EXIT_FAILURE);
16129 }
16130 exit(EXIT_SUCCESS);
16131 }
16132 EOCP
16133 set try
16134 if eval $compile && ./try; then
16135 $echo "lchown() found." >&4
16136 val="$define"
16137 else
16138 $echo "lchown() NOT found." >&4
16139 val="$undef"
16140 fi
16141 set d_lchown
16142 eval $setvar
16143 $rm_try
16144
16145 : See if number of significant digits in a double precision number is known
16146 echo " "
16147 $cat >ldbl_dig.c <<EOM
16148 #include <limits.h>
16149 #include <float.h>
16150 #ifdef LDBL_DIG
16151 printf("Contains LDBL_DIG");
16152 #endif
16153 EOM
16154 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16155 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16156 echo "LDBL_DIG found." >&4
16157 val="$define"
16158 else
16159 echo "LDBL_DIG NOT found." >&4
16160 val="$undef"
16161 fi
16162 $rm -f ldbl_dig.?
16163 set d_ldbl_dig
16164 eval $setvar
16165
16166 : see if lgamma exists
16167 set lgamma d_lgamma
16168 eval $inlibc
16169
16170 : see if lgamma_r exists
16171 set lgamma_r d_lgamma_r
16172 eval $inlibc
16173
16174 : check to see if math.h defines _LIB_VERSION
16175 d_libm_lib_version="$undef"
16176 echo " "
16177 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16178 $cat >try.c <<EOCP
16179 #include <unistd.h>
16180 #include <math.h>
16181 #include <stdio.h>
16182 int main (int argc, char *argv[])
16183 {
16184 printf ("%d\n", _LIB_VERSION);
16185 return (0);
16186 } /* main */
16187 EOCP
16188 set try
16189 if eval $compile; then
16190 foo=`$run ./try`
16191 echo "Yes, it does ($foo)" >&4
16192 d_libm_lib_version="$define"
16193 else
16194 echo "No, it does not (probably harmless)" >&4
16195 fi
16196 $rm_try
16197
16198 : see if link exists
16199 set link d_link
16200 eval $inlibc
16201
16202 : see if llrint exists
16203 set llrint d_llrint
16204 eval $inlibc
16205
16206 : see if llrintl exists
16207 set llrintl d_llrintl
16208 eval $inlibc
16209
16210 : see if llround exists
16211 set llround d_llround
16212 eval $inlibc
16213
16214 : see if llroundl exists
16215 set llroundl d_llroundl
16216 eval $inlibc
16217
16218 : see if malloc/malloc.h has to be included
16219 set malloc/malloc.h i_mallocmalloc
16220 eval $inhdr
16221
16222 : see if this is a malloc.h system
16223 : we want a real compile instead of Inhdr because some systems have a
16224 : malloc.h that just gives a compile error saying to use stdlib.h instead
16225 echo " "
16226 $cat >try.c <<EOCP
16227 #include <stdlib.h>
16228 #include <malloc.h>
16229 #$i_mallocmalloc I_MALLOCMALLOC
16230 #ifdef I_MALLOCMALLOC
16231 # include <malloc/malloc.h>
16232 #endif
16233
16234 int main () { return 0; }
16235 EOCP
16236 set try
16237 if eval $compile; then
16238 echo "<malloc.h> found." >&4
16239 val="$define"
16240 else
16241 echo "<malloc.h> NOT found." >&4
16242 val="$undef"
16243 fi
16244 $rm_try
16245 set i_malloc
16246 eval $setvar
16247
16248 : see if localtime_r exists
16249 set localtime_r d_localtime_r
16250 eval $inlibc
16251 case "$d_localtime_r" in
16252 "$define")
16253 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16254 case "$d_localtime_r_proto:$usethreads" in
16255 ":define") d_localtime_r_proto=define
16256 set d_localtime_r_proto localtime_r $hdrs
16257 eval $hasproto ;;
16258 *) ;;
16259 esac
16260 case "$d_localtime_r_proto" in
16261 define)
16262 case "$localtime_r_proto" in
16263 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16264 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16265 esac
16266 case "$localtime_r_proto" in
16267 ''|0) try='int localtime_r(const time_t*, struct tm*);'
16268 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16269 esac
16270 case "$localtime_r_proto" in
16271 ''|0) d_localtime_r=undef
16272 localtime_r_proto=0
16273 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16274 * ) case "$localtime_r_proto" in
16275 REENTRANT_PROTO*) ;;
16276 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16277 esac
16278 echo "Prototype: $try" ;;
16279 esac
16280 ;;
16281 *) case "$usethreads" in
16282 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16283 esac
16284 d_localtime_r=undef
16285 localtime_r_proto=0
16286 ;;
16287 esac
16288 ;;
16289 *) localtime_r_proto=0
16290 ;;
16291 esac
16292
16293 : see if localtime_r calls tzset
16294 case "$localtime_r_proto" in
16295 REENTRANT_PROTO*)
16296 $cat >try.c <<EOCP
16297 /* Does our libc's localtime_r call tzset ?
16298 * return 0 if so, 1 otherwise.
16299 */
16300 #$i_systypes I_SYS_TYPES
16301 #$i_unistd I_UNISTD
16302 #$i_time I_TIME
16303 #$i_stdlib I_STDLIB
16304 #$i_malloc I_MALLOC
16305 #ifdef I_SYS_TYPES
16306 # include <sys/types.h>
16307 #endif
16308 #ifdef I_UNISTD
16309 # include <unistd.h>
16310 #endif
16311 #ifdef I_TIME
16312 # include <time.h>
16313 #endif
16314 #ifdef I_STDLIB
16315 #include <stdlib.h>
16316 #endif
16317 #include <string.h>
16318 #ifdef I_MALLOC
16319 # include <malloc.h>
16320 #endif
16321 int main()
16322 {
16323 int result = 0;
16324 time_t t = time(0L);
16325 char w_tz[]="TZ" "=GMT+5",
16326 e_tz[]="TZ" "=GMT-5",
16327 *tz_e = (char*)malloc(16),
16328 *tz_w = (char*)malloc(16);
16329 struct tm tm_e, tm_w;
16330 memset(&tm_e,'\0',sizeof(struct tm));
16331 memset(&tm_w,'\0',sizeof(struct tm));
16332 strcpy(tz_e,e_tz);
16333 strcpy(tz_w,w_tz);
16334
16335 putenv(tz_e);
16336 localtime_r(&t, &tm_e);
16337
16338 putenv(tz_w);
16339 localtime_r(&t, &tm_w);
16340
16341 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16342 result = 1;
16343
16344 free(tz_e);free(tz_w);
16345 return result;
16346 }
16347 EOCP
16348 set try
16349 if eval $compile; then
16350 if $run ./try; then
16351 d_localtime_r_needs_tzset=undef;
16352 else
16353 d_localtime_r_needs_tzset=define;
16354 fi;
16355 else
16356 d_localtime_r_needs_tzset=undef;
16357 fi;
16358 ;;
16359 *)
16360 d_localtime_r_needs_tzset=undef;
16361 ;;
16362 esac
16363 $rm_try
16364
16365 : see if lockf exists
16366 set lockf d_lockf
16367 eval $inlibc
16368
16369 : see if log1p exists
16370 set log1p d_log1p
16371 eval $inlibc
16372
16373 : see if log2 exists
16374 set log2 d_log2
16375 eval $inlibc
16376
16377 : see if logb exists
16378 set logb d_logb
16379 eval $inlibc
16380
16381 : see if lrint exists
16382 set lrint d_lrint
16383 eval $inlibc
16384
16385 : see if lrintl exists
16386 set lrintl d_lrintl
16387 eval $inlibc
16388
16389 : see if lround exists
16390 set lround d_lround
16391 eval $inlibc
16392
16393 : see if lroundl exists
16394 set lroundl d_lroundl
16395 eval $inlibc
16396
16397 : see if prototype for lseek is available
16398 echo " "
16399 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16400 eval $hasproto
16401
16402 : see if lstat exists
16403 set lstat d_lstat
16404 eval $inlibc
16405
16406 : see if madvise exists
16407 set madvise d_madvise
16408 eval $inlibc
16409
16410 : see if malloc_size exists
16411 set malloc_size d_malloc_size
16412 eval $inlibc
16413
16414 : see if malloc_size_good exists
16415 set malloc_good_size d_malloc_good_size
16416 eval $inlibc
16417
16418 : see if malloc_usable_size exists
16419 set malloc_usable_size d_malloc_usable_size
16420 eval $inlibc
16421
16422 : see if mblen exists
16423 set mblen d_mblen
16424 eval $inlibc
16425
16426 : see if mbrlen exists
16427 set mbrlen d_mbrlen
16428 eval $inlibc
16429
16430 : see if mbrtowc exists
16431 set mbrtowc d_mbrtowc
16432 eval $inlibc
16433
16434 : see if mbstowcs exists
16435 set mbstowcs d_mbstowcs
16436 eval $inlibc
16437
16438 : see if mbtowc exists
16439 set mbtowc d_mbtowc
16440 eval $inlibc
16441
16442 : see if memmem exists
16443 : We need both a prototype in string.h and the symbol in libc.
16444 echo " "
16445 d_memmem_proto=''
16446 xx1="#$d_gnulibc HAS_GNULIBC"
16447 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16448 xx3='# define _GNU_SOURCE'
16449 xx4='#endif'
16450 set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16451 eval $hasproto
16452 case "$d_memmem_proto" in
16453 define) # see if memmem exists
16454 set memmem d_memmem
16455 eval $inlibc
16456 ;;
16457 *) val=$undef
16458 set d_memmem
16459 eval $setvar
16460 ;;
16461 esac
16462
16463 : see if memrchr exists
16464 : We need both a prototype in string.h and the symbol in libc.
16465 echo " "
16466 d_memrchr_proto=''
16467 xx1="#$d_gnulibc HAS_GNULIBC"
16468 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16469 xx3='# define _GNU_SOURCE'
16470 xx4='#endif'
16471 set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16472 eval $hasproto
16473 case "$d_memrchr_proto" in
16474 define) # see if memrchr exists
16475 set memrchr d_memrchr
16476 eval $inlibc
16477 ;;
16478 *) val=$undef
16479 set d_memrchr
16480 eval $setvar
16481 ;;
16482 esac
16483
16484 : see if mkdir exists
16485 set mkdir d_mkdir
16486 eval $inlibc
16487
16488 : see if mkdtemp exists
16489 set mkdtemp d_mkdtemp
16490 eval $inlibc
16491
16492 : see if mkfifo exists
16493 set mkfifo d_mkfifo
16494 eval $inlibc
16495
16496 : see if mkostemp exists
16497 set mkostemp d_mkostemp
16498 eval $inlibc
16499
16500 : see if mkstemp exists
16501 set mkstemp d_mkstemp
16502 eval $inlibc
16503
16504 : see if mkstemps exists
16505 set mkstemps d_mkstemps
16506 eval $inlibc
16507
16508 : see if mktime exists
16509 set mktime d_mktime
16510 eval $inlibc
16511
16512 : see if sys/mman.h has to be included
16513 set sys/mman.h i_sysmman
16514 eval $inhdr
16515
16516 : see if mmap exists
16517 set mmap d_mmap
16518 eval $inlibc
16519 : see what shmat returns
16520 : default to something harmless
16521 mmaptype='void *'
16522 case "$i_sysmman$d_mmap" in
16523 "$define$define")
16524 $cat >mmap.c <<'END'
16525 #include <sys/mman.h>
16526 void *mmap();
16527 END
16528 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16529 mmaptype='void *'
16530 else
16531 mmaptype='caddr_t'
16532 fi
16533 echo "and it returns ($mmaptype)." >&4
16534 ;;
16535 esac
16536
16537 : see if sqrtl exists
16538 set sqrtl d_sqrtl
16539 eval $inlibc
16540
16541 : see if scalbnl exists
16542 set scalbnl d_scalbnl
16543 eval $inlibc
16544
16545 : see if truncl exists
16546 set truncl d_truncl
16547 eval $inlibc
16548
16549 : see if modfl exists
16550 set modfl d_modfl
16551 eval $inlibc
16552
16553 : see if prototype for modfl is available
16554 echo " "
16555 set d_modflproto modfl define math.h
16556 eval $hasproto
16557
16558 if $test "$uselongdouble" = "$define"; then
16559 message=""
16560 if $test "$d_sqrtl" != "$define"; then
16561 message="$message sqrtl"
16562 fi
16563 if $test "$d_modfl" != "$define"; then
16564 if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16565 echo "You have both truncl and copysignl, so I can emulate modfl."
16566 else
16567 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16568 echo "You have both aintl and copysignl, so I can emulate modfl."
16569 else
16570 message="$message modfl"
16571 fi
16572 fi
16573 fi
16574 if $test "$d_frexpl" != "$define"; then
16575 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16576 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16577 else
16578 message="$message frexpl"
16579 fi
16580 fi
16581 if $test "$d_ldexpl" != "$define"; then
16582 message="$message ldexpl"
16583 fi
16584
16585 if $test "$message" != ""; then
16586 $cat <<EOM >&4
16587
16588 *** You requested the use of long doubles but you do not seem to have
16589 *** the following mathematical functions needed for long double support:
16590 *** $message
16591 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16592 *** Cannot continue, aborting.
16593
16594 EOM
16595
16596 exit 1
16597 fi
16598 fi
16599
16600 : see if mprotect exists
16601 set mprotect d_mprotect
16602 eval $inlibc
16603
16604 : see if msgctl exists
16605 set msgctl d_msgctl
16606 eval $inlibc
16607
16608 : see if msgget exists
16609 set msgget d_msgget
16610 eval $inlibc
16611
16612 : see if msgsnd exists
16613 set msgsnd d_msgsnd
16614 eval $inlibc
16615
16616 : see if msgrcv exists
16617 set msgrcv d_msgrcv
16618 eval $inlibc
16619
16620 : see how much of the 'msg*(2)' library is present.
16621 h_msg=true
16622 echo " "
16623 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16624 *"$undef"*) h_msg=false;;
16625 esac
16626 case "$osname" in
16627 freebsd)
16628 case "`ipcs 2>&1`" in
16629 "SVID messages"*"not configured"*)
16630 echo "Your $osname does not have the msg*(2) configured." >&4
16631 h_msg=false
16632 val="$undef"
16633 set msgctl d_msgctl
16634 eval $setvar
16635 set msgget d_msgget
16636 eval $setvar
16637 set msgsnd d_msgsnd
16638 eval $setvar
16639 set msgrcv d_msgrcv
16640 eval $setvar
16641 ;;
16642 esac
16643 ;;
16644 esac
16645 : we could also check for sys/ipc.h ...
16646 if $h_msg && $test `./findhdr sys/msg.h`; then
16647 echo "You have the full msg*(2) library." >&4
16648 val="$define"
16649 else
16650 echo "You don't have the full msg*(2) library." >&4
16651 val="$undef"
16652 fi
16653 set d_msg
16654 eval $setvar
16655
16656 : Check for msghdr_s
16657 echo " "
16658 echo "Checking to see if your system supports struct msghdr..." >&4
16659 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16660 eval $hasstruct
16661 case "$d_msghdr_s" in
16662 "$define") echo "Yes, it does." ;;
16663 *) echo "No, it doesn't." ;;
16664 esac
16665
16666 : see if msync exists
16667 set msync d_msync
16668 eval $inlibc
16669
16670 : see if munmap exists
16671 set munmap d_munmap
16672 eval $inlibc
16673
16674 : see if nan exists
16675 set nan d_nan
16676 eval $inlibc
16677
16678 : see if nanosleep exists
16679 set nanosleep d_nanosleep
16680 eval $inlibc
16681
16682 : see if nearbyint exists
16683 set nearbyint d_nearbyint
16684 eval $inlibc
16685
16686 : see if nextafter exists
16687 set nextafter d_nextafter
16688 eval $inlibc
16689
16690 : see if nexttoward exists
16691 set nexttoward d_nexttoward
16692 eval $inlibc
16693
16694 : see if nice exists
16695 set nice d_nice
16696 eval $inlibc
16697
16698 : see if this is a langinfo.h system
16699 set langinfo.h i_langinfo
16700 eval $inhdr
16701
16702 : see if nl_langinfo and/or nl_langinfo_l exist
16703 set nl_langinfo d_nl_langinfo
16704 eval $inlibc
16705 set nl_langinfo_l d_nl_langinfo_l
16706 eval $inlibc
16707
16708 : Look for non 'int'-sized bitfields
16709 case "$d_non_int_bitfields" in
16710 '')
16711 echo " " >&4
16712 echo "Checking whether your compiler can handle struct bitfields that aren't 'int' or 'unsigned int' ..." >&4
16713 $cat >try.c <<'EOCP'
16714 #include <stdio.h>
16715 struct foo {
16716 unsigned char byte:1;
16717 unsigned short halfword:1;
16718 } bar;
16719 EOCP
16720 if $cc $ccflags -c try.c >try.out 2>&1 ; then
16721 if $compiler_warning try.out >/dev/null 2>&1; then
16722 echo "Your C compiler doesn't support struct bitfields that aren't 'int' or 'unsigned int'." >&4
16723 val="$undef"
16724 else
16725 echo "Your C compiler supports struct bitfields besides 'int' and 'unsigned int'." >&4
16726 val="$define"
16727 fi
16728 else
16729 echo "Your C compiler doesn't seem to understand struct bitfields that aren't 'int' or 'unsigned int' at all." >&4
16730 val="$undef"
16731 fi
16732 ;;
16733 *) val="$d_non_int_bitfields" ;;
16734 esac
16735 set d_non_int_bitfields
16736 eval $setvar
16737 $rm_try
16738
16739 : see if this is a quadmath.h system
16740 set quadmath.h i_quadmath
16741 eval $inhdr
16742
16743 : Check basic sizes
16744 echo " "
16745 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16746
16747 case "$use64bitint:$d_quad:$quadtype" in
16748 define:define:?*)
16749 ivtype="$quadtype"
16750 uvtype="$uquadtype"
16751 ivsize=8
16752 uvsize=8
16753 ;;
16754 *) ivtype="long"
16755 uvtype="unsigned long"
16756 ivsize=$longsize
16757 uvsize=$longsize
16758 ;;
16759 esac
16760
16761 case "$uselongdouble:$d_longdbl" in
16762 define:define)
16763 nvtype="long double"
16764 nvsize=$longdblsize
16765 ;;
16766 *) nvtype=double
16767 nvsize=$doublesize
16768 ;;
16769 esac
16770
16771 case "$usequadmath:$i_quadmath" in
16772 define:define)
16773 nvtype="__float128"
16774 nvsize=16
16775 : libquadmath is not in the usual places, and the place
16776 : changes if the compiler is upgraded. So ask the compiler if it
16777 : can find it.
16778 : We do not need to save this, if it fails we abort.
16779 libs="$libs -lquadmath"
16780 set try
16781 $cat >try.c <<EOM
16782 #include <quadmath.h>
16783 #include <stdio.h>
16784 int main(int argc, char *argv[]) {
16785 __float128 x = 1.0;
16786 if (fabsq(logq(x)) > 1e-6) {
16787 fputs("quadmath is broken\n", stderr);
16788 return 1;
16789 }
16790 puts("define");
16791 return 0;
16792 }
16793 EOM
16794 yyy=''
16795 if eval $compile_ok; then
16796 yyy=`$run ./try`
16797 case "$yyy" in
16798 define) ;;
16799 *) cat <<EOM >&4
16800
16801 *** You requested the use of the quadmath library, but
16802 *** it appears to be nonfunctional.
16803 *** Cannot continue, aborting.
16804
16805 EOM
16806 exit 1
16807 ;;
16808 esac
16809 else
16810 $cat <<EOM >&4
16811
16812 *** You requested the use of the quadmath library, but you
16813 *** do not seem to have the quadmath library installed.
16814 *** Cannot continue, aborting.
16815 EOM
16816 exit 1
16817 fi
16818 ;;
16819 define:*) $cat <<EOM >&4
16820
16821 *** You requested the use of the quadmath library, but you
16822 *** do not seem to have the required header, <quadmath.h>.
16823 EOM
16824 case "$gccversion" in
16825 [23].*|4.[0-5]*)
16826 $cat <<EOM >&4
16827 *** Your gcc looks a bit old:
16828 *** $gccversion
16829 EOM
16830 ;;
16831 '')
16832 $cat <<EOM >&4
16833 *** You are not running a gcc.
16834 EOM
16835 ;;
16836 esac
16837 $cat <<EOM >&4
16838 *** For the quadmath library you need at least gcc 4.6.
16839 *** Cannot continue, aborting.
16840 EOM
16841 exit 1
16842 ;;
16843 esac
16844
16845 $echo "(IV will be "$ivtype", $ivsize bytes)"
16846 $echo "(UV will be "$uvtype", $uvsize bytes)"
16847 $echo "(NV will be "$nvtype", $nvsize bytes)"
16848
16849 $cat >try.c <<EOCP
16850 #$i_inttypes I_INTTYPES
16851 #ifdef I_INTTYPES
16852 #include <inttypes.h>
16853 #endif
16854 #include <stdio.h>
16855 int main() {
16856 #ifdef INT8
16857 int8_t i = INT8_MAX;
16858 uint8_t u = UINT8_MAX;
16859 printf("int8_t\n");
16860 #endif
16861 #ifdef INT16
16862 int16_t i = INT16_MAX;
16863 uint16_t u = UINT16_MAX;
16864 printf("int16_t\n");
16865 #endif
16866 #ifdef INT32
16867 int32_t i = INT32_MAX;
16868 uint32_t u = UINT32_MAX;
16869 printf("int32_t\n");
16870 #endif
16871 }
16872 EOCP
16873
16874 i8type="signed char"
16875 u8type="unsigned char"
16876 i8size=1
16877 u8size=1
16878
16879 case "$i16type" in
16880 '') case "$shortsize" in
16881 2) i16type=short
16882 u16type="unsigned short"
16883 i16size=$shortsize
16884 u16size=$shortsize
16885 ;;
16886 esac
16887 ;;
16888 esac
16889 case "$i16type" in
16890 '') set try -DINT16
16891 if eval $compile; then
16892 case "`$run ./try`" in
16893 int16_t)
16894 i16type=int16_t
16895 u16type=uint16_t
16896 i16size=2
16897 u16size=2
16898 ;;
16899 esac
16900 fi
16901 ;;
16902 esac
16903 case "$i16type" in
16904 '') if $test $shortsize -ge 2; then
16905 i16type=short
16906 u16type="unsigned short"
16907 i16size=$shortsize
16908 u16size=$shortsize
16909 fi
16910 ;;
16911 esac
16912
16913 case "$i32type" in
16914 '') case "$longsize" in
16915 4) i32type=long
16916 u32type="unsigned long"
16917 i32size=$longsize
16918 u32size=$longsize
16919 ;;
16920 *) case "$intsize" in
16921 4) i32type=int
16922 u32type="unsigned int"
16923 i32size=$intsize
16924 u32size=$intsize
16925 ;;
16926 esac
16927 ;;
16928 esac
16929 ;;
16930 esac
16931 case "$i32type" in
16932 '') set try -DINT32
16933 if eval $compile; then
16934 case "`$run ./try`" in
16935 int32_t)
16936 i32type=int32_t
16937 u32type=uint32_t
16938 i32size=4
16939 u32size=4
16940 ;;
16941 esac
16942 fi
16943 ;;
16944 esac
16945 case "$i32type" in
16946 '') if $test $intsize -ge 4; then
16947 i32type=int
16948 u32type="unsigned int"
16949 i32size=$intsize
16950 u32size=$intsize
16951 fi
16952 ;;
16953 esac
16954
16955 case "$i64type" in
16956 '') case "$d_quad:$quadtype" in
16957 define:?*)
16958 i64type="$quadtype"
16959 u64type="$uquadtype"
16960 i64size=8
16961 u64size=8
16962 ;;
16963 esac
16964 ;;
16965 esac
16966
16967 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16968 $cat <<EOP >try.c
16969 #include <stdio.h>
16970 #$i_stdlib I_STDLIB
16971 #ifdef I_STDLIB
16972 #include <stdlib.h>
16973 #endif
16974 #$i_inttypes I_INTTYPES
16975 #ifdef I_INTTYPES
16976 #include <inttypes.h>
16977 #endif
16978 #include <sys/types.h>
16979 #include <signal.h>
16980 #ifdef SIGFPE
16981 /* volatile so that the compiler has to store it out to memory */
16982 volatile int bletched = 0;
16983 $signal_t blech(int s) { bletched = 1; }
16984 #endif
16985 int main() {
16986 $uvtype u = 0;
16987 $nvtype d;
16988 int n = 8 * $uvsize;
16989 int i;
16990 #ifdef SIGFPE
16991 signal(SIGFPE, blech);
16992 #endif
16993
16994 for (i = 0; i < n; i++) {
16995 u = u << 1 | ($uvtype)1;
16996 d = ($nvtype)u;
16997 if (($uvtype)d != u)
16998 break;
16999 if (d <= 0)
17000 break;
17001 d = ($nvtype)(u - 1);
17002 if (($uvtype)d != (u - 1))
17003 break;
17004 #ifdef SIGFPE
17005 if (bletched)
17006 break;
17007 #endif
17008 }
17009 printf("%d\n", ((i == n) ? -n : i));
17010 exit(0);
17011 }
17012 EOP
17013 set try
17014
17015 d_nv_preserves_uv="$undef"
17016 if eval $compile; then
17017 nv_preserves_uv_bits="`$run ./try`"
17018 fi
17019 case "$nv_preserves_uv_bits" in
17020 \-[1-9]*)
17021 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
17022 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." >&4
17023 d_nv_preserves_uv="$define"
17024 ;;
17025 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." >&4
17026 d_nv_preserves_uv="$undef" ;;
17027 *) $echo "Can't figure out how many bits your NVs preserve." >&4
17028 nv_preserves_uv_bits="0" ;;
17029 esac
17030 $rm_try
17031
17032 $echo "Checking to find the largest integer value your NVs can hold..." >&4
17033 $cat <<EOP >try.c
17034 #include <stdio.h>
17035
17036 typedef $nvtype NV;
17037
17038 int
17039 main() {
17040 NV value = 2;
17041 int count = 1;
17042
17043 while(count < 256) {
17044 /* volatile so that the compiler has to store it out to memory */
17045 volatile NV up = value + 1.0;
17046 volatile NV negated = -value;
17047 volatile NV down = negated - 1.0;
17048 volatile NV got_up = up - value;
17049 int up_good = got_up == 1.0;
17050 int got_down = down - negated;
17051 int down_good = got_down == -1.0;
17052
17053 if (down_good != up_good) {
17054 fprintf(stderr,
17055 "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
17056 up_good, (double) got_up, down_good, (double) got_down,
17057 count, (double) value);
17058 return 1;
17059 }
17060 if (!up_good) {
17061 while (1) {
17062 if (count > 8) {
17063 count -= 8;
17064 fputs("256.0", stdout);
17065 } else {
17066 count--;
17067 fputs("2.0", stdout);
17068 }
17069 if (!count) {
17070 puts("");
17071 return 0;
17072 }
17073 fputs("*", stdout);
17074 }
17075 }
17076 value *= 2;
17077 ++count;
17078 }
17079 fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
17080 count, (double) value);
17081 return 1;
17082 }
17083 EOP
17084 set try
17085
17086 nv_overflows_integers_at='0'
17087 if eval $compile; then
17088 xxx="`$run ./try`"
17089 case "$?" in
17090 0)
17091 case "$xxx" in
17092 2*) cat >&4 <<EOM
17093 The largest integer your NVs can preserve is equal to $xxx
17094 EOM
17095 nv_overflows_integers_at="$xxx"
17096 ;;
17097 *) cat >&4 <<EOM
17098 Cannot determine the largest integer value your NVs can hold, unexpected output
17099 '$xxx'
17100 EOM
17101 ;;
17102 esac
17103 ;;
17104 *) cat >&4 <<EOM
17105 Cannot determine the largest integer value your NVs can hold
17106 EOM
17107 ;;
17108 esac
17109 fi
17110 $rm_try
17111
17112 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
17113 $cat <<EOP >try.c
17114 #include <stdio.h>
17115 #$i_stdlib I_STDLIB
17116 #ifdef I_STDLIB
17117 #include <stdlib.h>
17118 #endif
17119 #include <string.h>
17120 #include <sys/types.h>
17121 #include <signal.h>
17122 #ifdef SIGFPE
17123 /* volatile so that the compiler has to store it out to memory */
17124 volatile int bletched = 0;
17125 $signal_t blech(int s) { bletched = 1; }
17126 #endif
17127
17128 int checkit($nvtype d, const char *where) {
17129 void *v = &d;
17130 unsigned char *p = (unsigned char *)v;
17131 unsigned char *end = p + sizeof(d);
17132 int fail = 0;
17133
17134 while (p < end)
17135 fail += *p++;
17136
17137 if (!fail)
17138 return 0;
17139
17140 p = (unsigned char *)v;
17141 printf("No - %s: 0x", where);
17142 while (p < end)
17143 printf ("%02X", *p++);
17144 printf("\n");
17145 return 1;
17146 }
17147
17148 int main(int argc, char **argv) {
17149 $nvtype d = 0.0;
17150 int fail = 0;
17151 fail += checkit(d, "0.0");
17152
17153 /* The compiler shouldn't be assuming that bletched is 0 */
17154 d = bletched;
17155
17156 fail += checkit(d, "bleched");
17157
17158 #ifdef SIGFPE
17159 signal(SIGFPE, blech);
17160 #endif
17161
17162 /* Paranoia - the compiler should have no way of knowing that ANSI says
17163 that argv[argc] will always be NULL. Actually, if it did assume this it
17164 would be buggy, as this is C and main() can be called from elsewhere in
17165 the program. */
17166 d = argv[argc] ? 1 : 0;
17167
17168 if (d) {
17169 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17170 }
17171
17172 fail += checkit(d, "ternary");
17173
17174 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17175
17176 if (d != 0.0) {
17177 printf("No - memset doesn't give 0.0\n");
17178 /* This might just blow up: */
17179 printf("(gives %g)\n", d);
17180 return 1;
17181 }
17182
17183 #ifdef SIGFPE
17184 if (bletched) {
17185 printf("No - something bleched\n");
17186 return 1;
17187 }
17188 #endif
17189 if (fail) {
17190 printf("No - %d fail(s)\n", fail);
17191 return 1;
17192 }
17193 printf("Yes\n");
17194 return 0;
17195 }
17196 EOP
17197 set try
17198
17199 d_nv_zero_is_allbits_zero="$undef"
17200 if eval $compile; then
17201 xxx="`$run ./try`"
17202 case "$?" in
17203 0)
17204 case "$xxx" in
17205 Yes) cat >&4 <<EOM
17206 0.0 is represented as all bits zero in memory
17207 EOM
17208 d_nv_zero_is_allbits_zero="$define"
17209 ;;
17210 *) cat >&4 <<EOM
17211 0.0 is not represented as all bits zero in memory
17212 EOM
17213 d_nv_zero_is_allbits_zero="$undef"
17214 ;;
17215 esac
17216 ;;
17217 *) cat >&4 <<EOM
17218 0.0 is not represented as all bits zero in memory
17219 EOM
17220 d_nv_zero_is_allbits_zero="$undef"
17221 ;;
17222 esac
17223 fi
17224 $rm_try
17225
17226 : check for off64_t
17227 echo " "
17228 echo "Checking to see if you have off64_t..." >&4
17229 $cat >try.c <<EOCP
17230 #include <sys/types.h>
17231 #include <unistd.h>
17232 int main() { off64_t x = 7; }
17233 EOCP
17234 set try
17235 if eval $compile; then
17236 val="$define"
17237 echo "You have off64_t."
17238 else
17239 val="$undef"
17240 echo "You do not have off64_t."
17241 case "$lseeksize" in
17242 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17243 esac
17244 fi
17245 $rm_try
17246 set d_off64_t
17247 eval $setvar
17248
17249 : how to create joinable pthreads
17250 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17251 echo " "
17252 echo "Checking what constant to use for creating joinable pthreads..." >&4
17253 $cat >try.c <<'EOCP'
17254 #include <pthread.h>
17255 int main() {
17256 int detachstate = JOINABLE;
17257 }
17258 EOCP
17259 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17260 if eval $compile; then
17261 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17262 val="$undef" # Yes, undef.
17263 set d_old_pthread_create_joinable
17264 eval $setvar
17265 val=""
17266 set old_pthread_create_joinable
17267 eval $setvar
17268 else
17269 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17270 if eval $compile; then
17271 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17272 val="$define"
17273 set d_old_pthread_create_joinable
17274 eval $setvar
17275 val=PTHREAD_CREATE_UNDETACHED
17276 set old_pthread_create_joinable
17277 eval $setvar
17278 else
17279 set try -DJOINABLE=__UNDETACHED
17280 if eval $compile; then
17281 echo "You seem to use __UNDETACHED." >&4
17282 val="$define"
17283 set d_old_pthread_create_joinable
17284 eval $setvar
17285 val=__UNDETACHED
17286 set old_pthread_create_joinable
17287 eval $setvar
17288 else
17289 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
17290 val="$define"
17291 set d_old_pthread_create_joinable
17292 eval $setvar
17293 val=0
17294 set old_pthread_create_joinable
17295 eval $setvar
17296 fi
17297 fi
17298 fi
17299 $rm_try
17300 else
17301 d_old_pthread_create_joinable="$undef"
17302 old_pthread_create_joinable=""
17303 fi
17304
17305 : see if pause exists
17306 set pause d_pause
17307 eval $inlibc
17308
17309 : see if locale.h is available
17310 set locale.h i_locale
17311 eval $inhdr
17312
17313 : see if this system has wctype.h
17314 set wctype.h i_wctype
17315 eval $inhdr
17316
17317 : see if towupper exists
17318 set towupper d_towupper
17319 eval $inlibc
17320
17321 : check for setlocale function and behavior
17322 case "$d_setlocale" in
17323 '')
17324 $cat >&4 <<EOM
17325
17326 Checking to see if you have setlocale() and its behavior
17327 EOM
17328 $cat >try.c <<EOCP
17329 #include <stdlib.h>
17330 #include <string.h>
17331 #$i_locale I_LOCALE
17332 #ifdef I_LOCALE
17333 # include <locale.h>
17334 #endif
17335 #$i_wctype I_WCTYPE
17336 #ifdef I_WCTYPE
17337 # include <wctype.h>
17338 #endif
17339
17340 int main() {
17341 const char * invalid_name = "\a"; /* This is really invalid! */
17342 int accepts_any_locale_name = 0;
17343 int has_C_UTF8 = 0;
17344 unsigned char bad_setlocale = 255;
17345
17346 /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
17347 * disabled. It's hard to imagine an instance where meaningful locale
17348 * handling could be done without LC_CTYPE */
17349 const char * name = setlocale(LC_CTYPE, "C");
17350
17351 if (name == NULL || strcmp(name, "C") != 0) {
17352 exit(bad_setlocale);
17353 }
17354
17355 name = setlocale(LC_CTYPE, invalid_name);
17356 if (name != NULL) {
17357
17358 /* Let it pass if it accepts the name but gives back one of the C
17359 * locales */
17360 if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
17361 accepts_any_locale_name = 1;
17362 }
17363 }
17364
17365 name = setlocale(LC_CTYPE, "C.UTF-8");
17366 if (name != NULL) {
17367 unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
17368
17369 #$d_towupper HAS_TOWUPPER
17370 #ifdef HAS_TOWUPPER
17371
17372 /* We assume that if the machine doesn't have the C99 towupper, it
17373 * doesn't have C.UTF-8, even if we successfully changed locales to
17374 * include it. This seems safer even on platforms that didn't accept
17375 * the really invalid name */
17376
17377 if (towupper(y_with_diaeresis) == 0x178) {
17378 has_C_UTF8 = 1;
17379 }
17380
17381 #endif
17382
17383 }
17384
17385 exit( 0 /* (separator - min_separator) << 3
17386 | uses_name_value_pair_names << 2
17387 */
17388 | has_C_UTF8 << 1
17389 | accepts_any_locale_name);
17390
17391 }
17392 EOCP
17393 val=
17394 set d_setlocale
17395 eval $setvar
17396 case $d_setlocale in
17397 $undef) d_setlocale_accepts_any_locale_name="$undef"
17398 d_has_C_UTF8="false"
17399 ;;
17400 *) set try
17401 if eval $compile; then
17402 echo "Your system has setlocale()..." >&4
17403 $run ./try
17404 case $? in
17405 0) echo "and it seems sane; you don't have a C.UTF-8 locale" >&4
17406 d_setlocale="$define"
17407 d_setlocale_accepts_any_locale_name="$undef"
17408 d_has_C_UTF8="false"
17409 ;;
17410 1) echo "and it seems sane, but accepts any locale name as valid" >&4
17411 d_setlocale="$define"
17412 d_setlocale_accepts_any_locale_name="$define"
17413 d_has_C_UTF8="false"
17414 ;;
17415 2) echo "and it seems sane; you have a C.UTF-8 locale" >&4
17416 d_setlocale="$define"
17417 d_setlocale_accepts_any_locale_name="$undef"
17418 d_has_C_UTF8="true"
17419 ;;
17420 3) echo "and it seems sane, but accepts any locale name as valid" >&4
17421 d_setlocale="$define"
17422 d_setlocale_accepts_any_locale_name="$define"
17423 d_has_C_UTF8="true"
17424 ;;
17425 *) echo "but it doesn't seem to work, so we won't use it." >&4
17426 d_setlocale="$undef"
17427 d_setlocale_accepts_any_locale_name="$undef"
17428 d_has_C_UTF8="false"
17429 ;;
17430 esac
17431 else
17432 echo "your system does not have setlocale()" >&4
17433 d_setlocale="$undef"
17434 d_setlocale_accepts_any_locale_name="$undef"
17435 d_has_C_UTF8="false"
17436 fi
17437 esac
17438 $rm_try
17439 ;;
17440 *) val="$d_setlocale"
17441 set d_setlocale
17442 eval $setvar
17443 case "$d_setlocale" in
17444 $undef) echo "There may be other ways to set the locale on your system, so we need to ask:" >&4
17445 ;;
17446 esac
17447 rp="Does your system have the C.UTF-8 locale?"
17448 dflt=n
17449 . ./myread
17450 case "$ans" in
17451 [Yy]*) d_has_C_UTF8="true"
17452 c_utf8_locale=" or C.UTF-8"
17453 ;;
17454 *) d_has_C_UTF8="false"
17455 c_utf8_locale=""
17456 ;;
17457 esac
17458 case "$d_setlocale" in
17459 $define)
17460 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
17461 dflt=n
17462 . ./myread
17463 case "$ans" in
17464 true|[Yy]*)
17465 d_setlocale_accepts_any_locale_name="$define"
17466 ;;
17467 *) d_setlocale_accepts_any_locale_name="$undef"
17468 ;;
17469 esac
17470 ;;
17471 *) d_setlocale_accepts_any_locale_name="$undef"
17472 ;;
17473 esac
17474 esac
17475
17476 : Check the syntax of LC_ALL when categories are set to different locales
17477 echo " "
17478 $echo "Checking the syntax of LC_ALL when categories are set to different locales..." >&4
17479
17480 case $d_setlocale in
17481 $define)
17482 $rm -f try try.*
17483 $cat >try.c <<'EOF'
17484 #include <limits.h>
17485 #include <locale.h>
17486 #include <stdlib.h>
17487 #include <string.h>
17488 #include <stdio.h>
17489
17490 #ifndef LC_ALL
17491
17492 int
17493 main (const int argc, const char ** argv)
17494 {
17495 }
17496
17497 #else
17498 # define C_ARRAY_LENGTH(a) (sizeof(a)/sizeof((a)[0]))
17499 # define strEQ(s1,s2) (strcmp(s1,s2) == 0)
17500 # define strNE(s1,s2) (strcmp(s1,s2) != 0)
17501 # define Copy(s,d,n,t) (void)memcpy((char*)(d),(const char*)(s), (n) * sizeof(t))
17502 # define memEQ(s1,s2,l) (memcmp(((const void *) (s1)), ((const void *) (s2)), l) == 0)
17503 # define memNE(s1,s2,l) (! memEQ(s1,s2,l))
17504
17505 int
17506 main (const int argc, const char ** argv)
17507 {
17508
17509 int debug = 0;
17510
17511 /* All categories Perl knows about on any system. If any are missing, this
17512 * won't work for that system, and they must be added here and in perl.h,
17513 * locale.c */
17514 const int categories[] = {
17515
17516 # ifdef LC_CTYPE
17517 LC_CTYPE,
17518 # endif
17519 # ifdef LC_NUMERIC
17520 LC_NUMERIC,
17521 # endif
17522 # ifdef LC_COLLATE
17523 LC_COLLATE,
17524 # endif
17525 # ifdef LC_TIME
17526 LC_TIME,
17527 # endif
17528 # ifdef LC_MESSAGES
17529 LC_MESSAGES,
17530 # endif
17531 # ifdef LC_MONETARY
17532 LC_MONETARY,
17533 # endif
17534 # ifdef LC_ADDRESS
17535 LC_ADDRESS,
17536 # endif
17537 # ifdef LC_IDENTIFICATION
17538 LC_IDENTIFICATION,
17539 # endif
17540 # ifdef LC_MEASUREMENT
17541 LC_MEASUREMENT,
17542 # endif
17543 # ifdef LC_PAPER
17544 LC_PAPER,
17545 # endif
17546 # ifdef LC_TELEPHONE
17547 LC_TELEPHONE,
17548 # endif
17549 # ifdef LC_NAME
17550 LC_NAME,
17551 # endif
17552 # ifdef LC_SYNTAX
17553 LC_SYNTAX,
17554 # endif
17555 # ifdef LC_TOD
17556 LC_TOD
17557 # endif
17558
17559 };
17560
17561 const char * category_names[] = {
17562
17563 # ifdef LC_CTYPE
17564 "LC_CTYPE",
17565 # endif
17566 # ifdef LC_NUMERIC
17567 "LC_NUMERIC",
17568 # endif
17569 # ifdef LC_COLLATE
17570 "LC_COLLATE",
17571 # endif
17572 # ifdef LC_TIME
17573 "LC_TIME",
17574 # endif
17575 # ifdef LC_MESSAGES
17576 "LC_MESSAGES",
17577 # endif
17578 # ifdef LC_MONETARY
17579 "LC_MONETARY",
17580 # endif
17581 # ifdef LC_ADDRESS
17582 "LC_ADDRESS",
17583 # endif
17584 # ifdef LC_IDENTIFICATION
17585 "LC_IDENTIFICATION",
17586 # endif
17587 # ifdef LC_MEASUREMENT
17588 "LC_MEASUREMENT",
17589 # endif
17590 # ifdef LC_PAPER
17591 "LC_PAPER",
17592 # endif
17593 # ifdef LC_TELEPHONE
17594 "LC_TELEPHONE",
17595 # endif
17596 # ifdef LC_NAME
17597 "LC_NAME",
17598 # endif
17599 # ifdef LC_SYNTAX
17600 "LC_SYNTAX",
17601 # endif
17602 # ifdef LC_TOD
17603 "LC_TOD"
17604 # endif
17605
17606 };
17607
17608 char alternate[1024] = { '\0' } ;
17609
17610 /* This is a list of locales that are likely to be found on any machine
17611 * (Windows and non-Windows) */
17612 const char * candidates[] = {
17613 "POSIX",
17614 "C.UTF-8",
17615 "en_US",
17616 "en_US.UTF-8",
17617 "American",
17618 "English"
17619 };
17620 char separator[1024];
17621 size_t separator_len = 0;
17622 unsigned int distincts_count = 0;
17623
17624 /* We look through the candidates for one which returns the same non-C
17625 * locale for every category */
17626 for (unsigned int i = 0; i < C_ARRAY_LENGTH(candidates); i++) {
17627 const char * candidate = candidates[i];
17628 distincts_count = 0;
17629 alternate[0] = '\0';
17630
17631 for (unsigned int j = 0; j < C_ARRAY_LENGTH(categories); j++) {
17632 const int category = categories[j];
17633 const char * locale_name = setlocale(category, candidate);
17634
17635 if (locale_name == NULL) { /* Not on this system */
17636 break;
17637 }
17638
17639 if (debug) fprintf(stderr,
17640 "i=%d,j=%d;"
17641 " Return of setlocale(%d=%s, '%s') is '%s'\n",
17642 i, j,
17643 category, category_names[j],
17644 candidate, locale_name);
17645
17646 /* If the candidate is indistinguishable from C, break to try the
17647 * next candidate */
17648 if (strEQ(locale_name, "C")) {
17649 break;
17650 }
17651
17652 /* Save the name the first time through, and on subsequent ones */
17653 /* make sure the name is the same as before, so the code below can
17654 * be assured of finding it when searching */
17655 if (j == 0) {
17656 strncpy(alternate, locale_name, sizeof(alternate));
17657 }
17658 else if (strNE(alternate, locale_name)) {
17659 break;
17660 }
17661
17662 distincts_count++;
17663 }
17664
17665 /* Done with this candidate. If every category returned the same non-C
17666 * name, this candidate works. It not, loop to try the next candidate
17667 * */
17668 if (distincts_count == C_ARRAY_LENGTH(categories)) {
17669 break;
17670 }
17671 }
17672
17673 /* Here, either found a suitable candidate, or exhausted the possibilities.
17674 * In the latter case, give up */
17675 if (distincts_count < C_ARRAY_LENGTH(categories)) {
17676 fprintf(stderr, "Couldn't find a locale distinguishable from C\n");
17677 return 1;
17678 }
17679
17680 /* An example syntax, from cygwin, is:
17681 * LC_COLLATE/LC_CTYPE/LC_MONETARY/LC_NUMERIC/LC_TIME/LC_MESSAGES
17682 * The locales for a given category are always in the same position,
17683 * indicated above, with a slash separating them */
17684
17685 int map_LC_ALL_position_to_category[C_ARRAY_LENGTH(categories)];
17686
17687 /* Initialize */
17688 for (unsigned int i = 0; i < C_ARRAY_LENGTH(categories); i++) {
17689 map_LC_ALL_position_to_category[i] = INT_MAX;
17690 }
17691
17692 const char * lc_all = NULL;
17693
17694 /* We need to find the category that goes in each position */
17695 for (unsigned int i = 0; i < C_ARRAY_LENGTH(categories); i++) {
17696
17697 /* First set everything to 'C' */
17698 if (! setlocale(LC_ALL, "C")) {
17699 fprintf(stderr, "Failed to set LC_ALL to C\n");
17700 return 1;
17701 }
17702
17703 /* Then set this category to the alternate */
17704 if (! setlocale(categories[i], alternate)) {
17705 fprintf(stderr, "Failed to set %d to to '%s'\n",
17706 categories[i], alternate);
17707 return 1;
17708 }
17709
17710 /* Then find what the system says LC_ALL looks like with just this one
17711 * category not set to 'C' */
17712 lc_all = setlocale(LC_ALL, NULL);
17713 if (! lc_all) {
17714 fprintf(stderr, "Failed to retrieve LC_ALL\n");
17715 return 1;
17716 }
17717
17718 if (debug) fprintf(stderr, "LC_ALL is '%s'\n", lc_all);
17719
17720 /* Assume is name=value pairs if the result contains both an equals and
17721 * a semi-colon. */
17722 if (strchr(lc_all, '=') && strchr(lc_all, ';')) {
17723 fprintf(stdout, "\"=;\"\n\n");
17724 return 0;
17725 }
17726
17727 /* Here isn't name=value pairs. Find the position of the alternate */
17728 const char * alt_pos = strstr(lc_all, alternate);
17729 if (! alt_pos) {
17730 fprintf(stderr, "Couldn't find '%s' in '%s'\n", alternate, lc_all);
17731 return 1;
17732 }
17733
17734 /* Parse the LC_ALL string from the beginning up to where the alternate
17735 * locale is */
17736 const char * s = lc_all;
17737 int count = 0;
17738 while (s < alt_pos) {
17739
17740 /* Count the 'C' locales before the non-C one. (Note the letter
17741 * 'C' can only occur as the entire 'C' locale, since all of them
17742 * are that locale before 'alt_pos') */
17743 const char * next_C = (const char *) memchr(s, 'C', alt_pos - s);
17744 if (next_C) {
17745 count++;
17746 s = next_C + 1;
17747 continue;
17748 }
17749
17750 /* Here, there is no 'C' between 's' and the alternate locale, so
17751 * 'count' gives the total number of occurrences of 'C' in that
17752 * span. If count is 0, this is the first category in an LC_ALL
17753 * string, and we know its position, but not the separator. */
17754 if (count == 0) {
17755 break;
17756 }
17757
17758 /* When 'count' isn't 0, 's' points to one past the previous 'C'.
17759 * The separator starts here, ending just before the non-C locale.
17760 */
17761
17762 const char * new_sep = s;
17763 unsigned int new_sep_len = alt_pos - s;
17764
17765 /* If we don't already have a separator saved, save this as it */
17766 if (separator_len == 0) {
17767 separator_len = new_sep_len;
17768 Copy(s, separator, separator_len, char);
17769 separator[separator_len] = '\0';
17770 }
17771 else { /* Otherwise make sure it's the same string as previously
17772 * calculated */
17773 if ( new_sep_len != separator_len
17774 || memNE(separator, new_sep, separator_len))
17775 {
17776 fprintf(stderr, "Unexpectedly got distinct separators"
17777 " '%s' vs '%s\n", separator, new_sep);
17778 return 1;
17779 }
17780 }
17781
17782 /* Here, we have found the position of category[i] in LC_ALL. */
17783 break;
17784
17785 } /* End of loop parsing the LC_ALL string */
17786
17787 if (map_LC_ALL_position_to_category[count] != INT_MAX) {
17788 fprintf(stderr, "Categories %d and %d both appear to occupy"
17789 " position %d in LC_ALL; there is something"
17790 " wrong with the calculation\n",
17791 categories[count], categories[i],
17792 count);
17793 return 1;
17794 }
17795
17796 /* Save the position of this category */
17797 map_LC_ALL_position_to_category[count] = categories[i];
17798
17799 } /* End of loop through all the categories */
17800
17801 fprintf(stdout, "\"%s\"\n{", separator);
17802 for (unsigned int i = 0; i < C_ARRAY_LENGTH(categories) - 1; i++) {
17803 fprintf(stdout, " %d,", map_LC_ALL_position_to_category[i]);
17804 }
17805 fprintf(stdout, " %d }\n", map_LC_ALL_position_to_category[
17806 C_ARRAY_LENGTH(categories) - 1]);
17807 return 0;
17808
17809 }
17810
17811 #endif
17812 EOF
17813 set try
17814 if eval $compile_ok; then
17815 output=`$run ./try 2>/dev/null`
17816 separator=`echo "$output" | $sed 1q`
17817 case $separator in
17818 "\"=;\"")
17819 d_perl_lc_all_uses_name_value_pairs="$define"
17820 d_perl_lc_all_separator="$undef"
17821 perl_lc_all_separator=
17822 d_perl_lc_all_category_positions_init="$undef"
17823 perl_lc_all_category_positions_init=
17824 ;;
17825 "") d_perl_lc_all_uses_name_value_pairs="$undef"
17826 d_perl_lc_all_separator="$undef"
17827 perl_lc_all_separator=
17828 d_perl_lc_all_category_positions_init="$undef"
17829 perl_lc_all_category_positions_init=
17830 ;;
17831 *) d_perl_lc_all_uses_name_value_pairs="$undef"
17832 d_perl_lc_all_separator="$define"
17833 perl_lc_all_separator="$separator"
17834 d_perl_lc_all_category_positions_init="$define"
17835 perl_lc_all_category_positions_init=`echo "$output" | sed -n 2p`
17836 ;;
17837 esac
17838 else
17839 $echo "Failed to compile lc_all probe" >&4
17840 fi
17841 $rm -f try try.*
17842 ;;
17843 *) d_perl_lc_all_separator="$undef"
17844 perl_lc_all_separator=
17845 d_perl_lc_all_category_positions_init="$undef"
17846 perl_lc_all_category_positions_init=
17847
17848 # No setlocale(), but using this default allows our code to compile
17849 # and run without having to have a bunch more #ifdef's
17850 d_perl_lc_all_uses_name_value_pairs="$define"
17851 ;;
17852 esac
17853
17854 : see if pipe2 exists
17855 set pipe2 d_pipe2
17856 eval $inlibc
17857
17858 : see if poll exists
17859 set poll d_poll
17860 eval $inlibc
17861
17862 : see if prctl exists
17863 set prctl d_prctl
17864 eval $inlibc
17865
17866 : see if prctl supports PR_SET_NAME
17867 d_prctl_set_name=$undef
17868 case $d_prctl in
17869 $define)
17870 $cat >try.c <<EOM
17871 #ifdef __ANDROID__
17872 #include <unistd.h>
17873 #endif
17874 #include <sys/prctl.h>
17875
17876 int main (int argc, char *argv[])
17877 {
17878 return (prctl (PR_SET_NAME, "Test"));
17879 } /* main */
17880 EOM
17881 set try
17882 if eval $compile_ok && $run ./try; then
17883 echo "Your prctl (PR_SET_NAME, ...) works"
17884 d_prctl_set_name=$define
17885 fi
17886 $rm_try
17887 ;;
17888 esac
17889
17890 : see if readlink exists
17891 set readlink d_readlink
17892 eval $inlibc
17893
17894 : Check if there is a /proc symlink to the abs path of
17895 : the executing program. We will honor hints of d_procselfexe=$undef
17896 : or procselfexe being non-empty, otherwise will try to determine both
17897 : if we have readlink.
17898 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17899 : referenced, and AmigaOS does not have a proc filesystem anyway.
17900 echo " "
17901 val="$undef"
17902 if $test "X$d_procselfexe" = Xundef; then
17903 procselfexe=''
17904 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17905 val="$define"
17906 elif $test "X$d_readlink" = Xdefine; then
17907 : NetBSD first as /proc/self is a symlink to /proc/curproc,
17908 : and it feels more tidy to avoid an extra level of symlink
17909 set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17910 while test $# -gt 0; do
17911 type=$1; try=$2
17912 shift; shift
17913 if $issymlink $try; then
17914 $ls -l $try > reflect
17915 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17916 echo "You have $type-like $try."
17917 procselfexe='"'$try'"'
17918 val="$define"
17919 : This will break out of the loop
17920 set X; shift
17921 fi
17922 fi
17923 done
17924 fi
17925 $rm -f reflect
17926 set d_procselfexe
17927 eval $setvar
17928
17929 : backward compatibility for d_hvfork
17930 if test X$d_hvfork != X; then
17931 d_vfork="$d_hvfork"
17932 d_hvfork=''
17933 fi
17934 : see if there is a vfork
17935 val=''
17936 set vfork val
17937 eval $inlibc
17938
17939 d_pseudofork=$undef
17940
17941 : Ok, but do we want to use it. vfork is reportedly unreliable in
17942 : perl on Solaris 2.x, and probably elsewhere.
17943 case "$val" in
17944 $define)
17945 echo " "
17946 case "$usevfork" in
17947 false) dflt='n';;
17948 *) dflt='y';;
17949 esac
17950 cat <<'EOM'
17951
17952 Perl can only use a vfork() that doesn't suffer from strict
17953 restrictions on calling functions or modifying global data in
17954 the child. For example, glibc-2.1 contains such a vfork()
17955 that is unsuitable. If your system provides a proper fork()
17956 call, chances are that you do NOT want perl to use vfork().
17957
17958 EOM
17959 rp="Do you still want to use vfork()?"
17960 . ./myread
17961 case "$ans" in
17962 y|Y) ;;
17963 *)
17964 echo "Ok, we won't use vfork()."
17965 val="$undef"
17966 ;;
17967 esac
17968 ;;
17969 esac
17970 set d_vfork
17971 eval $setvar
17972 case "$d_vfork" in
17973 $define) usevfork='true';;
17974 *) usevfork='false';;
17975 esac
17976
17977 : see whether the pthread_atfork exists
17978 $cat >try.c <<EOP
17979 #include <pthread.h>
17980 #include <stdio.h>
17981 int main() {
17982 #ifdef PTHREAD_ATFORK
17983 pthread_atfork(NULL,NULL,NULL);
17984 #endif
17985 }
17986 EOP
17987
17988 : see if pthread_atfork exists
17989 set try -DPTHREAD_ATFORK
17990 if eval $compile; then
17991 val="$define"
17992 else
17993 val="$undef"
17994 fi
17995 case "$usethreads" in
17996 $define)
17997 case "$val" in
17998 $define) echo 'pthread_atfork found.' >&4 ;;
17999 *) echo 'pthread_atfork NOT found.' >&4 ;;
18000 esac
18001 esac
18002 set d_pthread_atfork
18003 eval $setvar
18004
18005 : see if pthread_attr_setscope exists
18006 set pthread_attr_setscope d_pthread_attr_setscope
18007 eval $inlibc
18008
18009 : see whether the various POSIXish _yields exist
18010 $cat >try.c <<EOP
18011 #include <pthread.h>
18012 #include <stdio.h>
18013 int main() {
18014 #ifdef SCHED_YIELD
18015 sched_yield();
18016 #else
18017 #ifdef PTHREAD_YIELD
18018 pthread_yield();
18019 #else
18020 #ifdef PTHREAD_YIELD_NULL
18021 pthread_yield(NULL);
18022 #endif
18023 #endif
18024 #endif
18025 }
18026 EOP
18027 : see if sched_yield exists
18028 set try -DSCHED_YIELD
18029 if eval $compile; then
18030 val="$define"
18031 sched_yield='sched_yield()'
18032 else
18033 val="$undef"
18034 fi
18035 case "$usethreads" in
18036 $define)
18037 case "$val" in
18038 $define) echo 'sched_yield() found.' >&4 ;;
18039 *) echo 'sched_yield() NOT found.' >&4 ;;
18040 esac
18041 esac
18042 set d_sched_yield
18043 eval $setvar
18044
18045 : see if pthread_yield exists
18046 set try -DPTHREAD_YIELD
18047 if eval $compile; then
18048 val="$define"
18049 case "$sched_yield" in
18050 '') sched_yield='pthread_yield()' ;;
18051 esac
18052 else
18053 set try -DPTHREAD_YIELD_NULL
18054 if eval $compile; then
18055 val="$define"
18056 case "$sched_yield" in
18057 '') sched_yield='pthread_yield(NULL)' ;;
18058 esac
18059 else
18060 val="$undef"
18061 fi
18062 fi
18063 case "$usethreads" in
18064 $define)
18065 case "$val" in
18066 $define) echo 'pthread_yield() found.' >&4 ;;
18067 *) echo 'pthread_yield() NOT found.' >&4 ;;
18068 esac
18069 ;;
18070 esac
18071 set d_pthread_yield
18072 eval $setvar
18073 case "$sched_yield" in
18074 '') sched_yield=undef ;;
18075 esac
18076 $rm_try
18077
18078 : check for ptrdiff_t
18079 echo " "
18080 echo "Checking to see if you have ptrdiff_t..." >&4
18081 $cat >try.c <<EOCP
18082 #include <stddef.h>
18083 int main() { ptrdiff_t x = 7; }
18084 EOCP
18085 set try
18086 if eval $compile; then
18087 val="$define"
18088 echo "You have ptrdiff_t."
18089 else
18090 val="$undef"
18091 echo "You do not have ptrdiff_t."
18092 fi
18093 $rm_try
18094 set d_ptrdiff_t
18095 eval $setvar
18096
18097 : see if random_r exists
18098 set random_r d_random_r
18099 eval $inlibc
18100 case "$d_random_r" in
18101 "$define")
18102 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18103 case "$d_random_r_proto:$usethreads" in
18104 ":define") d_random_r_proto=define
18105 set d_random_r_proto random_r $hdrs
18106 eval $hasproto ;;
18107 *) ;;
18108 esac
18109 case "$d_random_r_proto" in
18110 define)
18111 case "$random_r_proto" in
18112 ''|0) try='int random_r(int*, struct random_data*);'
18113 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
18114 esac
18115 case "$random_r_proto" in
18116 ''|0) try='int random_r(long*, struct random_data*);'
18117 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
18118 esac
18119 case "$random_r_proto" in
18120 ''|0) try='int random_r(struct random_data*, int32_t*);'
18121 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
18122 esac
18123 case "$random_r_proto" in
18124 ''|0) d_random_r=undef
18125 random_r_proto=0
18126 echo "Disabling random_r, cannot determine prototype." >&4 ;;
18127 * ) case "$random_r_proto" in
18128 REENTRANT_PROTO*) ;;
18129 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
18130 esac
18131 echo "Prototype: $try" ;;
18132 esac
18133 ;;
18134 *) case "$usethreads" in
18135 define) echo "random_r has no prototype, not using it." >&4 ;;
18136 esac
18137 d_random_r=undef
18138 random_r_proto=0
18139 ;;
18140 esac
18141 ;;
18142 *) random_r_proto=0
18143 ;;
18144 esac
18145
18146 : see if readdir and friends exist
18147 set readdir d_readdir
18148 eval $inlibc
18149 set seekdir d_seekdir
18150 eval $inlibc
18151 set telldir d_telldir
18152 eval $inlibc
18153 set rewinddir d_rewinddir
18154 eval $inlibc
18155
18156 : see if readdir64_r exists
18157 set readdir64_r d_readdir64_r
18158 eval $inlibc
18159 case "$d_readdir64_r" in
18160 "$define")
18161 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
18162 case "$d_readdir64_r_proto:$usethreads" in
18163 ":define") d_readdir64_r_proto=define
18164 set d_readdir64_r_proto readdir64_r $hdrs
18165 eval $hasproto ;;
18166 *) ;;
18167 esac
18168 case "$d_readdir64_r_proto" in
18169 define)
18170 case "$readdir64_r_proto" in
18171 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
18172 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
18173 esac
18174 case "$readdir64_r_proto" in
18175 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
18176 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
18177 esac
18178 case "$readdir64_r_proto" in
18179 ''|0) d_readdir64_r=undef
18180 readdir64_r_proto=0
18181 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
18182 * ) case "$readdir64_r_proto" in
18183 REENTRANT_PROTO*) ;;
18184 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
18185 esac
18186 echo "Prototype: $try" ;;
18187 esac
18188 ;;
18189 *) case "$usethreads" in
18190 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
18191 esac
18192 d_readdir64_r=undef
18193 readdir64_r_proto=0
18194 ;;
18195 esac
18196 ;;
18197 *) readdir64_r_proto=0
18198 ;;
18199 esac
18200
18201 : see if readdir_r exists
18202 set readdir_r d_readdir_r
18203 eval $inlibc
18204 case "$d_readdir_r" in
18205 "$define")
18206 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
18207 case "$d_readdir_r_proto:$usethreads" in
18208 ":define") d_readdir_r_proto=define
18209 set d_readdir_r_proto readdir_r $hdrs
18210 eval $hasproto ;;
18211 *) ;;
18212 esac
18213 case "$d_readdir_r_proto" in
18214 define)
18215 case "$readdir_r_proto" in
18216 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
18217 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
18218 esac
18219 case "$readdir_r_proto" in
18220 ''|0) try='int readdir_r(DIR*, struct dirent*);'
18221 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
18222 esac
18223 case "$readdir_r_proto" in
18224 ''|0) d_readdir_r=undef
18225 readdir_r_proto=0
18226 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
18227 * ) case "$readdir_r_proto" in
18228 REENTRANT_PROTO*) ;;
18229 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
18230 esac
18231 echo "Prototype: $try" ;;
18232 esac
18233 ;;
18234 *) case "$usethreads" in
18235 define) echo "readdir_r has no prototype, not using it." >&4 ;;
18236 esac
18237 d_readdir_r=undef
18238 readdir_r_proto=0
18239 ;;
18240 esac
18241 ;;
18242 *) readdir_r_proto=0
18243 ;;
18244 esac
18245
18246 : see if readv exists
18247 set readv d_readv
18248 eval $inlibc
18249
18250 : see if recvmsg exists
18251 set recvmsg d_recvmsg
18252 eval $inlibc
18253
18254 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
18255 echo " "
18256 if set regcomp val -f d_regcomp; eval $csym; $val; then
18257 echo 'regcomp() found.' >&4
18258 d_regcomp="$define"
18259 d_regcmp="$undef"
18260 d_re_comp="$undef"
18261 elif set regcmp val -f d_regcmp; eval $csym; $val; then
18262 echo 'regcmp() found.' >&4
18263 d_regcmp="$define"
18264 d_regcomp="$undef"
18265 d_re_comp="$undef"
18266 elif set re_comp val -f d_re_comp; eval $csym; $val; then
18267 echo 're_comp() found, assuming re_exec() also exists.' >&4
18268 d_re_comp="$define"
18269 d_regcomp="$undef"
18270 d_regcmp="$undef"
18271 else
18272 $cat >&4 <<EOM
18273 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
18274 EOM
18275 d_regcmp="$undef"
18276 d_re_comp="$undef"
18277 d_regcomp="$undef"
18278 fi
18279
18280 : see if remainder exists
18281 set remainder d_remainder
18282 eval $inlibc
18283
18284 : see if remquo exists
18285 set remquo d_remquo
18286 eval $inlibc
18287
18288 : see if rename exists
18289 set rename d_rename
18290 eval $inlibc
18291
18292 : see if rint exists
18293 set rint d_rint
18294 eval $inlibc
18295
18296 : see if rmdir exists
18297 set rmdir d_rmdir
18298 eval $inlibc
18299
18300 : see if round exists
18301 set round d_round
18302 eval $inlibc
18303
18304 : see if prototype for sbrk is available
18305 echo " "
18306 set d_sbrkproto sbrk $i_unistd unistd.h
18307 eval $hasproto
18308
18309 : see if scalbn exists
18310 set scalbn d_scalbn
18311 eval $inlibc
18312
18313 : see if select exists
18314 set select d_select
18315 eval $inlibc
18316
18317 : see if semctl exists
18318 set semctl d_semctl
18319 eval $inlibc
18320
18321 : see if semget exists
18322 set semget d_semget
18323 eval $inlibc
18324
18325 : see if semop exists
18326 set semop d_semop
18327 eval $inlibc
18328
18329 : see how much of the 'sem*(2)' library is present.
18330 h_sem=true
18331 echo " "
18332 case "$d_semctl$d_semget$d_semop" in
18333 *"$undef"*) h_sem=false;;
18334 esac
18335 case "$osname" in
18336 freebsd)
18337 case "`ipcs 2>&1`" in
18338 "SVID messages"*"not configured"*)
18339 echo "Your $osname does not have the sem*(2) configured." >&4
18340 h_sem=false
18341 val="$undef"
18342 set semctl d_semctl
18343 eval $setvar
18344 set semget d_semget
18345 eval $setvar
18346 set semop d_semop
18347 eval $setvar
18348 ;;
18349 esac
18350 ;;
18351 esac
18352 : we could also check for sys/ipc.h ...
18353 if $h_sem && $test `./findhdr sys/sem.h`; then
18354 echo "You have the full sem*(2) library." >&4
18355 val="$define"
18356 else
18357 echo "You don't have the full sem*(2) library." >&4
18358 val="$undef"
18359 fi
18360 set d_sem
18361 eval $setvar
18362
18363 : see whether sys/sem.h defines union semun
18364 echo " "
18365 $cat > try.c <<'END'
18366 #include <sys/types.h>
18367 #include <sys/ipc.h>
18368 #include <sys/sem.h>
18369 int main () { union semun semun; semun.buf = 0; }
18370 END
18371 set try
18372 if eval $compile; then
18373 echo "You have union semun in <sys/sem.h>." >&4
18374 val="$define"
18375 else
18376 echo "You do not have union semun in <sys/sem.h>." >&4
18377 val="$undef"
18378 fi
18379 $rm_try
18380 set d_union_semun
18381 eval $setvar
18382
18383 : see how to do semctl IPC_STAT
18384 case "$d_sem" in
18385 $define)
18386 echo " "
18387 $cat > tryh.h <<END
18388 #ifndef S_IRUSR
18389 # ifdef S_IREAD
18390 # define S_IRUSR S_IREAD
18391 # define S_IWUSR S_IWRITE
18392 # define S_IXUSR S_IEXEC
18393 # else
18394 # define S_IRUSR 0400
18395 # define S_IWUSR 0200
18396 # define S_IXUSR 0100
18397 # endif
18398 # define S_IRGRP (S_IRUSR>>3)
18399 # define S_IWGRP (S_IWUSR>>3)
18400 # define S_IXGRP (S_IXUSR>>3)
18401 # define S_IROTH (S_IRUSR>>6)
18402 # define S_IWOTH (S_IWUSR>>6)
18403 # define S_IXOTH (S_IXUSR>>6)
18404 #endif
18405 #ifndef S_IRWXU
18406 # define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
18407 # define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
18408 # define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
18409 #endif
18410 END
18411 : see whether semctl IPC_STAT can use union semun
18412 case "$d_semctl_semun" in
18413 '')
18414 val="$undef"
18415 $cat > try.c <<END
18416 #include <sys/types.h>
18417 #include <sys/ipc.h>
18418 #include <sys/sem.h>
18419 #include <sys/stat.h>
18420 #include <stdio.h>
18421 #include <errno.h>
18422 #include "tryh.h"
18423 #ifndef errno
18424 extern int errno;
18425 #endif
18426 #$d_union_semun HAS_UNION_SEMUN
18427 int main() {
18428 union semun
18429 #ifndef HAS_UNION_SEMUN
18430 {
18431 int val;
18432 struct semid_ds *buf;
18433 unsigned short *array;
18434 }
18435 #endif
18436 arg;
18437 int sem, st;
18438
18439 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
18440 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18441 if (sem > -1) {
18442 struct semid_ds argbuf;
18443 arg.buf = &argbuf;
18444 # ifdef IPC_STAT
18445 st = semctl(sem, 0, IPC_STAT, arg);
18446 if (st == 0)
18447 printf("semun\n");
18448 else
18449 # endif /* IPC_STAT */
18450 printf("semctl IPC_STAT failed: errno = %d\n", errno);
18451 # ifdef IPC_RMID
18452 if (semctl(sem, 0, IPC_RMID, arg) != 0)
18453 # endif /* IPC_RMID */
18454 printf("semctl IPC_RMID failed: errno = %d\n", errno);
18455 } else
18456 #endif /* IPC_PRIVATE && ... */
18457 printf("semget failed: errno = %d\n", errno);
18458 return 0;
18459 }
18460 END
18461 set try
18462 if eval $compile; then
18463 xxx=`$run ./try`
18464 case "$xxx" in
18465 semun) val="$define" ;;
18466 esac
18467 fi
18468 $rm_try
18469 set d_semctl_semun
18470 eval $setvar
18471 ;;
18472 esac
18473 case "$d_semctl_semun" in
18474 $define)
18475 echo "You can use union semun for semctl IPC_STAT." >&4
18476 also='also'
18477 ;;
18478 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
18479 also=''
18480 ;;
18481 esac
18482
18483 : see whether semctl IPC_STAT can use struct semid_ds pointer
18484 case "$d_semctl_semid_ds" in
18485 '')
18486 val="$undef"
18487 $cat > try.c <<'END'
18488 #include <sys/types.h>
18489 #include <sys/ipc.h>
18490 #include <sys/sem.h>
18491 #include <sys/stat.h>
18492 #include "tryh.h"
18493 #include <stdio.h>
18494 #include <errno.h>
18495 #ifndef errno
18496 extern int errno;
18497 #endif
18498 int main() {
18499 union semun
18500 #ifndef HAS_UNION_SEMUN
18501 {
18502 int val;
18503 struct semid_ds *buf;
18504 unsigned short *array;
18505 }
18506 #endif
18507 arg;
18508 struct semid_ds argbuf;
18509 int sem, st;
18510
18511 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
18512 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18513 if (sem > -1) {
18514 arg.buf = &argbuf;
18515 # ifdef IPC_STAT
18516 st = semctl(sem, 0, IPC_STAT, arg);
18517 if (st == 0)
18518 printf("semid_ds\n");
18519 else
18520 # endif /* IPC_STAT */
18521 printf("semctl IPC_STAT failed: errno = %d\n", errno);
18522 # ifdef IPC_RMID
18523 if (semctl(sem, 0, IPC_RMID, arg) != 0)
18524 # endif /* IPC_RMID */
18525 printf("semctl IPC_RMID failed: errno = %d\n", errno);
18526 } else
18527 #endif /* IPC_PRIVATE && ... */
18528 printf("semget failed: errno = %d\n", errno);
18529
18530 return 0;
18531 }
18532 END
18533 set try
18534 if eval $compile; then
18535 xxx=`$run ./try`
18536 case "$xxx" in
18537 semid_ds) val="$define" ;;
18538 esac
18539 fi
18540 $rm_try
18541 set d_semctl_semid_ds
18542 eval $setvar
18543 ;;
18544 esac
18545 case "$d_semctl_semid_ds" in
18546 $define)
18547 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18548 ;;
18549 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18550 ;;
18551 esac
18552 ;;
18553 *) val="$undef"
18554
18555 # We do not have the full sem*(2) library, so assume we can not
18556 # use either.
18557
18558 set d_semctl_semun
18559 eval $setvar
18560
18561 set d_semctl_semid_ds
18562 eval $setvar
18563 ;;
18564 esac
18565 $rm_try tryh.h
18566
18567 : see if sendmsg exists
18568 set sendmsg d_sendmsg
18569 eval $inlibc
18570
18571 : see if setegid exists
18572 set setegid d_setegid
18573 eval $inlibc
18574
18575 : see if setenv exists
18576 set setenv d_setenv
18577 eval $inlibc
18578
18579 : see if seteuid exists
18580 set seteuid d_seteuid
18581 eval $inlibc
18582
18583 : see if setgrent exists
18584 set setgrent d_setgrent
18585 eval $inlibc
18586
18587 : see if setgrent_r exists
18588 set setgrent_r d_setgrent_r
18589 eval $inlibc
18590 case "$d_setgrent_r" in
18591 "$define")
18592 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18593 case "$d_setgrent_r_proto:$usethreads" in
18594 ":define") d_setgrent_r_proto=define
18595 set d_setgrent_r_proto setgrent_r $hdrs
18596 eval $hasproto ;;
18597 *) ;;
18598 esac
18599 case "$d_setgrent_r_proto" in
18600 define)
18601 case "$setgrent_r_proto" in
18602 ''|0) try='int setgrent_r(FILE**);'
18603 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18604 esac
18605 case "$setgrent_r_proto" in
18606 ''|0) try='void setgrent_r(FILE**);'
18607 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18608 esac
18609 case "$setgrent_r_proto" in
18610 ''|0) d_setgrent_r=undef
18611 setgrent_r_proto=0
18612 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18613 * ) case "$setgrent_r_proto" in
18614 REENTRANT_PROTO*) ;;
18615 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18616 esac
18617 echo "Prototype: $try" ;;
18618 esac
18619 ;;
18620 *) case "$usethreads" in
18621 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18622 esac
18623 d_setgrent_r=undef
18624 setgrent_r_proto=0
18625 ;;
18626 esac
18627 ;;
18628 *) setgrent_r_proto=0
18629 ;;
18630 esac
18631
18632 : see if sethostent exists
18633 set sethostent d_sethent
18634 eval $inlibc
18635
18636 : see if sethostent_r exists
18637 set sethostent_r d_sethostent_r
18638 eval $inlibc
18639 case "$d_sethostent_r" in
18640 "$define")
18641 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18642 case "$d_sethostent_r_proto:$usethreads" in
18643 ":define") d_sethostent_r_proto=define
18644 set d_sethostent_r_proto sethostent_r $hdrs
18645 eval $hasproto ;;
18646 *) ;;
18647 esac
18648 case "$d_sethostent_r_proto" in
18649 define)
18650 case "$sethostent_r_proto" in
18651 ''|0) try='int sethostent_r(int, struct hostent_data*);'
18652 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18653 esac
18654 case "$sethostent_r_proto" in
18655 ''|0) try='void sethostent_r(int, struct hostent_data*);'
18656 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18657 esac
18658 case "$sethostent_r_proto" in
18659 ''|0) d_sethostent_r=undef
18660 sethostent_r_proto=0
18661 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18662 * ) case "$sethostent_r_proto" in
18663 REENTRANT_PROTO*) ;;
18664 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18665 esac
18666 echo "Prototype: $try" ;;
18667 esac
18668 ;;
18669 *) case "$usethreads" in
18670 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18671 esac
18672 d_sethostent_r=undef
18673 sethostent_r_proto=0
18674 ;;
18675 esac
18676 ;;
18677 *) sethostent_r_proto=0
18678 ;;
18679 esac
18680
18681 : see if setitimer exists
18682 set setitimer d_setitimer
18683 eval $inlibc
18684
18685 : see if setlinebuf exists
18686 set setlinebuf d_setlinebuf
18687 eval $inlibc
18688
18689 : see if setlocale_r exists
18690 set setlocale_r d_setlocale_r
18691 eval $inlibc
18692 case "$d_setlocale_r" in
18693 "$define")
18694 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18695 case "$d_setlocale_r_proto:$usethreads" in
18696 ":define") d_setlocale_r_proto=define
18697 set d_setlocale_r_proto setlocale_r $hdrs
18698 eval $hasproto ;;
18699 *) ;;
18700 esac
18701 case "$d_setlocale_r_proto" in
18702 define)
18703 case "$setlocale_r_proto" in
18704 ''|0) try='int setlocale_r(int, const char*, char*, int);'
18705 ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18706 esac
18707 case "$setlocale_r_proto" in
18708 ''|0) d_setlocale_r=undef
18709 setlocale_r_proto=0
18710 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18711 * ) case "$setlocale_r_proto" in
18712 REENTRANT_PROTO*) ;;
18713 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18714 esac
18715 echo "Prototype: $try" ;;
18716 esac
18717 ;;
18718 *) case "$usethreads" in
18719 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18720 esac
18721 d_setlocale_r=undef
18722 setlocale_r_proto=0
18723 ;;
18724 esac
18725 ;;
18726 *) setlocale_r_proto=0
18727 ;;
18728 esac
18729
18730 : see if setnetent exists
18731 set setnetent d_setnent
18732 eval $inlibc
18733
18734 : see if setnetent_r exists
18735 set setnetent_r d_setnetent_r
18736 eval $inlibc
18737 case "$d_setnetent_r" in
18738 "$define")
18739 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18740 case "$d_setnetent_r_proto:$usethreads" in
18741 ":define") d_setnetent_r_proto=define
18742 set d_setnetent_r_proto setnetent_r $hdrs
18743 eval $hasproto ;;
18744 *) ;;
18745 esac
18746 case "$d_setnetent_r_proto" in
18747 define)
18748 case "$setnetent_r_proto" in
18749 ''|0) try='int setnetent_r(int, struct netent_data*);'
18750 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18751 esac
18752 case "$setnetent_r_proto" in
18753 ''|0) try='void setnetent_r(int, struct netent_data*);'
18754 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18755 esac
18756 case "$setnetent_r_proto" in
18757 ''|0) d_setnetent_r=undef
18758 setnetent_r_proto=0
18759 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18760 * ) case "$setnetent_r_proto" in
18761 REENTRANT_PROTO*) ;;
18762 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18763 esac
18764 echo "Prototype: $try" ;;
18765 esac
18766 ;;
18767 *) case "$usethreads" in
18768 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18769 esac
18770 d_setnetent_r=undef
18771 setnetent_r_proto=0
18772 ;;
18773 esac
18774 ;;
18775 *) setnetent_r_proto=0
18776 ;;
18777 esac
18778
18779 : see if setprotoent exists
18780 set setprotoent d_setpent
18781 eval $inlibc
18782
18783 : see if setpgid exists
18784 set setpgid d_setpgid
18785 eval $inlibc
18786
18787 : see if setpgrp2 exists
18788 set setpgrp2 d_setpgrp2
18789 eval $inlibc
18790
18791 : see if setpriority exists
18792 set setpriority d_setprior
18793 eval $inlibc
18794
18795 : see if setproctitle exists
18796 set setproctitle d_setproctitle
18797 eval $inlibc
18798
18799 : see if setprotoent_r exists
18800 set setprotoent_r d_setprotoent_r
18801 eval $inlibc
18802 case "$d_setprotoent_r" in
18803 "$define")
18804 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18805 case "$d_setprotoent_r_proto:$usethreads" in
18806 ":define") d_setprotoent_r_proto=define
18807 set d_setprotoent_r_proto setprotoent_r $hdrs
18808 eval $hasproto ;;
18809 *) ;;
18810 esac
18811 case "$d_setprotoent_r_proto" in
18812 define)
18813 case "$setprotoent_r_proto" in
18814 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18815 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18816 esac
18817 case "$setprotoent_r_proto" in
18818 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18819 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18820 esac
18821 case "$setprotoent_r_proto" in
18822 ''|0) d_setprotoent_r=undef
18823 setprotoent_r_proto=0
18824 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18825 * ) case "$setprotoent_r_proto" in
18826 REENTRANT_PROTO*) ;;
18827 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18828 esac
18829 echo "Prototype: $try" ;;
18830 esac
18831 ;;
18832 *) case "$usethreads" in
18833 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18834 esac
18835 d_setprotoent_r=undef
18836 setprotoent_r_proto=0
18837 ;;
18838 esac
18839 ;;
18840 *) setprotoent_r_proto=0
18841 ;;
18842 esac
18843
18844 : see if setpwent exists
18845 set setpwent d_setpwent
18846 eval $inlibc
18847
18848 : see if setpwent_r exists
18849 set setpwent_r d_setpwent_r
18850 eval $inlibc
18851 case "$d_setpwent_r" in
18852 "$define")
18853 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18854 case "$d_setpwent_r_proto:$usethreads" in
18855 ":define") d_setpwent_r_proto=define
18856 set d_setpwent_r_proto setpwent_r $hdrs
18857 eval $hasproto ;;
18858 *) ;;
18859 esac
18860 case "$d_setpwent_r_proto" in
18861 define)
18862 case "$setpwent_r_proto" in
18863 ''|0) try='int setpwent_r(FILE**);'
18864 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18865 esac
18866 case "$setpwent_r_proto" in
18867 ''|0) try='void setpwent_r(FILE**);'
18868 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18869 esac
18870 case "$setpwent_r_proto" in
18871 ''|0) d_setpwent_r=undef
18872 setpwent_r_proto=0
18873 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18874 * ) case "$setpwent_r_proto" in
18875 REENTRANT_PROTO*) ;;
18876 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18877 esac
18878 echo "Prototype: $try" ;;
18879 esac
18880 ;;
18881 *) case "$usethreads" in
18882 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18883 esac
18884 d_setpwent_r=undef
18885 setpwent_r_proto=0
18886 ;;
18887 esac
18888 ;;
18889 *) setpwent_r_proto=0
18890 ;;
18891 esac
18892
18893 : see if setregid exists
18894 set setregid d_setregid
18895 eval $inlibc
18896 set setresgid d_setresgid
18897 eval $inlibc
18898
18899 : see if setreuid exists
18900 set setreuid d_setreuid
18901 eval $inlibc
18902 set setresuid d_setresuid
18903 eval $inlibc
18904
18905 : see if setrgid exists
18906 set setrgid d_setrgid
18907 eval $inlibc
18908
18909 : see if setruid exists
18910 set setruid d_setruid
18911 eval $inlibc
18912
18913 : see if setservent exists
18914 set setservent d_setsent
18915 eval $inlibc
18916
18917 : see if setservent_r exists
18918 set setservent_r d_setservent_r
18919 eval $inlibc
18920 case "$d_setservent_r" in
18921 "$define")
18922 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18923 case "$d_setservent_r_proto:$usethreads" in
18924 ":define") d_setservent_r_proto=define
18925 set d_setservent_r_proto setservent_r $hdrs
18926 eval $hasproto ;;
18927 *) ;;
18928 esac
18929 case "$d_setservent_r_proto" in
18930 define)
18931 case "$setservent_r_proto" in
18932 ''|0) try='int setservent_r(int, struct servent_data*);'
18933 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18934 esac
18935 case "$setservent_r_proto" in
18936 ''|0) try='void setservent_r(int, struct servent_data*);'
18937 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18938 esac
18939 case "$setservent_r_proto" in
18940 ''|0) d_setservent_r=undef
18941 setservent_r_proto=0
18942 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18943 * ) case "$setservent_r_proto" in
18944 REENTRANT_PROTO*) ;;
18945 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18946 esac
18947 echo "Prototype: $try" ;;
18948 esac
18949 ;;
18950 *) case "$usethreads" in
18951 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18952 esac
18953 d_setservent_r=undef
18954 setservent_r_proto=0
18955 ;;
18956 esac
18957 ;;
18958 *) setservent_r_proto=0
18959 ;;
18960 esac
18961
18962 : see if setsid exists
18963 set setsid d_setsid
18964 eval $inlibc
18965
18966 : see if setvbuf exists
18967 set setvbuf d_setvbuf
18968 eval $inlibc
18969
18970 : see if shmctl exists
18971 set shmctl d_shmctl
18972 eval $inlibc
18973
18974 : see if shmget exists
18975 set shmget d_shmget
18976 eval $inlibc
18977
18978 : see if shmat exists
18979 set shmat d_shmat
18980 eval $inlibc
18981 : see what shmat returns
18982 case "$d_shmat" in
18983 "$define")
18984 $cat >shmat.c <<'END'
18985 #include <sys/shm.h>
18986 void *shmat();
18987 END
18988 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18989 shmattype='void *'
18990 else
18991 shmattype='char *'
18992 fi
18993 echo "and it returns ($shmattype)." >&4
18994 : see if a prototype for shmat is available
18995 xxx=`./findhdr sys/shm.h`
18996 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18997 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18998 val="$define"
18999 else
19000 val="$undef"
19001 fi
19002 $rm -f shmat.[co]
19003 ;;
19004 *)
19005 val="$undef"
19006 ;;
19007 esac
19008 set d_shmatprototype
19009 eval $setvar
19010
19011 : see if shmdt exists
19012 set shmdt d_shmdt
19013 eval $inlibc
19014
19015 : see how much of the 'shm*(2)' library is present.
19016 h_shm=true
19017 echo " "
19018 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
19019 *"$undef"*) h_shm=false;;
19020 esac
19021 case "$osname" in
19022 freebsd)
19023 case "`ipcs 2>&1`" in
19024 "SVID shared memory"*"not configured"*)
19025 echo "Your $osname does not have the shm*(2) configured." >&4
19026 h_shm=false
19027 val="$undef"
19028 set shmctl d_shmctl
19029 eval $setvar
19030 set shmget d_shmget
19031 eval $setvar
19032 set shmat d_shmat
19033 eval $setvar
19034 set shmdt d_shmdt
19035 eval $setvar
19036 ;;
19037 esac
19038 ;;
19039 esac
19040 : we could also check for sys/ipc.h ...
19041 if $h_shm && $test `./findhdr sys/shm.h`; then
19042 echo "You have the full shm*(2) library." >&4
19043 val="$define"
19044 else
19045 echo "You don't have the full shm*(2) library." >&4
19046 val="$undef"
19047 fi
19048 set d_shm
19049 eval $setvar
19050
19051 : see if we have sigaction
19052 echo " "
19053 if set sigaction val -f d_sigaction; eval $csym; $val; then
19054 echo 'sigaction() found.' >&4
19055 $cat > try.c <<EOP
19056 #include <stdio.h>
19057 #include <sys/types.h>
19058 #include <signal.h>
19059 #$i_stdlib I_STDLIB
19060 #ifdef I_STDLIB
19061 #include <stdlib.h>
19062 #endif
19063 int main()
19064 {
19065 struct sigaction act, oact;
19066 act.sa_flags = 0;
19067 oact.sa_handler = 0;
19068 /* so that act and oact are used */
19069 exit(act.sa_flags == 0 && oact.sa_handler == 0);
19070 }
19071 EOP
19072 set try
19073 if eval $compile_ok; then
19074 val="$define"
19075 else
19076 echo "But you don't seem to have a usable struct sigaction." >&4
19077 val="$undef"
19078 fi
19079 else
19080 echo 'sigaction NOT found.' >&4
19081 val="$undef"
19082 fi
19083 set d_sigaction; eval $setvar
19084 $rm_try
19085
19086 : see what type pids are declared as in the kernel
19087 rp="What is the type of process ids on this system?"
19088 set pid_t pidtype int stdio.h sys/types.h
19089 eval $typedef_ask
19090
19091 : see what type uids are declared as in the kernel
19092 echo " "
19093 echo "Looking for the type for user ids returned by getuid()."
19094 set uid_t uidtype xxx stdio.h sys/types.h
19095 eval $typedef
19096 case "$uidtype" in
19097 xxx)
19098 xxx=`./findhdr sys/user.h`
19099 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19100 case $1 in
19101 unsigned) dflt="$1 $2" ;;
19102 *) dflt="$1" ;;
19103 esac
19104 ;;
19105 *) dflt="$uidtype";;
19106 esac
19107 case "$uidtype" in
19108 uid_t) echo "uid_t found." ;;
19109 *) rp="What is the type for user ids returned by getuid()?"
19110 . ./myread
19111 uidtype="$ans"
19112 ;;
19113 esac
19114
19115 : Define hasfield_t macro for Configure internal use
19116 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
19117 while $test $# -ge 2; do
19118 case "$1" in
19119 $define) echo "#include <$2>";;
19120 esac ;
19121 shift 2;
19122 done > try.c;
19123 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
19124 set try;
19125 if eval $compile; then
19126 val="$define";
19127 else
19128 val="$undef";
19129 fi;
19130 set $varname;
19131 eval $setvar;
19132 $rm_try'
19133
19134 : see what siginfo fields we have
19135 case "$d_sigaction" in
19136 "$define")
19137 echo "Checking if your siginfo_t has si_errno field...">&4
19138 set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
19139 eval $hasfield_t;
19140
19141 echo "Checking if your siginfo_t has si_pid field...">&4
19142 set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
19143 eval $hasfield_t;
19144
19145 echo "Checking if your siginfo_t has si_uid field...">&4
19146 set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
19147 eval $hasfield_t;
19148
19149 echo "Checking if your siginfo_t has si_addr field...">&4
19150 set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
19151 eval $hasfield_t;
19152
19153 echo "Checking if your siginfo_t has si_status field...">&4
19154 set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
19155 eval $hasfield_t;
19156
19157 echo "Checking if your siginfo_t has si_band field...">&4
19158 set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
19159 eval $hasfield_t;
19160
19161 echo "Checking if your siginfo_t has si_value field...">&4
19162 set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
19163 eval $hasfield_t;
19164
19165 echo "Checking if your siginfo_t has si_fd field...">&4
19166 set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
19167 eval $hasfield_t;
19168
19169 ;;
19170 *)
19171 d_siginfo_si_errno="$undef"
19172 d_siginfo_si_pid="$undef"
19173 d_siginfo_si_uid="$undef"
19174 d_siginfo_si_addr="$undef"
19175 d_siginfo_si_status="$undef"
19176 d_siginfo_si_band="$undef"
19177 d_siginfo_si_value="$undef"
19178 d_siginfo_si_fd="$undef"
19179 ;;
19180 esac
19181
19182 : see if this is a sunmath.h system
19183 set sunmath.h i_sunmath
19184 eval $inhdr
19185
19186 : see if signbit exists
19187 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
19188 $cat >try.c <<EOCP
19189 #$i_sunmath I_SUNMATH
19190 #include <math.h>
19191 #ifdef I_SUNMATH /* Solaris special math library */
19192 # include <sunmath.h>
19193 #endif
19194 #define NV $nvtype
19195 int main(int argc, char **argv)
19196 {
19197 NV x = 0.0;
19198 NV y = -1.0;
19199 if ((signbit(x) == 0) && (signbit(y) != 0))
19200 return 0;
19201 else
19202 return 1;
19203 }
19204 EOCP
19205 val="$undef"
19206 set try
19207 if eval $compile; then
19208 if $run ./try; then
19209 $echo "Yes." >&4
19210 val="$define"
19211 else
19212 $echo "Signbit seems to be available, but doesn't work as I expected."
19213 $echo "I won't use it." >&4
19214 val="$undef"
19215 fi
19216 else
19217 $echo "Nope." >&4
19218 dflt="$undef"
19219 fi
19220 set d_signbit
19221 eval $setvar
19222 $rm_try
19223
19224 : see if sigprocmask exists
19225 set sigprocmask d_sigprocmask
19226 eval $inlibc
19227
19228 : see if sigsetjmp exists
19229 echo " "
19230 case "$d_sigsetjmp" in
19231 '')
19232 $cat >try.c <<EOP
19233 #include <setjmp.h>
19234 #$i_stdlib I_STDLIB
19235 #ifdef I_STDLIB
19236 #include <stdlib.h>
19237 #endif
19238 sigjmp_buf env;
19239 int set = 1;
19240 int main()
19241 {
19242 if (sigsetjmp(env,1))
19243 exit(set);
19244 set = 0;
19245 siglongjmp(env, 1);
19246 exit(1);
19247 }
19248 EOP
19249 set try
19250 if eval $compile; then
19251 if $run ./try >/dev/null 2>&1; then
19252 echo "POSIX sigsetjmp found." >&4
19253 val="$define"
19254 else
19255 $cat >&4 <<EOM
19256 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
19257 I'll ignore them.
19258 EOM
19259 val="$undef"
19260 fi
19261 else
19262 echo "sigsetjmp not found." >&4
19263 val="$undef"
19264 fi
19265 ;;
19266 *) val="$d_sigsetjmp"
19267 case "$d_sigsetjmp" in
19268 $define) echo "POSIX sigsetjmp found." >&4;;
19269 $undef) echo "sigsetjmp not found." >&4;;
19270 esac
19271 ;;
19272 esac
19273 set d_sigsetjmp
19274 eval $setvar
19275 $rm_try
19276
19277 : see if snprintf exists
19278 set snprintf d_snprintf
19279 eval $inlibc
19280
19281 : see if vsnprintf exists
19282 set vsnprintf d_vsnprintf
19283 eval $inlibc
19284
19285 case "$d_snprintf-$d_vsnprintf" in
19286 "$define-$define")
19287 $cat <<EOM
19288 Checking whether your snprintf() and vsnprintf() work okay...
19289 EOM
19290 $cat >try.c <<'EOCP'
19291 /* v?snprintf testing logic courtesy of Russ Allbery.
19292 * According to C99:
19293 * - if the buffer is too short it still must be \0-terminated
19294 * - if the buffer is too short the potentially required length
19295 * must be returned and not -1
19296 * - if the buffer is NULL the potentially required length
19297 * must be returned and not -1 or core dump
19298 */
19299 #include <stdio.h>
19300 #include <stdarg.h>
19301
19302 char buf[2];
19303
19304 int test (char *format, ...)
19305 {
19306 va_list args;
19307 int count;
19308
19309 va_start (args, format);
19310 count = vsnprintf (buf, sizeof buf, format, args);
19311 va_end (args);
19312 return count;
19313 }
19314
19315 int main ()
19316 {
19317 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
19318 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
19319 }
19320 EOCP
19321 set try
19322 if eval $compile; then
19323 `$run ./try`
19324 case "$?" in
19325 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
19326 *) cat <<EOM >&4
19327 Your snprintf() and snprintf() don't seem to be working okay.
19328 EOM
19329 d_snprintf="$undef"
19330 d_vsnprintf="$undef"
19331 ;;
19332 esac
19333 else
19334 echo "(I can't seem to compile the test program--assuming they don't)"
19335 d_snprintf="$undef"
19336 d_vsnprintf="$undef"
19337 fi
19338 $rm_try
19339 ;;
19340 esac
19341
19342 : see if sockatmark exists
19343 set sockatmark d_sockatmark
19344 eval $inlibc
19345
19346 : see if prototype for sockatmark is available
19347 echo " "
19348 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
19349 eval $hasproto
19350
19351 : see if socks5_init exists
19352 set socks5_init d_socks5_init
19353 eval $inlibc
19354
19355 : see if srand48_r exists
19356 set srand48_r d_srand48_r
19357 eval $inlibc
19358 case "$d_srand48_r" in
19359 "$define")
19360 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19361 case "$d_srand48_r_proto:$usethreads" in
19362 ":define") d_srand48_r_proto=define
19363 set d_srand48_r_proto srand48_r $hdrs
19364 eval $hasproto ;;
19365 *) ;;
19366 esac
19367 case "$d_srand48_r_proto" in
19368 define)
19369 case "$srand48_r_proto" in
19370 ''|0) try='int srand48_r(long, struct drand48_data*);'
19371 ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
19372 esac
19373 case "$srand48_r_proto" in
19374 ''|0) d_srand48_r=undef
19375 srand48_r_proto=0
19376 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
19377 * ) case "$srand48_r_proto" in
19378 REENTRANT_PROTO*) ;;
19379 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
19380 esac
19381 echo "Prototype: $try" ;;
19382 esac
19383 ;;
19384 *) case "$usethreads" in
19385 define) echo "srand48_r has no prototype, not using it." >&4 ;;
19386 esac
19387 d_srand48_r=undef
19388 srand48_r_proto=0
19389 ;;
19390 esac
19391 ;;
19392 *) srand48_r_proto=0
19393 ;;
19394 esac
19395
19396 : see if srandom_r exists
19397 set srandom_r d_srandom_r
19398 eval $inlibc
19399 case "$d_srandom_r" in
19400 "$define")
19401 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19402 case "$d_srandom_r_proto:$usethreads" in
19403 ":define") d_srandom_r_proto=define
19404 set d_srandom_r_proto srandom_r $hdrs
19405 eval $hasproto ;;
19406 *) ;;
19407 esac
19408 case "$d_srandom_r_proto" in
19409 define)
19410 case "$srandom_r_proto" in
19411 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
19412 ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
19413 esac
19414 case "$srandom_r_proto" in
19415 ''|0) d_srandom_r=undef
19416 srandom_r_proto=0
19417 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
19418 * ) case "$srandom_r_proto" in
19419 REENTRANT_PROTO*) ;;
19420 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
19421 esac
19422 echo "Prototype: $try" ;;
19423 esac
19424 ;;
19425 *) case "$usethreads" in
19426 define) echo "srandom_r has no prototype, not using it." >&4 ;;
19427 esac
19428 d_srandom_r=undef
19429 srandom_r_proto=0
19430 ;;
19431 esac
19432 ;;
19433 *) srandom_r_proto=0
19434 ;;
19435 esac
19436
19437 : see if prototype for setresgid is available
19438 echo " "
19439 set d_sresgproto setresgid $i_unistd unistd.h
19440 eval $hasproto
19441
19442 : see if prototype for setresuid is available
19443 echo " "
19444 set d_sresuproto setresuid $i_unistd unistd.h
19445 eval $hasproto
19446
19447 : see if stat exists
19448 set stat d_stat
19449 eval $inlibc
19450
19451 : see if sys/stat.h is available
19452 set sys/stat.h i_sysstat
19453 eval $inhdr
19454
19455 : see if stat knows about block sizes
19456 echo " "
19457 echo "Checking to see if your struct stat has st_blocks field..." >&4
19458 set d_statblks stat st_blocks $i_sysstat sys/stat.h
19459 eval $hasfield
19460
19461 : see if this is a sys/vfs.h system
19462 set sys/vfs.h i_sysvfs
19463 eval $inhdr
19464
19465 : see if this is a sys/statfs.h system
19466 set sys/statfs.h i_sysstatfs
19467 eval $inhdr
19468
19469 : Check for statfs_s
19470 echo " "
19471 echo "Checking to see if your system supports struct statfs..." >&4
19472 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
19473 eval $hasstruct
19474 case "$d_statfs_s" in
19475 "$define") echo "Yes, it does." ;;
19476 *) echo "No, it doesn't." ;;
19477 esac
19478
19479 : see if struct statfs knows about f_flags
19480 case "$d_statfs_s" in
19481 define)
19482 echo " "
19483 echo "Checking to see if your struct statfs has f_flags field..." >&4
19484 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
19485 eval $hasfield
19486 ;;
19487 *) val="$undef"
19488 set d_statfs_f_flags
19489 eval $setvar
19490 ;;
19491 esac
19492 case "$d_statfs_f_flags" in
19493 "$define") echo "Yes, it does." ;;
19494 *) echo "No, it doesn't." ;;
19495 esac
19496
19497 : see what flavor, if any, of static inline is supported
19498 echo " "
19499 echo "Checking to see if your system supports static inline..."
19500 $cat > try.c <<'EOCP'
19501 #include <stdlib.h>
19502 extern int f_via_a(int x);
19503 extern int f_via_b(int x);
19504 int main(int argc, char **argv)
19505 {
19506 int y;
19507
19508 y = f_via_a(0);
19509 #ifdef USE_B
19510 y = f_via_b(0);
19511 #endif
19512 if (y == 42) {
19513 return EXIT_SUCCESS;
19514 }
19515 else {
19516 return EXIT_FAILURE;
19517 }
19518 }
19519 EOCP
19520 $cat > a.c <<'EOCP'
19521 static INLINE int f(int x) {
19522 int y;
19523 y = x + 42;
19524 return y;
19525 }
19526
19527 int f_via_a(int x)
19528 {
19529 return f(x);
19530 }
19531 EOCP
19532 $cat > b.c <<'EOCP'
19533 extern int f(int x);
19534
19535 int f_via_b(int x)
19536 {
19537 return f(x);
19538 }
19539 EOCP
19540
19541 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19542 case "$perl_static_inline" in
19543 '') # Check the various possibilities, and break out on success.
19544 # For gcc, prefer __inline__, which will still permit
19545 # cflags.SH to add in -ansi.
19546 case "$gccversion" in
19547 '') xxx="inline __inline__ __inline _inline";;
19548 *) xxx="__inline__ inline __inline _inline";;
19549 esac
19550 for inline in $xxx; do
19551 set try -DINLINE=$inline a.c
19552 if eval $compile && $run ./try; then
19553 # Now make sure there is no external linkage of static
19554 # functions
19555 set try -DINLINE=$inline -DUSE_B a.c b.c
19556 if eval $compile && $run ./try; then
19557 $echo "Your compiler supports static $inline, " >&4
19558 $echo "but it also creates an external definition," >&4
19559 $echo "so I won't use it." >&4
19560 val=$undef
19561 else
19562 $echo "Your compiler supports static $inline." >&4
19563 val=$define
19564 perl_static_inline="static $inline";
19565 break;
19566 fi
19567 else
19568 $echo "Your compiler does NOT support static $inline." >&4
19569 val="$undef"
19570 fi
19571 done
19572 ;;
19573 *inline*) # Some variant of inline exists.
19574 echo "Keeping your $hint value of $perl_static_inline."
19575 val=$define
19576 ;;
19577 static) # No inline capabilities
19578 echo "Keeping your $hint value of $perl_static_inline."
19579 val=$undef
19580 ;;
19581 *) # Unrecognized previous value -- blindly trust the supplied
19582 # value and hope it makes sense. Use old value for
19583 # d_static_inline, if there is one.
19584 echo "Keeping your $hint value of $perl_static_inline."
19585 case "$d_static_inline" in
19586 '') val=$define ;;
19587 *) val=$d_static_inline ;;
19588 esac
19589 ;;
19590 esac
19591 # Fallback to plain 'static' if nothing worked.
19592 case "$perl_static_inline" in
19593 '')
19594 perl_static_inline="static"
19595 val=$undef
19596 ;;
19597 esac
19598 set d_static_inline
19599 eval $setvar
19600 $rm -f a.[co] b.[co]
19601 $rm_try
19602
19603 : Check stream access
19604 $cat >&4 <<EOM
19605 Checking how to access stdio streams by file descriptor number...
19606 EOM
19607 case "$stdio_stream_array" in
19608 '') $cat >try.c <<EOCP
19609 #include <stdio.h>
19610 int main() {
19611 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19612 printf("yes\n");
19613 }
19614 EOCP
19615 for s in _iob __iob __sF
19616 do
19617 set try -DSTDIO_STREAM_ARRAY=$s
19618 if eval $compile; then
19619 case "`$run ./try`" in
19620 yes) stdio_stream_array=$s; break ;;
19621 esac
19622 fi
19623 done
19624 $rm_try
19625 esac
19626 case "$stdio_stream_array" in
19627 '') $cat >&4 <<EOM
19628 I can't figure out how to access stdio streams by file descriptor number.
19629 EOM
19630 d_stdio_stream_array="$undef"
19631 ;;
19632 *) $cat >&4 <<EOM
19633 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19634 EOM
19635 d_stdio_stream_array="$define"
19636 ;;
19637 esac
19638
19639 : see if strcoll exists
19640 set strcoll d_strcoll
19641 eval $inlibc
19642
19643 : see if strerror_l exists
19644 set strerror_l d_strerror_l
19645 eval $inlibc
19646
19647 : see if strerror_r exists
19648 set strerror_r d_strerror_r
19649 eval $inlibc
19650 case "$d_strerror_r" in
19651 "$define")
19652 hdrs="$i_systypes sys/types.h define stdio.h define string.h"
19653 case "$d_strerror_r_proto:$usethreads" in
19654 ":define") d_strerror_r_proto=define
19655 set d_strerror_r_proto strerror_r $hdrs
19656 eval $hasproto ;;
19657 *) ;;
19658 esac
19659 case "$d_strerror_r_proto" in
19660 define)
19661 case "$strerror_r_proto" in
19662 ''|0) try='int strerror_r(int, char*, size_t);'
19663 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19664 esac
19665 case "$strerror_r_proto" in
19666 ''|0) try='int strerror_r(int, char*, int);'
19667 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19668 esac
19669 case "$strerror_r_proto" in
19670 ''|0) try='char* strerror_r(int, char*, size_t);'
19671 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19672 esac
19673 case "$strerror_r_proto" in
19674 ''|0) d_strerror_r=undef
19675 strerror_r_proto=0
19676 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19677 * ) case "$strerror_r_proto" in
19678 REENTRANT_PROTO*) ;;
19679 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19680 esac
19681 echo "Prototype: $try" ;;
19682 esac
19683 ;;
19684 *) case "$usethreads" in
19685 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19686 esac
19687 d_strerror_r=undef
19688 strerror_r_proto=0
19689 ;;
19690 esac
19691 ;;
19692 *) strerror_r_proto=0
19693 ;;
19694 esac
19695
19696 : see if strftime exists
19697 set strftime d_strftime
19698 eval $inlibc
19699
19700 : see if strlcat exists
19701 : We need both a prototype in string.h and the symbol in libc.
19702 echo " "
19703 d_strlcat_proto=''
19704 xx1="#$d_gnulibc HAS_GNULIBC"
19705 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19706 xx3='# define _GNU_SOURCE'
19707 xx4='#endif'
19708 set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19709 eval $hasproto
19710 case "$d_strlcat_proto" in
19711 define) # see if strlcat exists
19712 set strlcat d_strlcat
19713 eval $inlibc
19714 ;;
19715 *) val=$undef
19716 set d_strlcat
19717 eval $setvar
19718 ;;
19719 esac
19720
19721 : see if strlcpy exists
19722 : We need both a prototype in string.h and the symbol in libc.
19723 echo " "
19724 d_strlcpy_proto=''
19725 xx1="#$d_gnulibc HAS_GNULIBC"
19726 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19727 xx3='# define _GNU_SOURCE'
19728 xx4='#endif'
19729 set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19730 eval $hasproto
19731 case "$d_strlcpy_proto" in
19732 define) # see if strlcpy exists
19733 set strlcpy d_strlcpy
19734 eval $inlibc
19735 ;;
19736 *) val=$undef
19737 set d_strlcpy
19738 eval $setvar
19739 ;;
19740 esac
19741
19742 : see if strnlen exists
19743 set strnlen d_strnlen
19744 eval $inlibc
19745
19746 : see if strtod exists
19747 set strtod d_strtod
19748 eval $inlibc
19749
19750 : see if strtod_l exists
19751 set strtod_l d_strtod_l
19752 eval $inlibc
19753
19754 : see if strtol exists
19755 set strtol d_strtol
19756 eval $inlibc
19757
19758 : see if strtold exists
19759 set strtold d_strtold
19760 eval $inlibc
19761
19762 : see if strtold_l exists
19763 set strtold_l d_strtold_l
19764 eval $inlibc
19765
19766 : see if strtoll exists
19767 set strtoll d_strtoll
19768 eval $inlibc
19769
19770 case "$d_longlong-$d_strtoll" in
19771 "$define-$define")
19772 $cat <<EOM
19773 Checking whether your strtoll() works okay...
19774 EOM
19775 $cat >try.c <<'EOCP'
19776 #include <errno.h>
19777 #ifdef __hpux
19778 #define strtoll __strtoll
19779 #endif
19780 #ifdef __EMX__
19781 #define strtoll _strtoll
19782 #endif
19783 #include <stdio.h>
19784 #include <stdlib.h>
19785 static int bad = 0;
19786 void check(const char *s, long long ell, int een) {
19787 long long gll;
19788 errno = 0;
19789 gll = strtoll(s, 0, 10);
19790 if (!((gll == ell) && (errno == een)))
19791 bad++;
19792 }
19793 int main() {
19794 check(" 1", 1LL, 0);
19795 check(" 0", 0LL, 0);
19796 check("-1", -1LL, 0);
19797 check("-9223372036854775808", -9223372036854775808LL, 0);
19798 check("-9223372036854775808", -9223372036854775808LL, 0);
19799 check(" 9223372036854775807", 9223372036854775807LL, 0);
19800 check("-9223372036854775808", -9223372036854775808LL, 0);
19801 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
19802 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19803 if (!bad)
19804 printf("ok\n");
19805 }
19806 EOCP
19807 set try
19808 if eval $compile; then
19809 yyy=`$run ./try`
19810 case "$yyy" in
19811 ok) echo "Your strtoll() seems to be working okay." ;;
19812 *) cat <<EOM >&4
19813 Your strtoll() doesn't seem to be working okay.
19814 EOM
19815 d_strtoll="$undef"
19816 ;;
19817 esac
19818 else
19819 echo "(I can't seem to compile the test program--assuming it doesn't)"
19820 d_strtoll="$undef"
19821 fi
19822 ;;
19823 esac
19824
19825 : see if strtoq exists
19826 set strtoq d_strtoq
19827 eval $inlibc
19828
19829 : see if strtoul exists
19830 set strtoul d_strtoul
19831 eval $inlibc
19832
19833 case "$d_strtoul" in
19834 "$define")
19835 $cat <<EOM
19836 Checking whether your strtoul() works okay...
19837 EOM
19838 $cat >try.c <<'EOCP'
19839 #include <stdlib.h>
19840 #include <errno.h>
19841 #include <stdio.h>
19842 static int bad = 0;
19843 void check(const char *s, unsigned long eul, int een) {
19844 unsigned long gul;
19845 errno = 0;
19846 gul = strtoul(s, 0, 10);
19847 if (!((gul == eul) && (errno == een)))
19848 bad++;
19849 }
19850 int main() {
19851 check(" 1", 1L, 0);
19852 check(" 0", 0L, 0);
19853 EOCP
19854 case "$longsize" in
19855 8)
19856 $cat >>try.c <<'EOCP'
19857 check("18446744073709551615", 18446744073709551615UL, 0);
19858 check("18446744073709551616", 18446744073709551615UL, ERANGE);
19859 #if 0 /* strtoul() for /^-/ strings is undefined. */
19860 check("-1", 18446744073709551615UL, 0);
19861 check("-18446744073709551614", 2, 0);
19862 check("-18446744073709551615", 1, 0);
19863 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19864 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19865 #endif
19866 EOCP
19867 ;;
19868 4)
19869 $cat >>try.c <<'EOCP'
19870 check("4294967295", 4294967295UL, 0);
19871 check("4294967296", 4294967295UL, ERANGE);
19872 #if 0 /* strtoul() for /^-/ strings is undefined. */
19873 check("-1", 4294967295UL, 0);
19874 check("-4294967294", 2, 0);
19875 check("-4294967295", 1, 0);
19876 check("-4294967296", 4294967295UL, ERANGE);
19877 check("-4294967297", 4294967295UL, ERANGE);
19878 #endif
19879 EOCP
19880 ;;
19881 *)
19882 : Should we write these tests to be more portable by sprintf-ing
19883 : ~0 and then manipulating that char string as input for strtol?
19884 ;;
19885 esac
19886 $cat >>try.c <<'EOCP'
19887 if (!bad)
19888 printf("ok\n");
19889 return 0;
19890 }
19891 EOCP
19892 set try
19893 if eval $compile; then
19894 case "`$run ./try`" in
19895 ok) echo "Your strtoul() seems to be working okay." ;;
19896 *) cat <<EOM >&4
19897 Your strtoul() doesn't seem to be working okay.
19898 EOM
19899 d_strtoul="$undef"
19900 ;;
19901 esac
19902 else
19903 echo "(I can't seem to compile the test program--assuming it doesn't)"
19904 d_strtoul="$undef"
19905 fi
19906 ;;
19907 esac
19908
19909 : see if strtoull exists
19910 set strtoull d_strtoull
19911 eval $inlibc
19912
19913 case "$d_longlong-$d_strtoull" in
19914 "$define-$define")
19915 $cat <<EOM
19916 Checking whether your strtoull() works okay...
19917 EOM
19918 $cat >try.c <<'EOCP'
19919 #include <stdlib.h>
19920 #include <errno.h>
19921 #ifdef __hpux
19922 #define strtoull __strtoull
19923 #endif
19924 #include <stdio.h>
19925 static int bad = 0;
19926 void check(const char *s, long long eull, int een) {
19927 long long gull;
19928 errno = 0;
19929 gull = strtoull(s, 0, 10);
19930 if (!((gull == eull) && (errno == een)))
19931 bad++;
19932 }
19933 int main() {
19934 check(" 1", 1LL, 0);
19935 check(" 0", 0LL, 0);
19936 check("18446744073709551615", 18446744073709551615ULL, 0);
19937 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
19938 #if 0 /* strtoull() for /^-/ strings is undefined. */
19939 check("-1", 18446744073709551615ULL, 0);
19940 check("-18446744073709551614", 2LL, 0);
19941 check("-18446744073709551615", 1LL, 0);
19942 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19943 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19944 #endif
19945 if (!bad)
19946 printf("ok\n");
19947 }
19948 EOCP
19949 set try
19950 if eval $compile; then
19951 case "`$run ./try`" in
19952 ok) echo "Your strtoull() seems to be working okay." ;;
19953 *) cat <<EOM >&4
19954 Your strtoull() doesn't seem to be working okay.
19955 EOM
19956 d_strtoull="$undef"
19957 ;;
19958 esac
19959 else
19960 echo "(I can't seem to compile the test program--assuming it doesn't)"
19961 d_strtoull="$undef"
19962 fi
19963 ;;
19964 esac
19965
19966 : see if strtouq exists
19967 set strtouq d_strtouq
19968 eval $inlibc
19969
19970 case "$d_strtouq" in
19971 "$define")
19972 $cat <<EOM
19973 Checking whether your strtouq() works okay...
19974 EOM
19975 $cat >try.c <<'EOCP'
19976 #include <stdlib.h>
19977 #include <errno.h>
19978 #include <stdio.h>
19979 static int bad = 0;
19980 void check(const char *s, unsigned long long eull, int een) {
19981 unsigned long long gull;
19982 errno = 0;
19983 gull = strtouq(s, 0, 10);
19984 if (!((gull == eull) && (errno == een)))
19985 bad++;
19986 }
19987 int main() {
19988 check(" 1", 1LL, 0);
19989 check(" 0", 0LL, 0);
19990 check("18446744073709551615", 18446744073709551615ULL, 0);
19991 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
19992 #if 0 /* strtouq() for /^-/ strings is undefined. */
19993 check("-1", 18446744073709551615ULL, 0);
19994 check("-18446744073709551614", 2LL, 0);
19995 check("-18446744073709551615", 1LL, 0);
19996 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19997 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19998 #endif
19999 if (!bad)
20000 printf("ok\n");
20001 return 0;
20002 }
20003 EOCP
20004 set try
20005 if eval $compile; then
20006 case "`$run ./try`" in
20007 ok) echo "Your strtouq() seems to be working okay." ;;
20008 *) cat <<EOM >&4
20009 Your strtouq() doesn't seem to be working okay.
20010 EOM
20011 d_strtouq="$undef"
20012 ;;
20013 esac
20014 else
20015 echo "(I can't seem to compile the test program--assuming it doesn't)"
20016 d_strtouq="$undef"
20017 fi
20018 ;;
20019 esac
20020
20021 : see if strxfrm exists
20022 set strxfrm d_strxfrm
20023 eval $inlibc
20024
20025 : see if strxfrm_l exists
20026 set strxfrm_l d_strxfrm_l
20027 eval $inlibc
20028
20029 : see if symlink exists
20030 set symlink d_symlink
20031 eval $inlibc
20032
20033 : see if syscall exists
20034 set syscall d_syscall
20035 eval $inlibc
20036
20037 : see if this is a sys/syscall.h system
20038 set sys/syscall.h i_syssyscall
20039 eval $inhdr
20040
20041 : see if prototype for syscall is available
20042 echo " "
20043 set d_syscallproto syscall $i_unistd unistd.h $i_syssyscall sys/syscall.h
20044 eval $hasproto
20045
20046 : see if sysconf exists
20047 set sysconf d_sysconf
20048 eval $inlibc
20049
20050 : see if sys_errlist[] exists
20051 echo " "
20052 if test "X$d_syserrlst" = X; then
20053 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
20054 echo "You have sys_errlist[], so we could roll our own strerror."
20055 d_syserrlst="$define"
20056 else
20057 echo "You don't have sys_errlist[], so strerror() is welcome."
20058 d_syserrlst="$undef"
20059 fi
20060 fi
20061
20062 : see if system exists
20063 set system d_system
20064 eval $inlibc
20065
20066 : see if tcgetpgrp exists
20067 set tcgetpgrp d_tcgetpgrp
20068 eval $inlibc
20069
20070 : see if tcsetpgrp exists
20071 set tcsetpgrp d_tcsetpgrp
20072 eval $inlibc
20073
20074 : see if prototype for telldir is available
20075 echo " "
20076 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
20077 eval $hasproto
20078
20079 : see if tgamma exists
20080 set tgamma d_tgamma
20081 eval $inlibc
20082
20083 : see what flavor, if any, of thread local storage is supported
20084 echo " "
20085 echo "Checking to see if your system supports C11 thread local storage..."
20086 $cat > try.c <<'EOCP'
20087 #include <stdio.h>
20088 #include <stdlib.h>
20089 #include <pthread.h>
20090
20091 static int plus_one = 1;
20092 static int minus_one = -1;
20093
20094 PROBE_MACRO int *minion;
20095
20096 int callback (const void *a, const void *b) {
20097 int val_a = *minion * *(const int *)a;
20098 int val_b = *minion * *(const int *)b;
20099 return val_a < val_b ? -1 : val_a > val_b;
20100 }
20101
20102 #define SIZE 8
20103
20104 void *thread_function(void *arg) {
20105 /* thread local variables should start zeroed in each thread. */
20106 if (minion != NULL) {
20107 fprintf(stderr, "__thread variable started with %p, should be NULL\n",
20108 minion);
20109 exit(2);
20110 }
20111 minion = &minus_one;
20112
20113 int array[SIZE];
20114 unsigned int i;
20115 for (i = 0; i < SIZE; ++i) {
20116 /* "Hash randomisation" - this array isn't in sorted order: */
20117 array[i ^ 5] = i * i;
20118 }
20119
20120 qsort(array, SIZE, sizeof(int), callback);
20121
20122 int bad = 0;
20123 for (i = 0; i < SIZE; ++i) {
20124 int want = (SIZE - 1 - i) * (SIZE - 1 - i);
20125 int have = array[i];
20126 if (want != have) {
20127 ++bad;
20128 fprintf(stderr, "array[%u] - want %i, have %i\n", i, want, have);
20129 }
20130 }
20131 if (bad)
20132 exit(3);
20133
20134 return NULL;
20135 }
20136
20137 int main(int argc, char **argv) {
20138 if (minion != NULL) {
20139 fprintf(stderr, "__thread variable started with %p, should be NULL\n",
20140 minion);
20141 exit(4);
20142 }
20143
20144 minion = &plus_one;
20145
20146 pthread_t tid;
20147 int result = pthread_create(&tid, NULL, thread_function, NULL);
20148 if (result) {
20149 fprintf(stderr, "pthread_create failed (%d)\n", result);
20150 exit(5);
20151 }
20152
20153 result = pthread_join(tid, NULL);
20154 if (result) {
20155 fprintf(stderr, "pthread_join failed (%d)\n", result);
20156 exit(6);
20157 }
20158
20159 if (minion == NULL) {
20160 fprintf(stderr, "__thread variable should not be NULL\n");
20161 exit(7);
20162 }
20163 if (!(minion == &plus_one && *minion == 1)) {
20164 fprintf(stderr, "__thread variable should be %d @ %p, not %d @ %p\n",
20165 1, &plus_one, *minion, minion);
20166 exit(8);
20167 }
20168
20169 return 0;
20170 }
20171 EOCP
20172
20173 # Respect a hint (or previous) value for perl_thread_local, if there is one.
20174 case "$perl_thread_local" in
20175 '') # Check the various possibilities, and break out on success.
20176 for thread_local in _Thread_local __thread; do
20177 set try -DPROBE_MACRO=$thread_local
20178 if eval $compile && $run ./try; then
20179 $echo "Your compiler supports $thread_local." >&4
20180 val=$define
20181 perl_thread_local="$thread_local";
20182 break;
20183 fi
20184 $echo "Your compiler does NOT support $thread_local." >&4
20185 val="$undef"
20186 done
20187 ;;
20188 *thread*|*Thread*) # Some variant of thread local exists.
20189 echo "Keeping your $hint value of $perl_thread_local."
20190 val=$define
20191 ;;
20192 *) # Unrecognized previous value -- blindly trust the supplied
20193 # value and hope it makes sense. Use old value for
20194 # d_thread_local, if there is one.
20195 echo "Keeping your $hint value of $perl_thread_local."
20196 case "$d_thread_local" in
20197 '') val=$define ;;
20198 *) val=$d_thread_local ;;
20199 esac
20200 ;;
20201 esac
20202 set d_thread_local
20203 eval $setvar
20204 $rm_try
20205
20206 : see if time exists
20207 echo " "
20208 if test "X$d_time" = X -o X"$timetype" = X; then
20209 if set time val -f d_time; eval $csym; $val; then
20210 echo 'time() found.' >&4
20211 val="$define"
20212 rp="What is the type returned by time() on this system?"
20213 set time_t timetype long stdio.h sys/types.h
20214 eval $typedef_ask
20215 else
20216 echo 'time() not found, hope that will do.' >&4
20217 val="$undef"
20218 timetype='int';
20219 fi
20220 set d_time
20221 eval $setvar
20222 fi
20223
20224 : see if timegm exists
20225 set timegm d_timegm
20226 eval $inlibc
20227
20228 : see if this is a sys/times.h system
20229 set sys/times.h i_systimes
20230 eval $inhdr
20231
20232 : see if times exists
20233 echo " "
20234 if set times val -f d_times; eval $csym; $val; then
20235 echo 'times() found.' >&4
20236 d_times="$define"
20237 inc=''
20238 case "$i_systimes" in
20239 "$define") inc='sys/times.h';;
20240 esac
20241 rp="What is the type returned by times() on this system?"
20242 set clock_t clocktype long stdio.h sys/types.h $inc
20243 eval $typedef_ask
20244 else
20245 echo 'times() NOT found, hope that will do.' >&4
20246 d_times="$undef"
20247 clocktype='int'
20248 fi
20249
20250 : see if tmpnam_r exists
20251 set tmpnam_r d_tmpnam_r
20252 eval $inlibc
20253 case "$d_tmpnam_r" in
20254 "$define")
20255 hdrs="$i_systypes sys/types.h define stdio.h "
20256 case "$d_tmpnam_r_proto:$usethreads" in
20257 ":define") d_tmpnam_r_proto=define
20258 set d_tmpnam_r_proto tmpnam_r $hdrs
20259 eval $hasproto ;;
20260 *) ;;
20261 esac
20262 case "$d_tmpnam_r_proto" in
20263 define)
20264 case "$tmpnam_r_proto" in
20265 ''|0) try='char* tmpnam_r(char*);'
20266 ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
20267 esac
20268 case "$tmpnam_r_proto" in
20269 ''|0) d_tmpnam_r=undef
20270 tmpnam_r_proto=0
20271 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
20272 * ) case "$tmpnam_r_proto" in
20273 REENTRANT_PROTO*) ;;
20274 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
20275 esac
20276 echo "Prototype: $try" ;;
20277 esac
20278 ;;
20279 *) case "$usethreads" in
20280 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
20281 esac
20282 d_tmpnam_r=undef
20283 tmpnam_r_proto=0
20284 ;;
20285 esac
20286 ;;
20287 *) tmpnam_r_proto=0
20288 ;;
20289 esac
20290
20291 : see if towlower exists
20292 set towlower d_towlower
20293 eval $inlibc
20294
20295 : see if trunc exists
20296 set trunc d_trunc
20297 eval $inlibc
20298
20299 : see if truncate exists
20300 set truncate d_truncate
20301 eval $inlibc
20302
20303 : see if ttyname_r exists
20304 set ttyname_r d_ttyname_r
20305 eval $inlibc
20306 case "$d_ttyname_r" in
20307 "$define")
20308 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
20309 case "$d_ttyname_r_proto:$usethreads" in
20310 ":define") d_ttyname_r_proto=define
20311 set d_ttyname_r_proto ttyname_r $hdrs
20312 eval $hasproto ;;
20313 *) ;;
20314 esac
20315 case "$d_ttyname_r_proto" in
20316 define)
20317 case "$ttyname_r_proto" in
20318 ''|0) try='int ttyname_r(int, char*, size_t);'
20319 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
20320 esac
20321 case "$ttyname_r_proto" in
20322 ''|0) try='int ttyname_r(int, char*, int);'
20323 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
20324 esac
20325 case "$ttyname_r_proto" in
20326 ''|0) try='char* ttyname_r(int, char*, int);'
20327 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
20328 esac
20329 case "$ttyname_r_proto" in
20330 ''|0) d_ttyname_r=undef
20331 ttyname_r_proto=0
20332 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
20333 * ) case "$ttyname_r_proto" in
20334 REENTRANT_PROTO*) ;;
20335 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
20336 esac
20337 echo "Prototype: $try" ;;
20338 esac
20339 ;;
20340 *) case "$usethreads" in
20341 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
20342 esac
20343 d_ttyname_r=undef
20344 ttyname_r_proto=0
20345 ;;
20346 esac
20347 ;;
20348 *) ttyname_r_proto=0
20349 ;;
20350 esac
20351
20352 : see if tzname[] exists
20353 echo " "
20354 if set tzname val -a d_tzname; eval $csym; $val; then
20355 val="$define"
20356 echo 'tzname[] found.' >&4
20357 else
20358 val="$undef"
20359 echo 'tzname[] NOT found.' >&4
20360 fi
20361 set d_tzname
20362 eval $setvar
20363
20364 : Check if is a multiplatform env
20365 case "$osname" in
20366 darwin) multiarch="$define" ;;
20367 esac
20368 case "$multiarch" in
20369 ''|[nN]*) multiarch="$undef" ;;
20370 esac
20371
20372 : check for ordering of bytes in a UV
20373 echo " "
20374 case "$multiarch" in
20375 *$define*)
20376 $cat <<EOM
20377 You seem to be doing a multiarchitecture build,
20378 skipping the byteorder check.
20379
20380 EOM
20381 byteorder='ffff'
20382 ;;
20383 *)
20384 case "$byteorder" in
20385 '')
20386 $cat <<'EOM'
20387 In the following, larger digits indicate more significance. A big-endian
20388 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
20389 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
20390 machines may have weird orders like 3412. A Cray will report 87654321,
20391 an Alpha will report 12345678. If the test program works the default is
20392 probably right.
20393 I'm now running the test program...
20394 EOM
20395 $cat >try.c <<EOCP
20396 #include <stdio.h>
20397 #$i_stdlib I_STDLIB
20398 #ifdef I_STDLIB
20399 #include <stdlib.h>
20400 #endif
20401 #$i_inttypes I_INTTYPES
20402 #ifdef I_INTTYPES
20403 #include <inttypes.h>
20404 #endif
20405 #include <sys/types.h>
20406 typedef $uvtype UV;
20407 int main()
20408 {
20409 int i;
20410 union {
20411 UV l;
20412 char c[$uvsize];
20413 } u;
20414
20415 if ($uvsize > 4)
20416 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
20417 else
20418 u.l = (UV)0x04030201;
20419 for (i = 0; i < $uvsize; i++)
20420 printf("%c", u.c[i]+'0');
20421 printf("\n");
20422 exit(0);
20423 }
20424 EOCP
20425 xxx_prompt=y
20426 set try
20427 if eval $compile && $run ./try > /dev/null; then
20428 dflt=`$run ./try`
20429 case "$dflt" in
20430 [1-4][1-4][1-4][1-4]|12345678|87654321)
20431 echo "(The test program ran ok.)"
20432 echo "byteorder=$dflt"
20433 xxx_prompt=n
20434 ;;
20435 ????|????????) echo "(The test program ran ok.)" ;;
20436 *) echo "(The test program didn't run right for some reason.)" ;;
20437 esac
20438 else
20439 dflt='4321'
20440 cat <<'EOM'
20441 (I can't seem to compile the test program. Guessing big-endian...)
20442 EOM
20443 fi
20444 case "$xxx_prompt" in
20445 y)
20446 rp="What is the order of bytes in $uvtype?"
20447 . ./myread
20448 byteorder="$ans"
20449 ;;
20450 *) byteorder=$dflt
20451 ;;
20452 esac
20453 ;;
20454 esac
20455 $rm_try
20456 ;;
20457 esac
20458
20459 : Checking 32bit alignedness
20460 $cat <<EOM
20461
20462 Checking to see whether you can access character data unalignedly...
20463 EOM
20464 case "$d_u32align" in
20465 '') $cat >try.c <<EOCP
20466 #include <stdio.h>
20467 #$i_stdlib I_STDLIB
20468 #ifdef I_STDLIB
20469 #include <stdlib.h>
20470 #endif
20471 #define U32 $u32type
20472 #define BYTEORDER 0x$byteorder
20473 #define U8 $u8type
20474 #include <signal.h>
20475 #ifdef SIGBUS
20476 $signal_t bletch(int s) { exit(4); }
20477 #endif
20478 int main() {
20479 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
20480 volatile U8 buf[8];
20481 volatile U32 *up;
20482 int i;
20483
20484 if (sizeof(U32) != 4) {
20485 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
20486 exit(1);
20487 }
20488
20489 fflush(stdout);
20490
20491 #ifdef SIGBUS
20492 signal(SIGBUS, bletch);
20493 #endif
20494
20495 buf[0] = 0;
20496 buf[1] = 0;
20497 buf[2] = 0;
20498 buf[3] = 1;
20499 buf[4] = 0;
20500 buf[5] = 0;
20501 buf[6] = 0;
20502 buf[7] = 1;
20503
20504 for (i = 0; i < 4; i++) {
20505 up = (U32*)(buf + i);
20506 if (! ((*up == 1 << (8*i)) || /* big-endian */
20507 (*up == 1 << (8*(3-i))) /* little-endian */
20508 )
20509 )
20510 {
20511 printf("read failed (%x)\n", *up);
20512 exit(2);
20513 }
20514 }
20515
20516 /* write test */
20517 for (i = 0; i < 4; i++) {
20518 up = (U32*)(buf + i);
20519 *up = 0xBeef;
20520 if (*up != 0xBeef) {
20521 printf("write failed (%x)\n", *up);
20522 exit(3);
20523 }
20524 }
20525
20526 exit(0);
20527 #else
20528 printf("1\n");
20529 exit(1);
20530 #endif
20531 return 0;
20532 }
20533 EOCP
20534 set try
20535 if eval $compile_ok; then
20536 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
20537 $run ./try 2>&1 >/dev/null
20538 case "$?" in
20539 0) cat >&4 <<EOM
20540 You can access character data pretty unalignedly.
20541 EOM
20542 d_u32align="$undef"
20543 ;;
20544 *) cat >&4 <<EOM
20545 It seems that you must access character data in an aligned manner.
20546 EOM
20547 d_u32align="$define"
20548 ;;
20549 esac
20550 else
20551 rp='Can you access character data at unaligned addresses?'
20552 dflt='n'
20553 . ./myread
20554 case "$ans" in
20555 [yY]*) d_u32align="$undef" ;;
20556 *) d_u32align="$define" ;;
20557 esac
20558 fi
20559 $rm_try
20560 ;;
20561 esac
20562
20563 : see if ualarm exists
20564 set ualarm d_ualarm
20565 eval $inlibc
20566
20567 : see if umask exists
20568 set umask d_umask
20569 eval $inlibc
20570
20571 : see if unordered exists
20572 set unordered d_unordered
20573 eval $inlibc
20574
20575 : see if unsetenv exists
20576 set unsetenv d_unsetenv
20577 eval $inlibc
20578
20579 : see if usleep exists
20580 set usleep d_usleep
20581 eval $inlibc
20582
20583 : see if prototype for usleep is available
20584 echo " "
20585 set d_usleepproto usleep $i_unistd unistd.h
20586 eval $hasproto
20587
20588 : see if ustat exists
20589 set ustat d_ustat
20590 eval $inlibc
20591
20592 : see if closedir exists
20593 set closedir d_closedir
20594 eval $inlibc
20595
20596 case "$d_closedir" in
20597 "$define")
20598 echo " "
20599 echo "Checking whether closedir() returns a status..." >&4
20600 cat > try.c <<EOM
20601 #$i_dirent I_DIRENT /**/
20602 #$i_sysdir I_SYS_DIR /**/
20603 #$i_sysndir I_SYS_NDIR /**/
20604 #$i_systypes I_SYS_TYPES /**/
20605
20606 #if defined(I_SYS_TYPES)
20607 #include <sys/types.h>
20608 #endif
20609 #if defined(I_DIRENT)
20610 #include <dirent.h>
20611 #else
20612 #ifdef I_SYS_NDIR
20613 #include <sys/ndir.h>
20614 #else
20615 #ifdef I_SYS_DIR
20616 #include <sys/dir.h>
20617 #endif
20618 #endif
20619 #endif
20620 int main() { return closedir(opendir(".")); }
20621 EOM
20622 set try
20623 if eval $compile_ok; then
20624 if $run ./try > /dev/null 2>&1 ; then
20625 echo "Yes, it does."
20626 val="$undef"
20627 else
20628 echo "No, it doesn't."
20629 val="$define"
20630 fi
20631 else
20632 echo "(I can't seem to compile the test program--assuming it doesn't)"
20633 val="$define"
20634 fi
20635 ;;
20636 *)
20637 val="$undef";
20638 ;;
20639 esac
20640 set d_void_closedir
20641 eval $setvar
20642 $rm_try
20643
20644 : see if there is a wait4
20645 set wait4 d_wait4
20646 eval $inlibc
20647
20648 : see if waitpid exists
20649 set waitpid d_waitpid
20650 eval $inlibc
20651
20652 : see if wcrtomb exists
20653 set wcrtomb d_wcrtomb
20654 eval $inlibc
20655
20656 : look for wcscmp
20657 echo " "
20658 $cat >try.c <<'EOCP'
20659 #include <stdio.h>
20660 #include <wchar.h>
20661 int main ()
20662 {
20663 wchar_t *s = L" ";
20664 return (wcscmp (s, s) ? 1 : 0);
20665 }
20666 EOCP
20667 set try
20668 val="$undef"
20669 if eval $compile; then
20670 `$run ./try`
20671 case "$?" in
20672 0) echo "A working wcscmp() found." >&4
20673 val="$define" ;;
20674 *) echo "wcscmp() found, but it doesn't work" >&4
20675 ;;
20676 esac
20677 else
20678 echo "wcscmp() NOT found." >&4
20679 fi
20680 set d_wcscmp
20681 eval $setvar
20682 $rm_try
20683
20684 : see if wcstombs exists
20685 set wcstombs d_wcstombs
20686 eval $inlibc
20687
20688 : look for wcsxfrm
20689 echo " "
20690 $cat >try.c <<'EOCP'
20691 #include <errno.h>
20692 #include <wchar.h>
20693 int main ()
20694 {
20695 wchar_t dst[4], *src = L" ";
20696 errno = 0;
20697 return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20698 }
20699 EOCP
20700 set try
20701 val="$undef"
20702 if eval $compile; then
20703 `$run ./try`
20704 case "$?" in
20705 0) echo "A working wcsxfrm() found." >&4
20706 val="$define" ;;
20707 *) echo "wcsxfrm() found, but it doesn't work" >&4
20708 ;;
20709 esac
20710 else
20711 echo "wcsxfrm() NOT found." >&4
20712 fi
20713 set d_wcsxfrm
20714 eval $setvar
20715 $rm_try
20716
20717 : see if wctomb exists
20718 set wctomb d_wctomb
20719 eval $inlibc
20720
20721 : see if writev exists
20722 set writev d_writev
20723 eval $inlibc
20724
20725 : check for alignment requirements
20726 echo " "
20727 case "$alignbytes" in
20728 '') echo "Checking alignment constraints..." >&4
20729 $cat >try.c <<EOCP
20730 #include <stdio.h>
20731 struct foobar {
20732 char foo;
20733 $nvtype bar;
20734 } try_algn;
20735 int main()
20736 {
20737 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20738 return(0);
20739 }
20740 EOCP
20741 set try
20742 if eval $compile_ok; then
20743 dflt=`$run ./try`
20744 else
20745 dflt='8'
20746 echo "(I can't seem to compile the test program...)"
20747 fi
20748 case "$multiarch" in
20749 *$define*)
20750 : The usual safe value is 8, but Darwin with -Duselongdouble
20751 : needs 16. Hence, we will take 8 as a minimum, but allow
20752 : Configure to pick a larger value if needed.
20753 if $test "$dflt" -lt 8; then
20754 dflt='8'
20755 echo "Setting alignment to 8 for multiarch support.">&4
20756 fi
20757 ;;
20758 esac
20759 ;;
20760 *) dflt="$alignbytes"
20761 ;;
20762 esac
20763 rp="Doubles must be aligned on a how-many-byte boundary?"
20764 . ./myread
20765 alignbytes="$ans"
20766 $rm_try
20767
20768 : set the base revision
20769 baserev=5.0
20770
20771 : length of character in bytes. Is always 1, otherwise it is not C
20772 : This used to be a test using sizeof
20773 charsize=1
20774
20775 : Check for the number of bits in a character
20776 case "$charbits" in
20777 '') echo "Checking how long a character is (in bits)..." >&4
20778 $cat >try.c <<EOCP
20779 #include <stdio.h>
20780 int main ()
20781 {
20782 int n;
20783 unsigned char c;
20784 for (c = 1, n = 0; c; c <<= 1, n++) ;
20785 printf ("%d\n", n);
20786 return (0);
20787 }
20788 EOCP
20789 set try
20790 if eval $compile_ok; then
20791 dflt=`$run ./try`
20792 else
20793 dflt='8'
20794 echo "(I can't seem to compile the test program. Guessing...)"
20795 fi
20796 ;;
20797 *)
20798 dflt="$charbits"
20799 ;;
20800 esac
20801 rp="What is the length of a character (in bits)?"
20802 . ./myread
20803 charbits="$ans"
20804 $rm_try
20805 case "$charbits" in
20806 8) ;;
20807 *) cat >&4 << EOM
20808 Your system has an unsigned character size of $charbits bits, which
20809 is rather unusual (normally it is 8 bits). Perl likely will not work
20810 correctly on your system, with subtle bugs in various places.
20811 EOM
20812 rp='Do you really want to continue?'
20813 dflt='n'
20814 . ./myread
20815 case "$ans" in
20816 [yY]) echo >&4 "Okay, continuing." ;;
20817 *) exit 1 ;;
20818 esac
20819 esac
20820
20821 : how do we concatenate cpp tokens here?
20822 echo " "
20823 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20824 $cat >cpp_stuff.c <<'EOCP'
20825 #define RCAT(a,b)a/**/b
20826 #define ACAT(a,b)a ## b
20827 RCAT(Rei,ser)
20828 ACAT(Cir,cus)
20829 EOCP
20830 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20831 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20832 echo "Oh! Smells like ANSI's been here." >&4
20833 echo "We can catify or stringify, separately or together!"
20834 cpp_stuff=42
20835 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20836 echo "Ah, yes! The good old days!" >&4
20837 echo "However, in the good old days we don't know how to stringify and"
20838 echo "catify at the same time."
20839 cpp_stuff=1
20840 else
20841 $cat >&4 <<EOM
20842 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20843 You're going to have to edit the values of CAT[2-5] in config.h...
20844 EOM
20845 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20846 fi
20847 $rm -f cpp_stuff.*
20848
20849 : see if this is a db.h system
20850 set db.h i_db
20851 eval $inhdr
20852
20853 case "$i_db" in
20854 $define)
20855 : Check db version.
20856 echo " "
20857 echo "Checking Berkeley DB version ..." >&4
20858 $cat >try.c <<EOCP
20859 #include <sys/types.h>
20860 #include <stdio.h>
20861 #$i_stdlib I_STDLIB
20862 #ifdef I_STDLIB
20863 #include <stdlib.h>
20864 #endif
20865 #include <db.h>
20866 int main(int argc, char *argv[])
20867 {
20868 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20869 int Major, Minor, Patch ;
20870 unsigned long Version ;
20871 (void)db_version(&Major, &Minor, &Patch) ;
20872 if (argc == 2) {
20873 printf("%d %d %d %d %d %d\n",
20874 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20875 Major, Minor, Patch);
20876 exit(0);
20877 }
20878 printf("You have Berkeley DB Version 2 or greater.\n");
20879
20880 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20881 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20882 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20883 Major, Minor, Patch) ;
20884
20885 /* check that db.h & libdb are compatible */
20886 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20887 printf("db.h and libdb are incompatible.\n") ;
20888 exit(3);
20889 }
20890
20891 printf("db.h and libdb are compatible.\n") ;
20892
20893 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20894 + DB_VERSION_PATCH ;
20895
20896 /* needs to be >= 2.3.4 */
20897 if (Version < 2003004) {
20898 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20899 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20900 exit(2);
20901 }
20902
20903 exit(0);
20904 #else
20905 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20906 if (argc == 2) {
20907 printf("1 0 0\n");
20908 exit(0);
20909 }
20910 printf("You have Berkeley DB Version 1.\n");
20911 exit(0); /* DB version < 2: the coast is clear. */
20912 #else
20913 exit(1); /* <db.h> not Berkeley DB? */
20914 #endif
20915 #endif
20916 }
20917 EOCP
20918 set try
20919 if eval $compile_ok && $run ./try; then
20920 echo 'Looks OK.' >&4
20921 set `$run ./try 1`
20922 db_version_major=$1
20923 db_version_minor=$2
20924 db_version_patch=$3
20925 else
20926 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
20927 i_db=$undef
20928 case " $libs " in
20929 *"-ldb "*)
20930 : Remove db from list of libraries to use
20931 echo "Removing unusable -ldb from library list" >&4
20932 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20933 shift
20934 libs="$*"
20935 echo "libs = $libs" >&4
20936 ;;
20937 esac
20938 fi
20939 $rm_try
20940 ;;
20941 esac
20942
20943 case "$i_db" in
20944 define)
20945 : Check the return type needed for hash
20946 echo " "
20947 echo "Checking return type needed for hash for Berkeley DB ..." >&4
20948 $cat >try.c <<EOCP
20949 #include <sys/types.h>
20950 #include <db.h>
20951
20952 #ifndef DB_VERSION_MAJOR
20953 u_int32_t hash_cb (const void* ptr, size_t size)
20954 {
20955 return 0;
20956 }
20957 HASHINFO info;
20958 int main()
20959 {
20960 info.hash = hash_cb;
20961 }
20962 #endif
20963 EOCP
20964 if $cc $ccflags -c try.c >try.out 2>&1 ; then
20965 if $compiler_warning try.out >>/dev/null 2>&1 ; then
20966 db_hashtype='int'
20967 else
20968 db_hashtype='u_int32_t'
20969 fi
20970 else
20971 : XXX Maybe we should just give up here.
20972 db_hashtype=u_int32_t
20973 $cat try.out >&4
20974 echo "Help: I can't seem to compile the db test program." >&4
20975 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20976 fi
20977 $rm_try
20978 echo "Your version of Berkeley DB uses $db_hashtype for hash."
20979 ;;
20980 *) db_hashtype=u_int32_t
20981 ;;
20982 esac
20983 case "$i_db" in
20984 define)
20985 : Check the return type needed for prefix
20986 echo " "
20987 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20988 cat >try.c <<EOCP
20989 #include <sys/types.h>
20990 #include <db.h>
20991
20992 #ifndef DB_VERSION_MAJOR
20993 size_t prefix_cb (const DBT *key1, const DBT *key2)
20994 {
20995 return 0;
20996 }
20997 BTREEINFO info;
20998 int main()
20999 {
21000 info.prefix = prefix_cb;
21001 }
21002 #endif
21003 EOCP
21004 if $cc $ccflags -c try.c >try.out 2>&1 ; then
21005 if $compiler_warning try.out >>/dev/null 2>&1 ; then
21006 db_prefixtype='int'
21007 else
21008 db_prefixtype='size_t'
21009 fi
21010 else
21011 db_prefixtype='size_t'
21012 : XXX Maybe we should just give up here.
21013 $cat try.out >&4
21014 echo "Help: I can't seem to compile the db test program." >&4
21015 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
21016 fi
21017 $rm_try
21018 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
21019 ;;
21020 *) db_prefixtype='size_t'
21021 ;;
21022 esac
21023
21024 : Include . in @INC
21025 $cat <<EOM
21026
21027 Historically Perl has provided a final fallback of the current working
21028 directory '.' when searching for a library. This, however, can lead to
21029 problems when a Perl program which loads optional modules is called from
21030 a shared directory. This can lead to executing unexpected code.
21031
21032 EOM
21033
21034 # When changing to exclude by default:
21035 case "$default_inc_excludes_dot" in
21036 $undef|false|[nN]*) dflt="n" ;;
21037 *) dflt="y" ;;
21038 esac
21039 # To turn exclude off by default:
21040 #case "$default_inc_excludes_dot" in
21041 # $define|true|[yY]*) dflt="y" ;;
21042 # *) dflt="n" ;;
21043 #esac
21044
21045 rp='Exclude '.' from @INC by default? '
21046 . ./myread
21047 case "$ans" in
21048 [nN]|undef) default_inc_excludes_dot="$undef" ;;
21049 *) default_inc_excludes_dot="$define" ;;
21050 esac
21051
21052 : Check what kind of inf/nan your system has
21053 $echo "Checking the kind of infinities and nans you have..." >&4
21054 $echo "(The following tests may crash. That's okay.)" >&4
21055 $cat >try.c <<EOP
21056 #define DOUBLESIZE $doublesize
21057 #$d_longdbl HAS_LONG_DOUBLE
21058 #ifdef HAS_LONG_DOUBLE
21059 #define LONG_DOUBLESIZE $longdblsize
21060 #define LONG_DOUBLEKIND $longdblkind
21061 #endif
21062 #include <math.h>
21063 #include <string.h>
21064 #include <stdio.h>
21065 /* Note that whether the sign bit is on or off
21066 * for NaN depends on the CPU/FPU, and possibly
21067 * can be affected by the build toolchain.
21068 *
21069 * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
21070 * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
21071 * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
21072 * (respectively) as opposed to the more usual
21073 * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
21074 *
21075 * Pre-IEEE-754 floating point format do not even have inf/nan support
21076 * at all. They might have a "max" value (DBL_MAX), which may be deadly
21077 * to even mention, causing immediate SIGFPE or equivalent: this is
21078 * the case with VAX floating point, for example.
21079 */
21080 static void bytes(void *v, unsigned int n) {
21081 unsigned char *p = (unsigned char *)v;
21082 int i;
21083 for (i = 0; i < n; i++) {
21084 printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
21085 }
21086 }
21087 int main(int argc, char *argv[]) {
21088 /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
21089 * because some compilers are 'smart' and not only warn but refuse to
21090 * compile such 'illegal' values. */
21091 double dinf = exp(1e9);
21092 double dnan = sqrt(-1.0);
21093 #ifdef HAS_LONG_DOUBLE
21094 long double ldinf = (long double)exp(1e9);
21095 long double ldnan = (long double)sqrt(-1.0);
21096 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
21097 /* the 80-bit long doubles might have garbage in their excess bytes */
21098 memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
21099 memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
21100 # endif
21101 #endif
21102 if (argc == 2) {
21103 switch (argv[1][0]) {
21104 case '1': bytes(&dinf, sizeof(dinf)); break;
21105 case '2': bytes(&dnan, sizeof(dnan)); break;
21106 #ifdef HAS_LONG_DOUBLE
21107 case '3': bytes(&ldinf, sizeof(ldinf)); break;
21108 case '4': bytes(&ldnan, sizeof(ldnan)); break;
21109 #endif
21110 }
21111 }
21112 return 0;
21113 }
21114 EOP
21115 set try
21116 if eval $compile; then
21117 doubleinfbytes=`$run ./try 1`
21118 doublenanbytes=`$run ./try 2`
21119 case "$d_longdbl" in
21120 $define)
21121 longdblinfbytes=`$run ./try 3`
21122 longdblnanbytes=`$run ./try 4`
21123 ;;
21124 esac
21125 else
21126 # Defaults in case the above test program failed.
21127 case "$doublekind" in
21128 1) # IEEE 754 32-bit LE
21129 doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
21130 doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
21131 ;;
21132 2) # IEEE 754 32-bit BE
21133 doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
21134 doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
21135 ;;
21136 3) # IEEE 754 64-bit LE
21137 doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
21138 doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
21139 ;;
21140 4) # IEEE 754 64-bit BE
21141 doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21142 doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21143 ;;
21144 5) # IEEE 754 128-bit LE
21145 doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
21146 doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
21147 ;;
21148 6) # IEEE 754 128-bit BE
21149 doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21150 doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21151 ;;
21152 7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
21153 doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
21154 doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
21155 ;;
21156 8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
21157 doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
21158 doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
21159 ;;
21160 9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
21161 doubleinfbytes=$undef
21162 doublenanbytes=$undef
21163 ;;
21164 *) # No idea.
21165 doubleinfbytes=$undef
21166 doublenanbytes=$undef
21167 ;;
21168 esac
21169 case "$longdblkind" in
21170 1) # IEEE 754 128-bit LE
21171 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
21172 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
21173 ;;
21174 2) # IEEE 754 128-bit BE
21175 longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21176 longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21177 ;;
21178 3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
21179 case "$longdblsize" in
21180 12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
21181 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
21182 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
21183 ;;
21184 16) # x86_64
21185 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21186 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21187 ;;
21188 *) # No idea.
21189 longdblinfbytes=$undef
21190 longdblnanbytes=$undef
21191 ;;
21192 esac
21193 ;;
21194 4) # IEEE 754 80-bit BE, 12 or 16 bytes
21195 case "$longdblsize" in
21196 12) # 32-bit system
21197 longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21198 longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21199 ;;
21200 16) # 64-bit system
21201 longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21202 longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21203 ;;
21204 *) # No idea.
21205 longdblinfbytes=$undef
21206 longdblnanbytes=$undef
21207 ;;
21208 esac
21209 ;;
21210 5) # 128-bit LE-LE "double double"
21211 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
21212 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
21213 ;;
21214 6) # 128-bit BE-BE "double double"
21215 longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21216 longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21217 ;;
21218 7) # 128-bit LE-BE "double double"
21219 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21220 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21221 ;;
21222 8) # 128-bit BE-LE "double double"
21223 longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21224 longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21225 ;;
21226 9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
21227 longdblinfbytes=$undef
21228 longdblnanbytes=$undef
21229 ;;
21230 *) # No idea.
21231 longdblinfbytes=$undef
21232 longdblnanbytes=$undef
21233 ;;
21234 esac
21235 fi
21236 # In case the program crashed the values are empty, turn them undef.
21237 case "$doubleinfbytes" in
21238 '') doubleinfbytes=$undef ;;
21239 esac
21240 case "$doublenanbytes" in
21241 '') doublenanbytes=$undef ;;
21242 esac
21243 case "$longdblinfbytes" in
21244 '') longdblinfbytes=$undef ;;
21245 esac
21246 case "$longdblnanbytes" in
21247 '') longdblnanbytes=$undef ;;
21248 esac
21249 $rm_try
21250
21251 : Check the length of the double mantissa
21252 $echo "Checking how many mantissa bits your doubles have..." >&4
21253 $cat >try.c <<EOP
21254 #$i_sunmath I_SUNMATH
21255 #include <float.h>
21256 #ifdef I_SUNMATH
21257 # include <sunmath.h>
21258 #endif
21259 #ifdef DBL_MANT_DIG
21260 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
21261 #endif
21262 #include <stdio.h>
21263 int main(int argc, char *argv[]) {
21264 #ifdef BITS
21265 printf("%d\n", BITS);
21266 #endif
21267 return 0;
21268 }
21269 EOP
21270 set try
21271 if eval $compile; then
21272 doublemantbits=`$run ./try`
21273 else
21274 doublemantbits="$undef"
21275 fi
21276 $rm_try
21277
21278 : Check the length of the longdouble mantissa
21279 $echo "Checking how many mantissa bits your long doubles have..." >&4
21280 $cat >try.c <<EOP
21281 #$i_sunmath I_SUNMATH
21282 #include <float.h>
21283 #ifdef I_SUNMATH
21284 # include <sunmath.h>
21285 #endif
21286 #$d_longdbl HAS_LONG_DOUBLE
21287 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
21288 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
21289 /* This format has no implicit bit. Beware, however, that for
21290 * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
21291 * the top three bits are used for inf (100) / qnan (11x) / snan (101),
21292 * and the top bit must have been one since 387, zero is plain invalid.
21293 * For normal fp values, the LDBL_MANT_DIG is fine, though. */
21294 # define BITS LDBL_MANT_DIG
21295 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
21296 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
21297 * reason e.g. Irix thinks 107. But in any case, we want only
21298 * the number of real bits, the implicit bits are of no interest. */
21299 # define BITS 2 * (DBL_MANT_DIG - 1)
21300 # else
21301 # define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
21302 # endif
21303 #endif
21304 #include <stdio.h>
21305 int main(int argc, char *argv[]) {
21306 #ifdef BITS
21307 printf("%d\n", BITS);
21308 #endif
21309 return 0;
21310 }
21311 EOP
21312 set try
21313 if eval $compile; then
21314 longdblmantbits=`$run ./try`
21315 else
21316 longdblmantbits="$undef"
21317 fi
21318 $rm_try
21319
21320 : Check the length of the NV mantissa
21321 $echo "Checking how many mantissa bits your NVs have..." >&4
21322 if test "X$usequadmath" = "X$define"; then
21323 nvmantbits=112 # 128-1-15
21324 else
21325 if test "X$nvsize" = "X$doublesize"; then
21326 nvmantbits="$doublemantbits"
21327 else
21328 if test "X$nvsize" = "X$longdblsize"; then
21329 nvmantbits="$longdblmantbits"
21330 else
21331 nvmantbits="$undef"
21332 fi
21333 fi
21334 fi
21335
21336 : How can we generate normalized random numbers ?
21337 echo " "
21338 echo "Using our internal random number implementation..." >&4
21339
21340 case "$ccflags" in
21341 *-Dmy_rand=*|*-Dmy_srand=*)
21342 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
21343 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
21344 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
21345 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
21346 ;;
21347 esac
21348
21349 randfunc=Perl_drand48
21350 drand01="Perl_drand48()"
21351 seedfunc="Perl_drand48_init"
21352 randbits=48
21353 randseedtype=U32
21354
21355 : Probe whether dtrace builds an object, as newer Illumos requires an input
21356 : object file that uses at least one of the probes defined in the .d file
21357 case "$usedtrace" in
21358 $define)
21359 case "$dtracexnolibs" in
21360 $define|true|[yY]*)
21361 dtracexnolibs=$define
21362 $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
21363 ;;
21364 ' '|'')
21365 if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
21366 dtracexnolibs=$define
21367 echo "Your dtrace accepts -xnolibs"
21368 elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
21369 dtracexnolibs=$undef
21370 echo "Your dtrace doesn't accept -xnolibs"
21371 else
21372 echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
21373 exit 1
21374 fi
21375 ;;
21376 *)
21377 dtracexnolibs=$undef
21378 $dtrace -h -s ../perldtrace.d -o perldtrace.h
21379 ;;
21380 esac
21381 case $dtracexnolibs in
21382 $define) xnolibs=-xnolibs ;;
21383 *) xnolibs= ;;
21384 esac
21385
21386 case "$dtraceobject" in
21387 $define|true|[yY]*)
21388 dtraceobject=$define
21389 ;;
21390 ' '|'')
21391 $cat >try.c <<EOM
21392 #include "perldtrace.h"
21393 int main(void) {
21394 PERL_LOADED_FILE("dummy");
21395 return 0;
21396 }
21397 EOM
21398 dtraceobject=$undef
21399 if $cc -c -o try.o $optimize $ccflags try.c \
21400 && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
21401 dtraceobject=$define
21402 echo "Your dtrace builds an object file"
21403 fi
21404 ;;
21405 *) dtraceobject=$undef ;;
21406 esac
21407 $rm_try perldtrace.o perldtrace.h
21408 esac
21409
21410 : Determine if this is an EBCDIC system
21411 echo " "
21412 echo "Determining whether or not we are on an EBCDIC system..." >&4
21413 $cat >try.c <<'EOM'
21414 int main()
21415 {
21416 if ('M'==0xd4) return 0;
21417 return 1;
21418 }
21419 EOM
21420
21421 val=$undef
21422 set try
21423 if eval $compile_ok; then
21424 if $run ./try; then
21425 echo "You seem to speak EBCDIC." >&4
21426 val="$define"
21427 else
21428 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
21429 fi
21430 else
21431 echo "I'm unable to compile the test program." >&4
21432 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
21433 fi
21434 $rm_try
21435 set ebcdic
21436 eval $setvar
21437
21438 : Check how to flush
21439 echo " "
21440 $cat >&4 <<EOM
21441 Checking how to flush all pending stdio output...
21442 EOM
21443 # I only know how to find the first 32 possibly open files on SunOS.
21444 # See also hints/sunos_4_1.sh and util.c --AD
21445 case "$osname" in
21446 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
21447 esac
21448 $cat >>try.c <<EOCP
21449 #include <stdio.h>
21450 #$i_stdlib I_STDLIB
21451 #ifdef I_STDLIB
21452 #include <stdlib.h>
21453 #endif
21454 #$i_unistd I_UNISTD
21455 #ifdef I_UNISTD
21456 # include <unistd.h>
21457 #endif
21458 #$d_sysconf HAS_SYSCONF
21459 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
21460 #ifdef HAS_STDIO_STREAM_ARRAY
21461 # define STDIO_STREAM_ARRAY $stdio_stream_array
21462 #endif
21463 int main() {
21464 FILE* p;
21465 unlink("try.out");
21466 p = fopen("try.out", "w");
21467 #ifdef TRY_FPUTC
21468 fputc('x', p);
21469 #else
21470 # ifdef TRY_FPRINTF
21471 fprintf(p, "x");
21472 # endif
21473 #endif
21474 #ifdef TRY_FFLUSH_NULL
21475 fflush(NULL);
21476 #endif
21477 #ifdef TRY_FFLUSH_ALL
21478 {
21479 long open_max = -1;
21480 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
21481 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
21482 # else
21483 # if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
21484 open_max = sysconf(_SC_OPEN_MAX);
21485 # else
21486 # ifdef FOPEN_MAX
21487 open_max = FOPEN_MAX;
21488 # else
21489 # ifdef OPEN_MAX
21490 open_max = OPEN_MAX;
21491 # else
21492 # ifdef _NFILE
21493 open_max = _NFILE;
21494 # endif
21495 # endif
21496 # endif
21497 # endif
21498 # endif
21499 # ifdef HAS_STDIO_STREAM_ARRAY
21500 if (open_max > 0) {
21501 long i;
21502 for (i = 0; i < open_max; i++)
21503 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
21504 STDIO_STREAM_ARRAY[i]._file < open_max &&
21505 STDIO_STREAM_ARRAY[i]._flag)
21506 fflush(&STDIO_STREAM_ARRAY[i]);
21507 }
21508 # endif
21509 }
21510 #endif
21511 _exit(42);
21512 }
21513 EOCP
21514 : first we have to find out how _not_ to flush
21515 $to try.c
21516 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
21517 output=''
21518 set try -DTRY_FPUTC
21519 if eval $compile; then
21520 $run ./try 2>/dev/null
21521 code="$?"
21522 $from try.out
21523 if $test ! -s try.out -a "X$code" = X42; then
21524 output=-DTRY_FPUTC
21525 fi
21526 fi
21527 case "$output" in
21528 '')
21529 set try -DTRY_FPRINTF
21530 if eval $compile; then
21531 $run ./try 2>/dev/null
21532 code="$?"
21533 $from try.out
21534 if $test ! -s try.out -a "X$code" = X42; then
21535 output=-DTRY_FPRINTF
21536 fi
21537 fi
21538 ;;
21539 esac
21540 fi
21541 : check for fflush NULL behavior
21542 case "$fflushNULL" in
21543 '') set try -DTRY_FFLUSH_NULL $output
21544 if eval $compile; then
21545 $run ./try 2>/dev/null
21546 code="$?"
21547 $from try.out
21548 if $test -s try.out -a "X$code" = X42; then
21549 fflushNULL="`$cat try.out`"
21550 else
21551 if $test "X$code" != X42; then
21552 $cat >&4 <<EOM
21553 (If this test failed, don't worry, we'll try another method shortly.)
21554 EOM
21555 fi
21556 fi
21557 fi
21558 $rm -f core try.core core.try.*
21559 case "$fflushNULL" in
21560 x) $cat >&4 <<EOM
21561 Your fflush(NULL) works okay for output streams.
21562 Let's see if it clobbers input pipes...
21563 EOM
21564 # As of mid-March 2000 all versions of Solaris appear to have a stdio
21565 # bug that improperly flushes the input end of pipes. So we avoid the
21566 # autoflush on fork/system/exec support for now. :-(
21567 $cat >tryp.c <<EOCP
21568 #include <stdio.h>
21569 int
21570 main(int argc, char **argv)
21571 {
21572 char buf[1024];
21573 int i;
21574 char *bp = buf;
21575 while (1) {
21576 while ((i = getc(stdin)) != -1
21577 && (*bp++ = i) != '\n'
21578 && bp < &buf[1024])
21579 /* DO NOTHING */ ;
21580 *bp = '\0';
21581 fprintf(stdout, "%s", buf);
21582 fflush(NULL);
21583 if (i == -1)
21584 return 0;
21585 bp = buf;
21586 }
21587 }
21588 EOCP
21589 fflushNULL="$define"
21590 set tryp
21591 if eval $compile; then
21592 $rm -f tryp.out
21593 # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
21594 if $test "X$targethost" != X; then
21595 $to tryp.c
21596 $to tryp
21597 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21598 else
21599 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
21600 fi
21601 if cmp tryp.c tryp.out >/dev/null 2>&1; then
21602 $cat >&4 <<EOM
21603 fflush(NULL) seems to behave okay with input streams.
21604 EOM
21605 fflushNULL="$define"
21606 else
21607 $cat >&4 <<EOM
21608 Ouch, fflush(NULL) clobbers input pipes! We will not use it.
21609 EOM
21610 fflushNULL="$undef"
21611 fi
21612 fi
21613 $rm -f core tryp.c tryp.core core.tryp.*
21614 ;;
21615 '') $cat >&4 <<EOM
21616 Your fflush(NULL) isn't working (contrary to ANSI C).
21617 EOM
21618 fflushNULL="$undef"
21619 ;;
21620 *) $cat >&4 <<EOM
21621 Cannot figure out whether your fflush(NULL) works or not.
21622 I'm assuming it doesn't (contrary to ANSI C).
21623 EOM
21624 fflushNULL="$undef"
21625 ;;
21626 esac
21627 ;;
21628 $define|true|[yY]*)
21629 fflushNULL="$define"
21630 ;;
21631 *)
21632 fflushNULL="$undef"
21633 ;;
21634 esac
21635 : check explicit looping only if NULL did not work, and if the pipe
21636 : bug does not show up on an explicit flush too
21637 case "$fflushNULL" in
21638 "$undef")
21639 $cat >tryp.c <<EOCP
21640 #include <stdio.h>
21641 int
21642 main(int argc, char **argv)
21643 {
21644 char buf[1024];
21645 int i;
21646 char *bp = buf;
21647 while (1) {
21648 while ((i = getc(stdin)) != -1
21649 && (*bp++ = i) != '\n'
21650 && bp < &buf[1024])
21651 /* DO NOTHING */ ;
21652 *bp = '\0';
21653 fprintf(stdout, "%s", buf);
21654 fflush(stdin);
21655 if (i == -1)
21656 return 0;
21657 bp = buf;
21658 }
21659 }
21660 EOCP
21661 set tryp
21662 if eval $compile; then
21663 $rm -f tryp.out
21664 if $test "X$targethost" != X; then
21665 $to tryp.c
21666 $to tryp
21667 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21668 else
21669 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
21670 fi
21671 if cmp tryp.c tryp.out >/dev/null 2>&1; then
21672 $cat >&4 <<EOM
21673 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
21674 EOM
21675 : now check for fflushall behaviour
21676 case "$fflushall" in
21677 '') set try -DTRY_FFLUSH_ALL $output
21678 if eval $compile; then
21679 $cat >&4 <<EOM
21680 (Now testing the other method--but note that this also may fail.)
21681 EOM
21682 $run ./try 2>/dev/null
21683 code=$?
21684 $from try.out
21685 if $test -s try.out -a "X$code" = X42; then
21686 fflushall="`$cat try.out`"
21687 fi
21688 fi
21689 $rm_try
21690 case "$fflushall" in
21691 x) $cat >&4 <<EOM
21692 Whew. Flushing explicitly all the stdio streams works.
21693 EOM
21694 fflushall="$define"
21695 ;;
21696 '') $cat >&4 <<EOM
21697 Sigh. Flushing explicitly all the stdio streams doesn't work.
21698 EOM
21699 fflushall="$undef"
21700 ;;
21701 *) $cat >&4 <<EOM
21702 Cannot figure out whether flushing stdio streams explicitly works or not.
21703 I'm assuming it doesn't.
21704 EOM
21705 fflushall="$undef"
21706 ;;
21707 esac
21708 ;;
21709 "$define"|true|[yY]*)
21710 fflushall="$define"
21711 ;;
21712 *)
21713 fflushall="$undef"
21714 ;;
21715 esac
21716 else
21717 $cat >&4 <<EOM
21718 All is futile. Even fflush(stdin) clobbers input pipes!
21719 EOM
21720 fflushall="$undef"
21721 fi
21722 else
21723 fflushall="$undef"
21724 fi
21725 $rm -f core tryp.c tryp.core core.tryp.*
21726 ;;
21727 *) fflushall="$undef"
21728 ;;
21729 esac
21730
21731 case "$fflushNULL$fflushall" in
21732 undefundef)
21733 $cat <<EOM
21734 OK, I give up. I cannot figure out how to flush pending stdio output.
21735 We won't be flushing handles at all before fork/exec/popen.
21736 EOM
21737 ;;
21738 esac
21739 $rm_try tryp
21740
21741 : Store the full pathname to the ar program for use in the C program
21742 : Respect a hint or command line value for full_ar.
21743 case "$full_ar" in
21744 '') full_ar=$ar ;;
21745 esac
21746
21747 : Store the full pathname to the sed program for use in the C program
21748 full_sed=$sed
21749
21750 : see what type gids are declared as in the kernel
21751 echo " "
21752 echo "Looking for the type for group ids returned by getgid()."
21753 set gid_t gidtype xxx stdio.h sys/types.h
21754 eval $typedef
21755 case "$gidtype" in
21756 xxx)
21757 xxx=`./findhdr sys/user.h`
21758 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21759 case $1 in
21760 unsigned) dflt="$1 $2" ;;
21761 *) dflt="$1" ;;
21762 esac
21763 ;;
21764 *) dflt="$gidtype";;
21765 esac
21766 case "$gidtype" in
21767 gid_t) echo "gid_t found." ;;
21768 *) rp="What is the type for group ids returned by getgid()?"
21769 . ./myread
21770 gidtype="$ans"
21771 ;;
21772 esac
21773
21774 : Check the size of GID
21775 echo " "
21776 case "$gidtype" in
21777 *_t) zzz="$gidtype" ;;
21778 *) zzz="gid" ;;
21779 esac
21780 echo "Checking the size of $zzz..." >&4
21781 cat > try.c <<EOCP
21782 #include <sys/types.h>
21783 #include <stdio.h>
21784 #$i_stdlib I_STDLIB
21785 #ifdef I_STDLIB
21786 #include <stdlib.h>
21787 #endif
21788 int main() {
21789 printf("%d\n", (int)sizeof($gidtype));
21790 exit(0);
21791 }
21792 EOCP
21793 set try
21794 if eval $compile_ok; then
21795 yyy=`$run ./try`
21796 case "$yyy" in
21797 '') gidsize=4
21798 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21799 ;;
21800 *) gidsize=$yyy
21801 echo "Your $zzz is $gidsize bytes long."
21802 ;;
21803 esac
21804 else
21805 gidsize=4
21806 echo "(I can't compile the test program--guessing $gidsize.)" >&4
21807 fi
21808
21809 : Check if GID is signed
21810 echo " "
21811 case "$gidtype" in
21812 *_t) zzz="$gidtype" ;;
21813 *) zzz="gid" ;;
21814 esac
21815 echo "Checking the sign of $zzz..." >&4
21816 cat > try.c <<EOCP
21817 #include <sys/types.h>
21818 #include <stdio.h>
21819 int main() {
21820 $gidtype foo = -1;
21821 if (foo < 0)
21822 printf("-1\n");
21823 else
21824 printf("1\n");
21825 }
21826 EOCP
21827 set try
21828 if eval $compile; then
21829 yyy=`$run ./try`
21830 case "$yyy" in
21831 '') gidsign=1
21832 echo "(I can't execute the test program--guessing unsigned.)" >&4
21833 ;;
21834 *) gidsign=$yyy
21835 case "$gidsign" in
21836 1) echo "Your $zzz is unsigned." ;;
21837 -1) echo "Your $zzz is signed." ;;
21838 esac
21839 ;;
21840 esac
21841 else
21842 gidsign=1
21843 echo "(I can't compile the test program--guessing unsigned.)" >&4
21844 fi
21845
21846 : Check 64bit sizes
21847 echo " "
21848
21849 if $test X"$quadtype" != X; then
21850
21851 echo "Checking how to print 64-bit integers..." >&4
21852
21853 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21854 $cat >try.c <<'EOCP'
21855 #include <sys/types.h>
21856 #include <stdio.h>
21857 int main() {
21858 int q = 12345678901;
21859 printf("%ld\n", q);
21860 }
21861 EOCP
21862 set try
21863 if eval $compile; then
21864 yyy=`$run ./try`
21865 case "$yyy" in
21866 12345678901)
21867 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21868 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21869 echo "We will use %d."
21870 ;;
21871 esac
21872 fi
21873 fi
21874
21875 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21876 $cat >try.c <<'EOCP'
21877 #include <sys/types.h>
21878 #include <stdio.h>
21879 int main() {
21880 long q = 12345678901;
21881 printf("%ld\n", q);
21882 }
21883 EOCP
21884 set try
21885 if eval $compile; then
21886 yyy=`$run ./try`
21887 case "$yyy" in
21888 12345678901)
21889 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21890 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21891 echo "We will use %ld."
21892 ;;
21893 esac
21894 fi
21895 fi
21896
21897 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21898 $cat >try.c <<'EOCP'
21899 #include <sys/types.h>
21900 #include <inttypes.h>
21901 #include <stdio.h>
21902 int main() {
21903 int64_t q = 12345678901;
21904 printf("%" PRId64 "\n", q);
21905 }
21906 EOCP
21907 set try
21908 if eval $compile; then
21909 yyy=`$run ./try`
21910 case "$yyy" in
21911 12345678901)
21912 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21913 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIX64;
21914 echo "We will use the C9X style."
21915 ;;
21916 esac
21917 fi
21918 fi
21919
21920 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21921 $cat >try.c <<'EOCP'
21922 #include <sys/types.h>
21923 #include <stdio.h>
21924 int main() {
21925 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21926 printf("%lld\n", q);
21927 }
21928 EOCP
21929 set try
21930 if eval $compile; then
21931 yyy=`$run ./try`
21932 case "$yyy" in
21933 12345678901)
21934 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21935 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21936 echo "We will use the %lld style."
21937 ;;
21938 esac
21939 fi
21940 fi
21941
21942 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21943 $cat >try.c <<EOCP
21944 #include <sys/types.h>
21945 #include <stdio.h>
21946 int main() {
21947 $quadtype q = 12345678901;
21948 printf("%qd\n", q);
21949 }
21950 EOCP
21951 set try
21952 if eval $compile; then
21953 yyy=`$run ./try`
21954 case "$yyy" in
21955 12345678901)
21956 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21957 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21958 echo "We will use %qd."
21959 ;;
21960 esac
21961 fi
21962 fi
21963
21964 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21965 $cat >try.c <<EOCP
21966 #include <sys/types.h>
21967 #include <stdio.h>
21968 int main() {
21969 $quadtype q = 12345678901;
21970 printf("%Ld\n", q);
21971 }
21972 EOCP
21973 set try
21974 if eval $compile; then
21975 yyy=`$run ./try`
21976 case "$yyy" in
21977 12345678901)
21978 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21979 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21980 echo "We will use %Ld."
21981 ;;
21982 esac
21983 fi
21984 fi
21985
21986 if $test X"$sPRId64" = X; then
21987 echo "Cannot figure out how to print 64-bit integers." >&4
21988 fi
21989 $rm_try
21990
21991 fi
21992
21993 case "$sPRId64" in
21994 '') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21995 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21996 ;;
21997 *) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21998 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21999 ;;
22000 esac
22001
22002 : Check format strings for internal types
22003 echo " "
22004 $echo "Checking the format strings to be used for Perl's internal types..." >&4
22005
22006 if $test X"$ivsize" = X8; then
22007 ivdformat="$sPRId64"
22008 uvuformat="$sPRIu64"
22009 uvoformat="$sPRIo64"
22010 uvxformat="$sPRIx64"
22011 uvXUformat="$sPRIXU64"
22012 else
22013 if $test X"$ivsize" = X"$longsize"; then
22014 ivdformat='"ld"'
22015 uvuformat='"lu"'
22016 uvoformat='"lo"'
22017 uvxformat='"lx"'
22018 uvXUformat='"lX"'
22019 else
22020 if $test X"$ivsize" = X"$intsize"; then
22021 ivdformat='"d"'
22022 uvuformat='"u"'
22023 uvoformat='"o"'
22024 uvxformat='"x"'
22025 uvXUformat='"X"'
22026 else
22027 : far out
22028 if $test X"$ivsize" = X"$shortsize"; then
22029 ivdformat='"hd"'
22030 uvuformat='"hu"'
22031 uvoformat='"ho"'
22032 uvxformat='"hx"'
22033 uvXUformat='"hX"'
22034 fi
22035 fi
22036 fi
22037 fi
22038
22039 if $test X"$usequadmath" = X"$define"; then
22040 nveformat='"Qe"'
22041 nvfformat='"Qf"'
22042 nvgformat='"Qg"'
22043 nvEUformat='"QE"'
22044 nvFUformat='"QF"'
22045 nvGUformat='"QG"'
22046 else
22047 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
22048 nveformat="$sPRIeldbl"
22049 nvfformat="$sPRIfldbl"
22050 nvgformat="$sPRIgldbl"
22051 nvEUformat="$sPRIEUldbl"
22052 nvFUformat="$sPRIFUldbl"
22053 nvGUformat="$sPRIGUldbl"
22054 else
22055 nveformat='"e"'
22056 nvfformat='"f"'
22057 nvgformat='"g"'
22058 nvEUformat='"E"'
22059 nvFUformat='"F"'
22060 nvGUformat='"G"'
22061 fi
22062 fi
22063
22064 case "$ivdformat" in
22065 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
22066 exit 1
22067 ;;
22068 esac
22069
22070 : Check format string for GID
22071
22072 echo " "
22073 $echo "Checking the format string to be used for gids..." >&4
22074
22075 case "$gidsign" in
22076 -1) if $test X"$gidsize" = X"$ivsize"; then
22077 gidformat="$ivdformat"
22078 else
22079 if $test X"$gidsize" = X"$longsize"; then
22080 gidformat='"ld"'
22081 else
22082 if $test X"$gidsize" = X"$intsize"; then
22083 gidformat='"d"'
22084 else
22085 if $test X"$gidsize" = X"$shortsize"; then
22086 gidformat='"hd"'
22087 fi
22088 fi
22089 fi
22090 fi
22091 ;;
22092 *) if $test X"$gidsize" = X"$uvsize"; then
22093 gidformat="$uvuformat"
22094 else
22095 if $test X"$gidsize" = X"$longsize"; then
22096 gidformat='"lu"'
22097 else
22098 if $test X"$gidsize" = X"$intsize"; then
22099 gidformat='"u"'
22100 else
22101 if $test X"$gidsize" = X"$shortsize"; then
22102 gidformat='"hu"'
22103 fi
22104 fi
22105 fi
22106 fi
22107 ;;
22108 esac
22109
22110 : see if getgroups exists
22111 set getgroups d_getgrps
22112 eval $inlibc
22113
22114 : see if setgroups exists
22115 set setgroups d_setgrps
22116 eval $inlibc
22117
22118 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
22119 echo " "
22120 case "$d_getgrps$d_setgrps" in
22121 *define*)
22122 case "$groupstype" in
22123 '') dflt="$gidtype" ;;
22124 *) dflt="$groupstype" ;;
22125 esac
22126 $cat <<EOM
22127 What type of pointer is the second argument to getgroups() and setgroups()?
22128 Usually this is the same as group ids, $gidtype, but not always.
22129
22130 EOM
22131 rp='What type pointer is the second argument to getgroups() and setgroups()?'
22132 . ./myread
22133 groupstype="$ans"
22134 ;;
22135 *) groupstype="$gidtype";;
22136 esac
22137
22138 : Check format strings for internal 32bit types
22139 echo " "
22140 $echo "Checking the format strings to be used for Perl's internal 32bit-types..." >&4
22141
22142 case "$i32dformat" in
22143 '') case "$i32type" in
22144 int)
22145 i32dformat='"d"'
22146 u32uformat='"u"'
22147 u32oformat='"o"'
22148 u32xformat='"x"'
22149 u32XUformat='"X"'
22150 ;;
22151 long)
22152 i32dformat='"ld"'
22153 u32uformat='"lu"'
22154 u32oformat='"lo"'
22155 u32xformat='"lx"'
22156 u32XUformat='"lX"'
22157 ;;
22158 int_least32_t) : will not happen currently
22159 i32dformat=PRIdLEAST32
22160 u32uformat=PRIuLEAST32
22161 u32oformat=PRIoLEAST32
22162 u32xformat=PRIxLEAST32
22163 u32XUformat=PRIXLEAST32
22164 ;;
22165 int32_t)
22166 i32dformat=PRId32
22167 u32uformat=PRIu32
22168 u32oformat=PRIo32
22169 u32xformat=PRIx32
22170 u32XUformat=PRIX32
22171 ;;
22172 esac ;;
22173 esac
22174
22175 case "$i32dformat" in
22176 '') echo "$0: Fatal: failed to find format strings for 32-bit integers, cannot continue." >&4
22177 exit 1
22178 ;;
22179 esac
22180
22181 : check whether make sets MAKE
22182 echo " "
22183 echo "Checking if your $make program sets \$(MAKE)..." >&4
22184 case "$make_set_make" in
22185 '')
22186 $sed 's/^X //' > testmake.mak << 'EOF'
22187 Xall:
22188 X @echo 'maketemp="$(MAKE)"'
22189 EOF
22190 case "`$make -f testmake.mak 2>/dev/null`" in
22191 *maketemp=*) make_set_make='#' ;;
22192 *) make_set_make="MAKE=$make" ;;
22193 esac
22194 $rm -f testmake.mak
22195 ;;
22196 esac
22197 case "$make_set_make" in
22198 '#') echo "Yup, it does.";;
22199 *) echo "Nope, it doesn't.";;
22200 esac
22201
22202 : see what type is used for mode_t
22203 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
22204 set mode_t modetype int stdio.h sys/types.h
22205 eval $typedef_ask
22206
22207 : see if we need va_copy
22208 echo " "
22209 $cat >try.c <<EOCP
22210 #include <stdarg.h>
22211 #include <stdio.h>
22212 #include <stdlib.h>
22213 #include <signal.h>
22214
22215 int
22216 ivfprintf(FILE *f, const char *fmt, va_list *valp)
22217 {
22218 return vfprintf(f, fmt, *valp);
22219 }
22220
22221 int
22222 myvfprintf(FILE *f, const char *fmt, va_list val)
22223 {
22224 return ivfprintf(f, fmt, &val);
22225 }
22226
22227 int
22228 myprintf(char *fmt, ...)
22229 {
22230 va_list val;
22231 va_start(val, fmt);
22232 return myvfprintf(stdout, fmt, val);
22233 }
22234
22235 int
22236 main(int ac, char **av)
22237 {
22238 signal(SIGSEGV, exit);
22239 #ifdef SIGBUS
22240 signal(SIGBUS, exit);
22241 #endif
22242
22243 myprintf("%s%cs all right, then\n", "that", '\'');
22244 exit(0);
22245 }
22246 EOCP
22247 set try
22248 if eval $compile && $run ./try 2>&1 >/dev/null; then
22249 case "`$run ./try`" in
22250 "that's all right, then")
22251 okay=yes
22252 ;;
22253 esac
22254 fi
22255 case "$okay" in
22256 yes) echo "It seems that you don't need va_copy()." >&4
22257 need_va_copy="$undef"
22258 ;;
22259 *) echo "It seems that va_copy() or similar will be needed." >&4
22260 need_va_copy="$define"
22261 ;;
22262 esac
22263 $rm_try
22264
22265 : see what type is used for size_t
22266 rp="What is the type used for the length parameter for string functions?"
22267 set size_t sizetype 'unsigned int' stdio.h sys/types.h
22268 eval $typedef_ask
22269
22270 : check for type of arguments to gethostbyaddr.
22271 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
22272 case "$d_gethbyaddr" in
22273 $define)
22274 $cat <<EOM
22275
22276 Checking to see what type of arguments are accepted by gethostbyaddr().
22277 EOM
22278 hdrs="$define sys/types.h
22279 $d_socket sys/socket.h
22280 $i_niin netinet/in.h
22281 $i_netdb netdb.h
22282 $i_unistd unistd.h"
22283 : The first arg can 'char *' or 'void *'
22284 : The second arg is some of integral type
22285 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
22286 for yyy in size_t long int; do
22287 case "$netdb_host_type" in
22288 '') try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
22289 if ./protochk "$try" $hdrs; then
22290 echo "Your system accepts $xxx for the first arg."
22291 echo "...and $yyy for the second arg."
22292 netdb_host_type="$xxx"
22293 netdb_hlen_type="$yyy"
22294 fi
22295 ;;
22296 esac
22297 done
22298 done
22299 : In case none of those worked, prompt the user.
22300 case "$netdb_host_type" in
22301 '') rp='What is the type for the 1st argument to gethostbyaddr?'
22302 dflt='char *'
22303 . ./myread
22304 netdb_host_type=$ans
22305 rp='What is the type for the 2nd argument to gethostbyaddr?'
22306 dflt="$sizetype"
22307 . ./myread
22308 netdb_hlen_type=$ans
22309 ;;
22310 esac
22311 ;;
22312 *) : no gethostbyaddr, so pick harmless defaults
22313 netdb_host_type='char *'
22314 netdb_hlen_type="$sizetype"
22315 ;;
22316 esac
22317 # Remove the "const" if needed. -- but then we'll have a
22318 # prototype clash!
22319 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
22320 fi
22321
22322 : check for type of argument to gethostbyname.
22323 if test "X$netdb_name_type" = X ; then
22324 case "$d_gethbyname" in
22325 $define)
22326 $cat <<EOM
22327
22328 Checking to see what type of argument is accepted by gethostbyname().
22329 EOM
22330 hdrs="$define sys/types.h
22331 $d_socket sys/socket.h
22332 $i_niin netinet/in.h
22333 $i_netdb netdb.h
22334 $i_unistd unistd.h"
22335 for xxx in "const char *" "char *"; do
22336 case "$netdb_name_type" in
22337 '') try="$extern_C struct hostent *gethostbyname($xxx);"
22338 if ./protochk "$try" $hdrs; then
22339 echo "Your system accepts $xxx."
22340 netdb_name_type="$xxx"
22341 fi
22342 ;;
22343 esac
22344 done
22345 : In case none of those worked, prompt the user.
22346 case "$netdb_name_type" in
22347 '') rp='What is the type for the 1st argument to gethostbyname?'
22348 dflt='char *'
22349 . ./myread
22350 netdb_name_type=$ans
22351 ;;
22352 esac
22353 ;;
22354 *) : no gethostbyname, so pick harmless default
22355 netdb_name_type='char *'
22356 ;;
22357 esac
22358 fi
22359
22360 : check for type of 1st argument to getnetbyaddr.
22361 if test "X$netdb_net_type" = X ; then
22362 case "$d_getnbyaddr" in
22363 $define)
22364 $cat <<EOM
22365
22366 Checking to see what type of 1st argument is accepted by getnetbyaddr().
22367 EOM
22368 hdrs="$define sys/types.h
22369 $d_socket sys/socket.h
22370 $i_niin netinet/in.h
22371 $i_netdb netdb.h
22372 $i_unistd unistd.h"
22373 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
22374 case "$netdb_net_type" in
22375 '') try="$extern_C struct netent *getnetbyaddr($xxx, int);"
22376 if ./protochk "$try" $hdrs; then
22377 echo "Your system accepts $xxx."
22378 netdb_net_type="$xxx"
22379 fi
22380 ;;
22381 esac
22382 done
22383 : In case none of those worked, prompt the user.
22384 case "$netdb_net_type" in
22385 '') rp='What is the type for the 1st argument to getnetbyaddr?'
22386 dflt='long'
22387 . ./myread
22388 netdb_net_type=$ans
22389 ;;
22390 esac
22391 ;;
22392 *) : no getnetbyaddr, so pick harmless default
22393 netdb_net_type='long'
22394 ;;
22395 esac
22396 fi
22397 : locate the preferred pager for this system
22398 fn=f/
22399 case "$pager" in
22400 '')
22401 dflt=''
22402 case "$pg" in
22403 /*) dflt=$pg;;
22404 [a-zA-Z]:/*) dflt=$pg;;
22405 esac
22406 case "$more" in
22407 /*) dflt=$more;;
22408 [a-zA-Z]:/*) dflt=$more;;
22409 esac
22410 case "$less" in
22411 /*) dflt=$less;;
22412 [a-zA-Z]:/*) dflt=$less;;
22413 esac
22414 case "$dflt" in
22415 '') dflt=/usr/ucb/more;;
22416 esac
22417 ;;
22418 *) dflt="$pager"
22419 ;;
22420 esac
22421 fn="f/($dflt)"
22422 echo " "
22423 rp='What pager is used on your system?'
22424 . ./getfile
22425 pager="$ans"
22426
22427 : see if ar generates random libraries by itself
22428 echo " "
22429 echo "Checking how to generate random libraries on your machine..." >&4
22430 echo 'extern int bar2(); int bar1() { return bar2(); }' > bar1.c
22431 echo 'int bar2() { return 2; }' > bar2.c
22432 $cat > foo.c <<EOP
22433 #$i_stdlib I_STDLIB
22434 #ifdef I_STDLIB
22435 #include <stdlib.h>
22436 #endif
22437 #include <stdio.h>
22438 extern int bar1();
22439 int main() { printf("%d\n", bar1()); exit(0); }
22440 EOP
22441 $cc $ccflags -c bar1.c >/dev/null 2>&1
22442 $cc $ccflags -c bar2.c >/dev/null 2>&1
22443 $cc $ccflags -c foo.c >/dev/null 2>&1
22444 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
22445 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22446 $run ./foobar >/dev/null 2>&1; then
22447 echo "$ar appears to generate random libraries itself."
22448 orderlib=false
22449 if [ "X$ranlib" = "X" ]; then
22450 ranlib=":"
22451 fi
22452 elif $ar s bar$_a >/dev/null 2>&1 &&
22453 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22454 $run ./foobar >/dev/null 2>&1; then
22455 echo "a table of contents needs to be added with '$ar s'."
22456 orderlib=false
22457 ranlib="$ar s"
22458 elif $ar ts bar$_a >/dev/null 2>&1 &&
22459 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22460 $run ./foobar >/dev/null 2>&1; then
22461 echo "a table of contents needs to be added with '$ar ts'."
22462 orderlib=false
22463 ranlib="$ar ts"
22464 else
22465 case "$ranlib" in
22466 :) ranlib='';;
22467 '')
22468 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
22469 $test -f $ranlib || ranlib=''
22470 ;;
22471 esac
22472 if $test -n "$ranlib"; then
22473 echo "your system has '$ranlib'; we'll use that."
22474 orderlib=false
22475 else
22476 echo "your system doesn't seem to support random libraries"
22477 echo "so we'll use lorder and tsort to order the libraries."
22478 orderlib=true
22479 ranlib=":"
22480 fi
22481 fi
22482 $rm -f foo* bar*
22483
22484 : Check the max offset that gmtime and localtime accept
22485 echo "Checking max offsets that gmtime () accepts"
22486
22487 case "$sGMTIME_min/$sGMTIME_max" in
22488 0/0|/)
22489 $cat >try.c <<EOCP
22490 #include <sys/types.h>
22491 #include <stdio.h>
22492 #include <time.h>
22493
22494 int i;
22495 struct tm *tmp;
22496 time_t pt;
22497
22498 void gm_check (time_t t, int min_year, int max_year)
22499 {
22500 tmp = gmtime (&t);
22501 if ( tmp == NULL ||
22502 /* Check tm_year overflow */
22503 tmp->tm_year < min_year || tmp->tm_year > max_year)
22504 tmp = NULL;
22505 else
22506 pt = t;
22507 } /* gm_check */
22508
22509 int check_max ()
22510 {
22511 tmp = NULL;
22512 pt = 0;
22513 #ifdef MAXLONG
22514 gm_check (MAXLONG, 69, 0x7fffffff);
22515 #endif
22516 if (tmp == NULL || tmp->tm_year < 0) {
22517 for (i = 63; i >= 0; i--) {
22518 time_t x = pt | ((time_t)1 << i);
22519 if (x < 0 || x < pt) continue;
22520 gm_check (x, 69, 0x7fffffff);
22521 }
22522 }
22523 printf ("sGMTIME_max=%ld\n", pt);
22524 return (0);
22525 } /* check_max */
22526
22527 int check_min ()
22528 {
22529 tmp = NULL;
22530 pt = 0;
22531 #ifdef MINLONG
22532 gm_check (MINLONG, -1900, 70);
22533 #endif
22534 if (tmp == NULL) {
22535 for (i = 36; i >= 0; i--) {
22536 time_t x = pt - ((time_t)1 << i);
22537 if (x > 0) continue;
22538 gm_check (x, -1900, 70);
22539 }
22540 }
22541 printf ("sGMTIME_min=%ld\n", pt);
22542 return (0);
22543 } /* check_min */
22544
22545 int main (int argc, char *argv[])
22546 {
22547 /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
22548 check_max ();
22549 check_min ();
22550 return (0);
22551 } /* main */
22552 EOCP
22553 set try
22554 if eval $compile; then
22555 eval `$run ./try 2>/dev/null`
22556 else
22557 echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
22558 fi
22559 $rm_try
22560 ;;
22561 esac
22562
22563 echo "Checking max offsets that localtime () accepts"
22564
22565 case "$sLOCALTIME_min/$sLOCALTIME_max" in
22566 0/0|/)
22567 $cat >try.c <<EOCP
22568 #include <sys/types.h>
22569 #include <stdio.h>
22570 #include <time.h>
22571
22572 int i;
22573 struct tm *tmp;
22574 time_t pt;
22575
22576 void local_check (time_t t, int min_year, int max_year)
22577 {
22578 if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
22579 tmp = NULL;
22580 else
22581 tmp = localtime (&t);
22582 if ( tmp == NULL ||
22583 /* Check tm_year overflow */
22584 tmp->tm_year < min_year || tmp->tm_year > max_year)
22585 tmp = NULL;
22586 else
22587 pt = t;
22588 } /* local_check */
22589
22590 int check_max ()
22591 {
22592 tmp = NULL;
22593 pt = 0;
22594 #ifdef MAXLONG
22595 local_check (MAXLONG, 69, 0x7fffffff);
22596 #endif
22597 if (tmp == NULL || tmp->tm_year < 0) {
22598 for (i = 63; i >= 0; i--) {
22599 time_t x = pt | ((time_t)1 << i);
22600 if (x < 0 || x < pt) continue;
22601 local_check (x, 69, 0x7fffffff);
22602 }
22603 }
22604 printf ("sLOCALTIME_max=%ld\n", pt);
22605 return (0);
22606 } /* check_max */
22607
22608 int check_min ()
22609 {
22610 tmp = NULL;
22611 pt = 0;
22612 #ifdef MINLONG
22613 local_check (MINLONG, -1900, 70);
22614 #endif
22615 if (tmp == NULL) {
22616 for (i = 36; i >= 0; i--) {
22617 time_t x = pt - ((time_t)1 << i);
22618 if (x > 0) continue;
22619 local_check (x, -1900, 70);
22620 }
22621 }
22622 printf ("sLOCALTIME_min=%ld\n", pt);
22623 return (0);
22624 } /* check_min */
22625
22626 int main (int argc, char *argv[])
22627 {
22628 check_max ();
22629 check_min ();
22630 return (0);
22631 } /* main */
22632 EOCP
22633 set try
22634 if eval $compile; then
22635 eval `$run ./try 2>/dev/null`
22636 else
22637 echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
22638 fi
22639 $rm_try
22640 ;;
22641 esac
22642
22643 : check for type of arguments to select.
22644 case "$selecttype" in
22645 '') case "$d_select" in
22646 $define)
22647 echo " "
22648 $cat <<EOM
22649 Checking to see what type of arguments are accepted by select().
22650 EOM
22651 hdrs="$define sys/types.h
22652 $i_systime sys/time.h
22653 $i_sysselct sys/select.h
22654 $d_socket sys/socket.h"
22655 : The first arg can be int, unsigned, or size_t
22656 : The last arg may or may not be 'const'
22657 val=''
22658 : void pointer has been seen but using that
22659 : breaks the selectminbits test
22660 for xxx in 'fd_set *' 'int *'; do
22661 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
22662 for tmo in 'struct timeval *' 'const struct timeval *'; do
22663 case "$val" in
22664 '') try="$extern_C int select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
22665 if ./protochk "$try" $hdrs; then
22666 echo "Your system accepts $xxx."
22667 val="$xxx"
22668 fi
22669 ;;
22670 esac
22671 done
22672 done
22673 done
22674 case "$val" in
22675 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
22676 case "$d_fd_set" in
22677 $define) dflt="fd_set *" ;;
22678 *) dflt="int *" ;;
22679 esac
22680 . ./myread
22681 val=$ans
22682 ;;
22683 esac
22684 selecttype="$val"
22685 ;;
22686 *) : no select, so pick a harmless default
22687 selecttype='int *'
22688 ;;
22689 esac
22690 ;;
22691 esac
22692
22693 : check for the select 'width'
22694 case "$selectminbits" in
22695 '') safebits=`expr $ptrsize \* 8`
22696 case "$d_select" in
22697 $define)
22698 $cat <<EOM
22699
22700 Checking to see on how many bits at a time your select() operates...
22701 EOM
22702 $cat >try.c <<EOCP
22703 #include <sys/types.h>
22704 #$i_time I_TIME
22705 #$i_systime I_SYS_TIME
22706 #$i_systimek I_SYS_TIME_KERNEL
22707 #ifdef I_TIME
22708 # include <time.h>
22709 #endif
22710 #ifdef I_SYS_TIME
22711 # ifdef I_SYS_TIME_KERNEL
22712 # define KERNEL
22713 # endif
22714 # include <sys/time.h>
22715 # ifdef I_SYS_TIME_KERNEL
22716 # undef KERNEL
22717 # endif
22718 #endif
22719 #$i_sysselct I_SYS_SELECT
22720 #ifdef I_SYS_SELECT
22721 #include <sys/select.h>
22722 #endif
22723 #$d_socket HAS_SOCKET
22724 #ifdef HAS_SOCKET
22725 # include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
22726 #endif
22727 #include <stdio.h>
22728 #$i_stdlib I_STDLIB
22729 #ifdef I_STDLIB
22730 #include <stdlib.h>
22731 #endif
22732 $selecttype b;
22733 #define S sizeof(*(b))
22734 #define MINBITS 64
22735 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
22736 #define NBITS (NBYTES * 8)
22737 int main() {
22738 char *s = (char *)malloc(NBYTES);
22739 struct timeval t;
22740 int i;
22741 FILE* fp;
22742 int fd;
22743
22744 if (!s)
22745 exit(1);
22746 fclose(stdin);
22747 fp = fopen("try.c", "r");
22748 if (fp == 0)
22749 exit(2);
22750 fd = fileno(fp);
22751 if (fd < 0)
22752 exit(3);
22753 b = ($selecttype)s;
22754 for (i = 0; i < NBITS; i++)
22755 FD_SET(i, b);
22756 t.tv_sec = 0;
22757 t.tv_usec = 0;
22758 select(fd + 1, b, 0, 0, &t);
22759 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22760 free(s);
22761 printf("%d\n", i + 1);
22762 return 0;
22763 }
22764 EOCP
22765 set try
22766 if eval $compile_ok; then
22767 selectminbits=`$run ./try 2>/dev/null`
22768 case "$selectminbits" in
22769 '') cat >&4 <<EOM
22770 Cannot figure out on how many bits at a time your select() operates.
22771 I'll play safe and guess it is $safebits bits.
22772 EOM
22773 selectminbits=$safebits
22774 bits="$safebits bits"
22775 ;;
22776 1) bits="1 bit" ;;
22777 *) bits="$selectminbits bits" ;;
22778 esac
22779 echo "Your select() operates on $bits at a time." >&4
22780 else
22781 rp='What is the minimum number of bits your select() operates on?'
22782 case "$byteorder" in
22783 12345678) dflt=64 ;;
22784 1234) dflt=32 ;;
22785 *) dflt=1 ;;
22786 esac
22787 . ./myread
22788 val=$ans
22789 selectminbits="$val"
22790 fi
22791 $rm_try
22792 ;;
22793 *) : no select, so pick a harmless default
22794 selectminbits=$safebits
22795 ;;
22796 esac
22797 ;;
22798 esac
22799
22800 : Trace out the files included by signal.h, then look for SIGxxx names.
22801 case "$sig_num_init" in
22802 '')
22803 if [ "X$fieldn" = X ]; then
22804 : Just make some guesses. We check them later.
22805 xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22806 else
22807 xxx=`echo '#include <signal.h>' |
22808 $cppstdin $cppminus $cppflags 2>/dev/null |
22809 $grep '^[ ]*#.*include' |
22810 $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22811 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22812 fi
22813 xxxfiles=''
22814 for xx in $xxx /dev/null ; do
22815 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22816 done
22817 case "$xxxfiles" in
22818 '') xxxfiles=`./findhdr signal.h` ;;
22819 esac
22820 xxx=`awk '
22821 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22822 print substr($2, 4, 20)
22823 }
22824 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22825 print substr($3, 4, 20)
22826 }' $xxxfiles`
22827 : Append some common names just in case the awk scan failed.
22828 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22829 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22830 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22831 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22832 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22833
22834 : generate a few handy files for later
22835 $cat > signal.c <<EOCP
22836 #include <sys/types.h>
22837 #include <signal.h>
22838 #$i_stdlib I_STDLIB
22839 #ifdef I_STDLIB
22840 #include <stdlib.h>
22841 #endif
22842 #include <stdio.h>
22843 int main() {
22844
22845 /* Strange style to avoid deeply-nested #if/#else/#endif */
22846 #ifndef NSIG
22847 # ifdef _NSIG
22848 # define NSIG (_NSIG)
22849 # endif
22850 #endif
22851
22852 #ifndef NSIG
22853 # ifdef SIGMAX
22854 # define NSIG (SIGMAX+1)
22855 # endif
22856 #endif
22857
22858 #ifndef NSIG
22859 # ifdef SIG_MAX
22860 # define NSIG (SIG_MAX+1)
22861 # endif
22862 #endif
22863
22864 #ifndef NSIG
22865 # ifdef _SIG_MAX
22866 # define NSIG (_SIG_MAX+1)
22867 # endif
22868 #endif
22869
22870 #ifndef NSIG
22871 # ifdef MAXSIG
22872 # define NSIG (MAXSIG+1)
22873 # endif
22874 #endif
22875
22876 #ifndef NSIG
22877 # ifdef MAX_SIG
22878 # define NSIG (MAX_SIG+1)
22879 # endif
22880 #endif
22881
22882 #ifndef NSIG
22883 # ifdef SIGARRAYSIZE
22884 # define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22885 # endif
22886 #endif
22887
22888 #ifndef NSIG
22889 # ifdef _sys_nsig
22890 # define NSIG (_sys_nsig) /* Solaris 2.5 */
22891 # endif
22892 #endif
22893
22894 /* Default to some arbitrary number that's big enough to get most
22895 of the common signals.
22896 */
22897 #ifndef NSIG
22898 # define NSIG 50
22899 #endif
22900
22901 printf("NSIG %d\n", NSIG);
22902
22903 #ifndef JUST_NSIG
22904
22905 EOCP
22906
22907 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22908 {
22909 printf "#ifdef SIG"; printf $1; printf "\n"
22910 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22911 printf $1; printf ");\n"
22912 printf "#endif\n"
22913 }
22914 END {
22915 printf "#endif /* JUST_NSIG */\n";
22916 printf "exit(0);\n}\n";
22917 }
22918 ' >>signal.c
22919 $cat >signal.awk <<'EOP'
22920 BEGIN { ndups = 0 }
22921 $1 ~ /^NSIG$/ { nsig = $2 }
22922 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22923 if ($2 > maxsig) { maxsig = $2 }
22924 if (sig_name[$2]) {
22925 dup_name[ndups] = $1
22926 dup_num[ndups] = $2
22927 ndups++
22928 }
22929 else {
22930 sig_name[$2] = $1
22931 sig_num[$2] = $2
22932 }
22933 }
22934 END {
22935 if (nsig == 0) {
22936 nsig = maxsig + 1
22937 }
22938 printf("NSIG %d\n", nsig);
22939 for (n = 1; n < nsig; n++) {
22940 if (sig_name[n]) {
22941 printf("%s %d\n", sig_name[n], sig_num[n])
22942 }
22943 else {
22944 printf("NUM%d %d\n", n, n)
22945 }
22946 }
22947 for (n = 0; n < ndups; n++) {
22948 printf("%s %d\n", dup_name[n], dup_num[n])
22949 }
22950 }
22951 EOP
22952 $cat >signal_cmd <<EOS
22953 $startsh
22954 if $test -s signal.lst; then
22955 echo "Using your existing signal.lst file"
22956 exit 0
22957 fi
22958 xxx="$xxx"
22959 EOS
22960 $cat >>signal_cmd <<'EOS'
22961
22962 set signal
22963 if eval $compile_ok; then
22964 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22965 $uniq | $awk -f signal.awk >signal.lst
22966 else
22967 echo "(I can't seem be able to compile the whole test program)" >&4
22968 echo "(I'll try it in little pieces.)" >&4
22969 set signal -DJUST_NSIG
22970 if eval $compile_ok; then
22971 $run ./signal$_exe > signal.nsg
22972 $cat signal.nsg
22973 else
22974 echo "I can't seem to figure out how many signals you have." >&4
22975 echo "Guessing 50." >&4
22976 echo 'NSIG 50' > signal.nsg
22977 fi
22978 : Now look at all the signal names, one at a time.
22979 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22980 $cat > signal.c <<EOCP
22981 #include <sys/types.h>
22982 #include <signal.h>
22983 #include <stdio.h>
22984 int main() {
22985 printf("$xx %d\n", SIG${xx});
22986 return 0;
22987 }
22988 EOCP
22989 set signal
22990 if eval $compile; then
22991 echo "SIG${xx} found."
22992 $run ./signal$_exe >> signal.ls1
22993 else
22994 echo "SIG${xx} NOT found."
22995 fi
22996 done
22997 if $test -s signal.ls1; then
22998 $cat signal.nsg signal.ls1 |
22999 $sort -n | $uniq | $awk -f signal.awk >signal.lst
23000 fi
23001
23002 fi
23003 if $test -s signal.lst; then
23004 :
23005 else
23006 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
23007 echo 'kill -l' >signal
23008 set X `csh -f <signal`
23009 $rm -f signal
23010 shift
23011 case $# in
23012 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
23013 esac
23014 echo $@ | $tr ' ' $trnl | \
23015 $awk '{ printf "%s %d\n", $1, ++s; }
23016 END { printf "NSIG %d\n", ++s }' >signal.lst
23017 fi
23018 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
23019 EOS
23020 chmod a+x signal_cmd
23021 $eunicefix signal_cmd
23022 ;;
23023 esac
23024
23025 : generate list of signal names
23026 case "$sig_num_init" in
23027 '')
23028 echo " "
23029 case "$sig_name_init" in
23030 '') doinit=yes ;;
23031 *) case "$sig_num_init" in
23032 ''|*,*) doinit=yes ;;
23033 esac ;;
23034 esac
23035 case "$doinit" in
23036 yes)
23037 echo "Generating a list of signal names and numbers..." >&4
23038 . ./signal_cmd
23039 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
23040 sig_name=`$awk 'BEGIN { printf "ZERO " }
23041 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
23042 sig_num=`$awk 'BEGIN { printf "0 " }
23043 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
23044 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
23045 !/^NSIG/ { printf "\"%s\", ", $1 }
23046 END { printf "0\n" }' signal.lst`
23047 sig_num_init=`$awk 'BEGIN { printf "0, " }
23048 !/^NSIG/ { printf "%d, ", $2}
23049 END { printf "0\n"}' signal.lst`
23050 ;;
23051 esac
23052 echo "The following $sig_count signals are available:"
23053 echo " "
23054 echo $sig_name | $awk \
23055 'BEGIN { linelen = 0 }
23056 {
23057 for (i = 1; i <= NF; i++) {
23058 name = "SIG" $i " "
23059 linelen = linelen + length(name)
23060 if (linelen > 70) {
23061 printf "\n"
23062 linelen = length(name)
23063 }
23064 printf "%s", name
23065 }
23066 printf "\n"
23067 }'
23068 sig_size=`echo $sig_name | awk '{print NF}'`
23069 $rm -f signal signal.c signal.awk signal.lst signal_cmd
23070 ;;
23071 esac
23072
23073 : Check size of size
23074 echo " "
23075 case "$sizetype" in
23076 *_t) zzz="$sizetype" ;;
23077 *) zzz="filesize" ;;
23078 esac
23079 echo "Checking the size of $zzz..." >&4
23080 cat > try.c <<EOCP
23081 #include <sys/types.h>
23082 #include <stdio.h>
23083 #$i_stdlib I_STDLIB
23084 #ifdef I_STDLIB
23085 #include <stdlib.h>
23086 #endif
23087 int main() {
23088 printf("%d\n", (int)sizeof($sizetype));
23089 exit(0);
23090 }
23091 EOCP
23092 set try
23093 if eval $compile_ok; then
23094 yyy=`$run ./try`
23095 case "$yyy" in
23096 '') sizesize=4
23097 echo "(I can't execute the test program--guessing $sizesize.)" >&4
23098 ;;
23099 *) sizesize=$yyy
23100 echo "Your $zzz size is $sizesize bytes."
23101 ;;
23102 esac
23103 else
23104 sizesize=4
23105 echo "(I can't compile the test program--guessing $sizesize.)" >&4
23106 fi
23107
23108 : check for socklen_t
23109 echo " "
23110 echo "Checking to see if you have socklen_t..." >&4
23111 $cat >try.c <<EOCP
23112 #include <sys/types.h>
23113 #$d_socket HAS_SOCKET
23114 #ifdef HAS_SOCKET
23115 #include <sys/socket.h>
23116 #endif
23117 int main() { socklen_t x = 16; }
23118 EOCP
23119 set try
23120 if eval $compile; then
23121 val="$define"
23122 echo "You have socklen_t."
23123 else
23124 val="$undef"
23125 echo "You do not have socklen_t."
23126 case "$sizetype" in
23127 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
23128 esac
23129 fi
23130 $rm_try
23131 set d_socklen_t
23132 eval $setvar
23133
23134 : see if this is a socks.h system
23135 set socks.h i_socks
23136 eval $inhdr
23137
23138 : check for type of the size argument to socket calls
23139 case "$d_socket" in
23140 "$define")
23141 $cat <<EOM
23142
23143 Checking to see what type is the last argument of accept().
23144 EOM
23145 yyy=''
23146 case "$d_socklen_t" in
23147 "$define") yyy="$yyy socklen_t"
23148 esac
23149 yyy="$yyy $sizetype int long unsigned"
23150 for xxx in $yyy; do
23151 case "$socksizetype" in
23152 '') try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
23153 case "$usesocks" in
23154 "$define")
23155 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
23156 echo "Your system accepts '$xxx *' for the last argument of accept()."
23157 socksizetype="$xxx"
23158 fi
23159 ;;
23160 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
23161 echo "Your system accepts '$xxx *' for the last argument of accept()."
23162 socksizetype="$xxx"
23163 fi
23164 ;;
23165 esac
23166 ;;
23167 esac
23168 done
23169 : In case none of those worked, prompt the user.
23170 case "$socksizetype" in
23171 '') rp='What is the type for socket address structure sizes?'
23172 dflt='int'
23173 . ./myread
23174 socksizetype=$ans
23175 ;;
23176 esac
23177 ;;
23178 *) : no sockets, so pick relatively harmless default
23179 socksizetype='int'
23180 ;;
23181 esac
23182
23183 : see what type is used for signed size_t
23184 set ssize_t ssizetype int stdio.h sys/types.h
23185 eval $typedef
23186 dflt="$ssizetype"
23187 $cat > try.c <<EOM
23188 #include <stdio.h>
23189 #$i_stdlib I_STDLIB
23190 #ifdef I_STDLIB
23191 #include <stdlib.h>
23192 #endif
23193 #include <sys/types.h>
23194 #define Size_t $sizetype
23195 #define SSize_t $dflt
23196 int main()
23197 {
23198 if (sizeof(Size_t) == sizeof(SSize_t))
23199 printf("$dflt\n");
23200 else if (sizeof(Size_t) == sizeof(int))
23201 printf("int\n");
23202 else
23203 printf("long\n");
23204 exit(0);
23205 }
23206 EOM
23207 echo " "
23208 set try
23209 if eval $compile_ok && $run ./try > /dev/null; then
23210 ssizetype=`$run ./try`
23211 echo "I'll be using $ssizetype for functions returning a byte count." >&4
23212 else
23213 $cat >&4 <<EOM
23214 Help! I can't compile and run the ssize_t test program: please enlighten me!
23215 (This is probably a misconfiguration in your system or libraries, and
23216 you really ought to fix it. Still, I'll try anyway.)
23217
23218 I need a type that is the same size as $sizetype, but is guaranteed to
23219 be signed. Common values are ssize_t, int and long.
23220
23221 EOM
23222 rp="What signed type is the same size as $sizetype?"
23223 . ./myread
23224 ssizetype="$ans"
23225 fi
23226 $rm_try
23227
23228 : Check the size of st_dev
23229 $echo " "
23230 $echo "Checking the size of st_dev..." >&4
23231 $cat > try.c <<EOCP
23232 #include <sys/stat.h>
23233 #include <stdio.h>
23234 #$i_stdlib I_STDLIB
23235 #ifdef I_STDLIB
23236 #include <stdlib.h>
23237 #endif
23238 int main() {
23239 struct stat st;
23240 printf("%d\n", (int)sizeof(st.st_dev));
23241 exit(0);
23242 }
23243 EOCP
23244 set try
23245 if eval $compile_ok; then
23246 val=`$run ./try`
23247 case "$val" in
23248 '') st_dev_size=4
23249 $echo "(I can't execute the test program--guessing $st_dev_size.)" >&4
23250 ;;
23251 *) st_dev_size=$val
23252 $echo "Your st_dev is $st_dev_size bytes long."
23253 ;;
23254 esac
23255 else
23256 st_dev_size=4
23257 $echo "(I can't compile the test program--guessing $st_dev_size.)" >&4
23258 fi
23259 $rm_try
23260
23261 : Check if st_dev is signed
23262 $echo " "
23263 $echo "Checking the sign of st_dev..." >&4
23264 $cat > try.c <<EOCP
23265 #include <sys/stat.h>
23266 #include <stdio.h>
23267 int main() {
23268 struct stat foo;
23269 foo.st_dev = -1;
23270 if (foo.st_dev < 0)
23271 printf("-1\n");
23272 else
23273 printf("1\n");
23274 }
23275 EOCP
23276 set try
23277 if eval $compile; then
23278 val=`$run ./try`
23279 case "$val" in
23280 '') st_dev_sign=1
23281 $echo "(I can't execute the test program--guessing unsigned.)" >&4
23282 ;;
23283 *) st_dev_sign=$val
23284 case "$st_dev_sign" in
23285 1) $echo "Your st_dev is unsigned." ;;
23286 -1) $echo "Your st_dev is signed." ;;
23287 esac
23288 ;;
23289 esac
23290 else
23291 st_dev_sign=1
23292 $echo "(I can't compile the test program--guessing unsigned.)" >&4
23293 fi
23294 $rm_try
23295
23296 : Check the size of st_ino
23297 $echo " "
23298 $echo "Checking the size of st_ino..." >&4
23299 $cat > try.c <<EOCP
23300 #include <sys/stat.h>
23301 #include <stdio.h>
23302 #$i_stdlib I_STDLIB
23303 #ifdef I_STDLIB
23304 #include <stdlib.h>
23305 #endif
23306 int main() {
23307 struct stat st;
23308 printf("%d\n", (int)sizeof(st.st_ino));
23309 exit(0);
23310 }
23311 EOCP
23312 set try
23313 if eval $compile_ok; then
23314 val=`$run ./try`
23315 case "$val" in
23316 '') st_ino_size=4
23317 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
23318 ;;
23319 *) st_ino_size=$val
23320 $echo "Your st_ino is $st_ino_size bytes long."
23321 ;;
23322 esac
23323 else
23324 st_ino_size=4
23325 $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
23326 fi
23327 $rm_try
23328
23329 : Check if st_ino is signed
23330 $echo " "
23331 $echo "Checking the sign of st_ino..." >&4
23332 $cat > try.c <<EOCP
23333 #include <sys/stat.h>
23334 #include <stdio.h>
23335 int main() {
23336 struct stat foo;
23337 foo.st_ino = -1;
23338 if (foo.st_ino < 0)
23339 printf("-1\n");
23340 else
23341 printf("1\n");
23342 }
23343 EOCP
23344 set try
23345 if eval $compile; then
23346 val=`$run ./try`
23347 case "$val" in
23348 '') st_ino_sign=1
23349 $echo "(I can't execute the test program--guessing unsigned.)" >&4
23350 ;;
23351 *) st_ino_sign=$val
23352 case "$st_ino_sign" in
23353 1) $echo "Your st_ino is unsigned." ;;
23354 -1) $echo "Your st_ino is signed." ;;
23355 esac
23356 ;;
23357 esac
23358 else
23359 st_ino_sign=1
23360 $echo "(I can't compile the test program--guessing unsigned.)" >&4
23361 fi
23362 $rm_try
23363
23364 : see what type of char stdio uses.
23365 echo " "
23366 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
23367 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
23368 echo "Your stdio uses unsigned chars." >&4
23369 stdchar="unsigned char"
23370 else
23371 echo "Your stdio uses signed chars." >&4
23372 stdchar="char"
23373 fi
23374 $rm -f stdioh
23375
23376 : Check size of UID
23377 echo " "
23378 case "$uidtype" in
23379 *_t) zzz="$uidtype" ;;
23380 *) zzz="uid" ;;
23381 esac
23382 echo "Checking the size of $zzz..." >&4
23383 cat > try.c <<EOCP
23384 #include <sys/types.h>
23385 #include <stdio.h>
23386 #$i_stdlib I_STDLIB
23387 #ifdef I_STDLIB
23388 #include <stdlib.h>
23389 #endif
23390 int main() {
23391 printf("%d\n", (int)sizeof($uidtype));
23392 exit(0);
23393 }
23394 EOCP
23395 set try
23396 if eval $compile_ok; then
23397 yyy=`$run ./try`
23398 case "$yyy" in
23399 '') uidsize=4
23400 echo "(I can't execute the test program--guessing $uidsize.)" >&4
23401 ;;
23402 *) uidsize=$yyy
23403 echo "Your $zzz is $uidsize bytes long."
23404 ;;
23405 esac
23406 else
23407 uidsize=4
23408 echo "(I can't compile the test program--guessing $uidsize.)" >&4
23409 fi
23410
23411 : Check if UID is signed
23412 echo " "
23413 case "$uidtype" in
23414 *_t) zzz="$uidtype" ;;
23415 *) zzz="uid" ;;
23416 esac
23417 echo "Checking the sign of $zzz..." >&4
23418 cat > try.c <<EOCP
23419 #include <sys/types.h>
23420 #include <stdio.h>
23421 int main() {
23422 $uidtype foo = -1;
23423 if (foo < 0)
23424 printf("-1\n");
23425 else
23426 printf("1\n");
23427 }
23428 EOCP
23429 set try
23430 if eval $compile; then
23431 yyy=`$run ./try`
23432 case "$yyy" in
23433 '') uidsign=1
23434 echo "(I can't execute the test program--guessing unsigned.)" >&4
23435 ;;
23436 *) uidsign=$yyy
23437 case "$uidsign" in
23438 1) echo "Your $zzz is unsigned." ;;
23439 -1) echo "Your $zzz is signed." ;;
23440 esac
23441 ;;
23442 esac
23443 else
23444 uidsign=1
23445 echo "(I can't compile the test program--guessing unsigned.)" >&4
23446 fi
23447
23448 : Check format string for UID
23449 echo " "
23450 $echo "Checking the format string to be used for uids..." >&4
23451
23452 case "$uidsign" in
23453 -1) if $test X"$uidsize" = X"$ivsize"; then
23454 uidformat="$ivdformat"
23455 else
23456 if $test X"$uidsize" = X"$longsize"; then
23457 uidformat='"ld"'
23458 else
23459 if $test X"$uidsize" = X"$intsize"; then
23460 uidformat='"d"'
23461 else
23462 if $test X"$uidsize" = X"$shortsize"; then
23463 uidformat='"hd"'
23464 fi
23465 fi
23466 fi
23467 fi
23468 ;;
23469 *) if $test X"$uidsize" = X"$uvsize"; then
23470 uidformat="$uvuformat"
23471 else
23472 if $test X"$uidsize" = X"$longsize"; then
23473 uidformat='"lu"'
23474 else
23475 if $test X"$uidsize" = X"$intsize"; then
23476 uidformat='"u"'
23477 else
23478 if $test X"$uidsize" = X"$shortsize"; then
23479 uidformat='"hu"'
23480 fi
23481 fi
23482 fi
23483 fi
23484 ;;
23485 esac
23486
23487 : Ask about strict by default.
23488 case "$usedefaultstrict" in
23489 $define|true|[Yy]*)
23490 dflt="y"
23491 ;;
23492 *)
23493 dflt="n"
23494 ;;
23495 esac
23496
23497 cat <<EOM
23498
23499 EXPERIMENTAL: Perl can now be built with strict on by default when not
23500 invoked with -e or -E. This is a diagnostic tool for development.
23501
23502 Unless you are familiar with this feature, you should probably answer 'no'.
23503
23504 EOM
23505
23506 rp='Would you like to build perl with strict enabled by default?'
23507 . ./myread
23508 case "$ans" in
23509 y|Y) val="$define" ;;
23510 *) val="$undef" ;;
23511 esac
23512 set usedefaultstrict
23513 eval $setvar
23514
23515 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
23516 echo " "
23517 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
23518 $cat >try.c <<'EOM'
23519 /* Intentionally a long probe as I'd like to sanity check that the exact
23520 approach is going to work, as thinking it will work, but only having it
23521 part working at runtime is worse than not having it. */
23522
23523 #include <sys/types.h>
23524 #include <sys/sysctl.h>
23525 #include <sys/param.h>
23526 #include <stdio.h>
23527 #include <string.h>
23528 #include <stdlib.h>
23529 #include <unistd.h>
23530
23531 int
23532 main(int argc, char **argv) {
23533 char *buffer;
23534 char *argv_leaf = strrchr(argv[0], '/');
23535 char *buffer_leaf;
23536 size_t size = 0;
23537 int mib[4];
23538
23539 mib[0] = CTL_KERN;
23540 mib[1] = KERN_PROC;
23541 mib[2] = KERN_PROC_PATHNAME;
23542 mib[3] = -1;
23543
23544 if (!argv_leaf) {
23545 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23546 return 1;
23547 }
23548
23549 if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
23550 perror("sysctl");
23551 return 2;
23552 }
23553
23554 if (size < strlen(argv_leaf) + 1) {
23555 fprintf(stderr, "size %lu is too short for a path\n",
23556 (unsigned long) size);
23557 return 3;
23558 }
23559
23560 if (size > MAXPATHLEN * MAXPATHLEN) {
23561 fprintf(stderr, "size %lu is too long for a path\n",
23562 (unsigned long) size);
23563 return 4;
23564 }
23565
23566 buffer = (char *)malloc(size);
23567 if (!buffer) {
23568 perror("malloc");
23569 return 5;
23570 }
23571
23572 if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
23573 perror("sysctl");
23574 return 6;
23575 }
23576
23577 if (strlen(buffer) + 1 != size) {
23578 fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
23579 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
23580 return 7;
23581 }
23582
23583
23584 if (*buffer != '/') {
23585 fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
23586 return 8;
23587 }
23588
23589 if (strstr(buffer, "/./")) {
23590 fprintf(stderr, "Contains /./: '%s'\n", buffer);
23591 return 9;
23592 }
23593
23594 if (strstr(buffer, "/../")) {
23595 fprintf(stderr, "Contains /../: '%s'\n", buffer);
23596 return 10;
23597 }
23598
23599 buffer_leaf = strrchr(buffer, '/');
23600 if (strcmp(buffer_leaf, argv_leaf) != 0) {
23601 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
23602 return 11;
23603 }
23604
23605 free(buffer);
23606
23607 return 0;
23608 }
23609 EOM
23610
23611 val=$undef
23612 set try
23613 if eval $compile; then
23614 if $run ./try; then
23615 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
23616 val="$define"
23617 else
23618 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
23619 val="$undef"
23620 fi
23621 else
23622 echo "I'm unable to compile the test program." >&4
23623 echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
23624 val="$undef"
23625 fi
23626 $rm_try
23627 set usekernprocpathname
23628 eval $setvar
23629
23630 : Determine if we can use _NSGetExecutablePath to find executing program
23631 echo " "
23632 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
23633 $cat >try.c <<'EOM'
23634 /* Intentionally a long probe as I'd like to sanity check that the exact
23635 approach is going to work, as thinking it will work, but only having it
23636 part working at runtime is worse than not having it. */
23637 #include <mach-o/dyld.h>
23638 #include <stdio.h>
23639 #include <stdlib.h>
23640 #include <sys/param.h>
23641 #include <string.h>
23642
23643 int
23644 main(int argc, char **argv) {
23645 char buf[1];
23646 uint32_t size = sizeof(buf);
23647 int result;
23648 char *buffer;
23649 char *tidied;
23650 char *argv_leaf = strrchr(argv[0], '/');
23651 char *tidied_leaf;
23652
23653 if (!argv_leaf) {
23654 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23655 return 1;
23656 }
23657
23658 _NSGetExecutablePath(buf, &size);
23659 if (size > MAXPATHLEN * MAXPATHLEN) {
23660 fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
23661 (unsigned int) size);
23662 return 2;
23663 }
23664
23665 buffer = (char *)malloc(size);
23666 if (!buffer) {
23667 perror("malloc");
23668 return 3;
23669 }
23670
23671 result = _NSGetExecutablePath(buffer, &size);
23672 if (result != 0) {
23673 fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
23674 result, (unsigned int) size);
23675 return 4;
23676 }
23677
23678 tidied = realpath(buffer, NULL);
23679 if (!tidied) {
23680 perror("realpath");
23681 return 5;
23682 }
23683
23684 free(buffer);
23685
23686 if (*tidied != '/') {
23687 fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
23688 return 6;
23689 }
23690
23691 if (strstr(tidied, "/./")) {
23692 fprintf(stderr, "Contains /./: '%s'\n", tidied);
23693 return 7;
23694 }
23695
23696 if (strstr(tidied, "/../")) {
23697 fprintf(stderr, "Contains /../: '%s'\n", tidied);
23698 return 8;
23699 }
23700
23701 tidied_leaf = strrchr(tidied, '/');
23702 if (strcmp(tidied_leaf, argv_leaf) != 0) {
23703 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
23704 return 9;
23705 }
23706
23707 free(tidied);
23708
23709 return 0;
23710 }
23711 EOM
23712
23713 val=$undef
23714 set try
23715 if eval $compile; then
23716 if $run ./try; then
23717 echo "You can use _NSGetExecutablePath to find the executing program." >&4
23718 val="$define"
23719 else
23720 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
23721 fi
23722 else
23723 echo "I'm unable to compile the test program." >&4
23724 echo "I'll assume no _NSGetExecutablePath here." >&4
23725 fi
23726 $rm_try
23727 set usensgetexecutablepath
23728 eval $setvar
23729
23730 : Check if site customization support was requested
23731 case "$usesitecustomize" in
23732 $define|true|[Yy]*)
23733 usesitecustomize="$define"
23734 ;;
23735 *)
23736 usesitecustomize="$undef"
23737 ;;
23738 esac
23739
23740 : determine compiler compiler
23741 case "$yacc" in
23742 '')
23743 dflt=yacc;;
23744 *)
23745 dflt="$yacc";;
23746 esac
23747 echo " "
23748 comp='yacc'
23749 if $test -f "$byacc$_exe"; then
23750 dflt="$byacc"
23751 comp="byacc or $comp"
23752 fi
23753 if $test -f "$bison$_exe"; then
23754 comp="$comp or bison -y"
23755 fi
23756 rp="Which compiler compiler ($comp) shall I use?"
23757 . ./myread
23758 yacc="$ans"
23759 case "$yacc" in
23760 *bis*)
23761 case "$yacc" in
23762 *-y*) ;;
23763 *)
23764 yacc="$yacc -y"
23765 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
23766 ;;
23767 esac
23768 ;;
23769 esac
23770
23771 : see if this is a bfd.h system
23772 set bfd.h i_bfd
23773 eval $inhdr
23774
23775 : see if this is an execinfo.h system
23776 set execinfo.h i_execinfo
23777 eval $inhdr
23778
23779 : see if this is a fenv.h system
23780 set fenv.h i_fenv
23781 eval $inhdr
23782
23783 : see if this is a fp.h system
23784 set fp.h i_fp
23785 eval $inhdr
23786
23787 : see if this is a fp_class.h system
23788 set fp_class.h i_fp_class
23789 eval $inhdr
23790
23791 : see if gdbm.h is available
23792 set gdbm.h t_gdbm
23793 eval $inhdr
23794 case "$t_gdbm" in
23795 $define)
23796 : see if gdbm_open exists
23797 set gdbm_open d_gdbm_open
23798 eval $inlibc
23799 case "$d_gdbm_open" in
23800 $undef)
23801 t_gdbm="$undef"
23802 echo "We won't be including <gdbm.h>"
23803 ;;
23804 esac
23805 ;;
23806 esac
23807 val="$t_gdbm"
23808 set i_gdbm
23809 eval $setvar
23810
23811 : see if this is a ieeefp.h system
23812 case "$i_ieeefp" in
23813 '' ) set ieeefp.h i_ieeefp
23814 eval $inhdr
23815 ;;
23816 esac
23817
23818 : see if this is a libutil.h system
23819 set libutil.h i_libutil
23820 eval $inhdr
23821
23822 : see if mach cthreads are available
23823 if test "X$usethreads" = "X$define"; then
23824 set mach/cthreads.h i_machcthr
23825 eval $inhdr
23826 else
23827 i_machcthr="$undef"
23828 fi
23829
23830 : see if this is a mntent.h system
23831 set mntent.h i_mntent
23832 eval $inhdr
23833
23834 : see if net/errno.h is available
23835 val=''
23836 set net/errno.h val
23837 eval $inhdr
23838
23839 : Unfortunately, it causes problems on some systems. Arrgh.
23840 case "$val" in
23841 $define)
23842 cat > try.c <<'EOM'
23843 #include <stdio.h>
23844 #include <errno.h>
23845 #include <net/errno.h>
23846 int func()
23847 {
23848 return ENOTSOCK;
23849 }
23850 EOM
23851 if $cc $ccflags -c try.c >/dev/null 2>&1; then
23852 echo "We'll be including <net/errno.h>." >&4
23853 else
23854 echo "We won't be including <net/errno.h>." >&4
23855 val="$undef"
23856 fi
23857 $rm_try
23858 ;;
23859 esac
23860 set i_neterrno
23861 eval $setvar
23862
23863 : see if netinet/tcp.h is available
23864 set netinet/tcp.h i_netinettcp
23865 eval $inhdr
23866
23867 : see if this is a poll.h system
23868 set poll.h i_poll
23869 eval $inhdr
23870
23871 : see if this is a prot.h system
23872 set prot.h i_prot
23873 eval $inhdr
23874
23875 : Preprocessor symbols
23876 echo " "
23877 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23878 $cat <<'EOSH' > Cppsym.know
23879 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23880 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23881 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23882 arch_pwr ardent ARM ARM32 atarist att386 att3b
23883 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23884 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23885 byteorder byte_order
23886 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23887 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23888 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23889 ELF encore EPI EXTENSIONS
23890 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23891 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23892 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23893 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23894 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
23895 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23896 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23897 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23898 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23899 ksr1
23900 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23901 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23902 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23903 luna88k Lynx
23904 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23905 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23906 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23907 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23908 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
23909 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23910 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23911 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23912 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23913 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23914 ns32000 ns32016 ns32332 ns32k nsc32000
23915 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23916 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23917 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23918 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23919 QK_USER QNX
23920 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23921 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23922 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23923 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23924 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23925 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23926 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23927 SYSV4 SYSV5 sysV68 sysV88
23928 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23929 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23930 tower32_800 tower32_850 tss
23931 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23932 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23933 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23934 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23935 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23936 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23937 uxpm uxps
23938 vax venix VMESA vms
23939 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23940 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23941 z8000 zarch
23942 EOSH
23943 # Maybe put other stuff here too.
23944 ./tr '-' '_' <<EOSH >>Cppsym.know
23945 $osname
23946 EOSH
23947 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23948 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23949 $cat Cppsym.know > Cppsym.c
23950 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23951 $rm -f Cppsym.a Cppsym.b Cppsym.c
23952 cat <<EOSH > Cppsym
23953 $startsh
23954 if $test \$# -gt 0; then
23955 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23956 if $test -s Cppsym.got; then
23957 $rm -f Cppsym.got
23958 exit 0
23959 fi
23960 $rm -f Cppsym.got
23961 exit 1
23962 else
23963 $tr " " "$trnl" | ./Cppsym.try
23964 exit 0
23965 fi
23966 EOSH
23967 chmod +x Cppsym
23968 $eunicefix Cppsym
23969 cat <<EOSH > Cppsym.try
23970 $startsh
23971 cat <<'EOCP' > try.c
23972 #include <stdio.h>
23973 #if cpp_stuff == 1
23974 #define STRINGIFY(a) "a"
23975 #endif
23976 #if cpp_stuff == 42
23977 #define StGiFy(a) #a
23978 #define STRINGIFY(a) StGiFy(a)
23979 #endif
23980 #if $cpp_stuff != 1 && $cpp_stuff != 42
23981 # include "Bletch: How does this C preprocessor stringify macros?"
23982 #endif
23983 int main() {
23984 EOCP
23985 $awk \\
23986 EOSH
23987 cat <<'EOSH' >> Cppsym.try
23988 'length($1) > 0 {
23989 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23990 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23991 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23992 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23993 }' >> try.c
23994 echo 'return 0;}' >> try.c
23995 EOSH
23996 cat <<EOSH >> Cppsym.try
23997 ccflags="$ccflags"
23998 case "$osname-$gccversion" in
23999 irix-) ccflags="\$ccflags -woff 1178" ;;
24000 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
24001 esac
24002 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
24003 EOSH
24004 chmod +x Cppsym.try
24005 $eunicefix Cppsym.try
24006 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
24007 : Add in any Linux cpp "predefined macros":
24008 case "$osname::$gccversion" in
24009 *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
24010 tHdrH=_tmpHdr
24011 rm -f $tHdrH'.h' $tHdrH
24012 touch $tHdrH'.h'
24013 # Filter out macro arguments, such as Linux's __INT8_C(c)
24014 if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
24015 sed -e 's/#define[\ \ ]*//;s/[\ \ ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
24016 if [ -s $tHdrH'_cppsym.real' ]; then
24017 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
24018 fi
24019 fi
24020 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
24021 ;;
24022 esac
24023 : now check the C compiler for additional symbols
24024 postprocess_cc_v=''
24025 case "$osname" in
24026 aix) postprocess_cc_v="|$tr , ' '" ;;
24027 esac
24028 $cat >ccsym <<EOS
24029 $startsh
24030 $cat >tmp.c <<EOF
24031 extern int foo;
24032 EOF
24033 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
24034 do
24035 case "\$i" in
24036 -D*) echo "\$i" | $sed 's/^-D//;s/['\''\"]//g';;
24037 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
24038 esac
24039 done
24040 $rm_try
24041 EOS
24042 postprocess_cc_v=''
24043 chmod +x ccsym
24044 $eunicefix ccsym
24045 ./ccsym > ccsym1.raw
24046 if $test -s ccsym1.raw; then
24047 $sort ccsym1.raw | $uniq >ccsym.raw
24048 else
24049 mv ccsym1.raw ccsym.raw
24050 fi
24051
24052 $awk '/=/ { print $0; next }
24053 { print $0"=1" }' ccsym.raw >ccsym.list
24054 $comm -13 Cppsym.true ccsym.list >ccsym.own
24055 $comm -12 Cppsym.true ccsym.list >ccsym.com
24056 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
24057 also=''
24058 if $test -z ccsym.raw; then
24059 echo "Your C compiler doesn't seem to define any symbols!" >&4
24060 echo " "
24061 echo "However, your C preprocessor defines the following symbols:"
24062 $cat Cppsym.true
24063 ccsymbols=''
24064 cppsymbols=`$cat Cppsym.true`
24065 cppsymbols=`echo $cppsymbols`
24066 cppccsymbols="$cppsymbols"
24067 else
24068 if $test -s ccsym.com; then
24069 echo "Your C compiler and pre-processor define these symbols:"
24070 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
24071 also='also '
24072 symbols='ones'
24073 cppccsymbols=`$cat ccsym.com`
24074 cppccsymbols=`echo $cppccsymbols`
24075 $test "$silent" || sleep 1
24076 fi
24077 if $test -s ccsym.cpp; then
24078 $test "$also" && echo " "
24079 echo "Your C pre-processor ${also}defines the following symbols:"
24080 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
24081 also='further '
24082 cppsymbols=`$cat ccsym.cpp`
24083 cppsymbols=`echo $cppsymbols`
24084 $test "$silent" || sleep 1
24085 fi
24086 if $test -s ccsym.own; then
24087 $test "$also" && echo " "
24088 echo "Your C compiler ${also}defines the following cpp symbols:"
24089 $sed -e 's/\(..*\)=1/\1/' ccsym.own
24090 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
24091 ccsymbols=`$cat ccsym.own`
24092 ccsymbols=`echo $ccsymbols`
24093 $test "$silent" || sleep 1
24094 fi
24095 fi
24096
24097 : add -D_FORTIFY_SOURCE if feasible and not already there
24098 case "$gccversion" in
24099 [456789].*|[1-9][0-9]*) case "$optimize$ccflags" in
24100 *-O*) case "$ccflags$cppsymbols" in
24101 *_FORTIFY_SOURCE=*) # Don't add it again.
24102 echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
24103 ;;
24104 *) echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
24105 ccflags="$ccflags -D_FORTIFY_SOURCE=2"
24106 ;;
24107 esac
24108 ;;
24109 *) echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
24110 ;;
24111 esac
24112 ;;
24113 *) echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
24114 ;;
24115 esac
24116
24117 : script used to emit important warnings
24118 cat >warn <<EOS
24119 $startsh
24120 if test \$# -gt 0; then
24121 echo "\$@" >msg
24122 else
24123 cat >msg
24124 fi
24125 echo "*** WARNING:" >&4
24126 sed -e 's/^/*** /' <msg >&4
24127 echo "*** " >&4
24128 cat msg >>config.msg
24129 echo " " >>config.msg
24130 rm -f msg
24131 EOS
24132 chmod +x warn
24133 $eunicefix warn
24134
24135 : see if this is a termio system
24136 val="$undef"
24137 val2="$undef"
24138 val3="$undef"
24139 if $test `./findhdr termios.h`; then
24140 set tcsetattr i_termios
24141 eval $inlibc
24142 val3="$i_termios"
24143 fi
24144 echo " "
24145 case "$val3" in
24146 "$define") echo "You have POSIX termios.h... good!" >&4;;
24147 *) if ./Cppsym pyr; then
24148 case "`$run /bin/universe`" in
24149 ucb) if $test `./findhdr sgtty.h`; then
24150 val2="$define"
24151 echo "<sgtty.h> found." >&4
24152 else
24153 echo "System is pyramid with BSD universe."
24154 ./warn "<sgtty.h> not found--you could have problems."
24155 fi;;
24156 *) if $test `./findhdr termio.h`; then
24157 val="$define"
24158 echo "<termio.h> found." >&4
24159 else
24160 echo "System is pyramid with USG universe."
24161 ./warn "<termio.h> not found--you could have problems."
24162 fi;;
24163 esac
24164 elif ./usg; then
24165 if $test `./findhdr termio.h`; then
24166 echo "<termio.h> found." >&4
24167 val="$define"
24168 elif $test `./findhdr sgtty.h`; then
24169 echo "<sgtty.h> found." >&4
24170 val2="$define"
24171 else
24172 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
24173 fi
24174 else
24175 if $test `./findhdr sgtty.h`; then
24176 echo "<sgtty.h> found." >&4
24177 val2="$define"
24178 elif $test `./findhdr termio.h`; then
24179 echo "<termio.h> found." >&4
24180 val="$define"
24181 else
24182 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
24183 fi
24184 fi;;
24185 esac
24186 set i_termio; eval $setvar
24187 val=$val2; set i_sgtty; eval $setvar
24188 val=$val3; set i_termios; eval $setvar
24189
24190 : see if stdbool is available
24191 : we want a real compile instead of Inhdr because some Solaris systems
24192 : have stdbool.h, but it can only be used if the compiler indicates it
24193 : is sufficiently c99-compliant.
24194 echo " "
24195 $cat >try.c <<EOCP
24196 #include <stdio.h>
24197 #include <stdbool.h>
24198 int func(bool x)
24199 {
24200 return x ? 1 : 0;
24201 }
24202 int main(int argc, char **argv)
24203 {
24204 return func(0);
24205 }
24206 EOCP
24207 set try
24208 if eval $compile; then
24209 echo "<stdbool.h> found." >&4
24210 val="$define"
24211 else
24212 echo "<stdbool.h> NOT found." >&4
24213 val="$undef"
24214 fi
24215 $rm_try
24216 set i_stdbool
24217 eval $setvar
24218
24219 : see if stdint is available
24220 set stdint.h i_stdint
24221 eval $inhdr
24222
24223 : see if sys/access.h is available
24224 set sys/access.h i_sysaccess
24225 eval $inhdr
24226
24227 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
24228 set sys/filio.h i_sysfilio
24229 eval $inhdr
24230 echo " "
24231 if $test `./findhdr sys/ioctl.h`; then
24232 val="$define"
24233 echo '<sys/ioctl.h> found.' >&4
24234 else
24235 val="$undef"
24236 if $test $i_sysfilio = "$define"; then
24237 echo '<sys/ioctl.h> NOT found.' >&4
24238 else
24239 $test $i_sgtty = "$define" && xxx="sgtty.h"
24240 $test $i_termio = "$define" && xxx="termio.h"
24241 $test $i_termios = "$define" && xxx="termios.h"
24242 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
24243 fi
24244 fi
24245 set i_sysioctl
24246 eval $setvar
24247
24248 : see if socket ioctl defs are in sys/sockio.h
24249 echo " "
24250 xxx=`./findhdr sys/sockio.h`
24251 if $test "$xxx"; then
24252 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
24253 val="$define"
24254 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
24255 else
24256 val="$undef"
24257 echo "No socket ioctls found in <sys/sockio.h>." >&4
24258 fi
24259 else
24260 val="$undef"
24261 $cat <<EOM
24262 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
24263 EOM
24264 fi
24265 set i_syssockio
24266 eval $setvar
24267
24268 : see if this is a syslog.h system
24269 set syslog.h i_syslog
24270 eval $inhdr
24271
24272 : see if this is a sys/mode.h system
24273 set sys/mode.h i_sysmode
24274 eval $inhdr
24275
24276 : see if there is a sys/poll.h file
24277 set sys/poll.h i_syspoll
24278 eval $inhdr
24279
24280 : see if sys/resource.h has to be included
24281 set sys/resource.h i_sysresrc
24282 eval $inhdr
24283
24284 : see if sys/security.h is available
24285 set sys/security.h i_syssecrt
24286 eval $inhdr
24287
24288 : see if this is a sys/statvfs.h system
24289 set sys/statvfs.h i_sysstatvfs
24290 eval $inhdr
24291
24292 : see if this is a sys/un.h system
24293 set sys/un.h i_sysun
24294 eval $inhdr
24295
24296 : see if this is a sys/utsname.h system
24297 set sys/utsname.h i_sysutsname
24298 eval $inhdr
24299
24300 : see if this is a syswait system
24301 set sys/wait.h i_syswait
24302 eval $inhdr
24303
24304 : see if this is a ustat.h system
24305 set ustat.h i_ustat
24306 eval $inhdr
24307
24308 : see if this is an utime system
24309 set utime.h i_utime
24310 eval $inhdr
24311
24312 : see if this is a vfork system
24313 case "$d_vfork" in
24314 "$define")
24315 set vfork.h i_vfork
24316 eval $inhdr
24317 ;;
24318 *)
24319 i_vfork="$undef"
24320 ;;
24321 esac
24322
24323 : see if wchar.h is present
24324 set wchar.h i_wchar
24325 eval $inhdr
24326
24327 : Check extensions
24328 echo " "
24329 echo "Looking for extensions..." >&4
24330 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
24331 : contain old or inaccurate or duplicate values.
24332 nonxs_extensions=''
24333 xs_extensions=''
24334 : We do not use find because it might not be available.
24335 : We do not just use MANIFEST because the user may have dropped
24336 : some additional extensions into the source tree and expect them
24337 : to be built.
24338
24339 : Function to recursively find available extensions, ignoring DynaLoader
24340 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
24341 : In 5.10.1 and later, extensions are stored in directories
24342 : like File-Glob instead of the older File/Glob/.
24343 find_extensions='
24344 for xxx in *; do
24345 case "$xxx" in
24346 DynaLoader|dynaload) ;;
24347 *)
24348 this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
24349 case "$this_ext" in
24350 Scalar/List/Utils) this_ext="List/Util" ;;
24351 PathTools) this_ext="Cwd" ;;
24352 esac;
24353 echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
24354 if $contains " $this_ext " "$tdir/$$.tmp"; then
24355 echo >&4;
24356 echo "Duplicate directories detected for extension $xxx" >&4;
24357 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
24358 case "$knowitall" in
24359 "") dflt=y;;
24360 *) dflt=n;;
24361 esac;
24362 . ../UU/myread;
24363 case "$ans" in
24364 n*|N*) ;;
24365 *) echo >&4;
24366 echo "Ok. Stopping Configure." >&4;
24367 echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
24368 exit 1;;
24369 esac;
24370 echo "Ok. You will need to correct config.sh before running make." >&4;
24371 fi;
24372 $ls -1 "$xxx" > "$tdir/$$.tmp";
24373 if $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
24374 xs_extensions="$xs_extensions $this_ext";
24375 elif $contains "\.c$" "$tdir/$$.tmp" > /dev/null 2>&1; then
24376 xs_extensions="$xs_extensions $this_ext";
24377 elif $test -d "$xxx"; then
24378 nonxs_extensions="$nonxs_extensions $this_ext";
24379 fi;
24380 $rm -f "$tdir/$$.tmp";
24381 ;;
24382 esac;
24383 done'
24384 tdir=`pwd`
24385 cd "$rsrc/cpan"
24386 set X
24387 shift
24388 eval $find_extensions
24389 cd "$rsrc/dist"
24390 set X
24391 shift
24392 eval $find_extensions
24393 cd "$rsrc/ext"
24394 set X
24395 shift
24396 eval $find_extensions
24397 set X $xs_extensions
24398 shift
24399 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
24400 set X $nonxs_extensions
24401 shift
24402 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
24403 cd "$tdir"
24404 known_extensions=`echo $nonxs_extensions $xs_extensions | tr ' ' $trnl | $sort | tr $trnl ' '`
24405
24406 : Now see which are supported on this system.
24407 avail_ext=''
24408 for xxx in $xs_extensions ; do
24409 case "$xxx" in
24410 Amiga*)
24411 case "$osname" in
24412 amigaos) avail_ext="$avail_ext $xxx" ;;
24413 esac
24414 ;;
24415 DB_File|db_file)
24416 case "$i_db" in
24417 $define) avail_ext="$avail_ext $xxx" ;;
24418 esac
24419 ;;
24420 GDBM_File|gdbm_fil)
24421 case "$i_gdbm" in
24422 $define) avail_ext="$avail_ext $xxx" ;;
24423 esac
24424 ;;
24425 IPC/SysV|ipc/sysv)
24426 : XXX Do we need a useipcsysv variable here
24427 case "${d_msg}${d_sem}${d_shm}" in
24428 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
24429 esac
24430 ;;
24431 NDBM_File|ndbm_fil)
24432 case "$d_ndbm" in
24433 $define)
24434 case "$osname-$use64bitint" in
24435 hpux-define)
24436 case "$libs" in
24437 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
24438 esac
24439 ;;
24440 *) avail_ext="$avail_ext $xxx" ;;
24441 esac
24442 ;;
24443 esac
24444 ;;
24445 ODBM_File|odbm_fil)
24446 case "${i_dbm}${i_rpcsvcdbm}" in
24447 *"${define}"*)
24448 case "$d_cplusplus" in
24449 define) ;; # delete as a function name will not work
24450 *) case "$osname-$use64bitint" in
24451 hpux-define)
24452 case "$libs" in
24453 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
24454 esac
24455 ;;
24456 *) avail_ext="$avail_ext $xxx" ;;
24457 esac
24458 ;;
24459 esac
24460 ;;
24461 esac
24462 ;;
24463 Opcode|opcode)
24464 case "$useopcode" in
24465 true|define|y) avail_ext="$avail_ext $xxx" ;;
24466 esac
24467 ;;
24468 POSIX|posix)
24469 case "$useposix" in
24470 true|define|y) avail_ext="$avail_ext $xxx" ;;
24471 esac
24472 ;;
24473 Socket|socket)
24474 case "$d_socket" in
24475 true|$define|y) avail_ext="$avail_ext $xxx" ;;
24476 esac
24477 ;;
24478 I18N/Langinfo|langinfo)
24479 case "$uselanginfo" in
24480 true|define|y) avail_ext="$avail_ext $xxx" ;;
24481 esac
24482 ;;
24483 Sys/Syslog|sys/syslog)
24484 case $osname in
24485 amigaos) ;; # not really very useful on AmigaOS
24486 *)
24487 : XXX syslog requires socket
24488 case "$d_socket" in
24489 true|$define|y) avail_ext="$avail_ext $xxx" ;;
24490 esac
24491 ;;
24492 esac
24493 ;;
24494 threads|threads/shared)
24495 # threads and threads::shared are special cases.
24496 # To stop people from asking "Perl 5.8.0 was supposed
24497 # to have this new fancy threads implementation but my
24498 # perl doesn't have it" and from people trying to
24499 # (re)install the threads module using CPAN.pm and
24500 # CPAN.pm then offering to reinstall Perl 5.8.0,
24501 # the threads.pm and threads/shared.pm will always be
24502 # there, croaking informatively ("you need to rebuild
24503 # all of Perl with threads, sorry") when threads haven't
24504 # been compiled in.
24505 # --jhi
24506 avail_ext="$avail_ext $xxx"
24507 ;;
24508 VMS*)
24509 ;;
24510 Win32*)
24511 case "$osname" in
24512 cygwin) avail_ext="$avail_ext $xxx" ;;
24513 esac
24514 ;;
24515 XS/APItest|xs/apitest)
24516 # This is just for testing. Skip it unless we have dynamic loading.
24517
24518 case "$usedl" in
24519 $define) avail_ext="$avail_ext $xxx" ;;
24520 esac
24521 ;;
24522 XS/Typemap|xs/typemap)
24523 # This is just for testing. Skip it unless we have dynamic loading.
24524 case "$usedl" in
24525 $define) avail_ext="$avail_ext $xxx" ;;
24526 esac
24527 ;;
24528 *) avail_ext="$avail_ext $xxx"
24529 ;;
24530 esac
24531 done
24532
24533 set X $avail_ext
24534 shift
24535 avail_ext="$*"
24536
24537 case "$onlyextensions" in
24538 '') ;;
24539 *) keepextensions=''
24540 echo "You have requested that only certain extensions be included..." >&4
24541 for i in $onlyextensions; do
24542 case " $avail_ext " in
24543 *" $i "*)
24544 echo "Keeping extension $i."
24545 keepextensions="$keepextensions $i"
24546 ;;
24547 *) echo "Ignoring extension $i." ;;
24548 esac
24549 done
24550 avail_ext="$keepextensions"
24551 ;;
24552 esac
24553
24554 case "$noextensions" in
24555 '') ;;
24556 *) keepextensions=''
24557 echo "You have requested that certain extensions be ignored..." >&4
24558 for i in $avail_ext; do
24559 case " $noextensions " in
24560 *" $i "*) echo "Ignoring extension $i." ;;
24561 *) echo "Keeping extension $i.";
24562 keepextensions="$keepextensions $i"
24563 ;;
24564 esac
24565 done
24566 avail_ext="$keepextensions"
24567 ;;
24568 esac
24569
24570 : Now see which nonxs extensions are supported on this system.
24571 : For now assume all are.
24572 nonxs_ext=''
24573 for xxx in $nonxs_extensions ; do
24574 case "$xxx" in
24575 VMS*)
24576 ;;
24577 *) nonxs_ext="$nonxs_ext $xxx"
24578 ;;
24579 esac
24580 done
24581
24582 set X $nonxs_ext
24583 shift
24584 nonxs_ext="$*"
24585
24586 case $usedl in
24587 $define)
24588 $cat <<EOM
24589 A number of extensions are supplied with $package. You may choose to
24590 compile these extensions for dynamic loading (the default), compile
24591 them into the $package executable (static loading), or not include
24592 them at all. Answer "none" to include no extensions.
24593 Note that DynaLoader is always built and need not be mentioned here.
24594
24595 EOM
24596 case "$dynamic_ext" in
24597 '')
24598 : Exclude those listed in static_ext
24599 dflt=''
24600 for xxx in $avail_ext; do
24601 case " $static_ext " in
24602 *" $xxx "*) ;;
24603 *) dflt="$dflt $xxx" ;;
24604 esac
24605 done
24606 set X $dflt
24607 shift
24608 dflt="$*"
24609 ;;
24610 *) dflt="$dynamic_ext"
24611 # Perhaps we are reusing an old out-of-date config.sh.
24612 case "$hint" in
24613 previous)
24614 if test X"$dynamic_ext" != X"$avail_ext"; then
24615 $cat <<EOM
24616 NOTICE: Your previous config.sh list may be incorrect.
24617 The extensions now available to you are
24618 ${avail_ext}
24619 but the default list from your previous config.sh is
24620 ${dynamic_ext}
24621
24622 EOM
24623 fi
24624 ;;
24625 esac
24626 ;;
24627 esac
24628 case "$dflt" in
24629 '') dflt=none;;
24630 esac
24631 rp="What extensions do you wish to load dynamically?"
24632 . ./myread
24633 case "$ans" in
24634 none) dynamic_ext=' ' ;;
24635 *) dynamic_ext="$ans" ;;
24636 esac
24637
24638 case "$static_ext" in
24639 '')
24640 : Exclude those already listed in dynamic linking
24641 dflt=''
24642 for xxx in $avail_ext; do
24643 case " $dynamic_ext " in
24644 *" $xxx "*) ;;
24645 *) dflt="$dflt $xxx" ;;
24646 esac
24647 done
24648 set X $dflt
24649 shift
24650 dflt="$*"
24651 ;;
24652 *) dflt="$static_ext"
24653 ;;
24654 esac
24655
24656 case "$dflt" in
24657 '') dflt=none;;
24658 esac
24659 rp="What extensions do you wish to load statically?"
24660 . ./myread
24661 case "$ans" in
24662 none) static_ext=' ' ;;
24663 *) static_ext="$ans" ;;
24664 esac
24665 ;;
24666 *)
24667 $cat <<EOM
24668 A number of extensions are supplied with $package. Answer "none"
24669 to include no extensions.
24670 Note that DynaLoader is always built and need not be mentioned here.
24671
24672 EOM
24673 case "$static_ext" in
24674 '') dflt="$avail_ext" ;;
24675 *) dflt="$static_ext"
24676 # Perhaps we are reusing an old out-of-date config.sh.
24677 case "$hint" in
24678 previous)
24679 if test X"$static_ext" != X"$avail_ext"; then
24680 $cat <<EOM
24681 NOTICE: Your previous config.sh list may be incorrect.
24682 The extensions now available to you are
24683 ${avail_ext}
24684 but the default list from your previous config.sh is
24685 ${static_ext}
24686
24687 EOM
24688 fi
24689 ;;
24690 esac
24691 ;;
24692 esac
24693 : Exclude those that are not xs extensions
24694 case "$dflt" in
24695 '') dflt=none;;
24696 esac
24697 rp="What extensions do you wish to include?"
24698 . ./myread
24699 case "$ans" in
24700 none) static_ext=' ' ;;
24701 *) static_ext="$ans" ;;
24702 esac
24703 ;;
24704 esac
24705 #
24706 # Encode is a special case. If we are building Encode as a static
24707 # extension, we need to explicitly list its subextensions as well.
24708 # For other nested extensions, this is handled automatically by
24709 # the appropriate Makefile.PL.
24710 case " $static_ext " in
24711 *" Encode "*) # Add the subextensions of Encode
24712 cd "$rsrc/cpan"
24713 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
24714 static_ext="$static_ext Encode/$xxx"
24715 known_extensions="$known_extensions Encode/$xxx"
24716 done
24717 cd "$tdir"
24718 ;;
24719 esac
24720
24721 set X $dynamic_ext $static_ext $nonxs_ext
24722 shift
24723 extensions="$*"
24724
24725 # Sanity check: We require an extension suitable for use with
24726 # AnyDBM_File, as well as Fcntl and IO. (Failure to have these
24727 # should show up as failures in the test suite, but it's helpful to
24728 # catch them now.) The 'extensions' list is normally sorted
24729 # alphabetically, so we need to accept either
24730 # DB_File ... Fcntl ... IO ....
24731 # or something like
24732 # Fcntl ... NDBM_File ... IO ....
24733 case " $extensions" in
24734 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
24735 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
24736 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
24737 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
24738 echo "WARNING: The Perl you are building will be quite crippled." >&4
24739 ;;
24740 esac
24741
24742 : Remove libraries needed only for extensions
24743 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
24744 : The exception is SunOS 4.x, which needs them.
24745 case "${osname}X${osvers}" in
24746 sunos*X4*)
24747 perllibs="$libs"
24748 ;;
24749 *) case "$usedl" in
24750 $define|true|[yY]*)
24751 set X `echo " $libs " | sed -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldb @ @'`
24752 shift
24753 perllibs="$*"
24754 ;;
24755 *) perllibs="$libs"
24756 ;;
24757 esac
24758 ;;
24759 esac
24760
24761 : Remove build directory name from cppstdin so it can be used from
24762 : either the present location or the final installed location.
24763 echo " "
24764 : Get out of the UU directory to get correct path name.
24765 cd ..
24766 case "$cppstdin" in
24767 `pwd`/cppstdin)
24768 echo "Stripping down cppstdin path name"
24769 cppstdin=cppstdin
24770 ;;
24771 esac
24772 cd UU
24773
24774 : end of configuration questions
24775 echo " "
24776 echo "End of configuration questions."
24777 echo " "
24778
24779 : back to where it started
24780 if test -d ../UU; then
24781 cd ..
24782 fi
24783
24784 : configuration may be unconditionally patched via a 'config.arch' file
24785 if $test -f config.arch; then
24786 echo "I see a config.arch file, loading it." >&4
24787 . ./config.arch
24788 fi
24789
24790 : configuration may be patched via a 'config.over' file
24791 if $test -f config.over; then
24792 echo " "
24793 dflt=y
24794 rp='I see a config.over file. Do you wish to load it?'
24795 . UU/myread
24796 case "$ans" in
24797 n*) echo "OK, I'll ignore it.";;
24798 *) . ./config.over
24799 echo "Configuration override changes have been loaded."
24800 ;;
24801 esac
24802 fi
24803
24804 : in case they want portability, strip down executable paths
24805 case "$d_portable" in
24806 "$define")
24807 echo " "
24808 echo "Stripping down executable paths..." >&4
24809 for file in $loclist $trylist; do
24810 eval temp=\$$file
24811 eval $file=`basename $temp`
24812 done
24813 ;;
24814 esac
24815
24816 : create config.sh file
24817 echo " "
24818 echo "Creating config.sh..." >&4
24819 $spitshell <<EOT >config.sh
24820 $startsh
24821 #
24822 # This file was produced by running the Configure script. It holds all the
24823 # definitions figured out by Configure. Should you modify one of these values,
24824 # do not forget to propagate your changes by running "Configure -der". You may
24825 # instead choose to run each of the .SH files by yourself, or "Configure -S".
24826 #
24827
24828 # Package name : $package
24829 # Source directory : $src
24830 # Configuration time: $cf_time
24831 # Configured by : $cf_by
24832 # Target system : $myuname
24833
24834 EOT
24835 : Add in command line options if available
24836 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24837
24838 $spitshell <<EOT >>config.sh
24839
24840 Author='$Author'
24841 Date='$Date'
24842 Header='$Header'
24843 Id='$Id'
24844 Locker='$Locker'
24845 Log='$Log'
24846 RCSfile='$RCSfile'
24847 Revision='$Revision'
24848 Source='$Source'
24849 State='$State'
24850 _a='$_a'
24851 _exe='$_exe'
24852 _o='$_o'
24853 afs='$afs'
24854 afsroot='$afsroot'
24855 alignbytes='$alignbytes'
24856 aphostname='$aphostname'
24857 api_revision='$api_revision'
24858 api_subversion='$api_subversion'
24859 api_version='$api_version'
24860 api_versionstring='$api_versionstring'
24861 ar='$ar'
24862 archlib='$archlib'
24863 archlibexp='$archlibexp'
24864 archname64='$archname64'
24865 archname='$archname'
24866 archobjs='$archobjs'
24867 asctime_r_proto='$asctime_r_proto'
24868 awk='$awk'
24869 baserev='$baserev'
24870 bash='$bash'
24871 bin='$bin'
24872 bin_ELF='$bin_ELF'
24873 binexp='$binexp'
24874 bison='$bison'
24875 byacc='$byacc'
24876 byteorder='$byteorder'
24877 c='$c'
24878 castflags='$castflags'
24879 cat='$cat'
24880 cc='$cc'
24881 cccdlflags='$cccdlflags'
24882 ccdlflags='$ccdlflags'
24883 ccflags='$ccflags'
24884 ccflags_uselargefiles='$ccflags_uselargefiles'
24885 ccname='$ccname'
24886 ccsymbols='$ccsymbols'
24887 ccversion='$ccversion'
24888 cf_by='$cf_by'
24889 cf_email='$cf_email'
24890 cf_time='$cf_time'
24891 charbits='$charbits'
24892 charsize='$charsize'
24893 chgrp='$chgrp'
24894 chmod='$chmod'
24895 chown='$chown'
24896 clocktype='$clocktype'
24897 comm='$comm'
24898 compiler_warning='$compiler_warning'
24899 compress='$compress'
24900 contains='$contains'
24901 cp='$cp'
24902 cpio='$cpio'
24903 cpp='$cpp'
24904 cpp_stuff='$cpp_stuff'
24905 cppccsymbols='$cppccsymbols'
24906 cppflags='$cppflags'
24907 cpplast='$cpplast'
24908 cppminus='$cppminus'
24909 cpprun='$cpprun'
24910 cppstdin='$cppstdin'
24911 cppsymbols='$cppsymbols'
24912 crypt_r_proto='$crypt_r_proto'
24913 cryptlib='$cryptlib'
24914 csh='$csh'
24915 ctermid_r_proto='$ctermid_r_proto'
24916 ctime_r_proto='$ctime_r_proto'
24917 d_Gconvert='$d_Gconvert'
24918 d_PRIEUldbl='$d_PRIEUldbl'
24919 d_PRIFUldbl='$d_PRIFUldbl'
24920 d_PRIGUldbl='$d_PRIGUldbl'
24921 d_PRIXU64='$d_PRIXU64'
24922 d_PRId64='$d_PRId64'
24923 d_PRIeldbl='$d_PRIeldbl'
24924 d_PRIfldbl='$d_PRIfldbl'
24925 d_PRIgldbl='$d_PRIgldbl'
24926 d_PRIi64='$d_PRIi64'
24927 d_PRIo64='$d_PRIo64'
24928 d_PRIu64='$d_PRIu64'
24929 d_PRIx64='$d_PRIx64'
24930 d_SCNfldbl='$d_SCNfldbl'
24931 d__fwalk='$d__fwalk'
24932 d_accept4='$d_accept4'
24933 d_access='$d_access'
24934 d_accessx='$d_accessx'
24935 d_acosh='$d_acosh'
24936 d_aintl='$d_aintl'
24937 d_alarm='$d_alarm'
24938 d_archlib='$d_archlib'
24939 d_asctime64='$d_asctime64'
24940 d_asctime_r='$d_asctime_r'
24941 d_asinh='$d_asinh'
24942 d_atanh='$d_atanh'
24943 d_atolf='$d_atolf'
24944 d_atoll='$d_atoll'
24945 d_attribute_always_inline='$d_attribute_always_inline'
24946 d_attribute_deprecated='$d_attribute_deprecated'
24947 d_attribute_format='$d_attribute_format'
24948 d_attribute_malloc='$d_attribute_malloc'
24949 d_attribute_nonnull='$d_attribute_nonnull'
24950 d_attribute_noreturn='$d_attribute_noreturn'
24951 d_attribute_pure='$d_attribute_pure'
24952 d_attribute_unused='$d_attribute_unused'
24953 d_attribute_visibility='$d_attribute_visibility'
24954 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24955 d_backtrace='$d_backtrace'
24956 d_bsd='$d_bsd'
24957 d_bsdgetpgrp='$d_bsdgetpgrp'
24958 d_bsdsetpgrp='$d_bsdsetpgrp'
24959 d_builtin_add_overflow='$d_builtin_add_overflow'
24960 d_builtin_choose_expr='$d_builtin_choose_expr'
24961 d_builtin_expect='$d_builtin_expect'
24962 d_builtin_mul_overflow='$d_builtin_mul_overflow'
24963 d_builtin_sub_overflow='$d_builtin_sub_overflow'
24964 d_c99_variadic_macros='$d_c99_variadic_macros'
24965 d_casti32='$d_casti32'
24966 d_castneg='$d_castneg'
24967 d_cbrt='$d_cbrt'
24968 d_chown='$d_chown'
24969 d_chroot='$d_chroot'
24970 d_chsize='$d_chsize'
24971 d_class='$d_class'
24972 d_clearenv='$d_clearenv'
24973 d_closedir='$d_closedir'
24974 d_cmsghdr_s='$d_cmsghdr_s'
24975 d_copysign='$d_copysign'
24976 d_copysignl='$d_copysignl'
24977 d_cplusplus='$d_cplusplus'
24978 d_crypt='$d_crypt'
24979 d_crypt_r='$d_crypt_r'
24980 d_csh='$d_csh'
24981 d_ctermid='$d_ctermid'
24982 d_ctermid_r='$d_ctermid_r'
24983 d_ctime64='$d_ctime64'
24984 d_ctime_r='$d_ctime_r'
24985 d_cuserid='$d_cuserid'
24986 d_dbminitproto='$d_dbminitproto'
24987 d_difftime64='$d_difftime64'
24988 d_difftime='$d_difftime'
24989 d_dir_dd_fd='$d_dir_dd_fd'
24990 d_dirfd='$d_dirfd'
24991 d_dirnamlen='$d_dirnamlen'
24992 d_dladdr='$d_dladdr'
24993 d_dlerror='$d_dlerror'
24994 d_dlopen='$d_dlopen'
24995 d_dlsymun='$d_dlsymun'
24996 d_dosuid='$d_dosuid'
24997 d_double_has_inf='$d_double_has_inf'
24998 d_double_has_nan='$d_double_has_nan'
24999 d_double_has_negative_zero='$d_double_has_negative_zero'
25000 d_double_has_subnormals='$d_double_has_subnormals'
25001 d_double_style_cray='$d_double_style_cray'
25002 d_double_style_ibm='$d_double_style_ibm'
25003 d_double_style_ieee='$d_double_style_ieee'
25004 d_double_style_vax='$d_double_style_vax'
25005 d_drand48_r='$d_drand48_r'
25006 d_drand48proto='$d_drand48proto'
25007 d_dup2='$d_dup2'
25008 d_dup3='$d_dup3'
25009 d_duplocale='$d_duplocale'
25010 d_eaccess='$d_eaccess'
25011 d_endgrent='$d_endgrent'
25012 d_endgrent_r='$d_endgrent_r'
25013 d_endhent='$d_endhent'
25014 d_endhostent_r='$d_endhostent_r'
25015 d_endnent='$d_endnent'
25016 d_endnetent_r='$d_endnetent_r'
25017 d_endpent='$d_endpent'
25018 d_endprotoent_r='$d_endprotoent_r'
25019 d_endpwent='$d_endpwent'
25020 d_endpwent_r='$d_endpwent_r'
25021 d_endsent='$d_endsent'
25022 d_endservent_r='$d_endservent_r'
25023 d_eofnblk='$d_eofnblk'
25024 d_erf='$d_erf'
25025 d_erfc='$d_erfc'
25026 d_eunice='$d_eunice'
25027 d_exp2='$d_exp2'
25028 d_expm1='$d_expm1'
25029 d_faststdio='$d_faststdio'
25030 d_fchdir='$d_fchdir'
25031 d_fchmod='$d_fchmod'
25032 d_fchmodat='$d_fchmodat'
25033 d_fchown='$d_fchown'
25034 d_fcntl='$d_fcntl'
25035 d_fcntl_can_lock='$d_fcntl_can_lock'
25036 d_fd_macros='$d_fd_macros'
25037 d_fd_set='$d_fd_set'
25038 d_fdclose='$d_fdclose'
25039 d_fdim='$d_fdim'
25040 d_fds_bits='$d_fds_bits'
25041 d_fegetround='$d_fegetround'
25042 d_ffs='$d_ffs'
25043 d_ffsl='$d_ffsl'
25044 d_fgetpos='$d_fgetpos'
25045 d_finite='$d_finite'
25046 d_finitel='$d_finitel'
25047 d_flexfnam='$d_flexfnam'
25048 d_flock='$d_flock'
25049 d_flockproto='$d_flockproto'
25050 d_fma='$d_fma'
25051 d_fmax='$d_fmax'
25052 d_fmin='$d_fmin'
25053 d_fdopendir='$d_fdopendir'
25054 d_fork='$d_fork'
25055 d_fp_class='$d_fp_class'
25056 d_fp_classify='$d_fp_classify'
25057 d_fp_classl='$d_fp_classl'
25058 d_fpathconf='$d_fpathconf'
25059 d_fpclass='$d_fpclass'
25060 d_fpclassify='$d_fpclassify'
25061 d_fpclassl='$d_fpclassl'
25062 d_fpgetround='$d_fpgetround'
25063 d_fpos64_t='$d_fpos64_t'
25064 d_freelocale='$d_freelocale'
25065 d_frexpl='$d_frexpl'
25066 d_fs_data_s='$d_fs_data_s'
25067 d_fseeko='$d_fseeko'
25068 d_fsetpos='$d_fsetpos'
25069 d_fstatfs='$d_fstatfs'
25070 d_fstatvfs='$d_fstatvfs'
25071 d_fsync='$d_fsync'
25072 d_ftello='$d_ftello'
25073 d_ftime='$d_ftime'
25074 d_futimes='$d_futimes'
25075 d_gai_strerror='$d_gai_strerror'
25076 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
25077 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
25078 d_getaddrinfo='$d_getaddrinfo'
25079 d_getcwd='$d_getcwd'
25080 d_getenv_preserves_other_thread='$d_getenv_preserves_other_thread'
25081 d_getespwnam='$d_getespwnam'
25082 d_getfsstat='$d_getfsstat'
25083 d_getgrent='$d_getgrent'
25084 d_getgrent_r='$d_getgrent_r'
25085 d_getgrgid_r='$d_getgrgid_r'
25086 d_getgrnam_r='$d_getgrnam_r'
25087 d_getgrps='$d_getgrps'
25088 d_gethbyaddr='$d_gethbyaddr'
25089 d_gethbyname='$d_gethbyname'
25090 d_gethent='$d_gethent'
25091 d_gethname='$d_gethname'
25092 d_gethostbyaddr_r='$d_gethostbyaddr_r'
25093 d_gethostbyname_r='$d_gethostbyname_r'
25094 d_gethostent_r='$d_gethostent_r'
25095 d_gethostprotos='$d_gethostprotos'
25096 d_getitimer='$d_getitimer'
25097 d_getlogin='$d_getlogin'
25098 d_getlogin_r='$d_getlogin_r'
25099 d_getmnt='$d_getmnt'
25100 d_getmntent='$d_getmntent'
25101 d_getnameinfo='$d_getnameinfo'
25102 d_getnbyaddr='$d_getnbyaddr'
25103 d_getnbyname='$d_getnbyname'
25104 d_getnent='$d_getnent'
25105 d_getnetbyaddr_r='$d_getnetbyaddr_r'
25106 d_getnetbyname_r='$d_getnetbyname_r'
25107 d_getnetent_r='$d_getnetent_r'
25108 d_getnetprotos='$d_getnetprotos'
25109 d_getpagsz='$d_getpagsz'
25110 d_getpbyname='$d_getpbyname'
25111 d_getpbynumber='$d_getpbynumber'
25112 d_getpent='$d_getpent'
25113 d_getpgid='$d_getpgid'
25114 d_getpgrp2='$d_getpgrp2'
25115 d_getpgrp='$d_getpgrp'
25116 d_getppid='$d_getppid'
25117 d_getprior='$d_getprior'
25118 d_getprotobyname_r='$d_getprotobyname_r'
25119 d_getprotobynumber_r='$d_getprotobynumber_r'
25120 d_getprotoent_r='$d_getprotoent_r'
25121 d_getprotoprotos='$d_getprotoprotos'
25122 d_getprpwnam='$d_getprpwnam'
25123 d_getpwent='$d_getpwent'
25124 d_getpwent_r='$d_getpwent_r'
25125 d_getpwnam_r='$d_getpwnam_r'
25126 d_getpwuid_r='$d_getpwuid_r'
25127 d_getsbyname='$d_getsbyname'
25128 d_getsbyport='$d_getsbyport'
25129 d_getsent='$d_getsent'
25130 d_getservbyname_r='$d_getservbyname_r'
25131 d_getservbyport_r='$d_getservbyport_r'
25132 d_getservent_r='$d_getservent_r'
25133 d_getservprotos='$d_getservprotos'
25134 d_getspnam='$d_getspnam'
25135 d_getspnam_r='$d_getspnam_r'
25136 d_gettimeod='$d_gettimeod'
25137 d_gmtime64='$d_gmtime64'
25138 d_gmtime_r='$d_gmtime_r'
25139 d_gnulibc='$d_gnulibc'
25140 d_grpasswd='$d_grpasswd'
25141 d_has_C_UTF8='$d_has_C_UTF8'
25142 d_hasmntopt='$d_hasmntopt'
25143 d_htonl='$d_htonl'
25144 d_hypot='$d_hypot'
25145 d_ilogb='$d_ilogb'
25146 d_ilogbl='$d_ilogbl'
25147 d_inc_version_list='$d_inc_version_list'
25148 d_inetaton='$d_inetaton'
25149 d_inetntop='$d_inetntop'
25150 d_inetpton='$d_inetpton'
25151 d_int64_t='$d_int64_t'
25152 d_ip_mreq='$d_ip_mreq'
25153 d_ip_mreq_source='$d_ip_mreq_source'
25154 d_ipv6_mreq='$d_ipv6_mreq'
25155 d_ipv6_mreq_source='$d_ipv6_mreq_source'
25156 d_isascii='$d_isascii'
25157 d_isblank='$d_isblank'
25158 d_isfinite='$d_isfinite'
25159 d_isfinitel='$d_isfinitel'
25160 d_isinf='$d_isinf'
25161 d_isinfl='$d_isinfl'
25162 d_isless='$d_isless'
25163 d_isnan='$d_isnan'
25164 d_isnanl='$d_isnanl'
25165 d_isnormal='$d_isnormal'
25166 d_j0='$d_j0'
25167 d_j0l='$d_j0l'
25168 d_killpg='$d_killpg'
25169 d_lc_monetary_2008='$d_lc_monetary_2008'
25170 d_lchown='$d_lchown'
25171 d_ldbl_dig='$d_ldbl_dig'
25172 d_ldexpl='$d_ldexpl'
25173 d_lgamma='$d_lgamma'
25174 d_lgamma_r='$d_lgamma_r'
25175 d_libm_lib_version='$d_libm_lib_version'
25176 d_libname_unique='$d_libname_unique'
25177 d_link='$d_link'
25178 d_linkat='$d_linkat'
25179 d_llrint='$d_llrint'
25180 d_llrintl='$d_llrintl'
25181 d_llround='$d_llround'
25182 d_llroundl='$d_llroundl'
25183 d_localeconv_l='$d_localeconv_l'
25184 d_localtime64='$d_localtime64'
25185 d_localtime_r='$d_localtime_r'
25186 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
25187 d_locconv='$d_locconv'
25188 d_lockf='$d_lockf'
25189 d_log1p='$d_log1p'
25190 d_log2='$d_log2'
25191 d_logb='$d_logb'
25192 d_long_double_style_ieee='$d_long_double_style_ieee'
25193 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
25194 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
25195 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
25196 d_long_double_style_vax='$d_long_double_style_vax'
25197 d_longdbl='$d_longdbl'
25198 d_longlong='$d_longlong'
25199 d_lrint='$d_lrint'
25200 d_lrintl='$d_lrintl'
25201 d_lround='$d_lround'
25202 d_lroundl='$d_lroundl'
25203 d_lseekproto='$d_lseekproto'
25204 d_lstat='$d_lstat'
25205 d_madvise='$d_madvise'
25206 d_malloc_good_size='$d_malloc_good_size'
25207 d_malloc_size='$d_malloc_size'
25208 d_malloc_usable_size='$d_malloc_usable_size'
25209 d_mblen='$d_mblen'
25210 d_mbrlen='$d_mbrlen'
25211 d_mbrtowc='$d_mbrtowc'
25212 d_mbstowcs='$d_mbstowcs'
25213 d_mbtowc='$d_mbtowc'
25214 d_memmem='$d_memmem'
25215 d_memrchr='$d_memrchr'
25216 d_mkdir='$d_mkdir'
25217 d_mkdtemp='$d_mkdtemp'
25218 d_mkfifo='$d_mkfifo'
25219 d_mkostemp='$d_mkostemp'
25220 d_mkstemp='$d_mkstemp'
25221 d_mkstemps='$d_mkstemps'
25222 d_mktime64='$d_mktime64'
25223 d_mktime='$d_mktime'
25224 d_mmap='$d_mmap'
25225 d_modfl='$d_modfl'
25226 d_modflproto='$d_modflproto'
25227 d_mprotect='$d_mprotect'
25228 d_msg='$d_msg'
25229 d_msg_ctrunc='$d_msg_ctrunc'
25230 d_msg_dontroute='$d_msg_dontroute'
25231 d_msg_oob='$d_msg_oob'
25232 d_msg_peek='$d_msg_peek'
25233 d_msg_proxy='$d_msg_proxy'
25234 d_msgctl='$d_msgctl'
25235 d_msgget='$d_msgget'
25236 d_msghdr_s='$d_msghdr_s'
25237 d_msgrcv='$d_msgrcv'
25238 d_msgsnd='$d_msgsnd'
25239 d_msync='$d_msync'
25240 d_munmap='$d_munmap'
25241 d_mymalloc='$d_mymalloc'
25242 d_nan='$d_nan'
25243 d_nanosleep='$d_nanosleep'
25244 d_ndbm='$d_ndbm'
25245 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
25246 d_nearbyint='$d_nearbyint'
25247 d_newlocale='$d_newlocale'
25248 d_nextafter='$d_nextafter'
25249 d_nexttoward='$d_nexttoward'
25250 d_nice='$d_nice'
25251 d_nl_langinfo='$d_nl_langinfo'
25252 d_nl_langinfo_l='$d_nl_langinfo_l'
25253 d_non_int_bitfields='$d_non_int_bitfields'
25254 d_nv_preserves_uv='$d_nv_preserves_uv'
25255 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
25256 d_off64_t='$d_off64_t'
25257 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
25258 d_oldpthreads='$d_oldpthreads'
25259 d_oldsock='$d_oldsock'
25260 d_open3='$d_open3'
25261 d_openat='$d_openat'
25262 d_pathconf='$d_pathconf'
25263 d_pause='$d_pause'
25264 d_perl_lc_all_category_positions_init='$d_perl_lc_all_category_positions_init'
25265 d_perl_lc_all_separator='$d_perl_lc_all_separator'
25266 d_perl_lc_all_uses_name_value_pairs='$d_perl_lc_all_uses_name_value_pairs'
25267 d_perl_otherlibdirs='$d_perl_otherlibdirs'
25268 d_phostname='$d_phostname'
25269 d_pipe2='$d_pipe2'
25270 d_pipe='$d_pipe'
25271 d_poll='$d_poll'
25272 d_portable='$d_portable'
25273 d_prctl='$d_prctl'
25274 d_prctl_set_name='$d_prctl_set_name'
25275 d_printf_format_null='$d_printf_format_null'
25276 d_procselfexe='$d_procselfexe'
25277 d_pseudofork='$d_pseudofork'
25278 d_pthread_atfork='$d_pthread_atfork'
25279 d_pthread_attr_setscope='$d_pthread_attr_setscope'
25280 d_pthread_yield='$d_pthread_yield'
25281 d_ptrdiff_t='$d_ptrdiff_t'
25282 d_pwage='$d_pwage'
25283 d_pwchange='$d_pwchange'
25284 d_pwclass='$d_pwclass'
25285 d_pwcomment='$d_pwcomment'
25286 d_pwexpire='$d_pwexpire'
25287 d_pwgecos='$d_pwgecos'
25288 d_pwpasswd='$d_pwpasswd'
25289 d_pwquota='$d_pwquota'
25290 d_qgcvt='$d_qgcvt'
25291 d_quad='$d_quad'
25292 d_querylocale='$d_querylocale'
25293 d_random_r='$d_random_r'
25294 d_re_comp='$d_re_comp'
25295 d_readdir64_r='$d_readdir64_r'
25296 d_readdir='$d_readdir'
25297 d_readdir_r='$d_readdir_r'
25298 d_readlink='$d_readlink'
25299 d_readv='$d_readv'
25300 d_recvmsg='$d_recvmsg'
25301 d_regcmp='$d_regcmp'
25302 d_regcomp='$d_regcomp'
25303 d_remainder='$d_remainder'
25304 d_remquo='$d_remquo'
25305 d_rename='$d_rename'
25306 d_renameat='$d_renameat'
25307 d_rewinddir='$d_rewinddir'
25308 d_rint='$d_rint'
25309 d_rmdir='$d_rmdir'
25310 d_round='$d_round'
25311 d_sbrkproto='$d_sbrkproto'
25312 d_scalbn='$d_scalbn'
25313 d_scalbnl='$d_scalbnl'
25314 d_sched_yield='$d_sched_yield'
25315 d_scm_rights='$d_scm_rights'
25316 d_seekdir='$d_seekdir'
25317 d_select='$d_select'
25318 d_sem='$d_sem'
25319 d_semctl='$d_semctl'
25320 d_semctl_semid_ds='$d_semctl_semid_ds'
25321 d_semctl_semun='$d_semctl_semun'
25322 d_semget='$d_semget'
25323 d_semop='$d_semop'
25324 d_sendmsg='$d_sendmsg'
25325 d_setegid='$d_setegid'
25326 d_setenv='$d_setenv'
25327 d_seteuid='$d_seteuid'
25328 d_setgrent='$d_setgrent'
25329 d_setgrent_r='$d_setgrent_r'
25330 d_setgrps='$d_setgrps'
25331 d_sethent='$d_sethent'
25332 d_sethostent_r='$d_sethostent_r'
25333 d_setitimer='$d_setitimer'
25334 d_setlinebuf='$d_setlinebuf'
25335 d_setlocale='$d_setlocale'
25336 d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
25337 d_setlocale_r='$d_setlocale_r'
25338 d_setnent='$d_setnent'
25339 d_setnetent_r='$d_setnetent_r'
25340 d_setpent='$d_setpent'
25341 d_setpgid='$d_setpgid'
25342 d_setpgrp2='$d_setpgrp2'
25343 d_setpgrp='$d_setpgrp'
25344 d_setprior='$d_setprior'
25345 d_setproctitle='$d_setproctitle'
25346 d_setprotoent_r='$d_setprotoent_r'
25347 d_setpwent='$d_setpwent'
25348 d_setpwent_r='$d_setpwent_r'
25349 d_setregid='$d_setregid'
25350 d_setresgid='$d_setresgid'
25351 d_setresuid='$d_setresuid'
25352 d_setreuid='$d_setreuid'
25353 d_setrgid='$d_setrgid'
25354 d_setruid='$d_setruid'
25355 d_setsent='$d_setsent'
25356 d_setservent_r='$d_setservent_r'
25357 d_setsid='$d_setsid'
25358 d_setvbuf='$d_setvbuf'
25359 d_shm='$d_shm'
25360 d_shmat='$d_shmat'
25361 d_shmatprototype='$d_shmatprototype'
25362 d_shmctl='$d_shmctl'
25363 d_shmdt='$d_shmdt'
25364 d_shmget='$d_shmget'
25365 d_sigaction='$d_sigaction'
25366 d_siginfo_si_addr='$d_siginfo_si_addr'
25367 d_siginfo_si_band='$d_siginfo_si_band'
25368 d_siginfo_si_errno='$d_siginfo_si_errno'
25369 d_siginfo_si_fd='$d_siginfo_si_fd'
25370 d_siginfo_si_pid='$d_siginfo_si_pid'
25371 d_siginfo_si_status='$d_siginfo_si_status'
25372 d_siginfo_si_uid='$d_siginfo_si_uid'
25373 d_siginfo_si_value='$d_siginfo_si_value'
25374 d_signbit='$d_signbit'
25375 d_sigprocmask='$d_sigprocmask'
25376 d_sigsetjmp='$d_sigsetjmp'
25377 d_sin6_scope_id='$d_sin6_scope_id'
25378 d_sitearch='$d_sitearch'
25379 d_snprintf='$d_snprintf'
25380 d_sockaddr_in6='$d_sockaddr_in6'
25381 d_sockaddr_sa_len='$d_sockaddr_sa_len'
25382 d_sockaddr_storage='$d_sockaddr_storage'
25383 d_sockatmark='$d_sockatmark'
25384 d_sockatmarkproto='$d_sockatmarkproto'
25385 d_socket='$d_socket'
25386 d_socklen_t='$d_socklen_t'
25387 d_sockpair='$d_sockpair'
25388 d_socks5_init='$d_socks5_init'
25389 d_sqrtl='$d_sqrtl'
25390 d_srand48_r='$d_srand48_r'
25391 d_srandom_r='$d_srandom_r'
25392 d_sresgproto='$d_sresgproto'
25393 d_sresuproto='$d_sresuproto'
25394 d_stat='$d_stat'
25395 d_statblks='$d_statblks'
25396 d_statfs_f_flags='$d_statfs_f_flags'
25397 d_statfs_s='$d_statfs_s'
25398 d_static_inline='$d_static_inline'
25399 d_statvfs='$d_statvfs'
25400 d_stdio_cnt_lval='$d_stdio_cnt_lval'
25401 d_stdio_ptr_lval='$d_stdio_ptr_lval'
25402 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
25403 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
25404 d_stdio_stream_array='$d_stdio_stream_array'
25405 d_stdiobase='$d_stdiobase'
25406 d_stdstdio='$d_stdstdio'
25407 d_strcoll='$d_strcoll'
25408 d_strerror_l='$d_strerror_l'
25409 d_strerror_r='$d_strerror_r'
25410 d_strftime='$d_strftime'
25411 d_strlcat='$d_strlcat'
25412 d_strlcpy='$d_strlcpy'
25413 d_strnlen='$d_strnlen'
25414 d_strtod='$d_strtod'
25415 d_strtod_l='$d_strtod_l'
25416 d_strtol='$d_strtol'
25417 d_strtold='$d_strtold'
25418 d_strtold_l='$d_strtold_l'
25419 d_strtoll='$d_strtoll'
25420 d_strtoq='$d_strtoq'
25421 d_strtoul='$d_strtoul'
25422 d_strtoull='$d_strtoull'
25423 d_strtouq='$d_strtouq'
25424 d_strxfrm='$d_strxfrm'
25425 d_strxfrm_l='$d_strxfrm_l'
25426 d_suidsafe='$d_suidsafe'
25427 d_symlink='$d_symlink'
25428 d_syscall='$d_syscall'
25429 d_syscallproto='$d_syscallproto'
25430 d_sysconf='$d_sysconf'
25431 d_sysernlst='$d_sysernlst'
25432 d_syserrlst='$d_syserrlst'
25433 d_system='$d_system'
25434 d_tcgetpgrp='$d_tcgetpgrp'
25435 d_tcsetpgrp='$d_tcsetpgrp'
25436 d_telldir='$d_telldir'
25437 d_telldirproto='$d_telldirproto'
25438 d_tgamma='$d_tgamma'
25439 d_thread_local='$d_thread_local'
25440 d_time='$d_time'
25441 d_timegm='$d_timegm'
25442 d_times='$d_times'
25443 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
25444 d_tm_tm_zone='$d_tm_tm_zone'
25445 d_tmpnam_r='$d_tmpnam_r'
25446 d_towlower='$d_towlower'
25447 d_towupper='$d_towupper'
25448 d_trunc='$d_trunc'
25449 d_truncate='$d_truncate'
25450 d_truncl='$d_truncl'
25451 d_ttyname_r='$d_ttyname_r'
25452 d_tzname='$d_tzname'
25453 d_u32align='$d_u32align'
25454 d_ualarm='$d_ualarm'
25455 d_umask='$d_umask'
25456 d_uname='$d_uname'
25457 d_union_semun='$d_union_semun'
25458 d_unlinkat='$d_unlinkat'
25459 d_unordered='$d_unordered'
25460 d_unsetenv='$d_unsetenv'
25461 d_uselocale='$d_uselocale'
25462 d_usleep='$d_usleep'
25463 d_usleepproto='$d_usleepproto'
25464 d_ustat='$d_ustat'
25465 d_vendorarch='$d_vendorarch'
25466 d_vendorbin='$d_vendorbin'
25467 d_vendorlib='$d_vendorlib'
25468 d_vendorscript='$d_vendorscript'
25469 d_vfork='$d_vfork'
25470 d_void_closedir='$d_void_closedir'
25471 d_voidsig='$d_voidsig'
25472 d_voidtty='$d_voidtty'
25473 d_vsnprintf='$d_vsnprintf'
25474 d_wait4='$d_wait4'
25475 d_waitpid='$d_waitpid'
25476 d_wcrtomb='$d_wcrtomb'
25477 d_wcscmp='$d_wcscmp'
25478 d_wcstombs='$d_wcstombs'
25479 d_wcsxfrm='$d_wcsxfrm'
25480 d_wctomb='$d_wctomb'
25481 d_writev='$d_writev'
25482 d_xenix='$d_xenix'
25483 date='$date'
25484 db_hashtype='$db_hashtype'
25485 db_prefixtype='$db_prefixtype'
25486 db_version_major='$db_version_major'
25487 db_version_minor='$db_version_minor'
25488 db_version_patch='$db_version_patch'
25489 default_inc_excludes_dot='$default_inc_excludes_dot'
25490 direntrytype='$direntrytype'
25491 dlext='$dlext'
25492 dlsrc='$dlsrc'
25493 doubleinfbytes='$doubleinfbytes'
25494 doublekind='$doublekind'
25495 doublemantbits='$doublemantbits'
25496 doublenanbytes='$doublenanbytes'
25497 doublesize='$doublesize'
25498 drand01='$drand01'
25499 drand48_r_proto='$drand48_r_proto'
25500 dtrace='$dtrace'
25501 dtraceobject='$dtraceobject'
25502 dtracexnolibs='$dtracexnolibs'
25503 dynamic_ext='$dynamic_ext'
25504 eagain='$eagain'
25505 ebcdic='$ebcdic'
25506 echo='$echo'
25507 egrep='$egrep'
25508 emacs='$emacs'
25509 endgrent_r_proto='$endgrent_r_proto'
25510 endhostent_r_proto='$endhostent_r_proto'
25511 endnetent_r_proto='$endnetent_r_proto'
25512 endprotoent_r_proto='$endprotoent_r_proto'
25513 endpwent_r_proto='$endpwent_r_proto'
25514 endservent_r_proto='$endservent_r_proto'
25515 eunicefix='$eunicefix'
25516 exe_ext='$exe_ext'
25517 expr='$expr'
25518 extensions='$extensions'
25519 extern_C='$extern_C'
25520 extras='$extras'
25521 fflushNULL='$fflushNULL'
25522 fflushall='$fflushall'
25523 find='$find'
25524 firstmakefile='$firstmakefile'
25525 flex='$flex'
25526 fpossize='$fpossize'
25527 fpostype='$fpostype'
25528 freetype='$freetype'
25529 from='$from'
25530 full_ar='$full_ar'
25531 full_csh='$full_csh'
25532 full_sed='$full_sed'
25533 gccansipedantic='$gccansipedantic'
25534 gccosandvers='$gccosandvers'
25535 gccversion='$gccversion'
25536 getgrent_r_proto='$getgrent_r_proto'
25537 getgrgid_r_proto='$getgrgid_r_proto'
25538 getgrnam_r_proto='$getgrnam_r_proto'
25539 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
25540 gethostbyname_r_proto='$gethostbyname_r_proto'
25541 gethostent_r_proto='$gethostent_r_proto'
25542 getlogin_r_proto='$getlogin_r_proto'
25543 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
25544 getnetbyname_r_proto='$getnetbyname_r_proto'
25545 getnetent_r_proto='$getnetent_r_proto'
25546 getprotobyname_r_proto='$getprotobyname_r_proto'
25547 getprotobynumber_r_proto='$getprotobynumber_r_proto'
25548 getprotoent_r_proto='$getprotoent_r_proto'
25549 getpwent_r_proto='$getpwent_r_proto'
25550 getpwnam_r_proto='$getpwnam_r_proto'
25551 getpwuid_r_proto='$getpwuid_r_proto'
25552 getservbyname_r_proto='$getservbyname_r_proto'
25553 getservbyport_r_proto='$getservbyport_r_proto'
25554 getservent_r_proto='$getservent_r_proto'
25555 getspnam_r_proto='$getspnam_r_proto'
25556 gidformat='$gidformat'
25557 gidsign='$gidsign'
25558 gidsize='$gidsize'
25559 gidtype='$gidtype'
25560 glibpth='$glibpth'
25561 gmake='$gmake'
25562 gmtime_r_proto='$gmtime_r_proto'
25563 gnulibc_version='$gnulibc_version'
25564 grep='$grep'
25565 groupcat='$groupcat'
25566 groupstype='$groupstype'
25567 gzip='$gzip'
25568 h_fcntl='$h_fcntl'
25569 h_sysfile='$h_sysfile'
25570 hint='$hint'
25571 hostcat='$hostcat'
25572 hostgenerate='$hostgenerate'
25573 hostosname='$hostosname'
25574 hostperl='$hostperl'
25575 html1dir='$html1dir'
25576 html1direxp='$html1direxp'
25577 html3dir='$html3dir'
25578 html3direxp='$html3direxp'
25579 i16size='$i16size'
25580 i16type='$i16type'
25581 i32dformat='$i32dformat'
25582 i32size='$i32size'
25583 i32type='$i32type'
25584 i64size='$i64size'
25585 i64type='$i64type'
25586 i8size='$i8size'
25587 i8type='$i8type'
25588 i_arpainet='$i_arpainet'
25589 i_bfd='$i_bfd'
25590 i_bsdioctl='$i_bsdioctl'
25591 i_crypt='$i_crypt'
25592 i_db='$i_db'
25593 i_dbm='$i_dbm'
25594 i_dirent='$i_dirent'
25595 i_dlfcn='$i_dlfcn'
25596 i_execinfo='$i_execinfo'
25597 i_fcntl='$i_fcntl'
25598 i_fenv='$i_fenv'
25599 i_fp='$i_fp'
25600 i_fp_class='$i_fp_class'
25601 i_gdbm='$i_gdbm'
25602 i_gdbm_ndbm='$i_gdbm_ndbm'
25603 i_gdbmndbm='$i_gdbmndbm'
25604 i_grp='$i_grp'
25605 i_ieeefp='$i_ieeefp'
25606 i_inttypes='$i_inttypes'
25607 i_langinfo='$i_langinfo'
25608 i_libutil='$i_libutil'
25609 i_locale='$i_locale'
25610 i_machcthr='$i_machcthr'
25611 i_malloc='$i_malloc'
25612 i_mallocmalloc='$i_mallocmalloc'
25613 i_mntent='$i_mntent'
25614 i_ndbm='$i_ndbm'
25615 i_netdb='$i_netdb'
25616 i_neterrno='$i_neterrno'
25617 i_netinettcp='$i_netinettcp'
25618 i_niin='$i_niin'
25619 i_poll='$i_poll'
25620 i_prot='$i_prot'
25621 i_pthread='$i_pthread'
25622 i_pwd='$i_pwd'
25623 i_quadmath='$i_quadmath'
25624 i_rpcsvcdbm='$i_rpcsvcdbm'
25625 i_sgtty='$i_sgtty'
25626 i_shadow='$i_shadow'
25627 i_socks='$i_socks'
25628 i_stdbool='$i_stdbool'
25629 i_stdint='$i_stdint'
25630 i_stdlib='$i_stdlib'
25631 i_sunmath='$i_sunmath'
25632 i_sysaccess='$i_sysaccess'
25633 i_sysdir='$i_sysdir'
25634 i_sysfile='$i_sysfile'
25635 i_sysfilio='$i_sysfilio'
25636 i_sysin='$i_sysin'
25637 i_sysioctl='$i_sysioctl'
25638 i_syslog='$i_syslog'
25639 i_sysmman='$i_sysmman'
25640 i_sysmode='$i_sysmode'
25641 i_sysmount='$i_sysmount'
25642 i_sysndir='$i_sysndir'
25643 i_sysparam='$i_sysparam'
25644 i_syspoll='$i_syspoll'
25645 i_sysresrc='$i_sysresrc'
25646 i_syssecrt='$i_syssecrt'
25647 i_sysselct='$i_sysselct'
25648 i_syssockio='$i_syssockio'
25649 i_sysstat='$i_sysstat'
25650 i_sysstatfs='$i_sysstatfs'
25651 i_sysstatvfs='$i_sysstatvfs'
25652 i_syssyscall='$i_syssyscall'
25653 i_systime='$i_systime'
25654 i_systimek='$i_systimek'
25655 i_systimes='$i_systimes'
25656 i_systypes='$i_systypes'
25657 i_sysuio='$i_sysuio'
25658 i_sysun='$i_sysun'
25659 i_sysutsname='$i_sysutsname'
25660 i_sysvfs='$i_sysvfs'
25661 i_syswait='$i_syswait'
25662 i_termio='$i_termio'
25663 i_termios='$i_termios'
25664 i_time='$i_time'
25665 i_unistd='$i_unistd'
25666 i_ustat='$i_ustat'
25667 i_utime='$i_utime'
25668 i_vfork='$i_vfork'
25669 i_wchar='$i_wchar'
25670 i_wctype='$i_wctype'
25671 i_xlocale='$i_xlocale'
25672 ignore_versioned_solibs='$ignore_versioned_solibs'
25673 inc_version_list='$inc_version_list'
25674 inc_version_list_init='$inc_version_list_init'
25675 incpath='$incpath'
25676 incpth='$incpth'
25677 inews='$inews'
25678 initialinstalllocation='$initialinstalllocation'
25679 installarchlib='$installarchlib'
25680 installbin='$installbin'
25681 installhtml1dir='$installhtml1dir'
25682 installhtml3dir='$installhtml3dir'
25683 installman1dir='$installman1dir'
25684 installman3dir='$installman3dir'
25685 installprefix='$installprefix'
25686 installprefixexp='$installprefixexp'
25687 installprivlib='$installprivlib'
25688 installscript='$installscript'
25689 installsitearch='$installsitearch'
25690 installsitebin='$installsitebin'
25691 installsitehtml1dir='$installsitehtml1dir'
25692 installsitehtml3dir='$installsitehtml3dir'
25693 installsitelib='$installsitelib'
25694 installsiteman1dir='$installsiteman1dir'
25695 installsiteman3dir='$installsiteman3dir'
25696 installsitescript='$installsitescript'
25697 installstyle='$installstyle'
25698 installusrbinperl='$installusrbinperl'
25699 installvendorarch='$installvendorarch'
25700 installvendorbin='$installvendorbin'
25701 installvendorhtml1dir='$installvendorhtml1dir'
25702 installvendorhtml3dir='$installvendorhtml3dir'
25703 installvendorlib='$installvendorlib'
25704 installvendorman1dir='$installvendorman1dir'
25705 installvendorman3dir='$installvendorman3dir'
25706 installvendorscript='$installvendorscript'
25707 intsize='$intsize'
25708 issymlink='$issymlink'
25709 ivdformat='$ivdformat'
25710 ivsize='$ivsize'
25711 ivtype='$ivtype'
25712 known_extensions='$known_extensions'
25713 ksh='$ksh'
25714 ld='$ld'
25715 ld_can_script='$ld_can_script'
25716 lddlflags='$lddlflags'
25717 ldflags='$ldflags'
25718 ldflags_uselargefiles='$ldflags_uselargefiles'
25719 ldlibpthname='$ldlibpthname'
25720 less='$less'
25721 lib_ext='$lib_ext'
25722 libc='$libc'
25723 libperl='$libperl'
25724 libpth='$libpth'
25725 libs='$libs'
25726 libsdirs='$libsdirs'
25727 libsfiles='$libsfiles'
25728 libsfound='$libsfound'
25729 libspath='$libspath'
25730 libswanted='$libswanted'
25731 libswanted_uselargefiles='$libswanted_uselargefiles'
25732 line='$line'
25733 lint='$lint'
25734 lkflags='$lkflags'
25735 ln='$ln'
25736 lns='$lns'
25737 localtime_r_proto='$localtime_r_proto'
25738 locincpth='$locincpth'
25739 loclibpth='$loclibpth'
25740 longdblinfbytes='$longdblinfbytes'
25741 longdblkind='$longdblkind'
25742 longdblmantbits='$longdblmantbits'
25743 longdblnanbytes='$longdblnanbytes'
25744 longdblsize='$longdblsize'
25745 longlongsize='$longlongsize'
25746 longsize='$longsize'
25747 lp='$lp'
25748 lpr='$lpr'
25749 ls='$ls'
25750 lseeksize='$lseeksize'
25751 lseektype='$lseektype'
25752 mail='$mail'
25753 mailx='$mailx'
25754 make='$make'
25755 make_set_make='$make_set_make'
25756 mallocobj='$mallocobj'
25757 mallocsrc='$mallocsrc'
25758 malloctype='$malloctype'
25759 man1dir='$man1dir'
25760 man1direxp='$man1direxp'
25761 man1ext='$man1ext'
25762 man3dir='$man3dir'
25763 man3direxp='$man3direxp'
25764 man3ext='$man3ext'
25765 mips_type='$mips_type'
25766 mistrustnm='$mistrustnm'
25767 mkdir='$mkdir'
25768 mmaptype='$mmaptype'
25769 modetype='$modetype'
25770 more='$more'
25771 multiarch='$multiarch'
25772 mv='$mv'
25773 myarchname='$myarchname'
25774 mydomain='$mydomain'
25775 myhostname='$myhostname'
25776 myuname='$myuname'
25777 n='$n'
25778 need_va_copy='$need_va_copy'
25779 netdb_hlen_type='$netdb_hlen_type'
25780 netdb_host_type='$netdb_host_type'
25781 netdb_name_type='$netdb_name_type'
25782 netdb_net_type='$netdb_net_type'
25783 nm='$nm'
25784 nm_opt='$nm_opt'
25785 nm_so_opt='$nm_so_opt'
25786 nonxs_ext='$nonxs_ext'
25787 nroff='$nroff'
25788 nvEUformat='$nvEUformat'
25789 nvFUformat='$nvFUformat'
25790 nvGUformat='$nvGUformat'
25791 nv_overflows_integers_at='$nv_overflows_integers_at'
25792 nv_preserves_uv_bits='$nv_preserves_uv_bits'
25793 nveformat='$nveformat'
25794 nvfformat='$nvfformat'
25795 nvgformat='$nvgformat'
25796 nvmantbits='$nvmantbits'
25797 nvsize='$nvsize'
25798 nvtype='$nvtype'
25799 o_nonblock='$o_nonblock'
25800 obj_ext='$obj_ext'
25801 old_pthread_create_joinable='$old_pthread_create_joinable'
25802 optimize='$optimize'
25803 orderlib='$orderlib'
25804 osname='$osname'
25805 osvers='$osvers'
25806 otherlibdirs='$otherlibdirs'
25807 package='$package'
25808 pager='$pager'
25809 passcat='$passcat'
25810 patchlevel='$patchlevel'
25811 path_sep='$path_sep'
25812 perl5='$perl5'
25813 perl='$perl'
25814 perl_lc_all_category_positions_init='$perl_lc_all_category_positions_init'
25815 perl_lc_all_separator='$perl_lc_all_separator'
25816 perl_patchlevel='$perl_patchlevel'
25817 perl_static_inline='$perl_static_inline'
25818 perl_thread_local='$perl_thread_local'
25819 perladmin='$perladmin'
25820 perllibs='$perllibs'
25821 perlpath='$perlpath'
25822 pg='$pg'
25823 phostname='$phostname'
25824 pidtype='$pidtype'
25825 plibpth='$plibpth'
25826 pmake='$pmake'
25827 pr='$pr'
25828 prefix='$prefix'
25829 prefixexp='$prefixexp'
25830 privlib='$privlib'
25831 privlibexp='$privlibexp'
25832 procselfexe='$procselfexe'
25833 ptrsize='$ptrsize'
25834 quadkind='$quadkind'
25835 quadtype='$quadtype'
25836 randbits='$randbits'
25837 randfunc='$randfunc'
25838 random_r_proto='$random_r_proto'
25839 randseedtype='$randseedtype'
25840 ranlib='$ranlib'
25841 rd_nodata='$rd_nodata'
25842 readdir64_r_proto='$readdir64_r_proto'
25843 readdir_r_proto='$readdir_r_proto'
25844 revision='$revision'
25845 rm='$rm'
25846 rm_try='$rm_try'
25847 rmail='$rmail'
25848 run='$run'
25849 runnm='$runnm'
25850 sGMTIME_max='$sGMTIME_max'
25851 sGMTIME_min='$sGMTIME_min'
25852 sLOCALTIME_max='$sLOCALTIME_max'
25853 sLOCALTIME_min='$sLOCALTIME_min'
25854 sPRIEUldbl='$sPRIEUldbl'
25855 sPRIFUldbl='$sPRIFUldbl'
25856 sPRIGUldbl='$sPRIGUldbl'
25857 sPRIXU64='$sPRIXU64'
25858 sPRId64='$sPRId64'
25859 sPRIeldbl='$sPRIeldbl'
25860 sPRIfldbl='$sPRIfldbl'
25861 sPRIgldbl='$sPRIgldbl'
25862 sPRIi64='$sPRIi64'
25863 sPRIo64='$sPRIo64'
25864 sPRIu64='$sPRIu64'
25865 sPRIx64='$sPRIx64'
25866 sSCNfldbl='$sSCNfldbl'
25867 sched_yield='$sched_yield'
25868 scriptdir='$scriptdir'
25869 scriptdirexp='$scriptdirexp'
25870 sed='$sed'
25871 seedfunc='$seedfunc'
25872 selectminbits='$selectminbits'
25873 selecttype='$selecttype'
25874 sendmail='$sendmail'
25875 setgrent_r_proto='$setgrent_r_proto'
25876 sethostent_r_proto='$sethostent_r_proto'
25877 setlocale_r_proto='$setlocale_r_proto'
25878 setnetent_r_proto='$setnetent_r_proto'
25879 setprotoent_r_proto='$setprotoent_r_proto'
25880 setpwent_r_proto='$setpwent_r_proto'
25881 setservent_r_proto='$setservent_r_proto'
25882 sh='$sh'
25883 shar='$shar'
25884 sharpbang='$sharpbang'
25885 shmattype='$shmattype'
25886 shortsize='$shortsize'
25887 shrpenv='$shrpenv'
25888 shsharp='$shsharp'
25889 sig_count='$sig_count'
25890 sig_name='$sig_name'
25891 sig_name_init='$sig_name_init'
25892 sig_num='$sig_num'
25893 sig_num_init='$sig_num_init'
25894 sig_size='$sig_size'
25895 signal_t='$signal_t'
25896 sitearch='$sitearch'
25897 sitearchexp='$sitearchexp'
25898 sitebin='$sitebin'
25899 sitebinexp='$sitebinexp'
25900 sitehtml1dir='$sitehtml1dir'
25901 sitehtml1direxp='$sitehtml1direxp'
25902 sitehtml3dir='$sitehtml3dir'
25903 sitehtml3direxp='$sitehtml3direxp'
25904 sitelib='$sitelib'
25905 sitelib_stem='$sitelib_stem'
25906 sitelibexp='$sitelibexp'
25907 siteman1dir='$siteman1dir'
25908 siteman1direxp='$siteman1direxp'
25909 siteman3dir='$siteman3dir'
25910 siteman3direxp='$siteman3direxp'
25911 siteprefix='$siteprefix'
25912 siteprefixexp='$siteprefixexp'
25913 sitescript='$sitescript'
25914 sitescriptexp='$sitescriptexp'
25915 sizesize='$sizesize'
25916 sizetype='$sizetype'
25917 sleep='$sleep'
25918 smail='$smail'
25919 so='$so'
25920 sockethdr='$sockethdr'
25921 socketlib='$socketlib'
25922 socksizetype='$socksizetype'
25923 sort='$sort'
25924 spackage='$spackage'
25925 spitshell='$spitshell'
25926 srand48_r_proto='$srand48_r_proto'
25927 srandom_r_proto='$srandom_r_proto'
25928 src='$src'
25929 ssizetype='$ssizetype'
25930 st_dev_sign='$st_dev_sign'
25931 st_dev_size='$st_dev_size'
25932 st_ino_sign='$st_ino_sign'
25933 st_ino_size='$st_ino_size'
25934 startperl='$startperl'
25935 startsh='$startsh'
25936 static_ext='$static_ext'
25937 stdchar='$stdchar'
25938 stdio_base='$stdio_base'
25939 stdio_bufsiz='$stdio_bufsiz'
25940 stdio_cnt='$stdio_cnt'
25941 stdio_filbuf='$stdio_filbuf'
25942 stdio_ptr='$stdio_ptr'
25943 stdio_stream_array='$stdio_stream_array'
25944 strerror_r_proto='$strerror_r_proto'
25945 submit='$submit'
25946 subversion='$subversion'
25947 sysman='$sysman'
25948 sysroot='$sysroot'
25949 tail='$tail'
25950 tar='$tar'
25951 targetarch='$targetarch'
25952 targetdir='$targetdir'
25953 targetenv='$targetenv'
25954 targethost='$targethost'
25955 targetmkdir='$targetmkdir'
25956 targetport='$targetport'
25957 targetsh='$targetsh'
25958 tbl='$tbl'
25959 tee='$tee'
25960 test='$test'
25961 timeincl='$timeincl'
25962 timetype='$timetype'
25963 tmpnam_r_proto='$tmpnam_r_proto'
25964 to='$to'
25965 touch='$touch'
25966 tr='$tr'
25967 trnl='$trnl'
25968 troff='$troff'
25969 ttyname_r_proto='$ttyname_r_proto'
25970 u16size='$u16size'
25971 u16type='$u16type'
25972 u32XUformat='$u32XUformat'
25973 u32oformat='$u32oformat'
25974 u32size='$u32size'
25975 u32type='$u32type'
25976 u32uformat='$u32uformat'
25977 u32xformat='$u32xformat'
25978 u64size='$u64size'
25979 u64type='$u64type'
25980 u8size='$u8size'
25981 u8type='$u8type'
25982 uidformat='$uidformat'
25983 uidsign='$uidsign'
25984 uidsize='$uidsize'
25985 uidtype='$uidtype'
25986 uname='$uname'
25987 uniq='$uniq'
25988 uquadtype='$uquadtype'
25989 use64bitall='$use64bitall'
25990 use64bitint='$use64bitint'
25991 usecbacktrace='$usecbacktrace'
25992 usecrosscompile='$usecrosscompile'
25993 usedefaultstrict='$usedefaultstrict'
25994 usedevel='$usedevel'
25995 usedl='$usedl'
25996 usedtrace='$usedtrace'
25997 usefaststdio='$usefaststdio'
25998 useithreads='$useithreads'
25999 usekernprocpathname='$usekernprocpathname'
26000 uselanginfo='$uselanginfo'
26001 uselargefiles='$uselargefiles'
26002 uselongdouble='$uselongdouble'
26003 usemallocwrap='$usemallocwrap'
26004 usemorebits='$usemorebits'
26005 usemultiplicity='$usemultiplicity'
26006 usemymalloc='$usemymalloc'
26007 usenm='$usenm'
26008 usensgetexecutablepath='$usensgetexecutablepath'
26009 useopcode='$useopcode'
26010 useperlio='$useperlio'
26011 useposix='$useposix'
26012 usequadmath='$usequadmath'
26013 usereentrant='$usereentrant'
26014 userelocatableinc='$userelocatableinc'
26015 useshrplib='$useshrplib'
26016 usesitecustomize='$usesitecustomize'
26017 usesocks='$usesocks'
26018 usethreads='$usethreads'
26019 usevendorprefix='$usevendorprefix'
26020 useversionedarchname='$useversionedarchname'
26021 usevfork='$usevfork'
26022 usrinc='$usrinc'
26023 uuname='$uuname'
26024 uvXUformat='$uvXUformat'
26025 uvoformat='$uvoformat'
26026 uvsize='$uvsize'
26027 uvtype='$uvtype'
26028 uvuformat='$uvuformat'
26029 uvxformat='$uvxformat'
26030 vendorarch='$vendorarch'
26031 vendorarchexp='$vendorarchexp'
26032 vendorbin='$vendorbin'
26033 vendorbinexp='$vendorbinexp'
26034 vendorhtml1dir='$vendorhtml1dir'
26035 vendorhtml1direxp='$vendorhtml1direxp'
26036 vendorhtml3dir='$vendorhtml3dir'
26037 vendorhtml3direxp='$vendorhtml3direxp'
26038 vendorlib='$vendorlib'
26039 vendorlib_stem='$vendorlib_stem'
26040 vendorlibexp='$vendorlibexp'
26041 vendorman1dir='$vendorman1dir'
26042 vendorman1direxp='$vendorman1direxp'
26043 vendorman3dir='$vendorman3dir'
26044 vendorman3direxp='$vendorman3direxp'
26045 vendorprefix='$vendorprefix'
26046 vendorprefixexp='$vendorprefixexp'
26047 vendorscript='$vendorscript'
26048 vendorscriptexp='$vendorscriptexp'
26049 version='$version'
26050 version_patchlevel_string='$version_patchlevel_string'
26051 versiononly='$versiononly'
26052 vi='$vi'
26053 xlibpth='$xlibpth'
26054 xlocale_needed='$xlocale_needed'
26055 yacc='$yacc'
26056 yaccflags='$yaccflags'
26057 zcat='$zcat'
26058 zip='$zip'
26059 EOT
26060
26061 : add special variables
26062 $test -f $src/patchlevel.h && \
26063 awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
26064 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
26065 echo "PERL_CONFIG_SH=true" >>config.sh
26066
26067 : propagate old symbols
26068 if $test -f UU/config.sh; then
26069 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
26070 $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
26071 config.sh config.sh UU/oldconfig.sh |\
26072 $sort | $uniq -u >UU/oldsyms
26073 set X `$cat UU/oldsyms`
26074 shift
26075 case $# in
26076 0) ;;
26077 *)
26078 $cat <<EOM
26079 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
26080 EOM
26081 echo ": Variables propagated from previous config.sh file." >>config.sh
26082 for sym in `$cat UU/oldsyms`; do
26083 echo " Propagating $hint variable "'$'"$sym..."
26084 eval 'tmp="$'"${sym}"'"'
26085 echo "$tmp" | \
26086 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
26087 done
26088 ;;
26089 esac
26090 fi
26091
26092 : preserve RCS keywords in files with variable substitution, grrr
26093 Id='$Id'
26094
26095 : Finish up by extracting the .SH files
26096 case "$alldone" in
26097 exit)
26098 echo "Stopping at your request, leaving temporary files around."
26099 exit 0
26100 ;;
26101 cont)
26102 ;;
26103 '')
26104 dflt=''
26105 nostick=true
26106 $cat <<EOM
26107
26108 If you'd like to make any changes to the config.sh file before I begin
26109 to configure things, do it as a shell escape now (e.g. !vi config.sh).
26110
26111 EOM
26112 rp="Press return or use a shell escape to edit config.sh:"
26113 . UU/myread
26114 nostick=''
26115 case "$ans" in
26116 '') ;;
26117 *) : in case they cannot read
26118 sh 1>&4 -c "$ans";;
26119 esac
26120 ;;
26121 esac
26122
26123 : if this fails, just run all the .SH files by hand
26124 . ./config.sh
26125
26126 echo " "
26127 exec 1>&4
26128 pwd=`pwd`
26129 . ./UU/extract
26130 cd "$pwd"
26131
26132 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
26133 dflt=y
26134 case "$silent" in
26135 true) ;;
26136 *)
26137 $cat <<EOM
26138
26139 Now you need to generate make dependencies by running "$make depend".
26140 You might prefer to run it in background: "$make depend > makedepend.out &"
26141 It can take a while, so you might not want to run it right now.
26142
26143 EOM
26144 ;;
26145 esac
26146 rp="Run $make depend now?"
26147 . UU/myread
26148 case "$ans" in
26149 y*)
26150 $make depend && echo "Now you must run '$make'."
26151 ;;
26152 *)
26153 echo "You must run '$make depend' then '$make'."
26154 ;;
26155 esac
26156 elif test -f [Mm]akefile; then
26157 echo " "
26158 echo "Now you must run a $make."
26159 else
26160 echo "Configure done."
26161 fi
26162
26163 if $test -f Policy.sh; then
26164 $cat <<EOM
26165
26166 If you compile $package on a different machine or from a different object
26167 directory, copy the Policy.sh file from this object directory to the
26168 new one before you run Configure -- this will help you with most of
26169 the policy defaults.
26170
26171 EOM
26172 fi
26173 if $test -f UU/config.msg; then
26174 echo "Hmm. I also noted the following information while running:"
26175 echo " "
26176 $cat UU/config.msg >&4
26177 fi
26178 $rm -f kit*isdone ark*isdone
26179 $rm -rf UU
26180
26181 : End of Configure
26182