This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
DynaLoader.doc was deleted 20 years ago in 3b35bae3
[perl5.git] / Configure
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 may wish to get metaconfig. Perl uses a modified version of this
17 # tool, available in the "dist" folder in the checkout of the git repo
18 #    $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
19 # The original dist package (including metaconfig) is available via SVN:
20 #    $ svn co https://svn.code.sf.net/p/dist/code/trunk/dist
21 #
22 # Though this script was generated by metaconfig from metaunits, it is
23 # OK to send patches against Configure itself. It's up to the Configure
24 # pumpkin to backport the patch to the metaunits if it is accepted.
25 # For more information on patching Configure, see pod/perlhack.pod
26 #
27 # The metaunits are also available from the public git repository:
28 #     http://perl5.git.perl.org/metaconfig.git/ or
29 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
30 #
31 # See Porting/pumpkin.pod for more information on metaconfig.
32
33 # Generated using [metaconfig 3.5 PL0]
34 # (with additional metaconfig patches by perlbug@perl.org)
35
36 cat >c1$$ <<EOF
37 ARGGGHHHH!!!!!
38
39 SCO csh still thinks true is false.  Write to SCO today and tell them that next
40 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
41
42 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
43 we'd have to do is go in and swap the && and || tokens, wherever they are.)
44
45 [End of diatribe. We now return you to your regularly scheduled programming...]
46 EOF
47 cat >c2$$ <<EOF
48
49 OOPS!  You naughty creature!  You didn't run Configure with sh!
50 I will attempt to remedy the situation by running sh for you...
51 EOF
52
53 true || cat c1$$ c2$$
54 true || exec sh $0 $argv:q
55
56 (exit $?0) || cat c2$$
57 (exit $?0) || exec sh $0 $argv:q
58 rm -f c1$$ c2$$
59
60 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
61         cat <<EOF
62 ***
63 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
64 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
65 *** Please read the README.plan9 for further instructions.
66 *** Cannot continue, aborting.
67 ***
68 EOF
69         exit 1
70 fi
71
72 if test -f /sys/utilities/MultiView ; then
73         # AmigaOS, test -c for /dev/null is not useful
74         :
75 elif test ! -c /dev/null ; then
76         cat <<EOF
77 ***
78 *** I'm sorry, but /dev/null appears to be a file rather than a device.
79 *** Please consult your operating sytem's notes for making a device
80 *** in /dev.
81 *** Cannot continue, aborting.
82 ***
83 EOF
84         exit 1
85 fi
86
87 : compute my invocation name
88 me=$0
89 case "$0" in
90 */*)
91         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
92         test "$me" || me=$0
93         ;;
94 esac
95
96 : Proper separator for the PATH environment variable
97 p_=:
98 : On OS/2 this directory should exist if this is not floppy only system ":-]"
99 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
100         if test -n "$OS2_SHELL"; then
101                 p_=\;
102                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
103                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
104                 is_os2=yes
105         elif test -n "$DJGPP"; then
106                 case "X${MACHTYPE:-nonesuchmach}" in
107                 *cygwin|*msys) ;;
108                 *) p_=\; ;;
109                 esac
110         fi
111 fi
112
113 : Proper PATH setting
114 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
115 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
116 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
117 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
118 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
119 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
120 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
121 paths="$paths /sbin /usr/sbin /usr/libexec"
122 paths="$paths /system/gnu_library/bin"
123
124 for p in $paths
125 do
126         case "$p_$PATH$p_" in
127         *$p_$p$p_*) ;;
128         *) test -d $p && PATH=$PATH$p_$p ;;
129         esac
130 done
131
132 PATH=.$p_$PATH
133 export PATH
134
135 : shall we be using ksh?
136 inksh=''
137 needksh=''
138 avoidksh=''
139 newsh=/bin/ksh
140 changesh=''
141 if (PATH=.; alias -x) >/dev/null 2>&1; then
142                 inksh=true
143 fi
144 if test -f /hp-ux -a -f /bin/ksh; then
145         needksh='to avoid sh bug in "here document" expansion'
146 fi
147 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
148         if test X`/usr/bin/uname -v` = X4; then
149                 avoidksh="to avoid AIX 4's /bin/sh"
150                 newsh=/usr/bin/bsh
151         fi
152 fi
153 if test -f /osf_boot -a -f /usr/sbin/setld; then
154         if test X`/usr/bin/uname -s` = XOSF1; then
155                 avoidksh="to avoid Digital UNIX' ksh"
156                 newsh=/bin/sh
157                 unset BIN_SH
158         fi
159 fi
160 case "$inksh/$needksh" in
161 /[a-z]*)
162                 ENV=''
163                 changesh=true
164                 reason="$needksh"
165         ;;
166 esac
167 case "$inksh/$avoidksh" in
168 true/[a-z]*)
169         changesh=true
170         reason="$avoidksh"
171         ;;
172 esac
173 case "$inksh/$needksh-$avoidksh-" in
174 true/--)
175                 cat <<EOM
176 (I see you are using the Korn shell.  Some ksh's blow up on $me,
177 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
178 EOM
179         ;;
180 esac
181 case "$changesh" in
182 true)
183         export newsh
184         echo "(Feeding myself to $newsh $reason.)"
185         case "$0" in
186         Configure|*/Configure) exec $newsh $0 "$@";;
187         *) exec $newsh Configure "$@";;
188         esac
189         ;;
190 esac
191 test -x "${newsh}" || unset newsh
192
193 : if needed, set CDPATH to a harmless value that is not chatty
194 : avoid bash 2.02 problems with empty CDPATH.
195 case "$CDPATH" in
196 '')     ;;
197 *)      case "$SHELL" in
198         *bash*) CDPATH='.' ;;
199         *) CDPATH='' ;;
200         esac
201         ;;
202 esac
203
204 : Configure runs within the UU subdirectory
205 test -d UU || mkdir UU
206 cd UU && rm -f ./*
207
208 ccname=''
209 ccversion=''
210 ccsymbols=''
211 cppccsymbols=''
212 cppsymbols=''
213 from=''
214 hostgenerate=''
215 hostosname=''
216 hostperl=''
217 run=''
218 targetarch=''
219 targetdir=''
220 targetenv=''
221 targethost=''
222 targetmkdir=''
223 targetport=''
224 to=''
225 usecrosscompile=''
226 extern_C=''
227 mistrustnm=''
228 usedevel=''
229 perllibs=''
230 dynamic_ext=''
231 extensions=''
232 known_extensions=''
233 nonxs_ext=''
234 static_ext=''
235 useopcode=''
236 useposix=''
237 extras=''
238 d_bsd=''
239 d_eunice=''
240 d_xenix=''
241 eunicefix=''
242 ar=''
243 awk=''
244 bash=''
245 bison=''
246 byacc=''
247 cat=''
248 chgrp=''
249 chmod=''
250 chown=''
251 comm=''
252 compress=''
253 cp=''
254 cpio=''
255 cpp=''
256 csh=''
257 date=''
258 echo=''
259 egrep=''
260 emacs=''
261 expr=''
262 find=''
263 flex=''
264 gmake=''
265 grep=''
266 gzip=''
267 inews=''
268 ksh=''
269 less=''
270 line=''
271 lint=''
272 ln=''
273 lp=''
274 lpr=''
275 ls=''
276 mail=''
277 mailx=''
278 make=''
279 mkdir=''
280 more=''
281 mv=''
282 nm=''
283 nroff=''
284 perl=''
285 pg=''
286 pmake=''
287 pr=''
288 rm=''
289 rmail=''
290 sed=''
291 sendmail=''
292 shar=''
293 sleep=''
294 smail=''
295 sort=''
296 submit=''
297 tail=''
298 tar=''
299 tbl=''
300 tee=''
301 test=''
302 touch=''
303 tr=''
304 troff=''
305 uname=''
306 uniq=''
307 uuname=''
308 vi=''
309 zcat=''
310 zip=''
311 full_ar=''
312 full_sed=''
313 libswanted=''
314 hint=''
315 myuname=''
316 osname=''
317 osvers=''
318 Author=''
319 Date=''
320 Header=''
321 Id=''
322 Locker=''
323 Log=''
324 RCSfile=''
325 Revision=''
326 Source=''
327 State=''
328 sysroot=''
329 _a=''
330 _exe=''
331 _o=''
332 archobjs=''
333 exe_ext=''
334 firstmakefile=''
335 lib_ext=''
336 obj_ext=''
337 path_sep=''
338 rm_try=''
339 afs=''
340 afsroot=''
341 alignbytes=''
342 ansi2knr=''
343 archlib=''
344 archlibexp=''
345 d_archlib=''
346 installarchlib=''
347 archname=''
348 myarchname=''
349 useversionedarchname=''
350 d_atolf=''
351 d_atoll=''
352 baserev=''
353 bin=''
354 binexp=''
355 initialinstalllocation=''
356 installbin=''
357 userelocatableinc=''
358 byteorder=''
359 cc=''
360 ccflags=''
361 cppflags=''
362 ldflags=''
363 lkflags=''
364 locincpth=''
365 optimize=''
366 cf_email=''
367 cf_by=''
368 cf_time=''
369 charbits=''
370 charsize=''
371 contains=''
372 cpp_stuff=''
373 cpplast=''
374 cppminus=''
375 cpprun=''
376 cppstdin=''
377 d__fwalk=''
378 d_access=''
379 d_accessx=''
380 d_acosh=''
381 d_aintl=''
382 d_alarm=''
383 asctime_r_proto=''
384 d_asctime_r=''
385 d_asinh=''
386 d_atanh=''
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_warn_unused_result=''
395 d_printf_format_null=''
396 d_backtrace=''
397 d_bcmp=''
398 d_bcopy=''
399 d_builtin_choose_expr=''
400 d_builtin_expect=''
401 d_bzero=''
402 d_c99_variadic_macros=''
403 d_casti32=''
404 castflags=''
405 d_castneg=''
406 d_cbrt=''
407 d_chown=''
408 d_chroot=''
409 d_chsize=''
410 d_class=''
411 d_clearenv=''
412 d_closedir=''
413 d_void_closedir=''
414 d_cmsghdr_s=''
415 d_const=''
416 d_copysign=''
417 d_copysignl=''
418 d_cplusplus=''
419 cryptlib=''
420 d_crypt=''
421 crypt_r_proto=''
422 d_crypt_r=''
423 d_csh=''
424 full_csh=''
425 d_ctermid=''
426 ctermid_r_proto=''
427 d_ctermid_r=''
428 ctime_r_proto=''
429 d_ctime_r=''
430 d_cuserid=''
431 d_dbl_dig=''
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_eaccess=''
447 d_endgrent=''
448 d_endgrent_r=''
449 endgrent_r_proto=''
450 d_endhent=''
451 d_endhostent_r=''
452 endhostent_r_proto=''
453 d_endnent=''
454 d_endnetent_r=''
455 endnetent_r_proto=''
456 d_endpent=''
457 d_endprotoent_r=''
458 endprotoent_r_proto=''
459 d_endpwent=''
460 d_endpwent_r=''
461 endpwent_r_proto=''
462 d_endsent=''
463 d_endservent_r=''
464 endservent_r_proto=''
465 d_erf=''
466 d_erfc=''
467 d_exp2=''
468 d_expm1=''
469 d_faststdio=''
470 d_fchdir=''
471 d_fchmod=''
472 d_fchown=''
473 d_fcntl=''
474 d_fcntl_can_lock=''
475 d_fd_macros=''
476 d_fd_set=''
477 d_fds_bits=''
478 d_fdim=''
479 d_fegetround=''
480 d_fgetpos=''
481 d_finite=''
482 d_finitel=''
483 d_flexfnam=''
484 d_flock=''
485 d_flockproto=''
486 d_fma=''
487 d_fmax=''
488 d_fmin=''
489 d_fork=''
490 d_fp_class=''
491 d_fp_classl=''
492 d_fpclass=''
493 d_fp_classify=''
494 d_fpclassify=''
495 d_fpclassl=''
496 d_fpgetround=''
497 d_fpos64_t=''
498 d_frexpl=''
499 d_fseeko=''
500 d_fsetpos=''
501 d_fsync=''
502 d_ftello=''
503 d_ftime=''
504 d_gettimeod=''
505 d_futimes=''
506 d_Gconvert=''
507 d_getaddrinfo=''
508 d_getcwd=''
509 d_getespwnam=''
510 d_getgrent=''
511 d_getgrent_r=''
512 getgrent_r_proto=''
513 d_getgrgid_r=''
514 getgrgid_r_proto=''
515 d_getgrnam_r=''
516 getgrnam_r_proto=''
517 d_getgrps=''
518 d_gethbyaddr=''
519 d_gethbyname=''
520 d_gethent=''
521 aphostname=''
522 d_gethname=''
523 d_phostname=''
524 d_uname=''
525 d_gethostbyaddr_r=''
526 gethostbyaddr_r_proto=''
527 d_gethostbyname_r=''
528 gethostbyname_r_proto=''
529 d_gethostent_r=''
530 gethostent_r_proto=''
531 d_gethostprotos=''
532 d_getitimer=''
533 d_getlogin=''
534 d_getlogin_r=''
535 getlogin_r_proto=''
536 d_getnameinfo=''
537 d_getnbyaddr=''
538 d_getnbyname=''
539 d_getnent=''
540 d_getnetbyaddr_r=''
541 getnetbyaddr_r_proto=''
542 d_getnetbyname_r=''
543 getnetbyname_r_proto=''
544 d_getnetent_r=''
545 getnetent_r_proto=''
546 d_getnetprotos=''
547 d_getpagsz=''
548 d_getpent=''
549 d_getpgid=''
550 d_getpgrp2=''
551 d_bsdgetpgrp=''
552 d_getpgrp=''
553 d_getppid=''
554 d_getprior=''
555 d_getpbyname=''
556 d_getpbynumber=''
557 d_getprotobyname_r=''
558 getprotobyname_r_proto=''
559 d_getprotobynumber_r=''
560 getprotobynumber_r_proto=''
561 d_getprotoent_r=''
562 getprotoent_r_proto=''
563 d_getprotoprotos=''
564 d_getprpwnam=''
565 d_getpwent=''
566 d_getpwent_r=''
567 getpwent_r_proto=''
568 d_getpwnam_r=''
569 getpwnam_r_proto=''
570 d_getpwuid_r=''
571 getpwuid_r_proto=''
572 d_getsent=''
573 d_getservbyname_r=''
574 getservbyname_r_proto=''
575 d_getservbyport_r=''
576 getservbyport_r_proto=''
577 d_getservent_r=''
578 getservent_r_proto=''
579 d_getservprotos=''
580 d_getspnam=''
581 d_getspnam_r=''
582 getspnam_r_proto=''
583 d_getsbyname=''
584 d_getsbyport=''
585 d_gmtime_r=''
586 gmtime_r_proto=''
587 d_gnulibc=''
588 gnulibc_version=''
589 d_htonl=''
590 d_hypot=''
591 d_ilogb=''
592 d_ilogbl=''
593 d_inetaton=''
594 d_inetntop=''
595 d_inetpton=''
596 d_int64_t=''
597 d_isascii=''
598 d_isblank=''
599 d_isfinite=''
600 d_isfinitel=''
601 d_isinf=''
602 d_isinfl=''
603 d_isless=''
604 d_isnan=''
605 d_isnanl=''
606 d_isnormal=''
607 d_j0=''
608 d_j0l=''
609 d_killpg=''
610 d_lc_monetary_2008=''
611 d_lchown=''
612 d_ldbl_dig=''
613 d_lgamma=''
614 d_lgamma_r=''
615 d_libm_lib_version=''
616 d_link=''
617 d_llrint=''
618 d_llrintl=''
619 d_llround=''
620 d_llroundl=''
621 d_localtime_r=''
622 d_localtime_r_needs_tzset=''
623 localtime_r_proto=''
624 d_locconv=''
625 d_lockf=''
626 d_log1p=''
627 d_log2=''
628 d_logb=''
629 d_ldexpl=''
630 d_longdbl=''
631 longdblkind=''
632 longdblsize=''
633 d_longlong=''
634 longlongsize=''
635 d_lrint=''
636 d_lrintl=''
637 d_lround=''
638 d_lroundl=''
639 d_lseekproto=''
640 d_lstat=''
641 d_madvise=''
642 d_malloc_good_size=''
643 d_malloc_size=''
644 d_mblen=''
645 d_mbstowcs=''
646 d_mbtowc=''
647 d_memchr=''
648 d_memcmp=''
649 d_memcpy=''
650 d_memmove=''
651 d_memset=''
652 d_mkdir=''
653 d_mkdtemp=''
654 d_mkfifo=''
655 d_mkstemp=''
656 d_mkstemps=''
657 d_mktime=''
658 d_mmap=''
659 mmaptype=''
660 d_modfl=''
661 d_modfl_pow32_bug=''
662 d_modflproto=''
663 d_mprotect=''
664 d_msg=''
665 d_msgctl=''
666 d_msgget=''
667 d_msghdr_s=''
668 d_msgrcv=''
669 d_msgsnd=''
670 d_msync=''
671 d_munmap=''
672 d_nan=''
673 d_nearbyint=''
674 d_nextafter=''
675 d_nexttoward=''
676 d_nice=''
677 d_nl_langinfo=''
678 d_off64_t=''
679 d_open3=''
680 d_fpathconf=''
681 d_pathconf=''
682 d_pause=''
683 d_pipe=''
684 d_poll=''
685 d_portable=''
686 d_prctl=''
687 d_prctl_set_name=''
688 d_procselfexe=''
689 procselfexe=''
690 d_old_pthread_create_joinable=''
691 old_pthread_create_joinable=''
692 d_pthread_atfork=''
693 d_pthread_attr_setscope=''
694 d_pthread_yield=''
695 d_sched_yield=''
696 sched_yield=''
697 d_ptrdiff_t=''
698 d_qgcvt=''
699 d_random_r=''
700 random_r_proto=''
701 d_readdir64_r=''
702 readdir64_r_proto=''
703 d_readdir=''
704 d_rewinddir=''
705 d_seekdir=''
706 d_telldir=''
707 d_readdir_r=''
708 readdir_r_proto=''
709 d_readlink=''
710 d_readv=''
711 d_recvmsg=''
712 d_re_comp=''
713 d_regcmp=''
714 d_regcomp=''
715 d_remainder=''
716 d_remquo=''
717 d_rename=''
718 d_rint=''
719 d_rmdir=''
720 d_round=''
721 d_safebcpy=''
722 d_safemcpy=''
723 d_sanemcmp=''
724 d_sbrkproto=''
725 d_scalbn=''
726 d_scalbnl=''
727 d_select=''
728 d_sem=''
729 d_semctl=''
730 d_semget=''
731 d_semop=''
732 d_sendmsg=''
733 d_setegid=''
734 d_seteuid=''
735 d_setgrent=''
736 d_setgrent_r=''
737 setgrent_r_proto=''
738 d_setgrps=''
739 d_sethent=''
740 d_sethostent_r=''
741 sethostent_r_proto=''
742 d_setitimer=''
743 d_setlinebuf=''
744 d_setlocale=''
745 d_setlocale_r=''
746 setlocale_r_proto=''
747 d_setnent=''
748 d_setnetent_r=''
749 setnetent_r_proto=''
750 d_setpent=''
751 d_setpgid=''
752 d_setpgrp2=''
753 d_bsdsetpgrp=''
754 d_setpgrp=''
755 d_setprior=''
756 d_setproctitle=''
757 d_setprotoent_r=''
758 setprotoent_r_proto=''
759 d_setpwent=''
760 d_setpwent_r=''
761 setpwent_r_proto=''
762 d_setregid=''
763 d_setresgid=''
764 d_setresuid=''
765 d_setreuid=''
766 d_setrgid=''
767 d_setruid=''
768 d_setsent=''
769 d_setservent_r=''
770 setservent_r_proto=''
771 d_setsid=''
772 d_setvbuf=''
773 d_shm=''
774 d_shmat=''
775 d_shmatprototype=''
776 shmattype=''
777 d_shmctl=''
778 d_shmdt=''
779 d_shmget=''
780 d_sigaction=''
781 d_signbit=''
782 d_sigprocmask=''
783 d_sigsetjmp=''
784 usesitecustomize=''
785 d_snprintf=''
786 d_vsnprintf=''
787 d_sockatmark=''
788 d_sockatmarkproto=''
789 d_ip_mreq=''
790 d_ip_mreq_source=''
791 d_ipv6_mreq=''
792 d_ipv6_mreq_source=''
793 d_msg_ctrunc=''
794 d_msg_dontroute=''
795 d_msg_oob=''
796 d_msg_peek=''
797 d_msg_proxy=''
798 d_oldsock=''
799 d_scm_rights=''
800 d_sin6_scope_id=''
801 d_sockaddr_in6=''
802 d_sockaddr_sa_len=''
803 d_socket=''
804 d_sockpair=''
805 sockethdr=''
806 socketlib=''
807 d_socklen_t=''
808 d_socks5_init=''
809 d_sprintf_returns_strlen=''
810 d_sqrtl=''
811 d_srand48_r=''
812 srand48_r_proto=''
813 d_srandom_r=''
814 srandom_r_proto=''
815 d_sresgproto=''
816 d_sresuproto=''
817 d_stat=''
818 d_statblks=''
819 d_static_inline=''
820 perl_static_inline=''
821 d_stdio_cnt_lval=''
822 d_stdio_ptr_lval=''
823 d_stdio_ptr_lval_nochange_cnt=''
824 d_stdio_ptr_lval_sets_cnt=''
825 d_stdiobase=''
826 d_stdstdio=''
827 stdio_base=''
828 stdio_bufsiz=''
829 stdio_cnt=''
830 stdio_filbuf=''
831 stdio_ptr=''
832 d_index=''
833 d_strchr=''
834 d_strcoll=''
835 d_strctcpy=''
836 d_strerrm=''
837 d_strerror=''
838 d_sysernlst=''
839 d_syserrlst=''
840 d_strerror_r=''
841 strerror_r_proto=''
842 d_strftime=''
843 d_strlcat=''
844 d_strlcpy=''
845 d_strtod=''
846 d_strtol=''
847 d_strtold=''
848 d_strtoll=''
849 d_strtoq=''
850 d_strtoul=''
851 d_strtoull=''
852 d_strtouq=''
853 d_strxfrm=''
854 d_symlink=''
855 d_syscall=''
856 d_syscallproto=''
857 d_sysconf=''
858 d_system=''
859 d_tcgetpgrp=''
860 d_tcsetpgrp=''
861 d_telldirproto=''
862 d_tgamma=''
863 d_time=''
864 timetype=''
865 d_asctime64=''
866 d_ctime64=''
867 d_difftime64=''
868 d_gmtime64=''
869 d_localtime64=''
870 d_mktime64=''
871 d_timegm=''
872 clocktype=''
873 d_times=''
874 d_tmpnam_r=''
875 tmpnam_r_proto=''
876 d_trunc=''
877 d_truncate=''
878 d_truncl=''
879 d_ttyname_r=''
880 ttyname_r_proto=''
881 d_tzname=''
882 d_u32align=''
883 d_ualarm=''
884 d_umask=''
885 d_semctl_semid_ds=''
886 d_semctl_semun=''
887 d_union_semun=''
888 d_unordered=''
889 d_unsetenv=''
890 d_usleep=''
891 d_usleepproto=''
892 d_pseudofork=''
893 d_vfork=''
894 usevfork=''
895 d_voidsig=''
896 signal_t=''
897 d_volatile=''
898 d_charvspr=''
899 d_vprintf=''
900 d_wait4=''
901 d_waitpid=''
902 d_wcscmp=''
903 d_wcstombs=''
904 d_wcsxfrm=''
905 d_wctomb=''
906 d_writev=''
907 dlext=''
908 bin_ELF=''
909 cccdlflags=''
910 ccdlflags=''
911 dlsrc=''
912 ld=''
913 ld_can_script=''
914 lddlflags=''
915 usedl=''
916 doublesize=''
917 ebcdic=''
918 fflushNULL=''
919 fflushall=''
920 fpossize=''
921 fpostype=''
922 gccansipedantic=''
923 gccosandvers=''
924 gccversion=''
925 gidformat=''
926 gidsign=''
927 gidsize=''
928 gidtype=''
929 groupstype=''
930 h_fcntl=''
931 h_sysfile=''
932 html1dir=''
933 html1direxp=''
934 installhtml1dir=''
935 html3dir=''
936 html3direxp=''
937 installhtml3dir=''
938 i_arpainet=''
939 i_assert=''
940 i_bfd=''
941 i_crypt=''
942 db_hashtype=''
943 db_prefixtype=''
944 db_version_major=''
945 db_version_minor=''
946 db_version_patch=''
947 i_db=''
948 i_dbm=''
949 i_rpcsvcdbm=''
950 d_dirnamlen=''
951 direntrytype=''
952 i_dirent=''
953 i_dlfcn=''
954 i_execinfo=''
955 i_fcntl=''
956 i_fenv=''
957 i_float=''
958 i_fp=''
959 i_fp_class=''
960 i_gdbm=''
961 d_grpasswd=''
962 i_grp=''
963 i_ieeefp=''
964 i_inttypes=''
965 i_langinfo=''
966 i_libutil=''
967 i_limits=''
968 i_locale=''
969 i_machcthr=''
970 i_malloc=''
971 i_mallocmalloc=''
972 i_math=''
973 i_memory=''
974 d_gdbm_ndbm_h_uses_prototypes=''
975 d_gdbmndbm_h_uses_prototypes=''
976 d_ndbm=''
977 d_ndbm_h_uses_prototypes=''
978 i_gdbm_ndbm=''
979 i_gdbmndbm=''
980 i_ndbm=''
981 i_netdb=''
982 i_neterrno=''
983 i_netinettcp=''
984 i_niin=''
985 i_sysin=''
986 i_poll=''
987 i_prot=''
988 i_pthread=''
989 d_pwage=''
990 d_pwchange=''
991 d_pwclass=''
992 d_pwcomment=''
993 d_pwexpire=''
994 d_pwgecos=''
995 d_pwpasswd=''
996 d_pwquota=''
997 i_pwd=''
998 i_quadmath=''
999 i_shadow=''
1000 i_socks=''
1001 i_stdbool=''
1002 i_stddef=''
1003 i_stdint=''
1004 i_stdlib=''
1005 i_string=''
1006 strings=''
1007 i_sunmath=''
1008 i_sysaccess=''
1009 i_sysdir=''
1010 i_sysfile=''
1011 d_voidtty=''
1012 i_bsdioctl=''
1013 i_sysfilio=''
1014 i_sysioctl=''
1015 i_syssockio=''
1016 i_syslog=''
1017 i_sysmman=''
1018 i_sysmode=''
1019 i_sysndir=''
1020 i_sysparam=''
1021 i_syspoll=''
1022 i_sysresrc=''
1023 i_syssecrt=''
1024 i_sysselct=''
1025 i_sysstat=''
1026 i_systimes=''
1027 i_systypes=''
1028 i_sysuio=''
1029 i_sysun=''
1030 i_sysutsname=''
1031 i_syswait=''
1032 i_sgtty=''
1033 i_termio=''
1034 i_termios=''
1035 d_tm_tm_gmtoff=''
1036 d_tm_tm_zone=''
1037 i_systime=''
1038 i_systimek=''
1039 i_time=''
1040 timeincl=''
1041 i_unistd=''
1042 i_utime=''
1043 i_values=''
1044 i_stdarg=''
1045 i_varargs=''
1046 i_varhdr=''
1047 i_vfork=''
1048 d_inc_version_list=''
1049 inc_version_list=''
1050 inc_version_list_init=''
1051 doubleinfbytes=''
1052 doublenanbytes=''
1053 longdblinfbytes=''
1054 longdblnanbytes=''
1055 installprefix=''
1056 installprefixexp=''
1057 installstyle=''
1058 installusrbinperl=''
1059 intsize=''
1060 longsize=''
1061 shortsize=''
1062 issymlink=''
1063 libc=''
1064 ldlibpthname=''
1065 libperl=''
1066 shrpenv=''
1067 useshrplib=''
1068 glibpth=''
1069 incpth=''
1070 libpth=''
1071 loclibpth=''
1072 plibpth=''
1073 xlibpth=''
1074 ignore_versioned_solibs=''
1075 libs=''
1076 libsdirs=''
1077 libsfiles=''
1078 libsfound=''
1079 libspath=''
1080 lns=''
1081 d_PRIEUldbl=''
1082 d_PRIFUldbl=''
1083 d_PRIGUldbl=''
1084 d_PRIeldbl=''
1085 d_PRIfldbl=''
1086 d_PRIgldbl=''
1087 d_SCNfldbl=''
1088 doublekind=''
1089 sPRIEUldbl=''
1090 sPRIFUldbl=''
1091 sPRIGUldbl=''
1092 sPRIeldbl=''
1093 sPRIfldbl=''
1094 sPRIgldbl=''
1095 sSCNfldbl=''
1096 lseeksize=''
1097 lseektype=''
1098 make_set_make=''
1099 d_mymalloc=''
1100 freetype=''
1101 mallocobj=''
1102 mallocsrc=''
1103 malloctype=''
1104 usemallocwrap=''
1105 usemymalloc=''
1106 installman1dir=''
1107 man1dir=''
1108 man1direxp=''
1109 man1ext=''
1110 installman3dir=''
1111 man3dir=''
1112 man3direxp=''
1113 man3ext=''
1114 doublemantbits=''
1115 longdblmantbits=''
1116 nvmantbits=''
1117 modetype=''
1118 multiarch=''
1119 mydomain=''
1120 myhostname=''
1121 phostname=''
1122 c=''
1123 n=''
1124 d_eofnblk=''
1125 eagain=''
1126 o_nonblock=''
1127 rd_nodata=''
1128 need_va_copy=''
1129 netdb_hlen_type=''
1130 netdb_host_type=''
1131 netdb_name_type=''
1132 netdb_net_type=''
1133 groupcat=''
1134 hostcat=''
1135 passcat=''
1136 orderlib=''
1137 ranlib=''
1138 d_perl_otherlibdirs=''
1139 otherlibdirs=''
1140 package=''
1141 spackage=''
1142 pager=''
1143 api_revision=''
1144 api_subversion=''
1145 api_version=''
1146 api_versionstring=''
1147 patchlevel=''
1148 perl_patchlevel=''
1149 revision=''
1150 subversion=''
1151 version=''
1152 version_patchlevel_string=''
1153 perl5=''
1154 perladmin=''
1155 perlpath=''
1156 d_nv_preserves_uv=''
1157 d_nv_zero_is_allbits_zero=''
1158 i16size=''
1159 i16type=''
1160 i32size=''
1161 i32type=''
1162 i64size=''
1163 i64type=''
1164 i8size=''
1165 i8type=''
1166 ivsize=''
1167 ivtype=''
1168 nv_overflows_integers_at=''
1169 nv_preserves_uv_bits=''
1170 nvsize=''
1171 nvtype=''
1172 u16size=''
1173 u16type=''
1174 u32size=''
1175 u32type=''
1176 u64size=''
1177 u64type=''
1178 u8size=''
1179 u8type=''
1180 uvsize=''
1181 uvtype=''
1182 ivdformat=''
1183 nvEUformat=''
1184 nvFUformat=''
1185 nvGUformat=''
1186 nveformat=''
1187 nvfformat=''
1188 nvgformat=''
1189 uvXUformat=''
1190 uvoformat=''
1191 uvuformat=''
1192 uvxformat=''
1193 pidtype=''
1194 prefix=''
1195 prefixexp=''
1196 installprivlib=''
1197 privlib=''
1198 privlibexp=''
1199 prototype=''
1200 ptrsize=''
1201 d_PRIXU64=''
1202 d_PRId64=''
1203 d_PRIi64=''
1204 d_PRIo64=''
1205 d_PRIu64=''
1206 d_PRIx64=''
1207 sPRIXU64=''
1208 sPRId64=''
1209 sPRIi64=''
1210 sPRIo64=''
1211 sPRIu64=''
1212 sPRIx64=''
1213 d_quad=''
1214 quadkind=''
1215 quadtype=''
1216 uquadtype=''
1217 drand01=''
1218 randbits=''
1219 randfunc=''
1220 randseedtype=''
1221 seedfunc=''
1222 installscript=''
1223 scriptdir=''
1224 scriptdirexp=''
1225 selectminbits=''
1226 selecttype=''
1227 sh=''
1228 targetsh=''
1229 sig_count=''
1230 sig_name=''
1231 sig_name_init=''
1232 sig_num=''
1233 sig_num_init=''
1234 sig_size=''
1235 d_sitearch=''
1236 installsitearch=''
1237 sitearch=''
1238 sitearchexp=''
1239 installsitebin=''
1240 sitebin=''
1241 sitebinexp=''
1242 installsitehtml1dir=''
1243 sitehtml1dir=''
1244 sitehtml1direxp=''
1245 installsitehtml3dir=''
1246 sitehtml3dir=''
1247 sitehtml3direxp=''
1248 installsitelib=''
1249 sitelib=''
1250 sitelib_stem=''
1251 sitelibexp=''
1252 installsiteman1dir=''
1253 siteman1dir=''
1254 siteman1direxp=''
1255 installsiteman3dir=''
1256 siteman3dir=''
1257 siteman3direxp=''
1258 siteprefix=''
1259 siteprefixexp=''
1260 installsitescript=''
1261 sitescript=''
1262 sitescriptexp=''
1263 sizesize=''
1264 sizetype=''
1265 d_libname_unique=''
1266 so=''
1267 socksizetype=''
1268 sharpbang=''
1269 shsharp=''
1270 spitshell=''
1271 src=''
1272 ssizetype=''
1273 st_ino_sign=''
1274 st_ino_size=''
1275 startperl=''
1276 startsh=''
1277 stdchar=''
1278 d_stdio_stream_array=''
1279 stdio_stream_array=''
1280 sysman=''
1281 sGMTIME_max=''
1282 sGMTIME_min=''
1283 sLOCALTIME_max=''
1284 sLOCALTIME_min=''
1285 trnl=''
1286 uidformat=''
1287 uidsign=''
1288 uidsize=''
1289 uidtype=''
1290 archname64=''
1291 use64bitall=''
1292 use64bitint=''
1293 usecbacktrace=''
1294 dtrace=''
1295 usedtrace=''
1296 usefaststdio=''
1297 usekernprocpathname=''
1298 ccflags_uselargefiles=''
1299 ldflags_uselargefiles=''
1300 libswanted_uselargefiles=''
1301 uselargefiles=''
1302 uselongdouble=''
1303 usemorebits=''
1304 usemultiplicity=''
1305 nm_opt=''
1306 nm_so_opt=''
1307 runnm=''
1308 usenm=''
1309 usensgetexecutablepath=''
1310 useperlio=''
1311 usequadmath=''
1312 usesocks=''
1313 d_oldpthreads=''
1314 use5005threads=''
1315 useithreads=''
1316 usereentrant=''
1317 usethreads=''
1318 incpath=''
1319 mips_type=''
1320 usrinc=''
1321 vaproto=''
1322 d_vendorarch=''
1323 installvendorarch=''
1324 vendorarch=''
1325 vendorarchexp=''
1326 d_vendorbin=''
1327 installvendorbin=''
1328 vendorbin=''
1329 vendorbinexp=''
1330 installvendorhtml1dir=''
1331 vendorhtml1dir=''
1332 vendorhtml1direxp=''
1333 installvendorhtml3dir=''
1334 vendorhtml3dir=''
1335 vendorhtml3direxp=''
1336 d_vendorlib=''
1337 installvendorlib=''
1338 vendorlib=''
1339 vendorlib_stem=''
1340 vendorlibexp=''
1341 installvendorman1dir=''
1342 vendorman1dir=''
1343 vendorman1direxp=''
1344 installvendorman3dir=''
1345 vendorman3dir=''
1346 vendorman3direxp=''
1347 usevendorprefix=''
1348 vendorprefix=''
1349 vendorprefixexp=''
1350 d_vendorscript=''
1351 installvendorscript=''
1352 vendorscript=''
1353 vendorscriptexp=''
1354 versiononly=''
1355 yacc=''
1356 yaccflags=''
1357 CONFIG=''
1358
1359 : Detect odd OSs
1360 define='define'
1361 undef='undef'
1362 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1363 rmlist=''
1364
1365 : We must find out about Eunice early
1366 eunicefix=':'
1367 if test -f /etc/unixtovms; then
1368         eunicefix=/etc/unixtovms
1369 fi
1370 if test -f /etc/unixtovms.exe; then
1371         eunicefix=/etc/unixtovms.exe
1372 fi
1373
1374 : Set executable suffix now -- needed before hints available
1375 if test -f "/libs/version.library"; then
1376 : Amiga OS
1377     _exe=""
1378 elif test -f "/system/gnu_library/bin/ar.pm"; then
1379 : Stratus VOS
1380     _exe=".pm"
1381 elif test -n "$DJGPP"; then
1382 : DOS DJGPP
1383     _exe=".exe"
1384 elif test -f /kern/cookiejar; then
1385 : MiNT
1386     _exe=""
1387 elif test -d c:/. -o -n "$is_os2" ; then
1388 : OS/2 or cygwin
1389     _exe=".exe"
1390 fi
1391
1392 groupstype=''
1393 i_whoami=''
1394 : Trailing extension.  Override this in a hint file, if needed.
1395 : Extra object files, if any, needed on this platform.
1396 archobjs=''
1397 archname=''
1398 : Possible local include directories to search.
1399 : Set locincpth to "" in a hint file to defeat local include searches.
1400 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1401 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1402 :
1403 : no include file wanted by default
1404 inclwanted=''
1405
1406 : Enable -DEBUGGING and -DDEBUGGING from the command line
1407 EBUGGING=''
1408 DEBUGGING=''
1409
1410 libnames=''
1411 : change the next line if compiling for Xenix/286 on Xenix/386
1412 xlibpth='/usr/lib/386 /lib/386'
1413 : Possible local library directories to search.
1414 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1415 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1416
1417 : general looking path for locating libraries
1418 glibpth="/lib /usr/lib $xlibpth"
1419 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1420 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1421 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1422 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1423
1424 : Private path used by Configure to find libraries.  Its value
1425 : is prepended to libpth. This variable takes care of special
1426 : machines, like the mips.  Usually, it should be empty.
1427 plibpth=''
1428
1429 : default library list
1430 libswanted=''
1431 : some systems want to use only the non-versioned libso:s
1432 ignore_versioned_solibs=''
1433 : set usethreads on the Configure command line to enable threads.
1434 usereentrant='undef'
1435 ccname=''
1436 ccversion=''
1437 perllibs=''
1438 : set useposix=false in your hint file to disable the POSIX extension.
1439 useposix=true
1440 : set useopcode=false in your hint file to disable the Opcode extension.
1441 useopcode=true
1442 archname64=''
1443 ccflags_uselargefiles=''
1444 ldflags_uselargefiles=''
1445 libswanted_uselargefiles=''
1446 : set usemultiplicity on the Configure command line to enable multiplicity.
1447 : set usesocks on the Configure command line to enable socks.
1448 : List of libraries we want.
1449 : If anyone needs extra -lxxx, put those in a hint file.
1450 libswanted="cl pthread socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld"
1451 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1452 : We probably want to search /usr/shlib before most other libraries.
1453 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1454 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1455 glibpth="/usr/shlib $glibpth"
1456 : Do not use vfork unless overridden by a hint file.
1457 usevfork=false
1458
1459 : Find the basic shell for Bourne shell scripts
1460 case "$sh" in
1461 '')
1462         case "$SYSTYPE" in
1463         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1464         *) xxx='/bin/sh';;
1465         esac
1466         if test -f "$xxx"; then
1467                 sh="$xxx"
1468         else
1469                 : Build up a list and do a single loop so we can 'break' out.
1470                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1471                 for xxx in sh bash ksh pdksh ash; do
1472                         for p in $pth; do
1473                                 try="$try ${p}/${xxx}"
1474                         done
1475                 done
1476                 for xxx in $try; do
1477                         if test -f "$xxx"; then
1478                                 sh="$xxx";
1479                                 break
1480                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1481                                 sh="$xxx";
1482                                 break
1483                         elif test -f "$xxx.exe"; then
1484                                 sh="$xxx";
1485                                 break
1486                         fi
1487                 done
1488         fi
1489         ;;
1490 esac
1491
1492 case "$sh" in
1493 '')     cat >&2 <<EOM
1494 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1495
1496 Usually it's in /bin/sh.  How did you even get this far?
1497 Please contact me (Perl Maintainers) at perlbug@perl.org and
1498 we'll try to straighten this all out.
1499 EOM
1500         exit 1
1501         ;;
1502 esac
1503
1504 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1505 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1506 targetsh=$sh
1507
1508 : see if sh knows # comments
1509 if `$sh -c '#' >/dev/null 2>&1`; then
1510         shsharp=true
1511         spitshell=cat
1512         xcat=/bin/cat
1513         test -f $xcat$_exe || xcat=/usr/bin/cat
1514         if test ! -f $xcat$_exe; then
1515                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1516                         if test -f $p/cat$_exe; then
1517                                 xcat=$p/cat
1518                                 break
1519                         fi
1520                 done
1521                 if test ! -f $xcat$_exe; then
1522                         echo "Can't find cat anywhere!"
1523                         exit 1
1524                 fi
1525         fi
1526         echo "#!$xcat" >sharp
1527         $eunicefix sharp
1528         chmod +x sharp
1529         ./sharp > today 2>/dev/null
1530         if test -s today; then
1531                 sharpbang='#!'
1532         else
1533                 echo "#! $xcat" > sharp
1534                 $eunicefix sharp
1535                 chmod +x sharp
1536                 ./sharp > today 2>/dev/null
1537                 if test -s today; then
1538                         sharpbang='#! '
1539                 else
1540                         sharpbang=': use '
1541                 fi
1542         fi
1543 else
1544         echo " "
1545         echo "Your $sh doesn't grok # comments--I will strip them later on."
1546         shsharp=false
1547         cd ..
1548         echo "exec grep -v '^[  ]*#'" >spitshell
1549         chmod +x spitshell
1550         $eunicefix spitshell
1551         spitshell=`pwd`/spitshell
1552         cd UU
1553         echo "I presume that if # doesn't work, #! won't work either!"
1554         sharpbang=': use '
1555 fi
1556 rm -f sharp today
1557
1558 : figure out how to guarantee sh startup
1559 case "$startsh" in
1560 '') startsh=${sharpbang}${sh} ;;
1561 *)
1562 esac
1563 cat >sharp <<EOSS
1564 $startsh
1565 set abc
1566 test "$?abc" != 1
1567 EOSS
1568
1569 chmod +x sharp
1570 $eunicefix sharp
1571 if ./sharp; then
1572         : echo "Yup, it does."
1573 else
1574         echo "Hmm... '$startsh' does not guarantee sh startup..."
1575         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1576 fi
1577 rm -f sharp
1578
1579 : Save command line options in file UU/cmdline.opt for later use in
1580 : generating config.sh.
1581 cat > cmdline.opt <<EOSH
1582 : Configure command line arguments.
1583 config_arg0='$0'
1584 config_args='$*'
1585 config_argc=$#
1586 EOSH
1587 argn=1
1588 args_exp=''
1589 args_sep=''
1590 for arg in "$@"; do
1591         cat >>cmdline.opt <<EOSH
1592 config_arg$argn='$arg'
1593 EOSH
1594         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1595 $arg
1596 EOC
1597         arg_exp=`cat cmdl.opt`
1598         args_exp="$args_exp$args_sep'$arg_exp'"
1599         argn=`expr $argn + 1`
1600         args_sep=' '
1601 done
1602 rm -f cmdl.opt
1603
1604 : produce awk script to parse command line options
1605 cat >options.awk <<'EOF'
1606 BEGIN {
1607         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1608
1609         len = length(optstr);
1610         for (i = 1; i <= len; i++) {
1611                 c = substr(optstr, i, 1);
1612                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1613                 if (a == ":") {
1614                         arg[c] = 1;
1615                         i++;
1616                 }
1617                 opt[c] = 1;
1618         }
1619 }
1620 {
1621         expect = 0;
1622         str = $0;
1623         if (substr(str, 1, 1) != "-") {
1624                 printf("'%s'\n", str);
1625                 next;
1626         }
1627         len = length($0);
1628         for (i = 2; i <= len; i++) {
1629                 c = substr(str, i, 1);
1630                 if (!opt[c]) {
1631                         printf("-%s\n", substr(str, i));
1632                         next;
1633                 }
1634                 printf("-%s\n", c);
1635                 if (arg[c]) {
1636                         if (i < len)
1637                                 printf("'%s'\n", substr(str, i + 1));
1638                         else
1639                                 expect = 1;
1640                         next;
1641                 }
1642         }
1643 }
1644 END {
1645         if (expect)
1646                 print "?";
1647 }
1648 EOF
1649
1650 : process the command line options
1651 set X `for arg in "$@"; do echo "X$arg"; done |
1652         sed -e s/X// | awk -f options.awk`
1653 eval "set $*"
1654 shift
1655 rm -f options.awk
1656
1657 : set up default values
1658 fastread=''
1659 reuseval=false
1660 config_sh=''
1661 alldone=''
1662 error=''
1663 silent=''
1664 extractsh=''
1665 override=''
1666 knowitall=''
1667 rm -f optdef.sh posthint.sh
1668 cat >optdef.sh <<EOS
1669 $startsh
1670 EOS
1671
1672
1673 : option parsing
1674 while test $# -gt 0; do
1675         case "$1" in
1676         -d) shift; fastread=yes;;
1677         -e) shift; alldone=cont;;
1678         -f)
1679                 shift
1680                 cd ..
1681                 if test -r "$1"; then
1682                         config_sh="$1"
1683                 else
1684                         echo "$me: cannot read config file $1." >&2
1685                         error=true
1686                 fi
1687                 cd UU
1688                 shift;;
1689         --help|\
1690         -h) shift; error=true;;
1691         -r) shift; reuseval=true;;
1692         -s) shift; silent=true; realsilent=true;;
1693         -E) shift; alldone=exit;;
1694         -K) shift; knowitall=true;;
1695         -O) shift; override=true;;
1696         -S) shift; silent=true; extractsh=true;;
1697         -D)
1698                 shift
1699                 case "$1" in
1700                 *=)
1701                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1702                         echo "$me: ignoring -D $1" >&2
1703                         ;;
1704                 *=*) echo "$1" | \
1705                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1706                 *) echo "$1='define'" >> optdef.sh;;
1707                 esac
1708                 shift
1709                 ;;
1710         -U)
1711                 shift
1712                 case "$1" in
1713                 *=) echo "$1" >> optdef.sh;;
1714                 *=*)
1715                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1716                         echo "$me: ignoring -U $1" >&2
1717                         ;;
1718                 *) echo "$1='undef'" >> optdef.sh;;
1719                 esac
1720                 shift
1721                 ;;
1722         -A)
1723             shift
1724             xxx=''
1725             yyy="$1"
1726             zzz=''
1727             uuu=undef
1728             case "$yyy" in
1729             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1730                  case "$zzz" in
1731                  *:*) zzz='' ;;
1732                  *)   xxx=append
1733                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1734                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1735                  esac
1736                  ;;
1737             esac
1738             case "$xxx" in
1739             '')  case "$yyy" in
1740                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1741                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1742                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1743                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1744                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1745                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1746                  esac
1747                  ;;
1748             esac
1749             case "$xxx" in
1750             append)
1751                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1752             clear)
1753                 echo "$yyy=''"                  >> posthint.sh ;;
1754             define)
1755                 case "$zzz" in
1756                 '') zzz=define ;;
1757                 esac
1758                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1759             eval)
1760                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1761             prepend)
1762                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1763             undef)
1764                 case "$zzz" in
1765                 '') zzz="$uuu" ;;
1766                 esac
1767                 echo "$yyy=$zzz"                >> posthint.sh ;;
1768             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1769             esac
1770             shift
1771             ;;
1772         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1773             exit 0;;
1774         --) break;;
1775         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1776         *) break;;
1777         esac
1778 done
1779
1780 case "$error" in
1781 true)
1782         cat >&2 <<EOM
1783 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1784                  [-U symbol] [-U symbol=] [-A command:symbol...]
1785   -d : use defaults for all answers.
1786   -e : go on without questioning past the production of config.sh.
1787   -f : specify an alternate default configuration file.
1788   -h : print this help message and exit (with an error status).
1789   -r : reuse C symbols value if possible (skips costly nm extraction).
1790   -s : silent mode, only echoes questions and essential information.
1791   -D : define symbol to have some value:
1792          -D symbol         symbol gets the value 'define'
1793          -D symbol=value   symbol gets the value 'value'
1794        common used examples (see INSTALL for more info):
1795          -Duse64bitint            use 64bit integers
1796          -Duse64bitall            use 64bit integers and pointers
1797          -Dusethreads             use thread support
1798          -Dinc_version_list=none  do not include older perl trees in @INC
1799          -DEBUGGING=none          DEBUGGING options
1800          -Dcc=gcc                 choose your compiler
1801          -Dprefix=/opt/perl5      choose your destination
1802   -E : stop at the end of questions, after having produced config.sh.
1803   -K : do not use unless you know what you are doing.
1804   -O : let -D and -U override definitions from loaded configuration file.
1805   -S : perform variable substitutions on all .SH files (can mix with -f)
1806   -U : undefine symbol:
1807          -U symbol    symbol gets the value 'undef'
1808          -U symbol=   symbol gets completely empty
1809        e.g.:  -Uversiononly
1810   -A : manipulate symbol after the platform specific hints have been applied:
1811          -A append:symbol=value   append value to symbol
1812          -A symbol=value          like append:, but with a separating space
1813          -A define:symbol=value   define symbol to have value
1814          -A clear:symbol          define symbol to be ''
1815          -A define:symbol         define symbol to be 'define'
1816          -A eval:symbol=value     define symbol to be eval of value
1817          -A prepend:symbol=value  prepend value to symbol
1818          -A undef:symbol          define symbol to be 'undef'
1819          -A undef:symbol=         define symbol to be ''
1820        e.g.:  -A prepend:libswanted='cl pthread '
1821               -A ccflags=-DSOME_MACRO
1822   -V : print version number and exit (with a zero status).
1823 EOM
1824         exit 1
1825         ;;
1826 esac
1827
1828 : Sanity checks
1829 case "$fastread$alldone" in
1830 yescont|yesexit) ;;
1831 *)
1832         case "$extractsh" in
1833         true) ;;
1834         *)
1835                 if test ! -t 0; then
1836                         echo "Say 'sh Configure', not 'sh <Configure'"
1837                         exit 1
1838                 fi
1839                 ;;
1840         esac
1841         ;;
1842 esac
1843
1844 exec 4>&1
1845 case "$silent" in
1846 true) exec 1>/dev/null;;
1847 esac
1848
1849 : run the defines and the undefines, if any, but leave the file out there...
1850 touch optdef.sh
1851 grep -q '\\' optdef.sh
1852 if test $? = 0; then
1853     echo "Configure does not support \\ in -D arguments"
1854     exit 1
1855 fi
1856 . ./optdef.sh
1857 : create the posthint manipulation script and leave the file out there...
1858 touch posthint.sh
1859
1860 : set package name
1861 package='perl5'
1862 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1863 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1864 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1865 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1866 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1867 esac
1868
1869 : Some greps do not return status, grrr.
1870 echo "grimblepritz" >grimble
1871 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1872         contains=contains
1873 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1874         contains=grep
1875 else
1876         contains=contains
1877 fi
1878 rm -f grimble
1879 : the following should work in any shell
1880 case "$contains" in
1881 contains*)
1882         echo " "
1883         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1884         cat >contains <<'EOSS'
1885 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1886 EOSS
1887 chmod +x contains
1888 esac
1889
1890 : Find the path to the source tree
1891 case "$src" in
1892 '') case "$0" in
1893     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1894          case "$src" in
1895          /*)    ;;
1896          .)     ;;
1897          *)     src=`cd ../$src && pwd` ;;
1898          esac
1899          ;;
1900     *)   src='.';;
1901     esac;;
1902 esac
1903 case "$src" in
1904 '')     src=/
1905         rsrc=/
1906         ;;
1907 /*)     rsrc="$src";;
1908 *)      rsrc="../$src";;
1909 esac
1910 if test -f $rsrc/Configure && \
1911         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1912 then
1913    : found it, so we are ok.
1914 else
1915         rsrc=''
1916         for src in . .. ../.. ../../.. ../../../..; do
1917                 if test -f ../$src/Configure && \
1918                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1919                 then
1920                         rsrc=../$src
1921                         break
1922                 fi
1923         done
1924 fi
1925 case "$rsrc" in
1926 '')
1927         cat <<EOM >&4
1928
1929 Sorry, I can't seem to locate the source dir for $package.  Please start
1930 Configure with an explicit path -- i.e. /some/path/Configure.
1931
1932 EOM
1933         exit 1
1934         ;;
1935 ../.)   rsrc='..';;
1936 *)
1937         echo " "
1938         echo "Sources for $package found in \"$src\"." >&4
1939         ;;
1940 esac
1941
1942 : script used to extract .SH files with variable substitutions
1943 cat >extract <<'EOS'
1944 PERL_CONFIG_SH=true
1945 echo "Doing variable substitutions on .SH files..."
1946 if test -f MANIFEST; then
1947         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1948 else
1949         echo "(Looking for .SH files under the source directory.)"
1950         set x `(cd "$src"; find . -name "*.SH" -print)`
1951 fi
1952 shift
1953 case $# in
1954 0) set x `(cd "$src"; echo *.SH)`; shift;;
1955 esac
1956 if test ! -f "$src/$1"; then
1957         shift
1958 fi
1959 mkdir_p='
1960 name=$1;
1961 create="";
1962 while test $name; do
1963         if test ! -d "$name"; then
1964                 create="$name $create";
1965                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1966                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1967         else
1968                 name="";
1969         fi;
1970 done;
1971 for file in $create; do
1972         mkdir $file;
1973 done
1974 '
1975 for file in $*; do
1976         case "$src" in
1977         ".")
1978                 case "$file" in
1979                 */*)
1980                         dir=`expr X$file : 'X\(.*\)/'`
1981                         file=`expr X$file : 'X.*/\(.*\)'`
1982                         (cd "$dir" && . ./$file)
1983                         ;;
1984                 *)
1985                         . ./$file
1986                         ;;
1987                 esac
1988                 ;;
1989         *)
1990                 case "$file" in
1991                 */*)
1992                         dir=`expr X$file : 'X\(.*\)/'`
1993                         file=`expr X$file : 'X.*/\(.*\)'`
1994                         (set x $dir; shift; eval $mkdir_p)
1995                         sh <"$src/$dir/$file"
1996                         ;;
1997                 *)
1998                         sh <"$src/$file"
1999                         ;;
2000                 esac
2001                 ;;
2002         esac
2003 done
2004 if test -f "$src/config_h.SH"; then
2005         if test ! -f config.h; then
2006         : oops, they left it out of MANIFEST, probably, so do it anyway.
2007         . "$src/config_h.SH"
2008         fi
2009 fi
2010 EOS
2011
2012 : extract files and exit if asked to do so
2013 case "$extractsh" in
2014 true)
2015         case "$realsilent" in
2016         true) ;;
2017         *) exec 1>&4;;
2018         esac
2019         case "$config_sh" in
2020         '') config_sh='config.sh';;
2021         esac
2022         echo " "
2023         echo "Fetching answers from $config_sh..."
2024         cd ..
2025         . $config_sh
2026         test "$override" && . ./optdef.sh
2027         echo " "
2028         . UU/extract
2029         rm -rf UU
2030         echo "Extraction done."
2031         exit 0
2032         ;;
2033 esac
2034
2035 : Eunice requires " " instead of "", can you believe it
2036 echo " "
2037 : Here we go...
2038 echo "Beginning of configuration questions for $package."
2039
2040 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2041
2042 : first determine how to suppress newline on echo command
2043 echo " "
2044 echo "Checking echo to see how to suppress newlines..."
2045 (echo "hi there\c" ; echo " ") >.echotmp
2046 if $contains c .echotmp >/dev/null 2>&1 ; then
2047         echo "...using -n."
2048         n='-n'
2049         c=''
2050 else
2051         cat <<'EOM'
2052 ...using \c
2053 EOM
2054         n=''
2055         c='\c'
2056 fi
2057 echo $n "The star should be here-->$c"
2058 echo '*'
2059 rm -f .echotmp
2060
2061 : Now test for existence of everything in MANIFEST
2062 echo " "
2063 if test -f "$rsrc/MANIFEST"; then
2064         echo "First let's make sure your kit is complete.  Checking..." >&4
2065         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2066                 (split -l 50 2>/dev/null || split -50)
2067         rm -f missing
2068         tmppwd=`pwd`
2069         for filelist in x??; do
2070                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2071                         >/dev/null 2>>"$tmppwd/missing")
2072         done
2073         if test -s missing; then
2074                 cat missing >&4
2075                 cat >&4 <<'EOM'
2076
2077 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2078
2079 You have the option of continuing the configuration process, despite the
2080 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2081 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2082 and contact the author (perlbug@perl.org).
2083
2084 EOM
2085                 echo $n "Continue? [n] $c" >&4
2086                 read ans
2087                 case "$ans" in
2088                 y*)
2089                         echo "Continuing..." >&4
2090                         rm -f missing
2091                         ;;
2092                 *)
2093                         echo "ABORTING..." >&4
2094                         kill $$
2095                         ;;
2096                 esac
2097         else
2098                 echo "Looks good..."
2099         fi
2100 else
2101         echo "There is no MANIFEST file.  I hope your kit is complete !"
2102 fi
2103 rm -f missing x??
2104
2105 : Find the appropriate value for a newline for tr
2106 echo " "
2107 if test -n "$DJGPP"; then
2108        trnl='\012'
2109 fi
2110 if test X"$trnl" = X; then
2111         case "`echo foo|tr '\n' x 2>/dev/null`" in
2112         foox) trnl='\n' ;;
2113         esac
2114 fi
2115 if test X"$trnl" = X; then
2116         case "`echo foo|tr '\012' x 2>/dev/null`" in
2117         foox) trnl='\012' ;;
2118         esac
2119 fi
2120 if test X"$trnl" = X; then
2121        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2122        fooxy) trnl='\n\r' ;;
2123        esac
2124 fi
2125 if test X"$trnl" = X; then
2126         cat <<EOM >&2
2127
2128 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2129
2130 EOM
2131         exit 1
2132 fi
2133
2134 : compute the number of columns on the terminal for proper question formatting
2135 case "$COLUMNS" in
2136 '') COLUMNS='80';;
2137 esac
2138
2139 : set up the echo used in my read
2140 myecho="case \"\$xxxm\" in
2141 '') echo $n \"\$rp $c\" >&4;;
2142 *) case \"\$rp\" in
2143         '') echo $n \"[\$xxxm] $c\";;
2144         *)
2145                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2146                         echo \"\$rp\" >&4
2147                         echo $n \"[\$xxxm] $c\" >&4
2148                 else
2149                         echo $n \"\$rp [\$xxxm] $c\" >&4
2150                 fi
2151                 ;;
2152         esac;;
2153 esac"
2154
2155 : now set up to do reads with possible shell escape and default assignment
2156 cat <<EOSC >myread
2157 $startsh
2158 xxxm=\$dflt
2159 $myecho
2160 ans='!'
2161 case "\$fastread" in
2162 yes) case "\$dflt" in
2163         '') ;;
2164         *) ans='';
2165                 case "\$silent-\$rp" in
2166                 true-) ;;
2167                 *) echo " " >&4;;
2168                 esac;;
2169         esac;;
2170 *) case "\$silent" in
2171         true) case "\$rp" in
2172                 '') ans='';;
2173                 esac;;
2174         esac;;
2175 esac
2176 while expr "X\$ans" : "X!" >/dev/null; do
2177         read answ
2178         set x \$xxxm
2179         shift
2180         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2181         case  "\$answ" in
2182         "!")
2183                 sh 1>&4
2184                 echo " "
2185                 $myecho
2186                 ;;
2187         !*)
2188                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2189                 shift
2190                 sh 1>&4 -c "\$*"
2191                 echo " "
2192                 $myecho
2193                 ;;
2194         "\$ans")
2195                 case "\$ans" in
2196                 \\&*)
2197                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2198                         shift
2199                         case "\$1" in
2200                         -d)
2201                                 fastread=yes
2202                                 echo "(OK, I'll run with -d after this question.)" >&4
2203                                 ;;
2204                         -*)
2205                                 echo "*** Sorry, \$1 not supported yet." >&4
2206                                 ;;
2207                         esac
2208                         $myecho
2209                         ans=!
2210                         ;;
2211                 esac;;
2212         *)
2213                 case "\$aok" in
2214                 y)
2215                         echo "*** Substitution done -- please confirm."
2216                         xxxm="\$ans"
2217                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2218                         xxxm="\$ans"
2219                         ans=!
2220                         ;;
2221                 *)
2222                         echo "*** Error -- try again."
2223                         ans=!
2224                         ;;
2225                 esac
2226                 $myecho
2227                 ;;
2228         esac
2229         case "\$ans\$xxxm\$nostick" in
2230         '')
2231                 ans=!
2232                 $myecho
2233                 ;;
2234         esac
2235 done
2236 case "\$ans" in
2237 '') ans="\$xxxm";;
2238 esac
2239 EOSC
2240
2241 : create .config dir to save info across Configure sessions
2242 test -d ../.config || mkdir ../.config
2243 cat >../.config/README <<EOF
2244 This directory created by Configure to save information that should
2245 persist across sessions for $package.
2246
2247 You may safely delete it if you wish.
2248 EOF
2249
2250 : See if we are using a devel version and want that
2251 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2252 case "$usedevel" in
2253 $define|true|[yY]*)
2254     usedevel="$define" ;;
2255 *) case "$xversion" in
2256    *[13579])
2257         cat >&4 <<EOH
2258 *** WHOA THERE!!! ***
2259
2260     This is an UNSTABLE DEVELOPMENT release.
2261     The version of this $package distribution is $xversion, that is, odd,
2262     (as opposed to even) and that signifies a development release.
2263     If you want a maintenance release, you want an even-numbered version.
2264
2265     Do ***NOT*** install this into production use.
2266     Data corruption and crashes are possible.
2267
2268     It is most seriously suggested that you do not continue any further
2269     unless you want to help in developing and debugging Perl.
2270
2271     If you *still* want to build perl, you can answer 'y' now,
2272     or pass -Dusedevel to Configure.
2273
2274 EOH
2275         rp='Do you really want to continue?'
2276         dflt='n'
2277         . ./myread
2278         case "$ans" in
2279         [yY]) echo >&4 "Okay, continuing."
2280               usedevel="$define" ;;
2281         *) echo >&4 "Okay, bye."
2282            exit 1
2283            ;;
2284         esac
2285         ;;
2286     esac
2287     usedevel="$undef"
2288     ;;
2289 esac
2290 case "$usedevel" in
2291 $define|true|[yY]*)
2292         case "$versiononly" in
2293         '') versiononly="$define" ;;
2294         esac
2295         case "$installusrbinperl" in
2296         '') installusrbinperl="$undef" ;;
2297         esac
2298         ;;
2299 esac
2300
2301 : general instructions
2302 needman=true
2303 firsttime=true
2304 user=`(logname) 2>/dev/null`
2305 case "$user" in
2306 '') user=`whoami 2>&1`;;
2307 esac
2308 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2309         firsttime=false
2310         echo " "
2311         rp='Would you like to see the instructions?'
2312         dflt=n
2313         . ./myread
2314         case "$ans" in
2315         [yY]*) ;;
2316         *) needman=false;;
2317         esac
2318 fi
2319 if $needman; then
2320         cat <<EOH
2321
2322 This installation shell script will examine your system and ask you questions
2323 to determine how the perl5 package should be installed. If you get
2324 stuck on a question, you may use a ! shell escape to start a subshell or
2325 execute a command.  Many of the questions will have default answers in square
2326 brackets; typing carriage return will give you the default.
2327
2328 On some of the questions which ask for file or directory names you are allowed
2329 to use the ~name construct to specify the login directory belonging to "name",
2330 even if you don't have a shell which knows about that.  Questions where this is
2331 allowed will be marked "(~name ok)".
2332
2333 EOH
2334         rp=''
2335         dflt='Type carriage return to continue'
2336         . ./myread
2337         cat <<'EOH'
2338
2339 The prompter used in this script allows you to use shell variables and
2340 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2341 in the default answer, as if the default line was a set of arguments given to a
2342 script shell.  This means you may also use $* to repeat the whole default line,
2343 so you do not have to re-type everything to add something to the default.
2344
2345 Every time there is a substitution, you will have to confirm.  If there is an
2346 error (e.g. an unmatched backtick), the default answer will remain unchanged
2347 and you will be prompted again.
2348
2349 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2350 the questions and use the computed defaults (or the previous answers if there
2351 was already a config.sh file). Type 'Configure -h' for a list of options.
2352 You may also start interactively and then answer '& -d' at any prompt to turn
2353 on the non-interactive behaviour for the remainder of the execution.
2354
2355 EOH
2356         . ./myread
2357         cat <<EOH
2358
2359 Much effort has been expended to ensure that this shell script will run on any
2360 Unix system.  If despite that it blows up on yours, your best bet is to edit
2361 Configure and run it again.  If you can't run Configure for some reason,
2362 you'll have to generate a config.sh file by hand.  Whatever problems you
2363 have, let me (perlbug@perl.org) know how I blew it.
2364
2365 This installation script affects things in two ways:
2366
2367 1) it may do direct variable substitutions on some of the files included
2368    in this kit.
2369 2) it builds a config.h file for inclusion in C programs.  You may edit
2370    any of these files as the need arises after running this script.
2371
2372 If you make a mistake on a question, there is no easy way to back up to it
2373 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2374 files.  Configure will offer to let you do this before it runs the SH files.
2375
2376 EOH
2377         dflt='Type carriage return to continue'
2378         . ./myread
2379         case "$firsttime" in
2380         true) echo $user >>../.config/instruct;;
2381         esac
2382 fi
2383
2384 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2385 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2386 if test "X$sysroot" = X; then
2387     sysroot=""
2388 else
2389     case "$cc" in
2390         *gcc*|*g++*)
2391             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2392             # _sysroot is used in places where we need --sysroot=foo
2393             # but using the rest of the flags could cause issues.
2394             _sysroot="--sysroot=$sysroot";
2395             case "$ccflags" in
2396                 *sysroot*) ;;
2397                 'undef'|*)
2398                 ccflags="$ccflags $_sysroot"
2399             esac
2400             case "$ldflags" in
2401                 *sysroot*) ;;
2402                 'undef'|*)
2403                 ldflags="$ldflags $_sysroot"
2404             esac
2405             case "$cppflags" in
2406                 *sysroot*) ;;
2407                 'undef'|*)
2408                 cppflags="$cppflags $_sysroot"
2409             esac
2410             # lddlflags updated below in lddlflags section;
2411             # same with cccdlflags
2412             ;;
2413     esac
2414
2415     # Adjust some defaults to also use $sysroot
2416     for var in xlibpth loclibpth locincpth glibpth; do
2417         eval xxx=\$$var
2418         eval $var=''
2419         for path in $xxx; do
2420             eval $var=\"\$$var $sysroot$path\"
2421         done
2422     done
2423
2424 fi
2425
2426 : find out where common programs are
2427 echo " "
2428 echo "Locating common programs..." >&4
2429 cat <<EOSC >loc
2430 $startsh
2431 case \$# in
2432 0) exit 1;;
2433 esac
2434 thing=\$1
2435 shift
2436 dflt=\$1
2437 shift
2438 for dir in \$*; do
2439         case "\$thing" in
2440         .)
2441         if test -d \$dir/\$thing; then
2442                 echo \$dir
2443                 exit 0
2444         fi
2445         ;;
2446         *)
2447         for thisthing in \$dir/\$thing; do
2448                 : just loop through to pick last item
2449         done
2450         if test -f \$thisthing; then
2451                 echo \$thisthing
2452                 exit 0
2453         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2454                 echo \$thisthing
2455                 exit 0
2456         elif test -f \$dir/\$thing.exe; then
2457                 if test -n "$DJGPP"; then
2458                         echo \$dir/\$thing.exe
2459                 elif test "$eunicefix" != ":"; then
2460                         : on Eunice apparently
2461                         echo \$dir/\$thing
2462                 fi
2463                 exit 0
2464         fi
2465         ;;
2466         esac
2467 done
2468 echo \$dflt
2469 exit 1
2470 EOSC
2471 chmod +x loc
2472 $eunicefix loc
2473 loclist="
2474 awk
2475 cat
2476 chmod
2477 comm
2478 cp
2479 echo
2480 expr
2481 grep
2482 ls
2483 mkdir
2484 rm
2485 sed
2486 sort
2487 touch
2488 tr
2489 uniq
2490 "
2491 trylist="
2492 ar
2493 bison
2494 byacc
2495 cpp
2496 csh
2497 date
2498 egrep
2499 gmake
2500 gzip
2501 less
2502 ln
2503 make
2504 more
2505 nm
2506 nroff
2507 perl
2508 pg
2509 test
2510 uname
2511 zip
2512 "
2513 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2514 pth="$pth $sysroot/lib $sysroot/usr/lib"
2515 for file in $loclist; do
2516         eval xxx=\$$file
2517         case "$xxx" in
2518         /*|?:[\\/]*)
2519                 if test -f "$xxx"; then
2520                         : ok
2521                 else
2522                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2523                         xxx=`./loc $file $file $pth`
2524                 fi
2525                 ;;
2526         '') xxx=`./loc $file $file $pth`;;
2527         *) xxx=`./loc $xxx $xxx $pth`;;
2528         esac
2529         eval $file=$xxx$_exe
2530         eval _$file=$xxx
2531         case "$xxx" in
2532         /*)
2533                 echo $file is in $xxx.
2534                 ;;
2535         ?:[\\/]*)
2536                 echo $file is in $xxx.
2537                 ;;
2538         *)
2539                 echo "I don't know where '$file' is, and my life depends on it." >&4
2540                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2541                 exit 1
2542                 ;;
2543         esac
2544 done
2545 echo " "
2546 echo "Don't worry if any of the following aren't found..."
2547 say=offhand
2548 for file in $trylist; do
2549         eval xxx=\$$file
2550         case "$xxx" in
2551         /*|?:[\\/]*)
2552                 if test -f "$xxx"; then
2553                         : ok
2554                 else
2555                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2556                         xxx=`./loc $file $file $pth`
2557                 fi
2558                 ;;
2559         '') xxx=`./loc $file $file $pth`;;
2560         *) xxx=`./loc $xxx $xxx $pth`;;
2561         esac
2562         eval $file=$xxx$_exe
2563         eval _$file=$xxx
2564         case "$xxx" in
2565         /*)
2566                 echo $file is in $xxx.
2567                 ;;
2568         ?:[\\/]*)
2569                 echo $file is in $xxx.
2570                 ;;
2571         *)
2572                 echo "I don't see $file out there, $say."
2573                 say=either
2574                 ;;
2575         esac
2576 done
2577 case "$egrep" in
2578 egrep)
2579         echo "Substituting grep for egrep."
2580         egrep=$grep
2581         _egrep=$grep
2582         ;;
2583 esac
2584 case "$less" in
2585 '')     ;;
2586 *)      if $less -R </dev/null >/dev/null 2>&1; then
2587                echo "Substituting less -R for less."
2588                less="$less -R"
2589                _less=$less
2590         fi
2591         ;;
2592 esac
2593 case "$ln" in
2594 ln)
2595         echo "Substituting cp for ln."
2596         ln=$cp
2597         _ln=$cp
2598         ;;
2599 esac
2600 case "$make" in
2601 make)
2602         case "$gmake" in
2603         gmake)
2604         echo "I can't find make or gmake, and my life depends on it." >&4
2605         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2606         exit 1
2607         ;;
2608         esac
2609         ;;
2610 esac
2611 case "$gmake" in
2612 gmake)  ;;
2613 *)      # We can't have osname yet.
2614         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2615                 # Assume that gmake, if found, is definitely GNU make
2616                 # and prefer it over the system make.
2617                 echo "Substituting gmake for make."
2618                 make=$gmake
2619                 _make=$gmake
2620         fi
2621         ;;
2622 esac
2623 case "$test" in
2624 test)
2625         echo "Hopefully test is built into your sh."
2626         ;;
2627 *)
2628         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2629                 echo "Using the test built into your sh."
2630                 test=test
2631                 _test=test
2632         fi
2633         ;;
2634 esac
2635 case "$echo" in
2636 echo)
2637         echo "Hopefully echo is built into your sh."
2638         ;;
2639 '') ;;
2640 *)
2641         echo " "
2642 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2643         $echo $n "hi there$c" >foo1
2644         echo $n "hi there$c" >foo2
2645         if cmp foo1 foo2 >/dev/null 2>&1; then
2646                 echo "They are compatible.  In fact, they may be identical."
2647         else
2648                 case "$n" in
2649                 '-n') n='' c='\c';;
2650                 *) n='-n' c='';;
2651                 esac
2652                 cat <<FOO
2653 They are not compatible!  You are probably running ksh on a non-USG system.
2654 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2655 have echo built in and we may have to run some Bourne shell scripts.  That
2656 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2657
2658 FOO
2659                 $echo $n "The star should be here-->$c"
2660                 $echo "*"
2661         fi
2662         $rm -f foo1 foo2
2663         ;;
2664 esac
2665
2666 # This question was auctioned at YAPC::Europe-2007 in Vienna
2667 # I never promised you could answer it. I only auctioned the question.
2668 cat <<FOO
2669 The following message is sponsored by
2670
2671   Dresden.pm<--The stars should be here.
2672
2673 Dear Perl user, system administrator or package
2674 maintainer, the Perl community sends greetings to
2675 you. Do you (emblematical) greet back [Y/n]? n
2676
2677 FOO
2678
2679 : Check what type of C compiler we use
2680 cat <<EOS >trygcc
2681 $startsh
2682 EOS
2683 cat <<'EOSC' >>trygcc
2684 case "$cc" in
2685 '') ;;
2686 *)  $rm -f try try.*
2687     $cat >try.c <<EOM
2688 int main(int argc, char *argv[]) {
2689   return 0;
2690 }
2691 EOM
2692     if $cc -o try $ccflags $ldflags try.c; then
2693        :
2694     else
2695         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2696         despair=yes
2697         trygcc=yes
2698         case "$cc" in
2699         *gcc*) trygcc=no ;;
2700         esac
2701         # Skip this test because it gives a false match on output like:
2702         #    ./trygcc: line 23: cc: command not found
2703         # case "`$cc -v -c try.c 2>&1`" in
2704         # *gcc*) trygcc=no ;;
2705         # esac
2706         if $test X"$trygcc" = Xyes; then
2707             if gcc -o try -c try.c; then
2708                 echo " "
2709                 echo "You seem to have a working gcc, though." >&4
2710                 # Switching compilers may undo the work of hints files.
2711                 # The most common problem is -D_REENTRANT for threads.
2712                 # This heuristic catches that case, but gets false positives
2713                 # if -Dusethreads was not actually specified.  Better to
2714                 # bail out here with a useful message than fail
2715                 # mysteriously later. Should we perhaps just try to
2716                 # re-invoke Configure -Dcc=gcc config_args ?
2717                 if $test -f usethreads.cbu; then
2718                         $cat >&4 <<EOM
2719
2720 *** However, any setting of the C compiler flags (e.g. for thread support)
2721 *** will be lost.  It may be necessary for you to restart Configure and
2722 *** add -Dcc=gcc to your Configure command line.
2723
2724 EOM
2725                         rp="Would you like to go ahead and try gcc anyway?"
2726                         dflt=n
2727                 else
2728                         rp="Would you like to use it?"
2729                         dflt=y
2730                 fi
2731                 if $test -f myread; then
2732                     . ./myread
2733                 else
2734                     if $test -f UU/myread; then
2735                         . ./UU/myread
2736                     else
2737                         echo "Cannot find myread, sorry.  Aborting." >&2
2738                         exit 1
2739                     fi
2740                 fi
2741                 case "$ans" in
2742                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2743                 esac
2744             fi
2745         fi
2746     fi
2747     $rm -f try try.*
2748     ;;
2749 esac
2750 EOSC
2751
2752 cat <<EOS >checkcc
2753 $startsh
2754 EOS
2755 cat <<'EOSC' >>checkcc
2756 case "$cc" in
2757 '') ;;
2758 *)  $rm -f try try.*
2759     $cat >try.c <<EOM
2760 int main(int argc, char *argv[]) {
2761   return 0;
2762 }
2763 EOM
2764     if $cc -o try $ccflags $ldflags try.c; then
2765        :
2766     else
2767         if $test X"$despair" = Xyes; then
2768            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2769         fi
2770         $cat >&4 <<EOM
2771 You need to find a working C compiler.
2772 Either (purchase and) install the C compiler supplied by your OS vendor,
2773 or for a free C compiler try http://gcc.gnu.org/
2774 I cannot continue any further, aborting.
2775 EOM
2776         exit 1
2777     fi
2778     $rm -f try try.*
2779     ;;
2780 esac
2781 EOSC
2782
2783 : determine whether symbolic links are supported
2784 echo " "
2785 $touch blurfl
2786 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2787         echo "Symbolic links are supported." >&4
2788         lns="$ln -s"
2789 else
2790         echo "Symbolic links are NOT supported." >&4
2791         lns="$ln"
2792 fi
2793 $rm -f blurfl sym
2794
2795 : determine whether symbolic links are supported
2796 echo " "
2797 case "$lns" in
2798 *"ln"*" -s")
2799         echo "Checking how to test for symbolic links..." >&4
2800         $lns blurfl sym
2801         if $test "X$issymlink" = X; then
2802                 case "$newsh" in
2803                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2804                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2805                 esac
2806                 if test $? = 0; then
2807                         issymlink="test -h"
2808                 else
2809                         echo "Your builtin 'test -h' may be broken." >&4
2810                         case "$test" in
2811                         /*)     ;;
2812                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2813                                 for p in $pth
2814                                 do
2815                                         if test -f "$p/$test"; then
2816                                                 test="$p/$test"
2817                                                 break
2818                                         fi
2819                                 done
2820                                 ;;
2821                         esac
2822                         case "$test" in
2823                         /*)
2824                                 echo "Trying external '$test -h'." >&4
2825                                 issymlink="$test -h"
2826                                 if $test ! -h sym >/dev/null 2>&1; then
2827                                         echo "External '$test -h' is broken, too." >&4
2828                                         issymlink=''
2829                                 fi
2830                                 ;;
2831                         *)      issymlink='' ;;
2832                         esac
2833                 fi
2834         fi
2835         if $test "X$issymlink" = X; then
2836                 if $test -L sym 2>/dev/null; then
2837                         issymlink="$test -L"
2838                         echo "The builtin '$test -L' worked." >&4
2839                 fi
2840         fi
2841         if $test "X$issymlink" != X; then
2842                 echo "You can test for symbolic links with '$issymlink'." >&4
2843         else
2844                 echo "I do not know how you can test for symbolic links." >&4
2845         fi
2846         $rm -f blurfl sym
2847         ;;
2848 *)      echo "No symbolic links, so not testing for their testing..." >&4
2849         ;;
2850 esac
2851 echo " "
2852
2853 : Make symlinks util
2854 case "$mksymlinks" in
2855 $define|true|[yY]*)
2856         case "$src" in
2857         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2858                 exit 1
2859                 ;;
2860         *)      case "$lns:$issymlink" in
2861                 *"ln"*" -s:"*"test -"?)
2862                         echo "Creating the symbolic links..." >&4
2863                         cd ..
2864                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2865                         awk 'NF == 1 {
2866                                 dir=".";
2867                                 file=$1 "";
2868                              }
2869                              NF == 2 {
2870                                 dir=$1 "";
2871                                 file=$2 "";
2872                              }
2873                              {
2874                                  print "# dir = ", dir, "file = ", file
2875                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2876                              } END {
2877                                  for (d in mf) {
2878                                      if (d != ".") { print("mkdir -p "d) }
2879                                      print("ln -sf "mf[d]" "d);
2880                                  }
2881                              }' source="$src" > UU/mksymlinks.$$
2882                         sh UU/mksymlinks.$$
2883                         rm UU/mksymlinks.$$
2884                         # Sanity check 1.
2885                         if test ! -d t/base; then
2886                                 echo "Failed to create the subdirectories.  Aborting." >&4
2887                                 exit 1
2888                         fi
2889                         # Sanity check 2.
2890                         if test ! -f t/base/lex.t; then
2891                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2892                                 exit 1
2893                         fi
2894                         if test ! -f win32/win32.c; then
2895                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2896                                 exit 1
2897                         fi
2898                         cd UU
2899                         ;;
2900                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2901                         ;;
2902                 esac
2903                 ;;
2904         esac
2905         ;;
2906 esac
2907
2908 : Check for Cross-Compilation
2909 if $test "X$targethost" = "X"; then
2910     targethost=""
2911 fi
2912 if $test "X$targetenv" = "X"; then
2913     targetenv=""
2914 fi
2915 case "$usecrosscompile" in
2916 $define|true|[yY]*)
2917         $echo "Cross-compiling..."
2918         croak=''
2919         case "$cc" in
2920         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2921             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2922             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2923             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2924             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2925             # leave out ld, choosing it is more complex
2926             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2927             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2928             # We are in a weird spot. Just before us, some values
2929             # were 'saved', to be restored after the hints are
2930             # run.  This means that the changes we made to ar,
2931             # nm and ranlib will get reverted.
2932             # To avoid that, we hijack the saving mechanism and
2933             # have it save our new values.
2934             for file in ar nm ranlib; do
2935                 eval xxx=\$$file
2936                 eval $file=$xxx$_exe
2937                 eval _$file=$xxx
2938             done
2939         ;;
2940         esac
2941         case "$targetarch" in
2942         '') echo "Targetarch not defined." >&4; croak=y ;;
2943         *)  echo "Using targetarch $targetarch." >&4 ;;
2944         esac
2945         case "$targethost" in
2946         '') echo "Targethost not defined." >&4; croak=y ;;
2947         *)  echo "Using targethost $targethost." >&4
2948         esac
2949         locincpth=' '
2950         loclibpth=' '
2951         case "$croak" in
2952         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2953         esac
2954     : compile a host miniperl and generate_uudmap, unless we got passed them
2955     if $test "X$hostperl" = X; then
2956       echo "Building host miniperl and generate_uudmap binaries" >&4
2957       before_host=`pwd`
2958       cd ..
2959       cd $src
2960       src=`pwd`
2961       rm -rf $src/host
2962       mkdir $src/host
2963       cd $src/host
2964       $src/Configure -des -Dusedevel -Dmksymlinks
2965       $make miniperl
2966       case "$hostgenerate" in
2967       '') $make generate_uudmap
2968           hostgenerate=$src/host/generate_uudmap
2969           ;;
2970        "$undef") hostgenerate=''
2971           ;;
2972       esac
2973       hostperl=$src/host/miniperl
2974       cd $before_host
2975     fi
2976     hostosname=`$hostperl -le 'print $^O'`
2977     ;;
2978 *)
2979     usecrosscompile="$undef"
2980     ;;
2981 esac
2982
2983 : Define -Dtargethost=somecomputer to run compiled tests on another machine
2984 case "$targethost" in
2985     '') echo "Checking for cross-compile" >&4
2986     case "$usecrosscompile$multiarch" in
2987        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
2988          if [ -f Makefile ]; then
2989            echo " "
2990            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2991          else
2992            echo "Configure done."
2993          fi
2994        exit 0
2995        ;;
2996      *) echo "No targethost for running compiler tests against defined, running locally" >&4
2997         run=''
2998         to=:
2999         from=:
3000         ;;
3001     esac
3002     ;;
3003     *) echo "Using targethost $targethost." >&4
3004         case "$src" in
3005         /*) run=$src/Cross/run
3006             targetmkdir=$src/Cross/mkdir
3007             to=$src/Cross/to
3008             from=$src/Cross/from
3009             ;;
3010         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3011             run=$pwd/Cross/run
3012             targetmkdir=$pwd/Cross/mkdir
3013             to=$pwd/Cross/to
3014             from=$pwd/Cross/from
3015             ;;
3016         esac
3017         case "$targetrun" in
3018         '') targetrun=ssh ;;
3019         esac
3020         case "$targetto" in
3021         '') targetto=scp ;;
3022         esac
3023         case "$targetfrom" in
3024         '') targetfrom=scp ;;
3025         esac
3026         run=$run-$targetrun
3027         to=$to-$targetto
3028         from=$from-$targetfrom
3029         case "$targetdir" in
3030         '')  targetdir=/tmp
3031              echo "Guessing targetdir $targetdir." >&4
3032              ;;
3033         esac
3034         case "$targetuser" in
3035         '')  targetuser=root
3036              echo "Guessing targetuser $targetuser." >&4
3037              ;;
3038         esac
3039         case "$targetport" in
3040         '')  targetport=22
3041              echo "Guessing targetport $targetport." >&4
3042              ;;
3043         esac
3044         case "$targetfrom" in
3045         scp)    q=-q ;;
3046         *)      q='' ;;
3047         esac
3048         case "$targetrun" in
3049         ssh|rsh)
3050             cat >$run <<EOF
3051 #!/bin/sh
3052 env=''
3053 case "\$1" in
3054 -cwd)
3055   shift
3056   cwd=\$1
3057   shift
3058   ;;
3059 esac
3060 case "\$1" in
3061 -env)
3062   shift
3063   env=\$1
3064   shift
3065   ;;
3066 esac
3067 case "\$cwd" in
3068 '') cwd=$targetdir ;;
3069 esac
3070 exe=\$1
3071 shift
3072 $to \$exe
3073 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3074 EOF
3075             ;;
3076         adb)
3077             $touch $run
3078             ;;
3079         *)  echo "Unknown targetrun '$targetrun'" >&4
3080             exit 1
3081             ;;
3082         esac
3083         case "$targetmkdir" in
3084         */Cross/mkdir)
3085             cat >$targetmkdir <<EOF
3086 #!/bin/sh
3087 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3088 EOF
3089             $chmod a+rx $targetmkdir
3090             ;;
3091         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3092             exit 1
3093             ;;
3094         esac
3095         case "$targetto" in
3096         scp|rcp)
3097             cat >$to <<EOF
3098 #!/bin/sh
3099 for f in \$@
3100 do
3101   case "\$f" in
3102   /*)
3103     $targetmkdir \`dirname \$f\`
3104     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3105     ;;
3106   *)
3107     $targetmkdir $targetdir/\`dirname \$f\`
3108     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3109     ;;
3110   esac
3111 done
3112 exit 0
3113 EOF
3114             ;;
3115         cp) cat >$to <<EOF
3116 #!/bin/sh
3117 for f in \$@
3118 do
3119   case "\$f" in
3120   /*)
3121     $mkdir -p $targetdir/\`dirname \$f\`
3122     $cp \$f $targetdir/\$f || exit 1
3123     ;;
3124   *)
3125     $targetmkdir $targetdir/\`dirname \$f\`
3126     $cp \$f $targetdir/\$f || exit 1
3127     ;;
3128   esac
3129 done
3130 exit 0
3131 EOF
3132             ;;
3133         *)  echo "Unknown targetto '$targetto'" >&4
3134             exit 1
3135             ;;
3136         esac
3137         case "$targetfrom" in
3138         scp|rcp)
3139           cat >$from <<EOF
3140 #!/bin/sh
3141 for f in \$@
3142 do
3143   $rm -f \$f
3144   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3145 done
3146 exit 0
3147 EOF
3148             ;;
3149         cp) cat >$from <<EOF
3150 #!/bin/sh
3151 for f in \$@
3152 do
3153   $rm -f \$f
3154   cp $targetdir/\$f . || exit 1
3155 done
3156 exit 0
3157 EOF
3158             ;;
3159         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3160             exit 1
3161             ;;
3162         esac
3163         if $test ! -f $run; then
3164             echo "Target 'run' script '$run' not found." >&4
3165         else
3166             $chmod a+rx $run
3167         fi
3168         if $test ! -f $to; then
3169             echo "Target 'to' script '$to' not found." >&4
3170         else
3171             $chmod a+rx $to
3172         fi
3173         if $test ! -f $from; then
3174             echo "Target 'from' script '$from' not found." >&4
3175         else
3176             $chmod a+rx $from
3177         fi
3178         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3179             exit 1
3180         fi
3181         cat >&4 <<EOF
3182 Using '$run' for remote execution,
3183 and '$from' and '$to'
3184 for remote file transfer.
3185 EOF
3186         ;;
3187 *)      run=''
3188         to=:
3189         from=:
3190         usecrosscompile="$undef"
3191         targetarch=''
3192         ;;
3193 esac
3194
3195 : see whether [:lower:] and [:upper:] are supported character classes
3196 echo " "
3197 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3198 ABYZ-abyz)
3199         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3200         up='[:upper:]'
3201         low='[:lower:]'
3202         ;;
3203 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3204         # (0xd9 and 0xe2), therefore that is a nice testing point.
3205         if test "X$up" = X -o "X$low" = X; then
3206             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3207             rs) up='[A-Z]'
3208                 low='[a-z]'
3209                 ;;
3210             esac
3211         fi
3212         if test "X$up" = X -o "X$low" = X; then
3213             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3214             rs) up='A-Z'
3215                 low='a-z'
3216                 ;;
3217             esac
3218         fi
3219         if test "X$up" = X -o "X$low" = X; then
3220             case "`echo RS | od -x 2>/dev/null`" in
3221             *D9E2*|*d9e2*)
3222                 echo "Hey, this might be EBCDIC." >&4
3223                 if test "X$up" = X -o "X$low" = X; then
3224                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3225                     rs) up='[A-IJ-RS-Z]'
3226                         low='[a-ij-rs-z]'
3227                         ;;
3228                     esac
3229                 fi
3230                 if test "X$up" = X -o "X$low" = X; then
3231                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3232                     rs) up='A-IJ-RS-Z'
3233                         low='a-ij-rs-z'
3234                         ;;
3235                     esac
3236                 fi
3237                 ;;
3238             esac
3239         fi
3240 esac
3241 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3242 rs)
3243     echo "Using $up and $low to convert case." >&4
3244     ;;
3245 *)
3246     echo "I don't know how to translate letters from upper to lower case." >&4
3247     echo "Your tr is not acting any way I know of." >&4
3248     exit 1
3249     ;;
3250 esac
3251 : set up the translation script tr, must be called with ./tr of course
3252 cat >tr <<EOSC
3253 $startsh
3254 case "\$1\$2" in
3255 '[A-Z][a-z]') exec $tr '$up' '$low';;
3256 '[a-z][A-Z]') exec $tr '$low' '$up';;
3257 esac
3258 exec $tr "\$@"
3259 EOSC
3260 chmod +x tr
3261 $eunicefix tr
3262
3263 : Try to determine whether config.sh was made on this system
3264 case "$config_sh" in
3265 '')
3266 myuname=`$uname -a 2>/dev/null`
3267 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3268 # Downcase everything to avoid ambiguity.
3269 # Remove slashes and single quotes so we can use parts of this in
3270 # directory and file names.
3271 # Remove newlines so myuname is sane to use elsewhere.
3272 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3273 # because the A-Z/a-z are not consecutive.
3274 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3275         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3276 newmyuname="$myuname"
3277 dflt=n
3278 case "$knowitall" in
3279 '')
3280         if test -f ../config.sh; then
3281                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3282                         eval "`grep myuname= ../config.sh`"
3283                 fi
3284                 if test "X$myuname" = "X$newmyuname"; then
3285                         dflt=y
3286                 fi
3287         fi
3288         ;;
3289 *) dflt=y;;
3290 esac
3291
3292 : Get old answers from old config file if Configure was run on the
3293 : same system, otherwise use the hints.
3294 hint=default
3295 cd ..
3296 if test -f config.sh; then
3297         echo " "
3298         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3299         . UU/myread
3300         case "$ans" in
3301         n*|N*) echo "OK, I'll ignore it."
3302                 mv config.sh config.sh.old
3303                 myuname="$newmyuname"
3304                 ;;
3305         *)  echo "Fetching default answers from your old config.sh file..." >&4
3306                 tmp_n="$n"
3307                 tmp_c="$c"
3308                 tmp_sh="$sh"
3309                 . ./config.sh
3310                 cp config.sh UU
3311                 n="$tmp_n"
3312                 c="$tmp_c"
3313                 : Older versions did not always set $sh.  Catch re-use of such
3314                 : an old config.sh.
3315                 case "$sh" in
3316                 '') sh="$tmp_sh" ;;
3317                 esac
3318                 hint=previous
3319                 ;;
3320         esac
3321 fi
3322 . ./UU/checkcc
3323 if test ! -f config.sh; then
3324         $cat <<EOM
3325
3326 First time through, eh?  I have some defaults handy for some systems
3327 that need some extra help getting the Configure answers right:
3328
3329 EOM
3330         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3331         dflt=''
3332         : Half the following guesses are probably wrong... If you have better
3333         : tests or hints, please send them to perlbug@perl.org
3334         : The metaconfig authors would also appreciate a copy...
3335         $test -f /irix && osname=irix
3336         $test -f /xenix && osname=sco_xenix
3337         $test -f /dynix && osname=dynix
3338         $test -f /dnix && osname=dnix
3339         $test -f /lynx.os && osname=lynxos
3340         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3341         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3342         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3343         $test -f /bin/mips && /bin/mips && osname=mips
3344         $test -d /usr/apollo/bin && osname=apollo
3345         $test -f /etc/saf/_sactab && osname=svr4
3346         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3347         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3348         $test -f /sys/utilities/MultiView && osname=amigaos
3349         if $test -d /MachTen -o -d /MachTen_Folder; then
3350                 osname=machten
3351                 if $test -x /sbin/version; then
3352                         osvers=`/sbin/version | $awk '{print $2}' |
3353                         $sed -e 's/[A-Za-z]$//'`
3354                 elif $test -x /usr/etc/version; then
3355                         osvers=`/usr/etc/version | $awk '{print $2}' |
3356                         $sed -e 's/[A-Za-z]$//'`
3357                 else
3358                         osvers="$2.$3"
3359                 fi
3360         fi
3361
3362         $test -f /sys/posix.dll &&
3363                 $test -f /usr/bin/what &&
3364                 set X `/usr/bin/what /sys/posix.dll` &&
3365                 $test "$3" = UWIN &&
3366                 osname=uwin &&
3367                 osvers="$5"
3368
3369         if $test -f $uname; then
3370                 set X $myuname
3371                 shift
3372
3373                 case "$5" in
3374                 fps*) osname=fps ;;
3375                 mips*)
3376                         case "$4" in
3377                         umips) osname=umips ;;
3378                         *) osname=mips ;;
3379                         esac;;
3380                 [23]100) osname=mips ;;
3381                 i386*)
3382                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3383                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3384                                 osname='sco'
3385                                 osvers=$tmp
3386                         elif $test -f /etc/kconfig; then
3387                                 osname=isc
3388                                 if test "$lns" = "$ln -s"; then
3389                                         osvers=4
3390                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3391                                         osvers=3
3392                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3393                                         osvers=2
3394                                 fi
3395                         fi
3396                         tmp=''
3397                         ;;
3398                 pc*)
3399                         if test -n "$DJGPP"; then
3400                                 osname=dos
3401                                 osvers=djgpp
3402                         fi
3403                         ;;
3404                 esac
3405
3406                 case "$1" in
3407                 aix) osname=aix
3408                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3409                         case "$tmp" in
3410                         # oslevel can fail with:
3411                         # oslevel: Unable to acquire lock.
3412                         *not\ found) osvers="$4"."$3" ;;
3413                         '<3240'|'<>3240') osvers=3.2.0 ;;
3414                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3415                         '=3250'|'>3250') osvers=3.2.5 ;;
3416                         *) osvers=$tmp;;
3417                         esac
3418                         ;;
3419                 bitrig) osname=bitrig
3420                         osvers="$3"
3421                         ;;
3422                 bsd386) osname=bsd386
3423                         osvers=`$uname -r`
3424                         ;;
3425                 cygwin*) osname=cygwin
3426                         osvers="$3"
3427                         ;;
3428                 *dc.osx) osname=dcosx
3429                         osvers="$3"
3430                         ;;
3431                 dnix) osname=dnix
3432                         osvers="$3"
3433                         ;;
3434                 domainos) osname=apollo
3435                         osvers="$3"
3436                         ;;
3437                 dgux)   osname=dgux
3438                         osvers="$3"
3439                         ;;
3440                 dragonfly) osname=dragonfly
3441                         osvers="$3"
3442                         ;;
3443                 dynixptx*) osname=dynixptx
3444                         osvers=`echo "$4"|sed 's/^v//'`
3445                         ;;
3446                 freebsd) osname=freebsd
3447                         osvers="$3" ;;
3448                 genix)  osname=genix ;;
3449                 gnu)    osname=gnu
3450                         osvers="$3" ;;
3451                 hp*)    osname=hpux
3452                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3453                         ;;
3454                 irix*)  osname=irix
3455                         case "$3" in
3456                         4*) osvers=4 ;;
3457                         5*) osvers=5 ;;
3458                         *)      osvers="$3" ;;
3459                         esac
3460                         ;;
3461                 linux)  osname=linux
3462                         case "$3" in
3463                         *)      osvers="$3" ;;
3464                         esac
3465                         $test -f /system/lib/libandroid.so && osname=linux-android
3466                         ;;
3467                 MiNT)   osname=mint
3468                         ;;
3469                 netbsd*) osname=netbsd
3470                         osvers="$3"
3471                         ;;
3472                 news-os) osvers="$3"
3473                         case "$3" in
3474                         4*) osname=newsos4 ;;
3475                         *) osname=newsos ;;
3476                         esac
3477                         ;;
3478                 nonstop-ux) osname=nonstopux ;;
3479                 openbsd) osname=openbsd
3480                         osvers="$3"
3481                         ;;
3482                 os2)    osname=os2
3483                         osvers="$4"
3484                         ;;
3485                 POSIX-BC | posix-bc ) osname=posix-bc
3486                         osvers="$3"
3487                         ;;
3488                 powerux | power_ux | powermax_os | powermaxos | \
3489                 powerunix | power_unix) osname=powerux
3490                         osvers="$3"
3491                         ;;
3492                 qnx) osname=qnx
3493                         osvers="$4"
3494                         ;;
3495                 solaris) osname=solaris
3496                         case "$3" in
3497                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3498                         *)      osvers="$3" ;;
3499                         esac
3500                         ;;
3501                 sunos) osname=sunos
3502                         case "$3" in
3503                         5*) osname=solaris
3504                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3505                         *)      osvers="$3" ;;
3506                         esac
3507                         ;;
3508                 titanos) osname=titanos
3509                         case "$3" in
3510                         1*) osvers=1 ;;
3511                         2*) osvers=2 ;;
3512                         3*) osvers=3 ;;
3513                         4*) osvers=4 ;;
3514                         *)      osvers="$3" ;;
3515                         esac
3516                         ;;
3517                 ultrix) osname=ultrix
3518                         osvers="$3"
3519                         ;;
3520                 osf1|mls+)      case "$5" in
3521                                 alpha)
3522                                         osname=dec_osf
3523                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3524                                         case "$osvers" in
3525                                         [1-9].[0-9]*) ;;
3526                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3527                                         esac
3528                                         ;;
3529                         hp*)    osname=hp_osf1  ;;
3530                         mips)   osname=mips_osf1 ;;
3531                         esac
3532                         ;;
3533                 # UnixWare 7.1.2 is known as Open UNIX 8
3534                 openunix|unixware) osname=svr5
3535                         osvers="$4"
3536                         ;;
3537                 uts)    osname=uts
3538                         osvers="$3"
3539                         ;;
3540                 vos) osvers="$3"
3541                         ;;
3542                 $2) case "$osname" in
3543                         *isc*) ;;
3544                         *freebsd*) ;;
3545                         svr*)
3546                                 : svr4.x or possibly later
3547                                 case "svr$3" in
3548                                 ${osname}*)
3549                                         osname=svr$3
3550                                         osvers=$4
3551                                         ;;
3552                                 esac
3553                                 case "$osname" in
3554                                 svr4.0)
3555                                         : Check for ESIX
3556                                         if test -f /stand/boot ; then
3557                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3558                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3559                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3560                                                         if test -n "$isesix"; then
3561                                                                 osname=esix4
3562                                                         fi
3563                                                 fi
3564                                         fi
3565                                         ;;
3566                                 esac
3567                                 ;;
3568                         *)      if test -f /etc/systemid; then
3569                                         osname=sco
3570                                         set `echo $3 | $sed 's/\./ /g'` $4
3571                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3572                                                 osvers=$1.$2.$3
3573                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3574                                                 osvers=$1.$2
3575                                         elif $test -f $src/hints/sco_$1.sh; then
3576                                                 osvers=$1
3577                                         fi
3578                                 else
3579                                         case "$osname" in
3580                                         '') : Still unknown.  Probably a generic Sys V.
3581                                                 osname="sysv"
3582                                                 osvers="$3"
3583                                                 ;;
3584                                         esac
3585                                 fi
3586                                 ;;
3587                         esac
3588                         ;;
3589                 *)      case "$osname" in
3590                         '') : Still unknown.  Probably a generic BSD.
3591                                 osname="$1"
3592                                 osvers="$3"
3593                                 ;;
3594                         esac
3595                         ;;
3596                 esac
3597         else
3598                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3599                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3600                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3601                                 osname=news_os
3602                         fi
3603                         $rm -f UU/kernel.what
3604                 elif test -d c:/. -o -n "$is_os2" ; then
3605                         set X $myuname
3606                         osname=os2
3607                         osvers="$5"
3608                 fi
3609         fi
3610
3611         case "$targetarch" in
3612         '') ;;
3613         *)  hostarch=$osname
3614             case "$targetarch" in
3615                 nto*|*-nto-*)
3616                     # Will load qnx.sh, which should change osname to nto
3617                     osname=qnx
3618                     osvers=''
3619                     ;;
3620                 *linux-android*)
3621                     # Catch arm-linux-androideabi, mipsel-linux-android,
3622                     # and i686-linux-android
3623                     osname=linux-android
3624                     osvers=''
3625                     ;;
3626                 *linux*)
3627                     # Something like arm-linux-gnueabihf is really just
3628                     # plain linux.
3629                     osname=linux
3630                     osvers=''
3631                     ;;
3632                 *solaris*|*sunos*)
3633                     osname=solaris
3634                     # XXX perhaps we should just assume
3635                     # osvers to be 2, or maybe take the value
3636                     # from targetarch. Using $run before the
3637                     # hints are run is somewhat icky.
3638                     set X `$run $uname -a 2>/dev/null`
3639                     shift
3640                     case "$3" in
3641                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3642                         *)  osvers="$3" ;;
3643                     esac
3644                     ;;
3645                 *)
3646                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3647                     osvers=''
3648                 ;;
3649             esac
3650             ;;
3651         esac
3652
3653         : Now look for a hint file osname_osvers, unless one has been
3654         : specified already.
3655         case "$hintfile" in
3656         ''|' ')
3657                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3658                 : Also try without trailing minor version numbers.
3659                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3660                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3661                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3662                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3663                 case "$file" in
3664                 '') dflt=none ;;
3665                 *)  case "$osvers" in
3666                         '') dflt=$file
3667                                 ;;
3668                         *)  if $test -f $src/hints/$file.sh ; then
3669                                         dflt=$file
3670                                 elif $test -f $src/hints/$xfile.sh ; then
3671                                         dflt=$xfile
3672                                 elif $test -f $src/hints/$xxfile.sh ; then
3673                                         dflt=$xxfile
3674                                 elif $test -f $src/hints/$xxxfile.sh ; then
3675                                         dflt=$xxxfile
3676                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3677                                         dflt=$xxxxfile
3678                                 elif $test -f "$src/hints/${osname}.sh" ; then
3679                                         dflt="${osname}"
3680                                 else
3681                                         dflt=none
3682                                 fi
3683                                 ;;
3684                         esac
3685                         ;;
3686                 esac
3687                 if $test -f Policy.sh ; then
3688                         case "$dflt" in
3689                         *Policy*) ;;
3690                         none) dflt="Policy" ;;
3691                         *) dflt="Policy $dflt" ;;
3692                         esac
3693                 fi
3694                 ;;
3695         *)
3696                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3697                 ;;
3698         esac
3699
3700         if $test -f Policy.sh ; then
3701                 $cat <<EOM
3702
3703 There's also a Policy hint file available, which should make the
3704 site-specific (policy) questions easier to answer.
3705 EOM
3706
3707         fi
3708
3709         $cat <<EOM
3710
3711 You may give one or more space-separated answers, or "none" if appropriate.
3712 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3713 previous run of Configure, you may specify it as well as or instead of
3714 OS-specific hints.  If hints are provided for your OS, you should use them:
3715 although Perl can probably be built without hints on many platforms, using
3716 hints often improve performance and may enable features that Configure can't
3717 set up on its own. If there are no hints that match your OS, specify "none";
3718 DO NOT give a wrong version or a wrong OS.
3719
3720 EOM
3721
3722         rp="Which of these apply, if any?"
3723         . UU/myread
3724         tans=$ans
3725         for file in $tans; do
3726                 if $test X$file = XPolicy -a -f Policy.sh; then
3727                         . Policy.sh
3728                         $cat Policy.sh >> UU/config.sh
3729                 elif $test -f $src/hints/$file.sh; then
3730                         . $src/hints/$file.sh
3731                         $cat $src/hints/$file.sh >> UU/config.sh
3732                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3733                         : nothing
3734                 else
3735                         : Give one chance to correct a possible typo.
3736                         echo "$file.sh does not exist"
3737                         dflt=$file
3738                         rp="hint to use instead?"
3739                         . UU/myread
3740                         for file in $ans; do
3741                                 if $test -f "$src/hints/$file.sh"; then
3742                                         . $src/hints/$file.sh
3743                                         $cat $src/hints/$file.sh >> UU/config.sh
3744                                 elif $test X$ans = X -o X$ans = Xnone ; then
3745                                         : nothing
3746                                 else
3747                                         echo "$file.sh does not exist -- ignored."
3748                                 fi
3749                         done
3750                 fi
3751         done
3752
3753         hint=recommended
3754         : Remember our hint file for later.
3755         if $test -f "$src/hints/$file.sh" ; then
3756                 hintfile="$file"
3757         else
3758                 hintfile=''
3759         fi
3760 fi
3761 cd UU
3762 ;;
3763 *)
3764         echo " "
3765         echo "Fetching default answers from $config_sh..." >&4
3766         tmp_n="$n"
3767         tmp_c="$c"
3768         cd ..
3769         cp $config_sh config.sh 2>/dev/null
3770         chmod +w config.sh
3771         . ./config.sh
3772         cd UU
3773         cp ../config.sh .
3774         n="$tmp_n"
3775         c="$tmp_c"
3776         hint=previous
3777         ;;
3778 esac
3779 test "$override" && . ./optdef.sh
3780
3781 : Restore computed paths
3782 for file in $loclist $trylist; do
3783         eval $file="\$_$file"
3784 done
3785
3786 cat << EOM
3787
3788 Configure uses the operating system name and version to set some defaults.
3789 The default value is probably right if the name rings a bell. Otherwise,
3790 since spelling matters for me, either accept the default or answer "none"
3791 to leave it blank.
3792
3793 EOM
3794 case "$osname" in
3795         ''|' ')
3796                 case "$hintfile" in
3797                 ''|' '|none) dflt=none ;;
3798                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3799                 esac
3800                 ;;
3801         *) dflt="$osname" ;;
3802 esac
3803 rp="Operating system name?"
3804 . ./myread
3805 case "$ans" in
3806 none)  osname='' ;;
3807 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3808 esac
3809 echo " "
3810 case "$osvers" in
3811         ''|' ')
3812                 case "$hintfile" in
3813                 ''|' '|none) dflt=none ;;
3814                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3815                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3816                         case "$dflt" in
3817                         ''|' ') dflt=none ;;
3818                         esac
3819                         ;;
3820                 esac
3821                 ;;
3822         *) dflt="$osvers" ;;
3823 esac
3824 rp="Operating system version?"
3825 . ./myread
3826 case "$ans" in
3827 none)  osvers='' ;;
3828 *) osvers="$ans" ;;
3829 esac
3830
3831
3832 . ./posthint.sh
3833
3834 : who configured the system
3835 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3836 case "$cf_by" in
3837 "")
3838         cf_by=`(logname) 2>/dev/null`
3839         case "$cf_by" in
3840         "")
3841                 cf_by=`(whoami) 2>/dev/null`
3842                 case "$cf_by" in
3843                 "") cf_by=unknown ;;
3844                 esac ;;
3845         esac ;;
3846 esac
3847
3848 : decide how portable to be.  Allow command line overrides.
3849 case "$d_portable" in
3850 "$undef") ;;
3851 *)      d_portable="$define" ;;
3852 esac
3853
3854 : set up shell script to do ~ expansion
3855 cat >filexp <<EOSS
3856 $startsh
3857 : expand filename
3858 case "\$1" in
3859  \~/*|\~)
3860         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3861         ;;
3862  \~*)
3863         if $test -f /bin/csh; then
3864                 /bin/csh -f -c "glob \$1"
3865                 failed=\$?
3866                 echo ""
3867                 exit \$failed
3868         else
3869                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3870                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3871                 if $test ! -d "\$dir"; then
3872                         me=\`basename \$0\`
3873                         echo "\$me: can't locate home directory for: \$name" >&2
3874                         exit 1
3875                 fi
3876                 case "\$1" in
3877                 */*)
3878                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3879                         ;;
3880                 *)
3881                         echo \$dir
3882                         ;;
3883                 esac
3884         fi
3885         ;;
3886 *)
3887         echo \$1
3888         ;;
3889 esac
3890 EOSS
3891 chmod +x filexp
3892 $eunicefix filexp
3893
3894 : now set up to get a file name
3895 cat <<EOS >getfile
3896 $startsh
3897 EOS
3898 cat <<'EOSC' >>getfile
3899 tilde=''
3900 fullpath=''
3901 already=''
3902 skip=''
3903 none_ok=''
3904 exp_file=''
3905 nopath_ok=''
3906 orig_rp="$rp"
3907 orig_dflt="$dflt"
3908 case "$gfpth" in
3909 '') gfpth='.' ;;
3910 esac
3911
3912 case "$fn" in
3913 *\(*)
3914         : getfile will accept an answer from the comma-separated list
3915         : enclosed in parentheses even if it does not meet other criteria.
3916         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3917         fn=`echo $fn | sed 's/(.*)//'`
3918         ;;
3919 esac
3920
3921 case "$fn" in
3922 *:*)
3923         loc_file=`expr $fn : '.*:\(.*\)'`
3924         fn=`expr $fn : '\(.*\):.*'`
3925         ;;
3926 esac
3927
3928 case "$fn" in
3929 *~*) tilde=true;;
3930 esac
3931 case "$fn" in
3932 */*) fullpath=true;;
3933 esac
3934 case "$fn" in
3935 *+*) skip=true;;
3936 esac
3937 case "$fn" in
3938 *n*) none_ok=true;;
3939 esac
3940 case "$fn" in
3941 *e*) exp_file=true;;
3942 esac
3943 case "$fn" in
3944 *p*) nopath_ok=true;;
3945 esac
3946
3947 case "$fn" in
3948 *f*) type='File';;
3949 *d*) type='Directory';;
3950 *l*) type='Locate';;
3951 esac
3952
3953 what="$type"
3954 case "$what" in
3955 Locate) what='File';;
3956 esac
3957
3958 case "$exp_file" in
3959 '')
3960         case "$d_portable" in
3961         "$define") ;;
3962         *) exp_file=true;;
3963         esac
3964         ;;
3965 esac
3966
3967 cd ..
3968 while test "$type"; do
3969         redo=''
3970         rp="$orig_rp"
3971         dflt="$orig_dflt"
3972         case "$tilde" in
3973         true) rp="$rp (~name ok)";;
3974         esac
3975         . UU/myread
3976         if test -f UU/getfile.ok && \
3977                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3978         then
3979                 value="$ans"
3980                 ansexp="$ans"
3981                 break
3982         fi
3983         case "$ans" in
3984         none)
3985                 value=''
3986                 ansexp=''
3987                 case "$none_ok" in
3988                 true) type='';;
3989                 esac
3990                 ;;
3991         *)
3992                 case "$tilde" in
3993                 '') value="$ans"
3994                         ansexp="$ans";;
3995                 *)
3996                         value=`UU/filexp $ans`
3997                         case $? in
3998                         0)
3999                                 if test "$ans" != "$value"; then
4000                                         echo "(That expands to $value on this system.)"
4001                                 fi
4002                                 ;;
4003                         *) value="$ans";;
4004                         esac
4005                         ansexp="$value"
4006                         case "$exp_file" in
4007                         '') value="$ans";;
4008                         esac
4009                         ;;
4010                 esac
4011                 case "$fullpath" in
4012                 true)
4013                         case "$ansexp" in
4014                         /*) value="$ansexp" ;;
4015                         [a-zA-Z]:/*) value="$ansexp" ;;
4016                         *)
4017                                 redo=true
4018                                 case "$already" in
4019                                 true)
4020                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4021                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4022                                         ;;
4023                                 *)
4024                                 echo "Please give a full path name, starting with slash." >&4
4025                                         case "$tilde" in
4026                                         true)
4027                                 echo "Note that using ~name is ok provided it expands well." >&4
4028                                                 already=true
4029                                                 ;;
4030                                         esac
4031                                 esac
4032                                 ;;
4033                         esac
4034                         ;;
4035                 esac
4036                 case "$redo" in
4037                 '')
4038                         case "$type" in
4039                         File)
4040                                 for fp in $gfpth; do
4041                                         if test "X$fp" = X.; then
4042                                             pf="$ansexp"
4043                                         else    
4044                                             pf="$fp/$ansexp"
4045                                         fi
4046                                         if test -f "$pf"; then
4047                                                 type=''
4048                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4049                                         then
4050                                                 echo "($value is not a plain file, but that's ok.)"
4051                                                 type=''
4052                                         fi
4053                                         if test X"$type" = X; then
4054                                             value="$pf"
4055                                             break
4056                                         fi
4057                                 done
4058                                 ;;
4059                         Directory)
4060                                 for fp in $gfpth; do
4061                                         if test "X$fp" = X.; then
4062                                             dir="$ans"
4063                                             direxp="$ansexp"
4064                                         else    
4065                                             dir="$fp/$ansexp"
4066                                             direxp="$fp/$ansexp"
4067                                         fi
4068                                         if test -d "$direxp"; then
4069                                                 type=''
4070                                                 value="$dir"
4071                                                 break
4072                                         fi
4073                                 done
4074                                 ;;
4075                         Locate)
4076                                 if test -d "$ansexp"; then
4077                                         echo "(Looking for $loc_file in directory $value.)"
4078                                         value="$value/$loc_file"
4079                                         ansexp="$ansexp/$loc_file"
4080                                 fi
4081                                 if test -f "$ansexp"; then
4082                                         type=''
4083                                 fi
4084                                 case "$nopath_ok" in
4085                                 true)   case "$value" in
4086                                         */*) ;;
4087                                         *)      echo "Assuming $value will be in people's path."
4088                                                 type=''
4089                                                 ;;
4090                                         esac
4091                                         ;;
4092                                 esac
4093                                 ;;
4094                         esac
4095
4096                         case "$skip" in
4097                         true) type='';
4098                         esac
4099
4100                         case "$type" in
4101                         '') ;;
4102                         *)
4103                                 if test "$fastread" = yes; then
4104                                         dflt=y
4105                                 else
4106                                         dflt=n
4107                                 fi
4108                                 rp="$what $value doesn't exist.  Use that name anyway?"
4109                                 . UU/myread
4110                                 dflt=''
4111                                 case "$ans" in
4112                                 y*) type='';;
4113                                 *) echo " ";;
4114                                 esac
4115                                 ;;
4116                         esac
4117                         ;;
4118                 esac
4119                 ;;
4120         esac
4121 done
4122 cd UU
4123 ans="$value"
4124 rp="$orig_rp"
4125 dflt="$orig_dflt"
4126 rm -f getfile.ok
4127 test "X$gfpthkeep" != Xy && gfpth=""
4128 EOSC
4129
4130 : determine root of directory hierarchy where package will be installed.
4131 case "$prefix" in
4132 '')
4133         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4134         ;;
4135 *?/)
4136         dflt=`echo "$prefix" | sed 's/.$//'`
4137         ;;
4138 *)
4139         dflt="$prefix"
4140         ;;
4141 esac
4142 $cat <<EOM
4143
4144 By default, $package will be installed in $dflt/bin, manual pages
4145 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4146 installation directories. Typically this is something like /usr/local.
4147 If you wish to have binaries under /usr/bin but other parts of the
4148 installation under /usr/local, that's ok: you will be prompted
4149 separately for each of the installation directories, the prefix being
4150 only used to set the defaults.
4151
4152 EOM
4153 fn=d~
4154 rp='Installation prefix to use?'
4155 . ./getfile
4156 oldprefix=''
4157 case "$prefix" in
4158 '') ;;
4159 *)
4160         case "$ans" in
4161         "$prefix") ;;
4162         *) oldprefix="$prefix";;
4163         esac
4164         ;;
4165 esac
4166 prefix="$ans"
4167 prefixexp="$ansexp"
4168
4169 : allow them to override the AFS root
4170 case "$afsroot" in
4171 '')     afsroot=/afs ;;
4172 *)      afsroot=$afsroot ;;
4173 esac
4174
4175 : is AFS running?
4176 echo " "
4177 case "$afs" in
4178 $define|true)   afs=true ;;
4179 $undef|false)   afs=false ;;
4180 *)      if $test -d $afsroot; then
4181                 afs=true
4182         else
4183                 afs=false
4184         fi
4185         ;;
4186 esac
4187 if $afs; then
4188         echo "AFS may be running... I'll be extra cautious then..." >&4
4189 else
4190         echo "AFS does not seem to be running..." >&4
4191 fi
4192
4193 : determine installation prefix for where package is to be installed.
4194 if $afs; then
4195 $cat <<EOM
4196
4197 Since you are running AFS, I need to distinguish the directory in which
4198 files will reside from the directory in which they are installed (and from
4199 which they are presumably copied to the former directory by occult means).
4200
4201 EOM
4202         case "$installprefix" in
4203         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4204         *) dflt="$installprefix";;
4205         esac
4206 else
4207 $cat <<EOM
4208
4209 In some special cases, particularly when building $package for distribution,
4210 it is convenient to distinguish the directory in which files should be
4211 installed from the directory ($prefix) in which they will
4212 eventually reside.  For most users, these two directories are the same.
4213
4214 EOM
4215         case "$installprefix" in
4216         '') dflt=$prefix ;;
4217         *) dflt=$installprefix;;
4218         esac
4219 fi
4220 fn=d~
4221 rp='What installation prefix should I use for installing files?'
4222 . ./getfile
4223 installprefix="$ans"
4224 installprefixexp="$ansexp"
4225
4226 : Perform the prefixexp/installprefixexp correction if necessary
4227 cat <<EOS >installprefix
4228 $startsh
4229 EOS
4230 cat <<'EOSC' >>installprefix
4231 : Change installation prefix, if necessary.
4232 if $test X"$prefix" != X"$installprefix"; then
4233     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4234 else
4235     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4236 fi
4237 EOSC
4238 chmod +x installprefix
4239 $eunicefix installprefix
4240
4241 : Set variables such as privlib and privlibexp from the output of ./getfile
4242 : performing the prefixexp/installprefixexp correction if necessary.
4243 cat <<EOS >setprefixvar
4244 $startsh
4245 EOS
4246 cat <<'EOSC' >>setprefixvar
4247 eval "${prefixvar}=\"\$ans\""
4248 eval "${prefixvar}exp=\"\$ansexp\""
4249 . ./installprefix
4250 EOSC
4251 chmod +x setprefixvar
4252 $eunicefix setprefixvar
4253
4254 : set up the script used to warn in case of inconsistency
4255 cat <<EOS >whoa
4256 $startsh
4257 EOS
4258 cat <<'EOSC' >>whoa
4259 dflt=y
4260 case "$hint" in
4261     recommended)
4262         case "$hintfile" in
4263         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4264                 ;;
4265         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4266                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4267                 ;;
4268         esac
4269         ;;
4270     *)  echo " "
4271         echo "*** WHOA THERE!!! ***" >&4
4272         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4273         ;;
4274 esac
4275 rp="    Keep the $hint value?"
4276 . ./myread
4277 case "$ans" in
4278 y) td=$was; tu=$was;;
4279 esac
4280 EOSC
4281
4282 : function used to set '$1' to '$val'
4283 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4284 case "$val$was" in
4285 $define$undef) . ./whoa; eval "$var=\$td";;
4286 $undef$define) . ./whoa; eval "$var=\$tu";;
4287 *) eval "$var=$val";;
4288 esac'
4289
4290 : get the patchlevel
4291 echo " "
4292 echo "Getting the current patchlevel..." >&4
4293 if $test -r $rsrc/patchlevel.h;then
4294         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4295         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4296         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4297         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4298         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4299         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4300         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4301 else
4302         revision=0
4303         patchlevel=0
4304         subversion=0
4305         api_revision=0
4306         api_version=0
4307         api_subversion=0
4308         perl_patchlevel=0
4309         $echo "(You do not have patchlevel.h.  Eek.)"
4310 fi
4311 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4312 version_patchlevel_string="version $patchlevel subversion $subversion"
4313 case "$perl_patchlevel" in
4314 0|'') ;;
4315 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4316     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4317     ;;
4318 esac
4319
4320 $echo "(You have $package $version_patchlevel_string.)"
4321
4322 case "$osname" in
4323 dos|vms)
4324         : XXX Should be a Configure test for double-dots in filenames.
4325         version=`echo $revision $patchlevel $subversion | \
4326                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4327         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4328                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4329         ;;
4330 *)
4331         version=`echo $revision $patchlevel $subversion | \
4332                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4333         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4334                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4335         ;;
4336 esac
4337 : Special case the 5.005_xx maintenance series, which used 5.005
4338 : without any subversion label as a subdirectory in $sitelib
4339 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4340         api_versionstring='5.005'
4341 fi
4342
4343 : Do we want threads support and if so, what type
4344 case "$usethreads" in
4345 $define|true|[yY]*)     dflt='y';;
4346 *)     # Catch case where user specified ithreads or 5005threads but
4347        # forgot -Dusethreads (A.D. 4/2002)
4348        case "$useithreads$use5005threads" in
4349        *$define*)       dflt='y';;
4350        *)               dflt='n';;
4351        esac
4352        ;;
4353 esac
4354 cat <<EOM
4355
4356 Perl can be built to offer a form of threading support on some systems
4357 To do so, Configure can be run with -Dusethreads.
4358
4359 Note that Perl built with threading support runs slightly slower
4360 and uses slightly more memory than plain Perl.
4361
4362 If this doesn't make any sense to you, just accept the default '$dflt'.
4363 EOM
4364 rp='Build a threading Perl?'
4365 . ./myread
4366 case "$ans" in
4367 y|Y)    val="$define" ;;
4368 *)      val="$undef" ;;
4369 esac
4370 set usethreads
4371 eval $setvar
4372
4373 if $test $patchlevel -lt 9; then
4374     case "$usethreads" in
4375     $define)
4376         : Default to ithreads unless overridden on command line or with
4377         : old config.sh
4378         dflt='y'
4379         case "$use5005threads" in
4380                 $define|true|[yY]*)
4381                         echo "5.005 threads are no longer supported"
4382                         exit 1
4383                 ;;
4384         esac
4385         case "$useithreads" in
4386                 $undef|false|[nN]*) dflt='n';;
4387         esac
4388         rp='Use the newer interpreter-based ithreads?'
4389         . ./myread
4390         case "$ans" in
4391         y|Y)    val="$define" ;;
4392         *)      val="$undef" ;;
4393         esac
4394         set useithreads
4395         eval $setvar
4396         : Now set use5005threads to the opposite value.
4397         case "$useithreads" in
4398         $define) val="$undef" ;;
4399         *) val="$define" ;;
4400         esac
4401         set use5005threads
4402         eval $setvar
4403         ;;
4404     *)
4405         useithreads="$undef"
4406         use5005threads="$undef"
4407         ;;
4408     esac
4409
4410     case "$useithreads$use5005threads" in
4411     "$define$define")
4412         $cat >&4 <<EOM
4413
4414 You cannot have both the ithreads and the 5.005 threads enabled
4415 at the same time.  Disabling the 5.005 threads since they are
4416 much less stable than the ithreads.
4417
4418 EOM
4419         use5005threads="$undef"
4420         ;;
4421     esac
4422
4423 else
4424 : perl-5.9.x and later
4425
4426     if test X"$usethreads" = "X$define"; then
4427         case "$use5005threads" in
4428             $define|true|[yY]*)
4429                 $cat >&4 <<EOM
4430
4431 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4432
4433 EOM
4434             ;;
4435         esac
4436     fi
4437
4438     use5005threads="$undef"
4439     useithreads="$usethreads"
4440 fi
4441
4442 case "$d_oldpthreads" in
4443 '')     : Configure tests would be welcome here.  For now, assume undef.
4444         val="$undef" ;;
4445 *)      val="$d_oldpthreads" ;;
4446 esac
4447 set d_oldpthreads
4448 eval $setvar
4449
4450
4451 : Look for a hint-file generated 'call-back-unit'.  If the
4452 : user has specified that a threading perl is to be built,
4453 : we may need to set or change some other defaults.
4454 if $test -f usethreads.cbu; then
4455     echo "Your platform has some specific hints regarding threaded builds, using them..."
4456     . ./usethreads.cbu
4457 else
4458     case "$usethreads" in
4459         "$define"|true|[yY]*)
4460                 $cat <<EOM
4461 (Your platform does not have any specific hints for threaded builds.
4462  Assuming POSIX threads, then.)
4463 EOM
4464         ;;
4465     esac
4466 fi
4467
4468 : Check if multiplicity is required
4469 cat <<EOM
4470
4471 Perl can be built so that multiple Perl interpreters can coexist
4472 within the same Perl executable.
4473 EOM
4474
4475 case "$useithreads" in
4476 $define)
4477         cat <<EOM
4478 This multiple interpreter support is required for interpreter-based threads.
4479 EOM
4480         val="$define"
4481         ;;
4482 *)      case "$usemultiplicity" in
4483         $define|true|[yY]*)     dflt='y';;
4484         *) dflt='n';;
4485         esac
4486         echo " "
4487         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4488         rp='Build Perl for multiplicity?'
4489         . ./myread
4490         case "$ans" in
4491         y|Y)    val="$define" ;;
4492         *)      val="$undef" ;;
4493         esac
4494         ;;
4495 esac
4496 set usemultiplicity
4497 eval $setvar
4498
4499 : Check if morebits is requested
4500 case "$usemorebits" in
4501 "$define"|true|[yY]*)
4502         use64bitint="$define"
4503         uselongdouble="$define"
4504         usemorebits="$define"
4505         ;;
4506 *)      usemorebits="$undef"
4507         ;;
4508 esac
4509
4510 : Determine the C compiler to be used
4511 echo " "
4512 case "$cc" in
4513 '') dflt=cc;;
4514 *) dflt="$cc";;
4515 esac
4516 rp="Use which C compiler?"
4517 . ./myread
4518 cc="$ans"
4519
4520 : See whether they have no cc but they do have gcc
4521 . ./trygcc
4522 if $test -f cc.cbu; then
4523     . ./cc.cbu
4524 fi
4525 . ./checkcc
4526
4527 : make some quick guesses about what we are up against
4528 echo " "
4529 $echo $n "Hmm...  $c"
4530 echo exit 1 >bsd
4531 echo exit 1 >usg
4532 echo exit 1 >v7
4533 echo exit 1 >osf1
4534 echo exit 1 >eunice
4535 echo exit 1 >xenix
4536 echo exit 1 >venix
4537 echo exit 1 >os2
4538 d_bsd="$undef"
4539 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4540 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4541 then
4542         echo "Looks kind of like an OSF/1 system, but we'll see..."
4543         echo exit 0 >osf1
4544 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4545         xxx=`./loc addbib blurfl $pth`
4546         if $test -f $xxx; then
4547         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4548                 echo exit 0 >bsd
4549                 echo exit 0 >usg
4550         else
4551                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4552                         echo "Looks kind of like an extended USG system, but we'll see..."
4553                 else
4554                         echo "Looks kind of like a USG system, but we'll see..."
4555                 fi
4556                 echo exit 0 >usg
4557         fi
4558 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4559         echo "Looks kind of like a BSD system, but we'll see..."
4560         d_bsd="$define"
4561         echo exit 0 >bsd
4562 else
4563         echo "Looks kind of like a Version 7 system, but we'll see..."
4564         echo exit 0 >v7
4565 fi
4566 case "$eunicefix" in
4567 *unixtovms*)
4568         $cat <<'EOI'
4569 There is, however, a strange, musty smell in the air that reminds me of
4570 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4571 EOI
4572         echo exit 0 >eunice
4573         d_eunice="$define"
4574 : it so happens the Eunice I know will not run shell scripts in Unix format
4575         ;;
4576 *)
4577         echo " "
4578         echo "Congratulations.  You aren't running Eunice."
4579         d_eunice="$undef"
4580         ;;
4581 esac
4582 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4583 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4584 : semicolon as a patch separator
4585 case "$p_" in
4586 :) ;;
4587 *)
4588         $cat <<'EOI'
4589 I have the feeling something is not exactly right, however...don't tell me...
4590 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4591 (Or you may be running DOS with DJGPP.)
4592 EOI
4593         echo exit 0 >os2
4594         ;;
4595 esac
4596 if test -f /xenix; then
4597         echo "Actually, this looks more like a XENIX system..."
4598         echo exit 0 >xenix
4599         d_xenix="$define"
4600 else
4601         echo " "
4602         echo "It's not Xenix..."
4603         d_xenix="$undef"
4604 fi
4605 chmod +x xenix
4606 $eunicefix xenix
4607 if test -f /venix; then
4608         echo "Actually, this looks more like a VENIX system..."
4609         echo exit 0 >venix
4610 else
4611         echo " "
4612         if ./xenix; then
4613                 : null
4614         else
4615                 echo "Nor is it Venix..."
4616         fi
4617 fi
4618 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4619 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4620 $rm -f foo
4621
4622 : Check if we are using GNU gcc and what its version is
4623 echo " "
4624 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4625 $cat >try.c <<EOM
4626 #include <stdio.h>
4627 int main() {
4628 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4629 #ifdef __VERSION__
4630         printf("%s\n", __VERSION__);
4631 #else
4632         printf("%s\n", "1");
4633 #endif
4634 #endif
4635         return(0);
4636 }
4637 EOM
4638 if $cc -o try $ccflags $ldflags try.c; then
4639         gccversion=`$run ./try`
4640         case "$gccversion" in
4641         '') echo "You are not using GNU cc." ;;
4642         *)  echo "You are using GNU cc $gccversion."
4643             ccname=gcc
4644             ;;
4645         esac
4646 else
4647         echo " "
4648         echo "*** WHOA THERE!!! ***" >&4
4649         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4650         case "$knowitall" in
4651         '')
4652         echo "    You'd better start hunting for one and let me know about it." >&4
4653                 exit 1
4654                 ;;
4655         esac
4656 fi
4657 $rm -f try try.*
4658 case "$gccversion" in
4659 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4660 esac
4661 case "$gccversion" in
4662 '') gccosandvers='' ;;
4663 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4664    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4665    gccshortvers=''
4666    case "$gccosandvers" in
4667    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4668    $osname$osvers) ;; # looking good
4669    $osname*) cat <<EOM >&4
4670
4671 *** WHOA THERE!!! ***
4672
4673     Your gcc has not been compiled for the exact release of
4674     your operating system ($gccosandvers versus $osname$osvers).
4675
4676     In general it is a good idea to keep gcc synchronized with
4677     the operating system because otherwise serious problems
4678     may ensue when trying to compile software, like Perl.
4679
4680     I'm trying to be optimistic here, though, and will continue.
4681     If later during the configuration and build icky compilation
4682     problems appear (headerfile conflicts being the most common
4683     manifestation), I suggest reinstalling the gcc to match
4684     your operating system release.
4685
4686 EOM
4687       ;;
4688    *) gccosandvers='' ;; # failed to parse, better be silent
4689    esac
4690    ;;
4691 esac
4692 case "$ccname" in
4693 '') ccname="$cc" ;;
4694 esac
4695
4696 # gcc 3.* complain about adding -Idirectories that they already know about,
4697 # so we will take those off from locincpth.
4698 case "$gccversion" in
4699 3*)
4700     echo "main(){}">try.c
4701     for incdir in $locincpth; do
4702        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4703              grep '^c[cp]p*[01]: warning: changing search order '`
4704        if test "X$warn" != X; then
4705            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4706        fi
4707     done
4708     $rm -f try try.*
4709 esac
4710
4711 # gcc 4.9 by default does some optimizations that break perl.
4712 # see ticket 121505.
4713 #
4714 # The -fwrapv disables those optimizations (and probably others,) so
4715 # for gcc 4.9 (and later, since the optimizations probably won't go
4716 # away), add -fwrapv unless the user requests -fno-wrapv, which
4717 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4718 # which turns the overflows -fwrapv ignores into runtime errors.
4719 case "$gccversion" in
4720 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4721     case "$ccflags" in
4722     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4723     *) ccflags="$ccflags -fwrapv" ;;
4724     esac
4725 esac
4726
4727 : What should the include directory be ?
4728 : Use sysroot if set, so findhdr looks in the right place.
4729 echo " "
4730 $echo $n "Hmm...  $c"
4731 dflt="$sysroot/usr/include"
4732 incpath=''
4733 mips_type=''
4734 if $test -f /bin/mips && /bin/mips; then
4735         echo "Looks like a MIPS system..."
4736         $cat >usr.c <<'EOCP'
4737 #ifdef SYSTYPE_BSD43
4738 /bsd43
4739 #endif
4740 EOCP
4741         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4742                 dflt='/bsd43/usr/include'
4743                 incpath='/bsd43'
4744                 mips_type='BSD 4.3'
4745         else
4746                 mips_type='System V'
4747         fi
4748         $rm -f usr.c usr.out
4749         echo "and you're compiling with the $mips_type compiler and libraries."
4750         xxx_prompt=y
4751         echo "exit 0" >mips
4752 else
4753         echo "Doesn't look like a MIPS system."
4754         xxx_prompt=n
4755         echo "exit 1" >mips
4756 fi
4757 chmod +x mips
4758 $eunicefix mips
4759 case "$usrinc" in
4760 '') ;;
4761 *) dflt="$usrinc";;
4762 esac
4763 case "$xxx_prompt" in
4764 y)      fn=d/
4765         echo " "
4766         rp='Where are the include files you want to use?'
4767         . ./getfile
4768         usrinc="$ans"
4769         ;;
4770 *)      usrinc="$dflt"
4771         ;;
4772 esac
4773
4774 : see how we invoke the C preprocessor
4775 echo " "
4776 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4777 cat <<'EOT' >testcpp.c
4778 #define ABC abc
4779 #define XYZ xyz
4780 ABC.XYZ
4781 EOT
4782 cd ..
4783 if test ! -f cppstdin; then
4784         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4785                 # AIX cc -E doesn't show the absolute headerfile
4786                 # locations but we'll cheat by using the -M flag.
4787                 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
4788         else
4789                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4790         fi
4791 else
4792         echo "Keeping your $hint cppstdin wrapper."
4793 fi
4794 chmod 755 cppstdin
4795 wrapper=`pwd`/cppstdin
4796 ok='false'
4797 cd UU
4798
4799 if $test "X$cppstdin" != "X" && \
4800         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4801         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4802 then
4803         echo "You used to use $cppstdin $cppminus so we'll use that again."
4804         case "$cpprun" in
4805         '') echo "But let's see if we can live without a wrapper..." ;;
4806         *)
4807                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4808                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4809                 then
4810                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4811                         ok='true'
4812                 else
4813                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4814                 fi
4815                 ;;
4816         esac
4817 else
4818         case "$cppstdin" in
4819         '') ;;
4820         *)
4821                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4822                 ;;
4823         esac
4824 fi
4825
4826 if $ok; then
4827         : nothing
4828 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4829         $cc -E <testcpp.c >testcpp.out 2>&1; \
4830         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4831         echo "Yup, it does."
4832         x_cpp="$cc $cppflags -E"
4833         x_minus='';
4834 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4835         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4836         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4837         echo "Yup, it does."
4838         x_cpp="$cc $cppflags -E"
4839         x_minus='-';
4840 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4841         $cc -P <testcpp.c >testcpp.out 2>&1; \
4842         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4843         echo "Yipee, that works!"
4844         x_cpp="$cc $cppflags -P"
4845         x_minus='';
4846 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4847         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4848         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4849         echo "At long last!"
4850         x_cpp="$cc $cppflags -P"
4851         x_minus='-';
4852 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4853         $cpp <testcpp.c >testcpp.out 2>&1; \
4854         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4855         echo "It works!"
4856         x_cpp="$cpp $cppflags"
4857         x_minus='';
4858 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4859         $cpp - <testcpp.c >testcpp.out 2>&1; \
4860         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4861         echo "Hooray, it works!  I was beginning to wonder."
4862         x_cpp="$cpp $cppflags"
4863         x_minus='-';
4864 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4865         $wrapper <testcpp.c >testcpp.out 2>&1; \
4866         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4867         x_cpp="$wrapper"
4868         x_minus=''
4869         echo "Eureka!"
4870 else
4871         dflt=''
4872         rp="No dice.  I can't find a C preprocessor.  Name one:"
4873         . ./myread
4874         x_cpp="$ans"
4875         x_minus=''
4876         $x_cpp <testcpp.c >testcpp.out 2>&1
4877         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4878                 echo "OK, that will do." >&4
4879         else
4880 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4881                 exit 1
4882         fi
4883 fi
4884
4885 case "$ok" in
4886 false)
4887         cppstdin="$x_cpp"
4888         cppminus="$x_minus"
4889         cpprun="$x_cpp"
4890         cpplast="$x_minus"
4891         set X $x_cpp
4892         shift
4893         case "$1" in
4894         "$cpp")
4895                 echo "Perhaps can we force $cc -E using a wrapper..."
4896                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4897                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4898                 then
4899                         echo "Yup, we can."
4900                         cppstdin="$wrapper"
4901                         cppminus='';
4902                 else
4903                         echo "Nope, we'll have to live without it..."
4904                 fi
4905                 ;;
4906         esac
4907         case "$cpprun" in
4908         "$wrapper")
4909                 cpprun=''
4910                 cpplast=''
4911                 ;;
4912         esac
4913         ;;
4914 esac
4915
4916 case "$cppstdin" in
4917 "$wrapper"|'cppstdin') ;;
4918 *) $rm -f $wrapper;;
4919 esac
4920 $rm -f testcpp.c testcpp.out
4921
4922 : Adjust cppfilter for path component separator
4923 case "$osname" in
4924 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4925 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4926 *)   cppfilter='' ;;
4927 esac
4928
4929 : Use gcc to determine libpth and incpth
4930 # If using gcc or clang, we can get better values for libpth, incpth
4931 # and usrinc directly from the compiler.
4932 # Note that ccname for clang is also gcc.
4933 case "$ccname" in
4934     gcc)
4935         $echo 'extern int foo;' > try.c
4936         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4937         shift
4938         if $test $# -gt 0; then
4939             incpth="$incpth $*"
4940             incpth="`$echo $incpth|$sed 's/^ //'`"
4941             for i in $*; do
4942                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4943                 if $test -d $j; then
4944                     libpth="$libpth $j"
4945                 fi
4946             done
4947             libpth="`$echo $libpth|$sed 's/^ //'`"
4948             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4949                 if $test -d $xxx; then
4950                     case " $libpth " in
4951                     *" $xxx "*) ;;
4952                     *) libpth="$libpth $xxx";;
4953                     esac
4954                 fi
4955             done
4956         fi
4957         $rm -f try.c
4958         case "$usrinc" in
4959         '') for i in $incpth; do
4960                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4961                     usrinc="$i"
4962                     break
4963                 fi
4964             done
4965             ;;
4966         esac
4967
4968         case "$usecrosscompile" in
4969         $define|true|[yY]*)
4970             case "$incpth" in
4971                 '') echo "Incpth not defined." >&4; croak=y ;;
4972                 *)  echo "Using incpth '$incpth'." >&4 ;;
4973             esac
4974             case "$libpth" in
4975                 '') echo "Libpth not defined." >&4; croak=y ;;
4976                 *)  echo "Using libpth '$libpth'." >&4 ;;
4977             esac
4978             case "$usrinc" in
4979                 '') echo "Usrinc not defined." >&4; croak=y ;;
4980                 *)  echo "Using usrinc $usrinc." >&4 ;;
4981             esac
4982             case "$croak" in
4983                 y)
4984                 if test "X$sysroot" = X; then
4985                     echo "Cannot continue, aborting." >&4; exit 1
4986                 else
4987                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4988                 fi
4989                 ;;
4990             esac
4991             ;;
4992         esac
4993     ;;
4994 esac
4995
4996 : Default value for incpth is just usrinc
4997 case "$incpth" in
4998 '') incpth="$usrinc";;
4999 esac
5000
5001 : Set private lib path
5002 case "$plibpth" in
5003 '') if ./mips; then
5004         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5005     fi;;
5006 esac
5007 case "$libpth" in
5008 ' ') dlist='';;
5009 '') dlist="$loclibpth $plibpth $glibpth";;
5010 *) dlist="$libpth";;
5011 esac
5012
5013 : Now check and see which directories actually exist, avoiding duplicates
5014 for xxx in $dlist
5015 do
5016     if $test -d $xxx; then
5017                 case " $libpth " in
5018                 *" $xxx "*) ;;
5019                 *) libpth="$libpth $xxx";;
5020                 esac
5021     fi
5022 done
5023 $cat <<'EOM'
5024
5025 Some systems have incompatible or broken versions of libraries.  Among
5026 the directories listed in the question below, please remove any you
5027 know not to be holding relevant libraries, and add any that are needed.
5028 Say "none" for none.
5029
5030 EOM
5031
5032 if test "X$sysroot" != X; then
5033     $cat <<EOM
5034 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5035
5036 EOM
5037 fi
5038
5039 case "$libpth" in
5040 '') dflt='none';;
5041 *)
5042         set X $libpth
5043         shift
5044         dflt=${1+"$@"}
5045         ;;
5046 esac
5047 rp="Directories to use for library searches?"
5048 . ./myread
5049 case "$ans" in
5050 none) libpth=' ';;
5051 *) libpth="$ans";;
5052 esac
5053
5054 : compute shared library extension
5055 case "$so" in
5056 '')
5057         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5058                 dflt='sl'
5059         else
5060                 dflt='so'
5061         fi
5062         ;;
5063 *) dflt="$so";;
5064 esac
5065 $cat <<EOM
5066
5067 On some systems, shared libraries may be available.  Answer 'none' if
5068 you want to suppress searching of shared libraries for the remainder
5069 of this configuration.
5070
5071 EOM
5072 rp='What is the file extension used for shared libraries?'
5073 . ./myread
5074 so="$ans"
5075
5076 : Does target system insist that shared library basenames are unique
5077 $cat << EOM
5078
5079 Some dynamic loaders assume that the *basename* of shared library filenames
5080 are globally unique.  We'll default this to undef as we assume your system
5081 is not this weird. Set to defined if you're on one of them.
5082
5083 EOM
5084
5085 dflt='n'
5086 rp='Make shared library basenames unique?'
5087 . ./myread
5088 case "$ans" in
5089 y|Y) val="$define" ;;
5090 *)   val="$undef"  ;;
5091 esac
5092 set d_libname_unique
5093 eval $setvar
5094
5095 : Define several unixisms.
5096 : Hints files or command line option can be used to override them.
5097 : The convoluted testing is in case hints files set either the old
5098 : or the new name.
5099 case "$_exe" in
5100 '')     case "$exe_ext" in
5101         '')     ;;
5102         *)      _exe="$exe_ext" ;;
5103         esac
5104         ;;
5105 esac
5106 case "$_a" in
5107 '')     case "$lib_ext" in
5108     '') _a='.a';;
5109         *)      _a="$lib_ext" ;;
5110         esac
5111         ;;
5112 esac
5113 case "$_o" in
5114 '') case "$obj_ext" in
5115         '')     _o='.o';;
5116         *)      _o="$obj_ext";;
5117         esac
5118         ;;
5119 esac
5120 case "$p_" in
5121 '') case "$path_sep" in
5122         '')     p_=':';;
5123         *)      p_="$path_sep";;
5124         esac
5125         ;;
5126 esac
5127 exe_ext=$_exe
5128 lib_ext=$_a
5129 obj_ext=$_o
5130 path_sep=$p_
5131
5132 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5133
5134 : Which makefile gets called first.  This is used by make depend.
5135 case "$firstmakefile" in
5136 '') firstmakefile='makefile';;
5137 esac
5138
5139 : Check is we will use socks
5140 case "$usesocks" in
5141 $define|true|[yY]*)     dflt='y';;
5142 *) dflt='n';;
5143 esac
5144 cat <<EOM
5145
5146 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5147 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5148 to use the PerlIO abstraction layer, this will be implicitly selected.
5149
5150 If this doesn't make any sense to you, just accept the default '$dflt'.
5151 EOM
5152 rp='Build Perl for SOCKS?'
5153 . ./myread
5154 case "$ans" in
5155 y|Y)    val="$define" ;;
5156 *)      val="$undef" ;;
5157 esac
5158 set usesocks
5159 eval $setvar
5160
5161 : Check for uselongdouble support
5162 case "$ccflags" in
5163 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5164 esac
5165
5166 case "$uselongdouble" in
5167 $define|true|[yY]*)     dflt='y';;
5168 *) dflt='n';;
5169 esac
5170 cat <<EOM
5171
5172 Perl can be built to take advantage of long doubles which
5173 (if available) may give more accuracy and range for floating point numbers.
5174
5175 If this doesn't make any sense to you, just accept the default '$dflt'.
5176 EOM
5177 rp='Try to use long doubles if available?'
5178 . ./myread
5179 case "$ans" in
5180 y|Y)    val="$define"   ;;
5181 *)      val="$undef"    ;;
5182 esac
5183 set uselongdouble
5184 eval $setvar
5185
5186 case "$uselongdouble" in
5187 true|[yY]*) uselongdouble="$define" ;;
5188 esac
5189
5190 : Look for a hint-file generated 'call-back-unit'.  If the
5191 : user has specified that long doubles should be used,
5192 : we may need to set or change some other defaults.
5193 if $test -f uselongdouble.cbu; then
5194     echo "Your platform has some specific hints regarding long doubles, using them..."
5195     . ./uselongdouble.cbu
5196 else
5197     case "$uselongdouble" in
5198         $define)
5199                 $cat <<EOM
5200 (Your platform does not have any specific hints for long doubles.)
5201 EOM
5202         ;;
5203     esac
5204 fi
5205
5206 : Check if quadmath is requested
5207 case "$usequadmath" in
5208 "$define"|true|[yY]*) usequadmath="$define" ;;
5209 *)                    usequadmath="$undef"  ;;
5210 esac
5211
5212 : Looking for optional libraries
5213 echo " "
5214 echo "Checking for optional libraries..." >&4
5215 case "$libs" in
5216 ' '|'') dflt='';;
5217 *) dflt="$libs";;
5218 esac
5219 case "$libswanted" in
5220 '') libswanted='c_s';;
5221 esac
5222 case "$usesocks" in
5223 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5224 esac
5225 case "$usecbacktrace" in
5226 "$define") libswanted="$libswanted bfd" ;;
5227 esac
5228 case "$usequadmath" in
5229 "$define") libswanted="$libswanted quadmath" ;;
5230 esac
5231 libsfound=''
5232 libsfiles=''
5233 libsdirs=''
5234 libspath=''
5235 for thisdir in $libpth $xlibpth; do
5236   test -d $thisdir && libspath="$libspath $thisdir"
5237 done
5238 for thislib in $libswanted; do
5239         for thisdir in $libspath; do
5240             xxx=''
5241             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5242                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5243                 $test -f "$xxx" && eval $libscheck
5244                 $test -f "$xxx" && libstyle=shared
5245                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5246                 $test -f "$xxx" && eval $libscheck
5247                 $test -f "$xxx" && libstyle=shared
5248             fi
5249             if test ! -f "$xxx"; then
5250                 xxx=$thisdir/lib$thislib.$so
5251                 $test -f "$xxx" && eval $libscheck
5252                 $test -f "$xxx" && libstyle=shared
5253             fi
5254             if test ! -f "$xxx"; then
5255                 xxx=$thisdir/lib$thislib$_a
5256                 $test -f "$xxx" && eval $libscheck
5257                 $test -f "$xxx" && libstyle=static
5258             fi
5259             if test ! -f "$xxx"; then
5260                 xxx=$thisdir/$thislib$_a
5261                 $test -f "$xxx" && eval $libscheck
5262                 $test -f "$xxx" && libstyle=static
5263             fi
5264             if test ! -f "$xxx"; then
5265                 xxx=$thisdir/lib${thislib}_s$_a
5266                 $test -f "$xxx" && eval $libscheck
5267                 $test -f "$xxx" && libstyle=static
5268                 $test -f "$xxx" && thislib=${thislib}_s
5269             fi
5270             if test ! -f "$xxx"; then
5271                 xxx=$thisdir/Slib$thislib$_a
5272                 $test -f "$xxx" && eval $libscheck
5273                 $test -f "$xxx" && libstyle=static
5274             fi
5275             if $test -f "$xxx"; then
5276                 case "$libstyle" in
5277                 shared) echo "Found -l$thislib (shared)." ;;
5278                 static) echo "Found -l$thislib." ;;
5279                 *)      echo "Found -l$thislib ($libstyle)." ;;
5280                 esac
5281                 case " $dflt " in
5282                 *"-l$thislib "*);;
5283                 *) dflt="$dflt -l$thislib"
5284                    libsfound="$libsfound $xxx"
5285                    yyy=`basename $xxx`
5286                    libsfiles="$libsfiles $yyy"
5287                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5288                    case " $libsdirs " in
5289                    *" $yyy "*) ;;
5290                    *) libsdirs="$libsdirs $yyy" ;;
5291                    esac
5292                    ;;
5293                 esac
5294                 break
5295             fi
5296         done
5297         if $test ! -f "$xxx"; then
5298             echo "No -l$thislib."
5299         fi
5300 done
5301 set X $dflt
5302 shift
5303 dflt="$*"
5304 case "$libs" in
5305 '') dflt="$dflt";;
5306 *) dflt="$libs";;
5307 esac
5308 case "$dflt" in
5309 ' '|'') dflt='none';;
5310 esac
5311
5312 $cat <<EOM
5313
5314 In order to compile $package on your machine, a number of libraries
5315 are usually needed.  Include any other special libraries here as well.
5316 Say "none" for none.  The default list is almost always right.
5317 EOM
5318
5319 echo " "
5320 rp="What libraries to use?"
5321 . ./myread
5322 case "$ans" in
5323 none) libs=' ';;
5324 *) libs="$ans";;
5325 esac
5326
5327 : determine optimization, if desired, or use for debug flag also
5328 case "$optimize" in
5329 ' '|$undef) dflt='none';;
5330 '') dflt='-O';;
5331 *) dflt="$optimize";;
5332 esac
5333 $cat <<EOH
5334
5335 By default, $package compiles with the -O flag to use the optimizer.
5336 Alternately, you might want to use the symbolic debugger, which uses
5337 the -g flag (on traditional Unix systems).  Either flag can be
5338 specified here.  To use neither flag, specify the word "none".
5339
5340 EOH
5341 rp="What optimizer/debugger flag should be used?"
5342 . ./myread
5343 optimize="$ans"
5344 case "$optimize" in
5345 'none') optimize=" ";;
5346 esac
5347
5348 : Check what DEBUGGING is required from the command line
5349 : -DEBUGGING      or -DDEBUGGING or
5350 : -DEBUGGING=both                       = -g + -DDEBUGGING
5351 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5352 : -DEBUGGING=none or -UDEBUGGING        =
5353 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5354 case "$EBUGGING" in
5355 '')     ;;
5356 *)      DEBUGGING=$EBUGGING ;;
5357 esac
5358
5359 case "$DEBUGGING" in
5360 -g|both|$define)
5361     case "$optimize" in
5362         *-g*) ;;
5363         *)    optimize="$optimize -g" ;;
5364     esac ;;
5365 none|$undef)
5366     case "$optimize" in
5367         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5368                 shift
5369                 optimize="$*"
5370                 ;;
5371     esac ;;
5372 esac
5373
5374 dflt=''
5375 case "$DEBUGGING" in
5376 both|$define) dflt='-DDEBUGGING'
5377 esac
5378
5379 : argument order is deliberate, as the flag will start with - which set could
5380 : think is an option
5381 checkccflag='check=$1; flag=$2; callback=$3;
5382 echo " ";
5383 echo "Checking if your compiler accepts $flag" 2>&1;
5384 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5385 echo "int main(void) { return 0; }" > gcctest.c;
5386 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5387     echo "Yes, it does." 2>&1;
5388     if $test -s gcctest.out ; then
5389         echo "But your platform does not like it:";
5390         cat gcctest.out;
5391     else
5392         case "$ccflags" in
5393         *$check*)
5394             echo "Leaving current flags $ccflags alone." 2>&1
5395             ;;
5396         *) dflt="$dflt $flag";
5397             eval $callback
5398             ;;
5399         esac
5400     fi
5401 else
5402     echo "Nope, it does not, but that is ok." 2>&1;
5403 fi
5404 '
5405
5406 : We will not override a previous value, but we might want to
5407 : augment a hint file
5408 case "$hint" in
5409 default|recommended)
5410         case "$gccversion" in
5411         1*) dflt="$dflt -fpcc-struct-return" ;;
5412         esac
5413         case "$optimize:$DEBUGGING" in
5414         *-g*:old) dflt="$dflt -DDEBUGGING";;
5415         esac
5416         case "$gccversion" in
5417         2*) if $test -d /etc/conf/kconfig.d &&
5418                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5419                 then
5420                         # Interactive Systems (ISC) POSIX mode.
5421                         dflt="$dflt -posix"
5422                 fi
5423                 ;;
5424         esac
5425         case "$gccversion" in
5426         1*) ;;
5427         2.[0-8]*) ;;
5428         ?*)     set strict-aliasing -fno-strict-aliasing
5429                 eval $checkccflag
5430                 ;;
5431         esac
5432         # For gcc, adding -pipe speeds up compilations for some, but apparently
5433         # some assemblers can't read from stdin.  (It also slows down compilations
5434         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5435         case "$gccversion" in
5436         ?*)     set pipe -pipe
5437                 eval $checkccflag
5438                 ;;
5439         esac
5440
5441         # on x86_64 (at least) we require an extra library (libssp) in the
5442         # link command line. This library is not named, so I infer that it is
5443         # an implementation detail that may change. Hence the safest approach
5444         # is to add the flag to the flags passed to the compiler at link time,
5445         # as that way the compiler can do the right implementation dependant
5446         # thing. (NWC)
5447         case "$osname" in
5448         amigaos) ;; # -fstack-protector builds but doesn't work
5449         *)      case "$gccversion" in
5450                 ?*)     set stack-protector-strong -fstack-protector-strong
5451                         eval $checkccflag
5452                         case "$dflt" in
5453                         *-fstack-protector-strong*) ;; # It got added.
5454                         *) # Try the plain/older -fstack-protector.
5455                            set stack-protector -fstack-protector
5456                            eval $checkccflag
5457                            ;;
5458                         esac
5459                         ;;
5460                 esac
5461                 ;;
5462         esac
5463         ;;
5464 esac
5465
5466 case "$mips_type" in
5467 *BSD*|'') inclwanted="$locincpth $usrinc";;
5468 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5469 esac
5470 for thisincl in $inclwanted; do
5471         if $test -d $thisincl; then
5472                 if $test x$thisincl != x$usrinc; then
5473                         case "$dflt" in
5474                         *" -I$thisincl "*);;
5475                         *) dflt="$dflt -I$thisincl ";;
5476                         esac
5477                 fi
5478         fi
5479 done
5480
5481 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5482         xxx=true;
5483 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5484         xxx=true;
5485 else
5486         xxx=false;
5487 fi;
5488 if $xxx; then
5489         case "$dflt" in
5490         *$2*);;
5491         *) dflt="$dflt -D$2";;
5492         esac;
5493 fi'
5494
5495 set signal.h LANGUAGE_C; eval $inctest
5496
5497 case "$usesocks" in
5498 $define)
5499         ccflags="$ccflags -DSOCKS"
5500         ;;
5501 esac
5502
5503 case "$hint" in
5504 default|recommended) dflt="$ccflags $dflt" ;;
5505 *) dflt="$ccflags";;
5506 esac
5507
5508 case "$dflt" in
5509 ''|' ') dflt=none;;
5510 esac
5511
5512 $cat <<EOH
5513
5514 Your C compiler may want other flags.  For this question you should include
5515 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5516 but you should NOT include libraries or ld flags like -lwhatever.  If you
5517 want $package to honor its debug switch, you should include -DDEBUGGING here.
5518 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5519
5520 To use no flags, specify the word "none".
5521
5522 EOH
5523 set X $dflt
5524 shift
5525 dflt=${1+"$@"}
5526 rp="Any additional cc flags?"
5527 . ./myread
5528 case "$ans" in
5529 none) ccflags='';;
5530 *) ccflags="$ans";;
5531 esac
5532
5533 : the following weeds options from ccflags that are of no interest to cpp
5534 case "$cppflags" in
5535 '') cppflags="$ccflags" ;;
5536 *)  cppflags="$cppflags $ccflags" ;;
5537 esac
5538 case "$gccversion" in
5539 1*) cppflags="$cppflags -D__GNUC__"
5540 esac
5541 case "$mips_type" in
5542 '');;
5543 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5544 esac
5545 case "$cppflags" in
5546 '');;
5547 *)
5548         echo " "
5549         echo "Let me guess what the preprocessor flags are..." >&4
5550         set X $cppflags
5551         shift
5552         cppflags=''
5553         $cat >cpp.c <<'EOM'
5554 #define BLURFL foo
5555
5556 BLURFL xx LFRULB
5557 EOM
5558         previous=''
5559         for flag in $*
5560         do
5561                 case "$flag" in
5562                 -*) ftry="$flag";;
5563                 *) ftry="$previous $flag";;
5564                 esac
5565                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5566                         >cpp1.out 2>/dev/null && \
5567                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5568                         >cpp2.out 2>/dev/null && \
5569                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5570                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5571                 then
5572                         cppflags="$cppflags $ftry"
5573                         previous=''
5574                 else
5575                         previous="$flag"
5576                 fi
5577         done
5578         set X $cppflags
5579         shift
5580         cppflags=${1+"$@"}
5581         case "$cppflags" in
5582         *-*)  echo "They appear to be: $cppflags";;
5583         esac
5584         $rm -f cpp.c cpp?.out
5585         ;;
5586 esac
5587
5588 : flags used in final linking phase
5589 case "$ldflags" in
5590 '') if ./venix; then
5591                 dflt='-i -z'
5592         else
5593                 dflt=''
5594         fi
5595         case "$ccflags" in
5596         *-posix*) dflt="$dflt -posix" ;;
5597         esac
5598         ;;
5599 *) dflt="$ldflags";;
5600 esac
5601 # See note above about -fstack-protector
5602 case "$ccflags" in
5603 *-fstack-protector-strong*)
5604         case "$dflt" in
5605         *-fstack-protector-strong*) ;; # Don't add it again
5606         *) dflt="$dflt -fstack-protector-strong" ;;
5607         esac
5608         ;;
5609 *-fstack-protector*)
5610         case "$dflt" in
5611         *-fstack-protector*) ;; # Don't add it again
5612         *) dflt="$dflt -fstack-protector" ;;
5613         esac
5614         ;;
5615 esac
5616
5617 : Try to guess additional flags to pick up local libraries.
5618 for thislibdir in $libpth; do
5619         case " $loclibpth " in
5620         *" $thislibdir "*)
5621                 case "$dflt " in
5622                 *"-L$thislibdir "*) ;;
5623                 *)  dflt="$dflt -L$thislibdir" ;;
5624                 esac
5625                 ;;
5626         esac
5627 done
5628
5629 case "$dflt" in
5630 '') dflt='none' ;;
5631 esac
5632
5633 $cat <<EOH
5634
5635 Your C linker may need flags.  For this question you should
5636 include -L/whatever and any other flags used by the C linker, but you
5637 should NOT include libraries like -lwhatever.
5638
5639 Make sure you include the appropriate -L/path flags if your C linker
5640 does not normally search all of the directories you specified above,
5641 namely
5642         $libpth
5643 To use no flags, specify the word "none".
5644
5645 EOH
5646
5647 rp="Any additional ld flags (NOT including libraries)?"
5648 . ./myread
5649 case "$ans" in
5650 none) ldflags='';;
5651 *) ldflags="$ans";;
5652 esac
5653 rmlist="$rmlist pdp11"
5654
5655 : coherency check
5656 echo " "
5657 echo "Checking your choice of C compiler and flags for coherency..." >&4
5658 $cat > try.c <<'EOF'
5659 #include <stdio.h>
5660 int main() { printf("Ok\n"); return(0); }
5661 EOF
5662 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5663 shift
5664 $cat >try.msg <<'EOM'
5665 I've tried to compile and run the following simple program:
5666
5667 EOM
5668 $cat try.c >> try.msg
5669
5670 $cat >> try.msg <<EOM
5671
5672 I used the command:
5673
5674         $*
5675         $run ./try
5676
5677 and I got the following output:
5678
5679 EOM
5680 dflt=y
5681 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5682         if $sh -c "$run ./try " >>try.msg 2>&1; then
5683                 xxx=`$run ./try`
5684                 case "$xxx" in
5685                 "Ok") dflt=n ;;
5686                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5687                 esac
5688         else
5689                 echo "The program compiled OK, but exited with status $?." >>try.msg
5690                 rp="You have a problem.  Shall I abort Configure"
5691                 dflt=y
5692         fi
5693 else
5694         echo "I can't compile the test program." >>try.msg
5695         rp="You have a BIG problem.  Shall I abort Configure"
5696         dflt=y
5697 fi
5698 case "$dflt" in
5699 y)
5700         $cat try.msg >&4
5701         case "$knowitall" in
5702         '')
5703                 echo "(The supplied flags or libraries might be incorrect.)"
5704                 ;;
5705         *) dflt=n;;
5706         esac
5707         echo " "
5708         . ./myread
5709         case "$ans" in
5710         n*|N*) ;;
5711         *)      echo "Ok.  Stopping Configure." >&4
5712                 exit 1
5713                 ;;
5714         esac
5715         ;;
5716 n) echo "OK, that should do.";;
5717 esac
5718 $rm_try gcctest gcctest.out
5719
5720 : define a shorthand compile call
5721 compile='
5722 mc_file=$1;
5723 shift;
5724 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5725 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5726 exit 1;
5727 fi;
5728 esac;
5729 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5730 : define a shorthand compile call for compilations that should be ok.
5731 compile_ok='
5732 mc_file=$1;
5733 shift;
5734 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5735
5736 : determine filename position in cpp output
5737 echo " "
5738 echo "Computing filename position in cpp output for #include directives..." >&4
5739 case "$osname" in
5740 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5741 esac
5742 case "$fieldn" in
5743 '')
5744 case "$osname" in
5745 vos) testaccess=-e ;;
5746 *)   testaccess=-r ;;
5747 esac
5748 echo '#include <stdio.h>' > foo.c
5749 $cat >fieldn <<EOF
5750 $startsh
5751 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5752 $grep '^[       ]*#.*stdio\.h' | \
5753 while read cline; do
5754         pos=1
5755         set \$cline
5756         while $test \$# -gt 0; do
5757                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5758                         echo "\$pos"
5759                         exit 0
5760                 fi
5761                 shift
5762                 pos=\`expr \$pos + 1\`
5763         done
5764 done
5765 EOF
5766 chmod +x fieldn
5767 fieldn=`./fieldn`
5768 $rm -f foo.c fieldn
5769 ;;
5770 esac
5771 case $fieldn in
5772 '') pos='???';;
5773 1) pos=first;;
5774 2) pos=second;;
5775 3) pos=third;;
5776 *) pos="${fieldn}th";;
5777 esac
5778 echo "Your cpp writes the filename in the $pos field of the line."
5779
5780 : locate header file
5781 $cat >findhdr <<EOF
5782 $startsh
5783 wanted=\$1
5784 name=''
5785 for usrincdir in $incpth
5786 do
5787         if test -f \$usrincdir/\$wanted; then
5788                 echo "\$usrincdir/\$wanted"
5789                 exit 0
5790         fi
5791 done
5792 awkprg='{ print \$$fieldn }'
5793 echo "#include <\$wanted>" > foo\$\$.c
5794 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5795 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5796 while read cline; do
5797         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5798         case "\$name" in
5799         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5800         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5801         *) exit 2;;
5802         esac;
5803 done;
5804 #
5805 # status = 0: grep returned 0 lines, case statement not executed
5806 # status = 1: headerfile found
5807 # status = 2: while loop executed, no headerfile found
5808 #
5809 status=\$?
5810 $rm -f foo\$\$.c;
5811 if test \$status -eq 1; then
5812         exit 0;
5813 fi
5814 exit 1
5815 EOF
5816 chmod +x findhdr
5817
5818 : define an alternate in-header-list? function
5819 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5820 cont=true; xxf="echo \"<\$1> found.\" >&4";
5821 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5822 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5823 esac;
5824 case $# in 4) instead=instead;; *) instead="at last";; esac;
5825 while $test "$cont"; do
5826         xxx=`./findhdr $1`
5827         var=$2; eval "was=\$$2";
5828         if $test "$xxx" && $test -r "$xxx";
5829         then eval $xxf;
5830         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5831                 cont="";
5832         else eval $xxnf;
5833         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5834         set $yyy; shift; shift; yyy=$@;
5835         case $# in 0) cont="";;
5836         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5837                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5838         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5839                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5840         esac;
5841 done;
5842 while $test "$yyy";
5843 do set $yyy; var=$2; eval "was=\$$2";
5844         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5845         set $yyy; shift; shift; yyy=$@;
5846 done'
5847
5848 : see if stdlib is available
5849 set stdlib.h i_stdlib
5850 eval $inhdr
5851
5852 : check for lengths of integral types
5853 echo " "
5854 case "$intsize" in
5855 '')
5856         echo "Checking to see how big your integers are..." >&4
5857         $cat >try.c <<EOCP
5858 #include <stdio.h>
5859 #$i_stdlib I_STDLIB
5860 #ifdef I_STDLIB
5861 #include <stdlib.h>
5862 #endif
5863 int main()
5864 {
5865         printf("intsize=%d;\n", (int)sizeof(int));
5866         printf("longsize=%d;\n", (int)sizeof(long));
5867         printf("shortsize=%d;\n", (int)sizeof(short));
5868         exit(0);
5869 }
5870 EOCP
5871         set try
5872         if eval $compile_ok && $run ./try > /dev/null; then
5873                 eval `$run ./try`
5874                 echo "Your integers are $intsize bytes long."
5875                 echo "Your long integers are $longsize bytes long."
5876                 echo "Your short integers are $shortsize bytes long."
5877         else
5878                 $cat >&4 <<EOM
5879 !
5880 Help! I can't compile and run the intsize test program: please enlighten me!
5881 (This is probably a misconfiguration in your system or libraries, and
5882 you really ought to fix it.  Still, I'll try anyway.)
5883 !
5884 EOM
5885                 dflt=4
5886                 rp="What is the size of an integer (in bytes)?"
5887                 . ./myread
5888                 intsize="$ans"
5889                 dflt=$intsize
5890                 rp="What is the size of a long integer (in bytes)?"
5891                 . ./myread
5892                 longsize="$ans"
5893                 dflt=2
5894                 rp="What is the size of a short integer (in bytes)?"
5895                 . ./myread
5896                 shortsize="$ans"
5897         fi
5898         ;;
5899 esac
5900 $rm_try
5901
5902 : check for long long
5903 echo " "
5904 echo "Checking to see if you have long long..." >&4
5905 echo 'int main() { long long x = 7; return 0; }' > try.c
5906 set try
5907 if eval $compile; then
5908         val="$define"
5909         echo "You have long long."
5910 else
5911         val="$undef"
5912         echo "You do not have long long."
5913 fi
5914 $rm_try
5915 set d_longlong
5916 eval $setvar
5917
5918 : check for length of long long
5919 case "${d_longlong}${longlongsize}" in
5920 $define)
5921         echo " "
5922         echo "Checking to see how big your long longs are..." >&4
5923         $cat >try.c <<'EOCP'
5924 #include <stdio.h>
5925 int main()
5926 {
5927     printf("%d\n", (int)sizeof(long long));
5928     return(0);
5929 }
5930 EOCP
5931         set try
5932         if eval $compile_ok; then
5933                 longlongsize=`$run ./try`
5934                 echo "Your long longs are $longlongsize bytes long."
5935         else
5936                 dflt='8'
5937                 echo " "
5938                 echo "(I can't seem to compile the test program.  Guessing...)"
5939                 rp="What is the size of a long long (in bytes)?"
5940                 . ./myread
5941                 longlongsize="$ans"
5942         fi
5943         if $test "X$longsize" = "X$longlongsize"; then
5944                 echo "(That isn't any different from an ordinary long.)"
5945         fi
5946         ;;
5947 esac
5948 $rm_try
5949
5950 : see if inttypes.h is available
5951 : we want a real compile instead of Inhdr because some systems
5952 : have an inttypes.h which includes non-existent headers
5953 echo " "
5954 $cat >try.c <<EOCP
5955 #include <inttypes.h>
5956 int main() {
5957         static int32_t foo32 = 0x12345678;
5958 }
5959 EOCP
5960 set try
5961 if eval $compile; then
5962         echo "<inttypes.h> found." >&4
5963         val="$define"
5964 else
5965         echo "<inttypes.h> NOT found." >&4
5966         val="$undef"
5967 fi
5968 $rm_try
5969 set i_inttypes
5970 eval $setvar
5971
5972 : check for int64_t
5973 echo " "
5974 echo "Checking to see if you have int64_t..." >&4
5975 $cat >try.c <<EOCP
5976 #include <sys/types.h>
5977 #$i_inttypes I_INTTYPES
5978 #ifdef I_INTTYPES
5979 #include <inttypes.h>
5980 #endif
5981 int main() { int64_t x = 7; }
5982 EOCP
5983 set try
5984 if eval $compile; then
5985         val="$define"
5986         echo "You have int64_t."
5987 else
5988         val="$undef"
5989         echo "You do not have int64_t."
5990 fi
5991 $rm_try
5992 set d_int64_t
5993 eval $setvar
5994
5995 : Check if 64bit ints have a quad type
5996 echo " "
5997 echo "Checking which 64-bit integer type we could use..." >&4
5998
5999 case "$intsize" in
6000 8) val=int
6001    set quadtype
6002    eval $setvar
6003    val='"unsigned int"'
6004    set uquadtype
6005    eval $setvar
6006    quadkind=1
6007    ;;
6008 *) case "$longsize" in
6009    8) val=long
6010       set quadtype
6011       eval $setvar
6012       val='"unsigned long"'
6013       set uquadtype
6014       eval $setvar
6015       quadkind=2
6016       ;;
6017    *) case "$d_longlong:$longlongsize" in
6018       define:8)
6019         val='"long long"'
6020         set quadtype
6021         eval $setvar
6022         val='"unsigned long long"'
6023         set uquadtype
6024         eval $setvar
6025         quadkind=3
6026         ;;
6027       *) case "$d_int64_t" in
6028          define)
6029            val=int64_t
6030            set quadtype
6031            eval $setvar
6032            val=uint64_t
6033            set uquadtype
6034            eval $setvar
6035            quadkind=4
6036            ;;
6037          esac
6038          ;;
6039       esac
6040       ;;
6041    esac
6042    ;;
6043 esac
6044
6045 case "$quadtype" in
6046 '')     echo "Alas, no 64-bit integer types in sight." >&4
6047         d_quad="$undef"
6048         ;;
6049 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6050         d_quad="$define"
6051         ;;
6052 esac
6053
6054 : Do we want 64bit support
6055 case "$uselonglong" in
6056 "$define"|true|[yY]*)
6057         cat <<EOM >&4
6058
6059 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6060 EOM
6061         use64bitint="$define"
6062         ;;
6063 esac
6064 case "$use64bits" in
6065 "$define"|true|[yY]*)
6066         cat <<EOM >&4
6067
6068 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6069 EOM
6070         use64bitint="$define"
6071         ;;
6072 esac
6073 case "$use64bitints" in
6074 "$define"|true|[yY]*)
6075         cat <<EOM >&4
6076
6077 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6078 EOM
6079         use64bitint="$define"
6080         ;;
6081 esac
6082 case "$use64bitsint" in
6083 "$define"|true|[yY]*)
6084         cat <<EOM >&4
6085
6086 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6087 EOM
6088         use64bitint="$define"
6089         ;;
6090 esac
6091 case "$uselonglongs" in
6092 "$define"|true|[yY]*)
6093         cat <<EOM >&4
6094
6095 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6096 EOM
6097         use64bitint="$define"
6098         ;;
6099 esac
6100 case "$use64bitsall" in
6101 "$define"|true|[yY]*)
6102         cat <<EOM >&4
6103
6104 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6105 EOM
6106         use64bitall="$define"
6107         ;;
6108 esac
6109
6110 case "$ccflags" in
6111 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6112 esac
6113 case "$use64bitall" in
6114 "$define"|true|[yY]*) use64bitint="$define" ;;
6115 esac
6116
6117 case "$longsize" in
6118 8) cat <<EOM
6119
6120 You have natively 64-bit long integers.
6121 EOM
6122    val="$define"
6123    ;;
6124 *) case "$use64bitint" in
6125    "$define"|true|[yY]*) dflt='y';;
6126    *) dflt='n';;
6127    esac
6128    case "$d_quad" in
6129    "$define") ;;
6130    *) dflt='n' ;;
6131    esac
6132    cat <<EOM
6133
6134 Perl can be built to take advantage of 64-bit integer types
6135 on some systems.  To do so, Configure can be run with -Duse64bitint.
6136 Choosing this option will most probably introduce binary incompatibilities.
6137
6138 If this doesn't make any sense to you, just accept the default '$dflt'.
6139 (The default has been chosen based on your configuration.)
6140 EOM
6141    rp='Try to use 64-bit integers, if available?'
6142    . ./myread
6143    case "$ans" in
6144    [yY]*) val="$define" ;;
6145    *)     val="$undef"  ;;
6146    esac
6147    ;;
6148 esac
6149 set use64bitint
6150 eval $setvar
6151
6152 case "$use64bitall" in
6153 "$define"|true|[yY]*) dflt='y' ;;
6154 *) case "$longsize" in
6155    8) dflt='y' ;;
6156    *) dflt='n' ;;
6157    esac
6158    ;;
6159 esac
6160 cat <<EOM
6161
6162 You may also choose to try maximal 64-bitness.  It means using as much
6163 64-bitness as possible on the platform.  This in turn means even more
6164 binary incompatibilities.  On the other hand, your platform may not
6165 have any more 64-bitness available than what you already have chosen.
6166
6167 If this doesn't make any sense to you, just accept the default '$dflt'.
6168 (The default has been chosen based on your configuration.)
6169 EOM
6170 rp='Try to use maximal 64-bit support, if available?'
6171 . ./myread
6172 case "$ans" in
6173 [yY]*) val="$define" ;;
6174 *)     val="$undef"  ;;
6175 esac
6176 set use64bitall
6177 eval $setvar
6178 case "$use64bitall" in
6179 "$define")
6180         case "$use64bitint" in
6181         "$undef")
6182                 cat <<EOM
6183
6184 Since you have chosen a maximally 64-bit build, I'm also turning on
6185 the use of 64-bit integers.
6186 EOM
6187                 use64bitint="$define" ;;
6188         esac
6189         ;;
6190 esac
6191
6192 : Look for a hint-file generated 'call-back-unit'.  If the
6193 : user has specified that a 64-bit perl is to be built,
6194 : we may need to set or change some other defaults.
6195 if $test -f use64bitint.cbu; then
6196         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6197         . ./use64bitint.cbu
6198 fi
6199 case "$use64bitint" in
6200 "$define"|true|[yY]*)
6201         : This test was common to all the OpenBSD forks, and seems harmless for
6202         : other platforms:
6203         echo " "
6204         echo "Checking if your C library has broken 64-bit functions..." >&4
6205         cat >try.c <<EOCP
6206 #include <stdio.h>
6207 typedef $uquadtype myULL;
6208 int main (void)
6209 {
6210     struct {
6211         double d;
6212         myULL  u;
6213     } *p, test[] = {
6214         {4294967303.15, 4294967303ULL},
6215         {4294967294.2,  4294967294ULL},
6216         {4294967295.7,  4294967295ULL},
6217         {0.0, 0ULL}
6218     };
6219     for (p = test; p->u; p++) {
6220         myULL x = (myULL)p->d;
6221         if (x != p->u) {
6222             printf("buggy\n");
6223             return 0;
6224         }
6225     }
6226     printf("ok\n");
6227     return 0;
6228 }
6229 EOCP
6230         set try
6231         if eval $compile_ok; then
6232             libcquad=`$run ./try`
6233             echo "Your C library's 64-bit functions are $libcquad."
6234         else
6235             echo "(I can't seem to compile the test program.)"
6236             echo "Assuming that your C library's 64-bit functions are ok."
6237             libcquad="ok"
6238         fi
6239         $rm_try
6240
6241         case "$libcquad" in
6242             buggy*)
6243                 cat >&4 <<EOM
6244
6245 *** You have a C library with broken 64-bit functions.
6246 *** 64-bit support does not work reliably in this configuration.
6247 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6248 *** Cannot continue, aborting.
6249
6250 EOM
6251                 exit 1
6252                 ;;
6253         esac
6254         case "$longsize" in
6255         4) case "$archname64" in
6256            '') archname64=64int ;;
6257            esac
6258            ;;
6259         esac
6260         ;;
6261 esac
6262
6263 : Look for a hint-file generated 'call-back-unit'.  If the
6264 : user has specified that a maximally 64-bit perl is to be built,
6265 : we may need to set or change some other defaults.
6266 if $test -f use64bitall.cbu; then
6267         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6268         . ./use64bitall.cbu
6269 fi
6270 case "$use64bitall" in
6271 "$define"|true|[yY]*)
6272         case "$longsize" in
6273         4) case "$archname64" in
6274            ''|64int) archname64=64all ;;
6275            esac
6276            ;;
6277         esac
6278         ;;
6279 esac
6280
6281 case "$d_quad:$use64bitint" in
6282 $undef:$define)
6283         cat >&4 <<EOF
6284
6285 *** You have chosen to use 64-bit integers,
6286 *** but none can be found.
6287 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6288 *** Cannot continue, aborting.
6289
6290 EOF
6291         exit 1
6292         ;;
6293 esac
6294
6295 : Check if we are using the GNU C library
6296 echo " "
6297 echo "Checking for GNU C Library..." >&4
6298 cat >try.c <<'EOCP'
6299 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6300    alone are insufficient to distinguish different versions, such as
6301    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6302    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6303 */
6304 #include <stdio.h>
6305 int main(void)
6306 {
6307 #ifdef __GLIBC__
6308 #   ifdef __GLIBC_MINOR__
6309 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6310 #           include <gnu/libc-version.h>
6311             printf("%s\n",  gnu_get_libc_version());
6312 #       else
6313             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6314 #       endif
6315 #   else
6316         printf("%d\n",  __GLIBC__);
6317 #   endif
6318     return 0;
6319 #else
6320     return 1;
6321 #endif
6322 }
6323 EOCP
6324 set try
6325 if eval $compile_ok && $run ./try > glibc.ver; then
6326         val="$define"
6327         gnulibc_version=`$cat glibc.ver`
6328         echo "You are using the GNU C Library version $gnulibc_version"
6329 else
6330         val="$undef"
6331         gnulibc_version=''
6332         echo "You are not using the GNU C Library"
6333 fi
6334 $rm_try glibc.ver
6335 set d_gnulibc
6336 eval $setvar
6337
6338 : see if nm is to be used to determine whether a symbol is defined or not
6339 case "$usenm" in
6340 '')
6341         dflt=''
6342         case "$d_gnulibc" in
6343         "$define")
6344                 echo " "
6345                 echo "nm probably won't work on the GNU C Library." >&4
6346                 dflt=n
6347                 ;;
6348         esac
6349         case "$dflt" in
6350         '')
6351                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6352                         echo " "
6353                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6354                         echo "'nm' won't be sufficient on this system." >&4
6355                         dflt=n
6356                 fi
6357                 ;;
6358         esac
6359         case "$dflt" in
6360         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6361                 if $test $dflt -gt 20; then
6362                         dflt=y
6363                 else
6364                         dflt=n
6365                 fi
6366                 ;;
6367         esac
6368         ;;
6369 *)
6370         case "$usenm" in
6371         true|$define) dflt=y;;
6372         *) dflt=n;;
6373         esac
6374         ;;
6375 esac
6376 $cat <<EOM
6377
6378 I can use $nm to extract the symbols from your C libraries. This
6379 is a time consuming task which may generate huge output on the disk (up
6380 to 3 megabytes) but that should make the symbols extraction faster. The
6381 alternative is to skip the 'nm' extraction part and to compile a small
6382 test program instead to determine whether each symbol is present. If
6383 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6384 this may be the best solution.
6385
6386 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6387
6388 EOM
6389 rp="Shall I use $nm to extract C symbols from the libraries?"
6390 . ./myread
6391 case "$ans" in
6392 [Nn]*) usenm=false;;
6393 *) usenm=true;;
6394 esac
6395
6396 runnm=$usenm
6397 case "$reuseval" in
6398 true) runnm=false;;
6399 esac
6400
6401 : nm options which may be necessary
6402 case "$nm_opt" in
6403 '') if $test -f /mach_boot; then
6404                 nm_opt=''       # Mach
6405         elif $test -d /usr/ccs/lib; then
6406                 nm_opt='-p'     # Solaris (and SunOS?)
6407         elif $test -f /dgux; then
6408                 nm_opt='-p'     # DG-UX
6409         elif $test -f /lib64/rld; then
6410                 nm_opt='-p'     # 64-bit Irix
6411         else
6412                 nm_opt=''
6413         fi;;
6414 esac
6415
6416 : nm options which may be necessary for shared libraries but illegal
6417 : for archive libraries.  Thank you, Linux.
6418 case "$nm_so_opt" in
6419 '')     case "$myuname" in
6420         *linux*|gnu*)
6421                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6422                         nm_so_opt='--dynamic'
6423                 fi
6424                 ;;
6425         esac
6426         ;;
6427 esac
6428
6429 : Figure out where the libc is located
6430 case "$runnm" in
6431 true)
6432 : get list of predefined functions in a handy place
6433 echo " "
6434 case "$libc" in
6435 '') libc=unknown
6436         case "$libs" in
6437         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6438         esac
6439         ;;
6440 esac
6441 case "$libs" in
6442 '') ;;
6443 *)  for thislib in $libs; do
6444         case "$thislib" in
6445         -lc|-lc_s)
6446                 : Handle C library specially below.
6447                 ;;
6448         -l*)
6449                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6450                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6451                         :
6452                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6453                         :
6454                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6455                         :
6456                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6457                         :
6458                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6459                         :
6460                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6461                         :
6462                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6463                         :
6464                 else
6465                         try=''
6466                 fi
6467                 libnames="$libnames $try"
6468                 ;;
6469         *) libnames="$libnames $thislib" ;;
6470         esac
6471         done
6472         ;;
6473 esac
6474 xxx=normal
6475 case "$libc" in
6476 unknown)
6477         set /lib/libc.$so
6478         for xxx in $libpth; do
6479                 $test -r $1 || set $xxx/libc.$so
6480                 : The messy sed command sorts on library version numbers.
6481                 $test -r $1 || \
6482                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6483                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6484                                 h
6485                                 s/[0-9][0-9]*/0000&/g
6486                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6487                                 G
6488                                 s/\n/ /' | \
6489                          $sort | $sed -e 's/^.* //'`
6490                 eval set \$$#
6491         done
6492         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6493         $test -r $1 || set $sysroot/lib/libsys_s$_a
6494         ;;
6495 *)
6496         set blurfl
6497         ;;
6498 esac
6499 if $test -r "$1"; then
6500         echo "Your (shared) C library seems to be in $1."
6501         libc="$1"
6502 elif $test -r /lib/libc && $test -r /lib/clib; then
6503         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6504         xxx=apollo
6505         libc='/lib/clib /lib/libc'
6506         if $test -r /lib/syslib; then
6507                 echo "(Your math library is in /lib/syslib.)"
6508                 libc="$libc /lib/syslib"
6509         fi
6510 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6511         echo "Your C library seems to be in $libc, as you said before."
6512 elif $test -r $incpath/usr/lib/libc$_a; then
6513         libc=$incpath/usr/lib/libc$_a;
6514         echo "Your C library seems to be in $libc.  That's fine."
6515 elif $test -r /lib/libc$_a; then
6516         libc=/lib/libc$_a;
6517         echo "Your C library seems to be in $libc.  You're normal."
6518 else
6519         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6520                 :
6521         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6522                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6523         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6524                 :
6525         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6526                 :
6527         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6528                 :
6529         else
6530                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6531         fi
6532         if $test -r "$tans"; then
6533                 echo "Your C library seems to be in $tans, of all places."
6534                 libc=$tans
6535         else
6536                 libc='blurfl'
6537         fi
6538 fi
6539 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6540         dflt="$libc"
6541         cat <<EOM
6542
6543 If the guess above is wrong (which it might be if you're using a strange
6544 compiler, or your machine supports multiple models), you can override it here.
6545
6546 EOM
6547 else
6548         dflt=''
6549         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6550         cat >&4 <<EOM
6551 I can't seem to find your C library.  I've looked in the following places:
6552
6553 EOM
6554         $sed 's/^/      /' libpath
6555         cat <<EOM
6556
6557 None of these seems to contain your C library. I need to get its name...
6558
6559 EOM
6560 fi
6561 fn=f
6562 rp='Where is your C library?'
6563 . ./getfile
6564 libc="$ans"
6565
6566 echo " "
6567 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6568 set X `cat libnames`
6569 shift
6570 xxx=files
6571 case $# in 1) xxx=file; esac
6572 echo "Extracting names from the following $xxx for later perusal:" >&4
6573 echo " "
6574 $sed 's/^/      /' libnames >&4
6575 echo " "
6576 $echo $n "This may take a while...$c" >&4
6577
6578 for file in $*; do
6579         case $file in
6580         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6581         *) $nm $nm_opt $file 2>/dev/null;;
6582         esac
6583 done >libc.tmp
6584
6585 $echo $n ".$c"
6586 $grep fprintf libc.tmp > libc.ptf
6587 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6588 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6589 xxx='[ADTSIWi]'
6590 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6591         eval $xscan;\
6592         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6593                 eval $xrun
6594 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6595         eval $xscan;\
6596         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6597                 eval $xrun
6598 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6599         eval $xscan;\
6600         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6601                 eval $xrun
6602 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6603         eval $xscan;\
6604         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6605                 eval $xrun
6606 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6607         eval $xscan;\
6608         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6609                 eval $xrun
6610 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6611         eval $xscan;\
6612         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6613                 eval $xrun
6614 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6615                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6616         eval $xscan;\
6617         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6618                 eval $xrun
6619 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6620         eval $xscan;\
6621         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6622                 eval $xrun
6623 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6624         eval $xscan;\
6625         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6626                 eval $xrun
6627 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6628         eval $xscan;\
6629         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6630                 eval $xrun
6631 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6632         eval $xscan;\
6633         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6634                 eval $xrun
6635 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6636         eval $xscan;\
6637         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6638                 eval $xrun
6639 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//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/[       ]*D[    ]*[0-9]*.*//p'";\
6644         eval $xscan;\
6645         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6646                 eval $xrun
6647 else
6648         $nm -p $* 2>/dev/null >libc.tmp
6649         $grep fprintf libc.tmp > libc.ptf
6650         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6651                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6652         then
6653                 nm_opt='-p'
6654                 eval $xrun
6655         else
6656                 echo " "
6657                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6658                 com=''
6659                 if $ar t $libc > libc.tmp && \
6660                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6661                 then
6662                         for thisname in $libnames $libc; do
6663                                 $ar t $thisname >>libc.tmp
6664                         done
6665                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6666                         echo "Ok." >&4
6667                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6668                         for thisname in $libnames $libc; do
6669                                 $ar tv $thisname >>libc.tmp
6670                                 emximp -o tmp.imp $thisname \
6671                                     2>/dev/null && \
6672                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6673                                     < tmp.imp >>libc.tmp
6674                                 $rm -f tmp.imp
6675                         done
6676                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6677                         echo "Ok." >&4
6678                 else
6679                         echo "$ar didn't seem to work right." >&4
6680                         echo "Maybe this is a Cray...trying bld instead..." >&4
6681                         if  bld t $libc | \
6682                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6683                                 $test -s libc.list
6684                         then
6685                                 for thisname in $libnames; do
6686                                         bld t $libnames | \
6687                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6688                                         $ar t $thisname >>libc.tmp
6689                                 done
6690                                 echo "Ok." >&4
6691                         else
6692                                 echo "That didn't work either.  Giving up." >&4
6693                                 exit 1
6694                         fi
6695                 fi
6696         fi
6697 fi
6698 nm_extract="$com"
6699 case "$PASE" in
6700 define)
6701     echo " "
6702     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6703     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6704     ;;
6705 *)  if $test -f /lib/syscalls.exp; then
6706         echo " "
6707         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6708         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6709                 /lib/syscalls.exp >>libc.list
6710     fi
6711     ;;
6712 esac
6713 ;;
6714 esac
6715 $rm -f libnames libpath
6716
6717 : Check if we are using C++
6718 echo " "
6719 echo "Checking for C++..." >&4
6720 $cat >try.c <<'EOCP'
6721 #include <stdio.h>
6722 int main(void)
6723 {
6724 #ifdef __cplusplus
6725     return 0;
6726 #else
6727     return 1;
6728 #endif
6729 }
6730 EOCP
6731 set try
6732 if eval $compile_ok && $run ./try; then
6733         val="$define"
6734         echo "You are using a C++ compiler."
6735 else
6736         val="$undef"
6737         echo "You are not using a C++ compiler."
6738 fi
6739 $rm_try cplusplus$$
6740 set d_cplusplus
6741 eval $setvar
6742
6743 : is a C symbol defined?
6744 csym='tlook=$1;
6745 case "$3" in
6746 -v) tf=libc.tmp; tdc="";;
6747 -a) tf=libc.tmp; tdc="[]";;
6748 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6749 esac;
6750 case "$d_cplusplus" in
6751     $define)    extern_C="extern \"C\"" ;;
6752     *)          extern_C="extern"       ;;
6753 esac;
6754 tx=yes;
6755 case "$reuseval-$4" in
6756 true-) ;;
6757 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6758 esac;
6759 case "$tx" in
6760 yes)
6761         tval=false;
6762         if $test "$runnm" = true; then
6763                 if $contains $tlook $tf >/dev/null 2>&1; then
6764                         tval=true;
6765                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6766                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
6767                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6768                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6769                         $rm_try;
6770                 fi;
6771         else
6772                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
6773                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6774                 $rm_try;
6775         fi;
6776         ;;
6777 *)
6778         case "$tval" in
6779         $define) tval=true;;
6780         *) tval=false;;
6781         esac;
6782         ;;
6783 esac;
6784 eval "$2=$tval"'
6785
6786 : define an is-in-libc? function
6787 inlibc='echo " "; td=$define; tu=$undef;
6788 sym=$1; var=$2; eval "was=\$$2";
6789 tx=yes;
6790 case "$reuseval$was" in
6791 true) ;;
6792 true*) tx=no;;
6793 esac;
6794 case "$tx" in
6795 yes)
6796         set $sym tres -f;
6797         eval $csym;
6798         case "$tres" in
6799         true)
6800                 echo "$sym() found." >&4;
6801                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6802         *)
6803                 echo "$sym() NOT found." >&4;
6804                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6805         esac;;
6806 *)
6807         case "$was" in
6808         $define) echo "$sym() found." >&4;;
6809         *) echo "$sym() NOT found." >&4;;
6810         esac;;
6811 esac'
6812
6813 : check for length of double
6814 echo " "
6815 case "$doublesize" in
6816 '')
6817         echo "Checking to see how big your double precision numbers are..." >&4
6818         $cat >try.c <<EOCP
6819 #include <stdio.h>
6820 #$i_stdlib I_STDLIB
6821 #ifdef I_STDLIB
6822 #include <stdlib.h>
6823 #endif
6824 int main()
6825 {
6826     printf("%d\n", (int)sizeof(double));
6827     exit(0);
6828 }
6829 EOCP
6830         set try
6831         if eval $compile_ok; then
6832                 doublesize=`$run ./try`
6833                 echo "Your double is $doublesize bytes long."
6834         else
6835                 dflt='8'
6836                 echo "(I can't seem to compile the test program.  Guessing...)"
6837                 rp="What is the size of a double precision number (in bytes)?"
6838                 . ./myread
6839                 doublesize="$ans"
6840         fi
6841         ;;
6842 esac
6843 $rm_try
6844
6845 : see if this is a float.h system
6846 set float.h i_float
6847 eval $inhdr
6848
6849 : check for long doubles
6850 echo " "
6851 echo "Checking to see if you have long double..." >&4
6852 echo 'int main() { long double x = 7.0; }' > try.c
6853 set try
6854 if eval $compile; then
6855         val="$define"
6856         echo "You have long double."
6857 else
6858         val="$undef"
6859         echo "You do not have long double."
6860 fi
6861 $rm_try
6862 set d_longdbl
6863 eval $setvar
6864
6865 : see if ldexpl exists
6866 set ldexpl d_ldexpl
6867 eval $inlibc
6868
6869 : check for length of long double
6870 case "${d_longdbl}${longdblsize}" in
6871 $define)
6872         echo " "
6873         echo "Checking to see how big your long doubles are..." >&4
6874         $cat >try.c <<'EOCP'
6875 #include <stdio.h>
6876 int main()
6877 {
6878         printf("%d\n", sizeof(long double));
6879 }
6880 EOCP
6881         set try
6882         set try
6883         if eval $compile; then
6884                 longdblsize=`$run ./try`
6885                 echo "Your long doubles are $longdblsize bytes long."
6886         else
6887                 dflt='8'
6888                 echo " "
6889                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6890                 rp="What is the size of a long double (in bytes)?"
6891                 . ./myread
6892                 longdblsize="$ans"
6893         fi
6894         if $test "X$doublesize" = "X$longdblsize"; then
6895                 echo "That isn't any different from an ordinary double."
6896                 echo "I'll keep your setting anyway, but you may see some"
6897                 echo "harmless compilation warnings."
6898         fi
6899         ;;
6900 esac
6901 $rm_try
6902
6903 $echo "Checking the kind of long doubles you have..." >&4
6904 case "$d_longdbl" in
6905 define)
6906 $cat <<EOP >try.c
6907 #$i_float I_FLOAT
6908 #$i_stdlib I_STDLIB
6909 #define LONGDBLSIZE $longdblsize
6910 #define DOUBLESIZE $doublesize
6911 #ifdef I_FLOAT
6912 #include <float.h>
6913 #endif
6914 #ifdef I_STDLIB
6915 #include <stdlib.h>
6916 #endif
6917 #include <stdio.h>
6918 static const long double d = -0.1L;
6919 int main() {
6920   unsigned const char* b = (unsigned const char*)(&d);
6921 #if DOUBLESIZE == LONGDBLSIZE
6922   printf("0\n"); /* if it floats like double */
6923   exit(0);
6924 #endif
6925 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6926   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6927     /* IEEE 754 128-bit little-endian */
6928     printf("1\n");
6929     exit(0);
6930   }
6931   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6932     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6933     printf("2\n");
6934     exit(0);
6935   }
6936 #endif
6937 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6938  * while 64-bits platforms have it in 16 bytes. */
6939 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6940   if (b[0] == 0xCD && b[9] == 0xBF && b[10] == 0x00) {
6941     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6942      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6943      * Also known as "extended precision". */
6944     printf("3\n");
6945     exit(0);
6946   }
6947   if (b[0] == 0xBF && b[9] == 0xCD && b[10] == 0x00) {
6948     /* is there ever big-endian 80-bit, really? */
6949     printf("4\n");
6950     exit(0);
6951   }
6952 #endif
6953 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6954   /* software "double double", the 106 is 53+53.
6955    * but irix thinks it is 107. */
6956   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6957     /* double double 128-bit little-endian,
6958      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
6959     printf("5\n");
6960     exit(0);
6961   }
6962   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
6963     /* double double 128-bit big-endian, e.g. PPC/Power and MIPS:
6964      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
6965     printf("6\n");
6966     exit(0);
6967   }
6968 #endif
6969   printf("-1\n"); /* unknown */
6970   exit(0);
6971 }
6972 EOP
6973 set try
6974 if eval $compile; then
6975     longdblkind=`$run ./try`
6976 else
6977     longdblkind=-1
6978 fi
6979 ;;
6980 *) longdblkind=0 ;;
6981 esac
6982 case "$longdblkind" in
6983 0) echo "Your long doubles are doubles." >&4 ;;
6984 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
6985 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
6986 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
6987 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
6988 5) echo "You have 128-bit little-endian double-double long doubles." >& 4 ;;
6989 6) echo "You have 128-bit big-endian double-double long doubles." >& 4 ;;
6990 *) echo "Cannot figure out your long double." >&4 ;;
6991 esac
6992 $rm_try
6993
6994 : determine the architecture name
6995 echo " "
6996 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6997         tarch=`arch`"-$osname"
6998 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6999         if uname -m > tmparch 2>&1 ; then
7000                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7001                         -e 's/$/'"-$osname/" tmparch`
7002         else
7003                 tarch="$osname"
7004         fi
7005         $rm -f tmparch
7006 else
7007         tarch="$osname"
7008 fi
7009 case "$myarchname" in
7010 ''|"$tarch") ;;
7011 *)
7012         echo "(Your architecture name used to be $myarchname.)"
7013         archname=''
7014         ;;
7015 esac
7016 case "$targetarch" in
7017 '') ;;
7018 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7019 esac
7020 myarchname="$tarch"
7021 case "$archname" in
7022 '') dflt="$tarch";;
7023 *) dflt="$archname";;
7024 esac
7025 rp='What is your architecture name'
7026 . ./myread
7027 archname="$ans"
7028
7029 : optionally add API version to the architecture for versioned archlibs
7030 case "$useversionedarchname" in
7031 $define|true|[yY]*) dflt='y';;
7032 *)                  dflt='n';;
7033 esac
7034 rp='Add the Perl API version to your archname?'
7035 . ./myread
7036 case "$ans" in
7037 y|Y)    useversionedarchname="$define" ;;
7038 *)      useversionedarchname="$undef" ;;
7039 esac
7040 case "$useversionedarchname" in
7041 $define)
7042         case "$archname" in
7043         *-$api_versionstring)
7044                 echo "...and architecture name already has -$api_versionstring" >&4
7045                 ;;
7046         *)
7047                 archname="$archname-$api_versionstring"
7048                 echo "...setting architecture name to $archname." >&4
7049                 ;;
7050         esac
7051         ;;
7052 esac
7053
7054 case "$usethreads" in
7055 $define)
7056         echo "Threads selected." >&4
7057         case "$archname" in
7058         *-thread*) echo "...and architecture name already has -thread." >&4
7059                 ;;
7060         *)      archname="$archname-thread"
7061                 echo "...setting architecture name to $archname." >&4
7062                 ;;
7063         esac
7064         ;;
7065 esac
7066 case "$usemultiplicity" in
7067 $define)
7068         echo "Multiplicity selected." >&4
7069         case "$archname" in
7070         *-multi*) echo "...and architecture name already has -multi." >&4
7071                 ;;
7072         *)      archname="$archname-multi"
7073                 echo "...setting architecture name to $archname." >&4
7074                 ;;
7075         esac
7076         ;;
7077 esac
7078 case "$use64bitint$use64bitall" in
7079 *"$define"*)
7080         case "$archname64" in
7081         '')
7082                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7083                 ;;
7084         *)
7085                 case "$use64bitint" in
7086                 "$define") echo "64 bit integers selected." >&4 ;;
7087                 esac
7088                 case "$use64bitall" in
7089                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7090                 esac
7091                 case "$archname" in
7092                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7093                         ;;
7094                 *)      archname="$archname-$archname64"
7095                         echo "...setting architecture name to $archname." >&4
7096                         ;;
7097                 esac
7098                 ;;
7099         esac
7100 esac
7101 case "$uselongdouble" in
7102 $define)
7103         echo "Long doubles selected." >&4
7104         case "$longdblsize" in
7105         $doublesize)
7106                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7107                 ;;
7108         *)
7109                 case "$archname" in
7110                 *-ld*) echo "...and architecture name already has -ld." >&4
7111                         ;;
7112                 *)      archname="$archname-ld"
7113                         echo "...setting architecture name to $archname." >&4
7114                         ;;
7115                 esac
7116                 ;;
7117         esac
7118         ;;
7119 esac
7120 case "$usequadmath" in
7121 $define)
7122         echo "quadmath selected." >&4
7123         case "$archname" in
7124         *-ld*) echo "...and architecture name already has -quadmath." >&4
7125                 ;;
7126         *)      archname="$archname-quadmath"
7127                 echo "...setting architecture name to $archname." >&4
7128                 ;;
7129         esac
7130         ;;
7131 esac
7132 if $test -f archname.cbu; then
7133         echo "Your platform has some specific hints for architecture name, using them..."
7134         . ./archname.cbu
7135 fi
7136
7137 : set the prefixit variable, to compute a suitable default value
7138 prefixit='case "$3" in
7139 ""|none)
7140         case "$oldprefix" in
7141         "") eval "$1=\"\$$2\"";;
7142         *)
7143                 case "$3" in
7144                 "") eval "$1=";;
7145                 none)
7146                         eval "tp=\"\$$2\"";
7147                         case "$tp" in
7148                         ""|" ") eval "$1=\"\$$2\"";;
7149                         *) eval "$1=";;
7150                         esac;;
7151                 esac;;
7152         esac;;
7153 *)
7154         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7155         case "$tp" in
7156         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7157         /*-$oldprefix/*|\~*-$oldprefix/*)
7158                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7159         *) eval "$1=\"\$$2\"";;
7160         esac;;
7161 esac'
7162
7163 : determine installation style
7164 : For now, try to deduce it from prefix unless it is already set.
7165 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7166 case "$installstyle" in
7167 '')     case "$prefix" in
7168                 *perl*) dflt='lib';;
7169                 *) dflt='lib/perl5' ;;
7170         esac
7171         ;;
7172 *)      dflt="$installstyle" ;;
7173 esac
7174 : Probably not worth prompting for this since we prompt for all
7175 : the directories individually, and the prompt would be too long and
7176 : confusing anyway.
7177 installstyle=$dflt
7178
7179 : determine where public executables go
7180 echo " "
7181 set dflt bin bin
7182 eval $prefixit
7183 fn=d~
7184 rp='Pathname where the public executables will reside?'
7185 . ./getfile
7186 if $test "X$ansexp" != "X$binexp"; then
7187         installbin=''
7188 fi
7189 prefixvar=bin
7190 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7191 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7192 :     this via initialinstalllocation
7193 . ./setprefixvar
7194
7195 case "$userelocatableinc" in
7196 $define|true|[yY]*)     dflt='y' ;;
7197 *)                      dflt='n' ;;
7198 esac
7199 cat <<EOM
7200
7201 Would you like to build Perl so that the installation is relocatable, so that
7202 library paths in @INC are determined relative to the path of the perl binary?
7203 This is not advised for system Perl installs, or if you need to run setid
7204 scripts or scripts under taint mode.
7205
7206 If this doesn't make any sense to you, just accept the default '$dflt'.
7207 EOM
7208 rp='Use relocatable @INC?'
7209 . ./myread
7210 case "$ans" in
7211 y|Y)    val="$define" ;;
7212 *)      val="$undef"  ;;
7213 esac
7214 set userelocatableinc
7215 eval $setvar
7216
7217 initialinstalllocation="$binexp"
7218 : Default prefix is now "up one level from where the binaries are"
7219 case "$userelocatableinc" in
7220 $define|true|[yY]*)
7221     bin=".../"
7222     binexp=".../"
7223     prefix=".../.."
7224     prefixexp=".../.."
7225     installprefixexp=".../.."
7226     ;;
7227 esac
7228
7229 : determine where private library files go
7230 : Usual default is /usr/local/lib/perl5/$version.
7231 : Also allow things like /opt/perl/lib/$version, since
7232 : /opt/perl/lib/perl5... would be redundant.
7233 : The default "style" setting is made in installstyle.U
7234 case "$installstyle" in
7235 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7236 *)       set dflt privlib lib/$version ;;
7237 esac
7238 eval $prefixit
7239 $cat <<EOM
7240
7241 There are some auxiliary files for $package that need to be put into a
7242 private library directory that is accessible by everyone.
7243
7244 EOM
7245 fn=$binexp
7246 fn=d~+
7247 rp='Pathname where the private library files will reside?'
7248 . ./getfile
7249 prefixvar=privlib
7250 . ./setprefixvar
7251
7252 : set the prefixup variable, to restore leading tilda escape
7253 prefixup='case "$prefixexp" in
7254 "$prefix") ;;
7255 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7256 esac'
7257
7258 : determine where public architecture dependent libraries go
7259 set archlib archlib
7260 eval $prefixit
7261 : privlib default is /usr/local/lib/$package/$version
7262 : archlib default is /usr/local/lib/$package/$version/$archname
7263 : privlib may have an optional trailing /share.
7264 tdflt=`echo $privlib | $sed 's,/share$,,'`
7265 tdflt=$tdflt/$archname
7266 case "$archlib" in
7267 '')     dflt=$tdflt
7268         ;;
7269 *)      dflt="$archlib"
7270     ;;
7271 esac
7272 $cat <<EOM
7273
7274 $spackage contains architecture-dependent library files.  If you are
7275 sharing libraries in a heterogeneous environment, you might store
7276 these files in a separate location.  Otherwise, you can just include
7277 them with the rest of the public library files.
7278
7279 EOM
7280 fn=$binexp
7281 fn=d+~
7282 rp='Where do you want to put the public architecture-dependent libraries?'
7283 . ./getfile
7284 prefixvar=archlib
7285 . ./setprefixvar
7286 if $test X"$archlib" = X"$privlib"; then
7287         d_archlib="$undef"
7288 else
7289         d_archlib="$define"
7290 fi
7291
7292 : see if setuid scripts can be secure
7293 $cat <<EOM
7294
7295 Some kernels have a bug that prevents setuid #! scripts from being
7296 secure.  Some sites have disabled setuid #! scripts because of this.
7297
7298 First let's decide if your kernel supports secure setuid #! scripts.
7299 (If setuid #! scripts would be secure but have been disabled anyway,
7300 don't say that they are secure if asked.)
7301
7302 EOM
7303
7304 val="$undef"
7305 if $test -d /dev/fd; then
7306         echo "#!$ls" >reflect
7307         chmod +x,u+s reflect
7308         ./reflect >flect 2>&1
7309         if $contains "/dev/fd" flect >/dev/null; then
7310                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7311                 val="$define"
7312         else
7313                 $cat <<EOM
7314 If you are not sure if they are secure, I can check but I'll need a
7315 username and password different from the one you are using right now.
7316 If you don't have such a username or don't want me to test, simply
7317 enter 'none'.
7318
7319 EOM
7320                 rp='Other username to test security of setuid scripts with?'
7321                 dflt='none'
7322                 . ./myread
7323                 case "$ans" in
7324                 n|none)
7325                         case "$d_suidsafe" in
7326                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7327                                 dflt=n;;
7328                         "$undef")
7329                                 echo "Well, the $hint value is *not* secure." >&4
7330                                 dflt=n;;
7331                         *)      echo "Well, the $hint value *is* secure." >&4
7332                                 dflt=y;;
7333                         esac
7334                         ;;
7335                 *)
7336                         $rm -f reflect flect
7337                         echo "#!$ls" >reflect
7338                         chmod +x,u+s reflect
7339                         echo >flect
7340                         chmod a+w flect
7341                         echo '"su" will (probably) prompt you for '"$ans's password."
7342                         su $ans -c './reflect >flect'
7343                         if $contains "/dev/fd" flect >/dev/null; then
7344                                 echo "Okay, it looks like setuid scripts are secure." >&4
7345                                 dflt=y
7346                         else
7347                                 echo "I don't think setuid scripts are secure." >&4
7348                                 dflt=n
7349                         fi
7350                         ;;
7351                 esac
7352                 rp='Does your kernel have *secure* setuid scripts?'
7353                 . ./myread
7354                 case "$ans" in
7355                 [yY]*)  val="$define";;
7356                 *)      val="$undef";;
7357                 esac
7358         fi
7359 else
7360         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7361         echo "(That's for file descriptors, not floppy disks.)"
7362         val="$undef"
7363 fi
7364 set d_suidsafe
7365 eval $setvar
7366
7367 $rm -f reflect flect
7368
7369 : now see if they want to do setuid emulation
7370 if $test $patchlevel -lt 11; then
7371 echo " "
7372 val="$undef"
7373 case "$d_suidsafe" in
7374 "$define")
7375         val="$undef"
7376         echo "No need to emulate SUID scripts since they are secure here." >&4
7377         ;;
7378 *)
7379         $cat <<EOM
7380 Some systems have disabled setuid scripts, especially systems where
7381 setuid scripts cannot be secure.  On systems where setuid scripts have
7382 been disabled, the setuid/setgid bits on scripts are currently
7383 useless.  It is possible for $package to detect those bits and emulate
7384 setuid/setgid in a secure fashion.  This emulation will only work if
7385 setuid scripts have been disabled in your kernel.
7386
7387 EOM
7388         case "$d_dosuid" in
7389         "$define") dflt=y ;;
7390         *) dflt=n ;;
7391         esac
7392         rp="Do you want to do setuid/setgid emulation?"
7393         . ./myread
7394         case "$ans" in
7395         [yY]*)  val="$define";;
7396         *)      val="$undef";;
7397         esac
7398         ;;
7399 esac
7400 set d_dosuid
7401 eval $setvar
7402 else
7403     case "$d_dosuid" in
7404         "$define")
7405         cat >&4 <<EOH
7406
7407 SUID emulation has been removed for 5.12
7408 Please re-run Configure without -Dd_dosuid
7409
7410 EOH
7411         exit 1;
7412         ;;
7413     esac
7414     d_dosuid=undef
7415 fi
7416
7417 : Find perl5.005 or later.
7418 echo "Looking for a previously installed perl5.005 or later... "
7419 case "$perl5" in
7420 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7421                 : Check if this perl is recent and can load a simple module
7422                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7423                         perl5=$tdir/perl
7424                         break;
7425                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7426                         perl5=$tdir/perl5
7427                         break;
7428                 fi
7429         done
7430         ;;
7431 *)      perl5="$perl5"
7432         ;;
7433 esac
7434 case "$perl5" in
7435 '')     echo "None found.  That's ok.";;
7436 *)      echo "Using $perl5." ;;
7437 esac
7438
7439 : Set the siteprefix variables
7440 $cat <<EOM
7441
7442 After $package is installed, you may wish to install various
7443 add-on modules and utilities.  Typically, these add-ons will
7444 be installed under $prefix with the rest
7445 of this package.  However, you may wish to install such add-ons
7446 elsewhere under a different prefix.
7447
7448 If you do not wish to put everything under a single prefix, that's
7449 ok.  You will be prompted for the individual locations; this siteprefix
7450 is only used to suggest the defaults.
7451
7452 The default should be fine for most people.
7453
7454 EOM
7455 fn=d~+
7456 rp='Installation prefix to use for add-on modules and utilities?'
7457 : XXX Here might be another good place for an installstyle setting.
7458 case "$siteprefix" in
7459 '') dflt=$prefix ;;
7460 *)  dflt=$siteprefix ;;
7461 esac
7462 . ./getfile
7463 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7464 oldsiteprefix=''
7465 case "$siteprefix" in
7466 '') ;;
7467 *)      case "$ans" in
7468         "$prefix") ;;
7469         *) oldsiteprefix="$prefix";;
7470         esac
7471         ;;
7472 esac
7473 siteprefix="$ans"
7474 siteprefixexp="$ansexp"
7475
7476 : determine where site specific libraries go.
7477 : Usual default is /usr/local/lib/perl5/site_perl/$version
7478 : The default "style" setting is made in installstyle.U
7479 : XXX No longer works with Prefixit stuff.
7480 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7481 case "$sitelib" in
7482 '') case "$installstyle" in
7483         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7484         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7485         esac
7486         ;;
7487 *)      dflt="$sitelib"
7488         ;;
7489 esac
7490 $cat <<EOM
7491
7492 The installation process will create a directory for
7493 site-specific extensions and modules.  Most users find it convenient
7494 to place all site-specific files in this directory rather than in the
7495 main distribution directory.
7496
7497 EOM
7498 fn=d~+
7499 rp='Pathname for the site-specific library files?'
7500 . ./getfile
7501 prefixvar=sitelib
7502 . ./setprefixvar
7503 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7504
7505 : Determine list of previous versions to include in @INC
7506 $cat > getverlist <<EOPL
7507 #!$perl5 -w
7508 use File::Basename;
7509 \$api_versionstring = "$api_versionstring";
7510 \$version = "$version";
7511 \$stem = "$sitelib_stem";
7512 \$archname = "$archname";
7513 EOPL
7514         $cat >> getverlist <<'EOPL'
7515 # The list found is store twice for each entry: the original name, and
7516 # the binary broken down version as pack "sss", so sorting is easy and
7517 # unambiguous. This will work for all versions that have a maximum of
7518 # three digit groups, separate by '.'s or '_'s. Names are extended with
7519 # ".0.0" to ensure at least three elements for the pack.
7520 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7521
7522 # Can't have leading @ because metaconfig interprets it as a command!
7523 ;@inc_version_list=();
7524 # XXX Redo to do opendir/readdir?
7525 if (-d $stem) {
7526     chdir($stem);
7527     ;@candidates = map {
7528         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7529     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7530 }
7531 else {
7532     ;@candidates = ();
7533 }
7534
7535 ($pversion, $aversion, $vsn5005) = map {
7536     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7537 foreach $d (@candidates) {
7538     if ($d->[1] lt $pversion) {
7539         if ($d->[1] ge $aversion) {
7540             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7541         }
7542         elsif ($d->[1] ge $vsn5005) {
7543             unshift(@inc_version_list, grep { -d } $d->[0]);
7544         }
7545     }
7546     else {
7547         # Skip newer version.  I.e. don't look in
7548         # 5.7.0 if we're installing 5.6.1.
7549     }
7550 }
7551
7552 if (@inc_version_list) {
7553     print join(' ', @inc_version_list);
7554 }
7555 else {
7556     # Blank space to preserve value for next Configure run.
7557     print " ";
7558 }
7559 EOPL
7560 chmod +x getverlist
7561 case "$inc_version_list" in
7562 '')     if test -x "$perl5$exe_ext"; then
7563                 dflt=`$perl5 getverlist`
7564         else
7565                 dflt='none'
7566         fi
7567         ;;
7568 $undef) dflt='none' ;;
7569 *)  eval dflt=\"$inc_version_list\" ;;
7570 esac
7571 case "$dflt" in
7572 ''|' ') dflt=none ;;
7573 esac
7574 case "$dflt" in
7575 5.005) dflt=none ;;
7576 esac
7577 $cat <<EOM
7578
7579 In order to ease the process of upgrading, this version of perl
7580 can be configured to use modules built and installed with earlier
7581 versions of perl that were installed under $prefix.  Specify here
7582 the list of earlier versions that this version of perl should check.
7583 If Configure detected no earlier versions of perl installed under
7584 $prefix, then the list will be empty.  Answer 'none' to tell perl
7585 to not search earlier versions.
7586
7587 The default should almost always be sensible, so if you're not sure,
7588 just accept the default.
7589 EOM
7590
7591 rp='List of earlier versions to include in @INC?'
7592 . ./myread
7593 case "$ans" in
7594 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7595 *) inc_version_list="$ans" ;;
7596 esac
7597 case "$inc_version_list" in
7598 ''|' ')
7599         inc_version_list_init='0'
7600         d_inc_version_list="$undef"
7601         ;;
7602 *)      inc_version_list_init=`echo $inc_version_list |
7603                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7604         d_inc_version_list="$define"
7605         ;;
7606 esac
7607 $rm -f getverlist
7608
7609 : see if malloc/malloc.h has to be included
7610 set malloc/malloc.h i_mallocmalloc
7611 eval $inhdr
7612
7613 : see if this is a malloc.h system
7614 : we want a real compile instead of Inhdr because some systems have a
7615 : malloc.h that just gives a compile error saying to use stdlib.h instead
7616 echo " "
7617 $cat >try.c <<EOCP
7618 #include <stdlib.h>
7619 #include <malloc.h>
7620 #$i_mallocmalloc I_MALLOCMALLOC
7621 #ifdef I_MALLOCMALLOC
7622 # include <malloc/malloc.h>
7623 #endif
7624
7625 int main () { return 0; }
7626 EOCP
7627 set try
7628 if eval $compile; then
7629     echo "<malloc.h> found." >&4
7630     val="$define"
7631 else
7632     echo "<malloc.h> NOT found." >&4
7633     val="$undef"
7634 fi
7635 $rm_try
7636 set i_malloc
7637 eval $setvar
7638
7639 : check for length of pointer
7640 echo " "
7641 case "$ptrsize" in
7642 '')
7643         echo "Checking to see how big your pointers are..." >&4
7644         $cat >try.c <<EOCP
7645 #include <stdio.h>
7646 #$i_stdlib I_STDLIB
7647 #ifdef I_STDLIB
7648 #include <stdlib.h>
7649 #endif
7650 int main()
7651 {
7652     printf("%d\n", (int)sizeof(void *));
7653     exit(0);
7654 }
7655 EOCP
7656         set try
7657         if eval $compile_ok; then
7658                 ptrsize=`$run ./try`
7659                 echo "Your pointers are $ptrsize bytes long."
7660         else
7661                 dflt='4'
7662                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7663                 rp="What is the size of a pointer (in bytes)?"
7664                 . ./myread
7665                 ptrsize="$ans"
7666         fi
7667         ;;
7668 esac
7669 $rm_try
7670 case "$use64bitall" in
7671 "$define"|true|[yY]*)
7672         case "$ptrsize" in
7673         4)      cat <<EOM >&4
7674
7675 *** You have chosen a maximally 64-bit build,
7676 *** but your pointers are only 4 bytes wide.
7677 *** Please rerun Configure without -Duse64bitall.
7678 EOM
7679                 case "$d_quad" in
7680                 define)
7681                         cat <<EOM >&4
7682 *** Since you have quads, you could possibly try with -Duse64bitint.
7683 EOM
7684                         ;;
7685                 esac
7686                 cat <<EOM >&4
7687 *** Cannot continue, aborting.
7688
7689 EOM
7690
7691                 exit 1
7692                 ;;
7693         esac
7694         ;;
7695 esac
7696
7697
7698 : determine whether to use malloc wrapping
7699 echo " "
7700 case "$usemallocwrap" in
7701 [yY]*|true|$define)     dflt='y' ;;
7702 [nN]*|false|$undef)     dflt='n' ;;
7703 *)      case "$usedevel" in
7704         [yY]*|true|$define)     dflt='y' ;;
7705         *) dflt='n' ;;
7706         esac
7707         ;;
7708 esac
7709 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7710 . ./myread
7711 usemallocwrap="$ans"
7712 case "$ans" in
7713 y*|true)
7714         usemallocwrap="$define" ;;
7715 *)
7716         usemallocwrap="$undef" ;;
7717 esac
7718
7719 : determine which malloc to compile in
7720 echo " "
7721 case "$usemymalloc" in
7722 [yY]*|true|$define)     dflt='y' ;;
7723 [nN]*|false|$undef)     dflt='n' ;;
7724 *)      case "$ptrsize" in
7725         4) dflt='y' ;;
7726         *) dflt='n' ;;
7727         esac
7728         if test "$useithreads" = "$define"; then dflt='n'; fi
7729         ;;
7730 esac
7731 rp="Do you wish to attempt to use the malloc that comes with $package?"
7732 . ./myread
7733 usemymalloc="$ans"
7734 case "$ans" in
7735 y*|true)
7736         usemymalloc='y'
7737         mallocsrc='malloc.c'
7738         mallocobj="malloc$_o"
7739         d_mymalloc="$define"
7740         case "$libs" in
7741         *-lmalloc*)
7742                 : Remove malloc from list of libraries to use
7743                 echo "Removing unneeded -lmalloc from library list" >&4
7744                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7745                 shift
7746                 libs="$*"
7747                 echo "libs = $libs" >&4
7748                 ;;
7749         esac
7750         ;;
7751 *)
7752         usemymalloc='n'
7753         mallocsrc=''
7754         mallocobj=''
7755         d_mymalloc="$undef"
7756         ;;
7757 esac
7758
7759 : compute the return types of malloc and free
7760 echo " "
7761 $cat >malloc.c <<END
7762 #$i_malloc I_MALLOC
7763 #$i_stdlib I_STDLIB
7764 #include <stdio.h>
7765 #include <sys/types.h>
7766 #ifdef I_MALLOC
7767 #include <malloc.h>
7768 #endif
7769 #ifdef I_STDLIB
7770 #include <stdlib.h>
7771 #endif
7772 #ifdef TRY_MALLOC
7773 void *malloc();
7774 #endif
7775 #ifdef TRY_FREE
7776 void free();
7777 #endif
7778 END
7779 case "$malloctype" in
7780 '')
7781         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7782                 malloctype='void *'
7783         else
7784                 malloctype='char *'
7785         fi
7786         ;;
7787 esac
7788 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7789
7790 case "$freetype" in
7791 '')
7792         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7793                 freetype='void'
7794         else
7795                 freetype='int'
7796         fi
7797         ;;
7798 esac
7799 echo "Your system uses $freetype free(), it would seem." >&4
7800 $rm -f malloc.[co]
7801 : determine where site specific architecture-dependent libraries go.
7802 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7803 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7804 : sitelib may have an optional trailing /share.
7805 case "$sitearch" in
7806 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7807         dflt="$dflt/$archname"
7808         ;;
7809 *)      dflt="$sitearch"
7810         ;;
7811 esac
7812 set sitearch sitearch none
7813 eval $prefixit
7814 $cat <<EOM
7815
7816 The installation process will also create a directory for
7817 architecture-dependent site-specific extensions and modules.
7818
7819 EOM
7820 fn=d~+
7821 rp='Pathname for the site-specific architecture-dependent library files?'
7822 . ./getfile
7823 prefixvar=sitearch
7824 . ./setprefixvar
7825 if $test X"$sitearch" = X"$sitelib"; then
7826         d_sitearch="$undef"
7827 else
7828         d_sitearch="$define"
7829 fi
7830
7831 : Set the vendorprefix variables
7832 $cat <<EOM
7833
7834 The installation process will also create a directory for
7835 vendor-supplied add-ons.  Vendors who supply perl with their system
7836 may find it convenient to place all vendor-supplied files in this
7837 directory rather than in the main distribution directory.  This will
7838 ease upgrades between binary-compatible maintenance versions of perl.
7839
7840 Of course you may also use these directories in whatever way you see
7841 fit.  For example, you might use them to access modules shared over a
7842 company-wide network.
7843
7844 The default answer should be fine for most people.
7845 This causes further questions about vendor add-ons to be skipped
7846 and no vendor-specific directories will be configured for perl.
7847
7848 EOM
7849 rp='Do you want to configure vendor-specific add-on directories?'
7850 case "$usevendorprefix" in
7851 define|true|[yY]*) dflt=y ;;
7852 *)      : User may have set vendorprefix directly on Configure command line.
7853         case "$vendorprefix" in
7854         ''|' ') dflt=n ;;
7855         *)      dflt=y ;;
7856         esac
7857         ;;
7858 esac
7859 . ./myread
7860 case "$ans" in
7861 [yY]*)  fn=d~+
7862         rp='Installation prefix to use for vendor-supplied add-ons?'
7863         case "$vendorprefix" in
7864         '') dflt="$prefix" ;;
7865         *)  dflt=$vendorprefix ;;
7866         esac
7867         . ./getfile
7868         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7869         oldvendorprefix=''
7870         case "$vendorprefix" in
7871         '') ;;
7872         *)      case "$ans" in
7873                 "$prefix") ;;
7874                 *) oldvendorprefix="$prefix";;
7875                 esac
7876                 ;;
7877         esac
7878         usevendorprefix="$define"
7879         vendorprefix="$ans"
7880         vendorprefixexp="$ansexp"
7881         ;;
7882 *)      usevendorprefix="$undef"
7883         vendorprefix=''
7884         vendorprefixexp=''
7885         ;;
7886 esac
7887
7888 : Set the vendorlib variables
7889 case "$vendorprefix" in
7890 '')     d_vendorlib="$undef"
7891         vendorlib=''
7892         vendorlibexp=''
7893         ;;
7894 *)      d_vendorlib="$define"
7895         : determine where vendor-supplied modules go.
7896         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7897         case "$vendorlib" in
7898         '')
7899                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7900                 case "$installstyle" in
7901                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7902                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7903                 esac
7904                 ;;
7905         *)      dflt="$vendorlib"
7906                 ;;
7907         esac
7908         fn=d~+
7909         rp='Pathname for the vendor-supplied library files?'
7910         . ./getfile
7911         vendorlib="$ans"
7912         vendorlibexp="$ansexp"
7913         ;;
7914 esac
7915 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7916 prefixvar=vendorlib
7917 . ./installprefix
7918
7919 : Set the vendorarch variables
7920 case "$vendorprefix" in
7921 '')     d_vendorarch="$undef"
7922         vendorarch=''
7923         vendorarchexp=''
7924         ;;
7925 *)      d_vendorarch="$define"
7926         : determine where vendor-supplied architecture-dependent libraries go.
7927         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7928         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7929         : vendorlib may have an optional trailing /share.
7930         case "$vendorarch" in
7931         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7932                 dflt="$dflt/$archname"
7933                 ;;
7934         *)      dflt="$vendorarch" ;;
7935         esac
7936         fn=d~+
7937         rp='Pathname for vendor-supplied architecture-dependent files?'
7938         . ./getfile
7939         vendorarch="$ans"
7940         vendorarchexp="$ansexp"
7941         ;;
7942 esac
7943 prefixvar=vendorarch
7944 . ./installprefix
7945 if $test X"$vendorarch" = X"$vendorlib"; then
7946         d_vendorarch="$undef"
7947 else
7948         d_vendorarch="$define"
7949 fi
7950
7951 : Final catch-all directories to search
7952 $cat <<EOM
7953
7954 Lastly, you can have perl look in other directories for extensions and
7955 modules in addition to those already specified.
7956 These directories will be searched after
7957         $sitearch
7958         $sitelib
7959 EOM
7960 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7961 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7962 echo ' '
7963 case "$otherlibdirs" in
7964 ''|' ') dflt='none' ;;
7965 *)      dflt="$otherlibdirs" ;;
7966 esac
7967 $cat <<EOM
7968 Enter a colon-separated set of extra paths to include in perl's @INC
7969 search path, or enter 'none' for no extra paths.
7970
7971 EOM
7972
7973 rp='Colon-separated list of additional directories for perl to search?'
7974 . ./myread
7975 case "$ans" in
7976 ' '|''|none)    otherlibdirs=' ' ;;
7977 *)      otherlibdirs="$ans" ;;
7978 esac
7979 case "$otherlibdirs" in
7980 ' ') val=$undef ;;
7981 *)      val=$define ;;
7982 esac
7983 set d_perl_otherlibdirs
7984 eval $setvar
7985
7986 : Cruising for prototypes
7987 echo " "
7988 echo "Checking out function prototypes..." >&4
7989 $cat >prototype.c <<EOCP
7990 #$i_stdlib I_STDLIB
7991 #ifdef I_STDLIB
7992 #include <stdlib.h>
7993 #endif
7994 int main(int argc, char *argv[]) {
7995         exit(0);}
7996 EOCP
7997 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7998         echo "Your C compiler appears to support function prototypes."
7999         val="$define"
8000 else
8001         echo "Your C compiler doesn't seem to understand function prototypes."
8002         val="$undef"
8003 fi
8004 set prototype
8005 eval $setvar
8006 $rm -f prototype*
8007
8008 : Check if ansi2knr is required
8009 case "$prototype" in
8010 "$define") ;;
8011 *)      ansi2knr='ansi2knr'
8012         echo " "
8013         cat <<EOM >&4
8014
8015 $me:  FATAL ERROR:
8016 This version of $package can only be compiled by a compiler that
8017 understands function prototypes.  Unfortunately, your C compiler
8018         $cc $ccflags
8019 doesn't seem to understand them.  Sorry about that.
8020
8021 If GNU cc is available for your system, perhaps you could try that instead.
8022
8023 Eventually, we hope to support building Perl with pre-ANSI compilers.
8024 If you would like to help in that effort, please contact <perlbug@perl.org>.
8025
8026 Aborting Configure now.
8027 EOM
8028         exit 2
8029         ;;
8030 esac
8031
8032 : DTrace support
8033 dflt_dtrace='/usr/sbin/dtrace'
8034 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8035
8036 cat <<EOM
8037
8038 Perl can be built to support DTrace on platforms that support it.
8039 DTrace is a diagnosis and performance analysis tool from Sun.
8040
8041 If this doesn't make any sense to you, just accept the default.
8042 EOM
8043
8044 while $test 1 ; do
8045         case "$usedtrace" in
8046         $define|true|[yY]*)
8047                 dflt='y'
8048                 ;;
8049         ?*)
8050                 dflt='y'
8051                 dflt_dtrace=$usedtrace
8052                 ;;
8053         *)
8054                 dflt='n'
8055                 ;;
8056         esac
8057
8058         rp='Support DTrace if available?'
8059         . ./myread
8060         case "$ans" in
8061         y|Y)    val="$define" ;;
8062         *)      val="$undef" ;;
8063         esac
8064         set usedtrace
8065         eval $setvar
8066
8067         test "X$usedtrace" != "X$define" && break
8068
8069         echo " "
8070         rp='Where is the dtrace executable?'
8071         dflt=$dflt_dtrace
8072         . ./getfile
8073         val="$ans"
8074         set dtrace
8075         eval $setvar
8076
8077         if $test -f $dtrace
8078         then
8079                 if $dtrace -h -s ../perldtrace.d \
8080                         -o perldtrace.tmp >/dev/null 2>&1 \
8081                         && rm -f perldtrace.tmp
8082                 then
8083                         echo " "
8084                         echo "Good: your $dtrace knows about the -h flag."
8085                 else
8086                         cat >&2 <<EOM
8087
8088 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8089 ***
8090 *** Your installed dtrace doesn't support the -h switch to compile a D
8091 *** program into a C header. Can't continue.
8092
8093 EOM
8094                         exit 1
8095                 fi
8096                 break;
8097         fi
8098
8099         case "$fastread" in
8100         yes)
8101                 cat >&2 <<EOM
8102
8103 *** $me:  Fatal Error:  $dtrace not found.
8104 *** Can't continue.
8105
8106 EOM
8107                 exit 1
8108                 ;;
8109         *)
8110                 echo "*** $dtrace was not found."
8111                 echo " "
8112                 ;;
8113         esac
8114 done
8115
8116 : See if we want extra modules installed
8117 echo " "
8118 case "$extras" in
8119 '') dflt='n';;
8120 *) dflt='y';;
8121 esac
8122 cat <<EOM
8123 Perl can be built with extra modules or bundles of modules which
8124 will be fetched from the CPAN and installed alongside Perl.
8125
8126 Notice that you will need access to the CPAN; either via the Internet,
8127 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8128 be asked later to configure the CPAN.pm module which will in turn do
8129 the installation of the rest of the extra modules or bundles.)
8130
8131 Notice also that if the modules require any external software such as
8132 libraries and headers (the libz library and the zlib.h header for the
8133 Compress::Zlib module, for example) you MUST have any such software
8134 already installed, this configuration process will NOT install such
8135 things for you.
8136
8137 If this doesn't make any sense to you, just accept the default '$dflt'.
8138 EOM
8139 rp='Install any extra modules (y or n)?'
8140 . ./myread
8141 case "$ans" in
8142 y|Y)
8143         cat <<EOM
8144
8145 Please list any extra modules or bundles to be installed from CPAN,
8146 with spaces between the names.  The names can be in any format the
8147 'install' command of CPAN.pm will understand.  (Answer 'none',
8148 without the quotes, to install no extra modules or bundles.)
8149 EOM
8150         rp='Extras?'
8151         dflt="$extras"
8152         . ./myread
8153         extras="$ans"
8154 esac
8155 case "$extras" in
8156 ''|'none')
8157         val=''
8158         $rm -f ../extras.lst
8159         ;;
8160 *)      echo "(Saving the list of extras for later...)"
8161         echo "$extras" > ../extras.lst
8162         val="'$extras'"
8163         ;;
8164 esac
8165 set extras
8166 eval $setvar
8167 echo " "
8168
8169 : determine where html pages for programs go
8170 set html1dir html1dir none
8171 eval $prefixit
8172 $cat <<EOM
8173
8174 If you wish to install html files for programs in $spackage, indicate
8175 the appropriate directory here.  To skip installing html files,
8176 answer "none".
8177 EOM
8178 case "$html1dir" in
8179 ''|none|$undef|' ') dflt=none ;;
8180 *) dflt=$html1dir ;;
8181 esac
8182 fn=dn+~
8183 rp="Directory for the main $spackage html pages?"
8184 . ./getfile
8185 prefixvar=html1dir
8186 . ./setprefixvar
8187 : Use ' ' for none so value is preserved next time through Configure
8188 $test X"$html1dir" = "X" && html1dir=' '
8189
8190 : determine where html pages for libraries and modules go
8191 set html3dir html3dir none
8192 eval $prefixit
8193 $cat <<EOM
8194
8195 If you wish to install html files for modules associated with $spackage,
8196 indicate the appropriate directory here.  To skip installing html files,
8197 answer "none".
8198 EOM
8199 : There is no obvious default.  If they have specified html1dir, then
8200 : try to key off that, possibly changing .../html1 into .../html3.
8201 case "$html3dir" in
8202 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8203 *) dflt=$html3dir ;;
8204 esac
8205 fn=dn+~
8206 rp="Directory for the $spackage module html pages?"
8207 . ./getfile
8208 prefixvar=html3dir
8209 . ./setprefixvar
8210 : Use ' ' for none so value is preserved next time through Configure
8211 $test X"$html3dir" = "X" && html3dir=' '
8212
8213 : determine whether to install perl also as /usr/bin/perl
8214
8215 echo " "
8216 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8217         $cat <<EOM
8218 Many scripts expect perl to be installed as /usr/bin/perl.
8219
8220 If you want to, I can install the perl you are about to compile
8221 as /usr/bin/perl (in addition to $bin/perl).
8222 EOM
8223         if test -f /usr/bin/perl; then
8224             $cat <<EOM
8225
8226 However, please note that because you already have a /usr/bin/perl,
8227 overwriting that with a new Perl would very probably cause problems.
8228 Therefore I'm assuming you don't want to do that (unless you insist).
8229
8230 EOM
8231             case "$installusrbinperl" in
8232             "$define"|[yY]*)    dflt='y';;
8233             *)                  dflt='n';;
8234             esac
8235         else
8236             $cat <<EOM
8237
8238 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8239
8240 EOM
8241             case "$installusrbinperl" in
8242             "$undef"|[nN]*)     dflt='n';;
8243             *)                  dflt='y';;
8244             esac
8245         fi
8246         rp="Do you want to install perl as /usr/bin/perl?"
8247         . ./myread
8248         case "$ans" in
8249         [yY]*)  val="$define";;
8250         *)      val="$undef" ;;
8251         esac
8252 else
8253         val="$undef"
8254 fi
8255 set installusrbinperl
8256 eval $setvar
8257
8258 : see if dlopen exists
8259 xxx_runnm="$runnm"
8260 xxx_ccflags="$ccflags"
8261 runnm=false
8262 : with g++ one needs -shared to get is-in-libc to work for dlopen
8263 case "$gccversion" in
8264 '')     ;;
8265 *Clang*)        ;;
8266 *)      case "$d_cplusplus" in
8267         "$define") ccflags="$ccflags -shared" ;;
8268         esac
8269         ;;
8270 esac
8271 set dlopen d_dlopen
8272 eval $inlibc
8273 runnm="$xxx_runnm"
8274 ccflags="$xxx_ccflags"
8275
8276 : see if this is a unistd.h system
8277 set unistd.h i_unistd
8278 eval $inhdr
8279
8280 : determine which dynamic loading, if any, to compile in
8281 echo " "
8282 dldir="ext/DynaLoader"
8283 case "$usedl" in
8284     $define|y|true)
8285         dflt='y'
8286         usedl="$define"
8287         ;;
8288     $undef|n|false)
8289         dflt='n'
8290         usedl="$undef"
8291         ;;
8292     *)
8293         dflt='n'
8294         case "$d_dlopen" in
8295             $define) dflt='y' ;;
8296         esac
8297         : Does a dl_xxx.xs file exist for this operating system
8298         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8299         ;;
8300 esac
8301 rp="Do you wish to use dynamic loading?"
8302 . ./myread
8303 usedl="$ans"
8304 bin_ELF="$undef"
8305 case "$ans" in
8306     y*) usedl="$define"
8307         case "$dlsrc" in
8308             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8309                     dflt="$dldir/dl_${osname}.xs"
8310                 elif $test "$d_dlopen" = "$define" ; then
8311                     dflt="$dldir/dl_dlopen.xs"
8312                 else
8313                     dflt=''
8314                 fi
8315                 ;;
8316             *)  dflt="$dldir/$dlsrc"
8317                 ;;
8318         esac
8319         echo "The following dynamic loading files are available:"
8320         : Can not go over to $dldir because getfile has path hard-coded in.
8321         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8322         rp="Source file to use for dynamic loading"
8323         fn="fne"
8324         gfpth="$src"
8325         . ./getfile
8326         usedl="$define"
8327         : emulate basename
8328         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8329
8330         $cat << EOM
8331
8332 Some systems may require passing special flags to $cc -c to
8333 compile modules that will be used to create a shared library.
8334 To use no flags, say "none".
8335
8336 EOM
8337         case "$cccdlflags" in
8338             '') case "$gccversion" in
8339                 '') case "$osname" in
8340                         hpux)   dflt='+z' ;;
8341                         irix*)  dflt='-KPIC' ;;
8342                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8343                         sunos)  dflt='-pic' ;;
8344                         *)      dflt='none' ;;
8345                     esac
8346                     ;;
8347                 *)  case "$osname" in
8348                         darwin) dflt='none' ;;
8349                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8350                         *)      dflt='-fpic' ;;
8351                     esac ;;
8352                 esac ;;
8353             ' ') dflt='none' ;;
8354             *)   dflt="$cccdlflags" ;;
8355         esac
8356
8357         case "$dflt" in
8358             none) dflt='' ;;
8359         esac
8360
8361         # If -Dsysroot was specified, now's the time to add it
8362         # to cccdlflags
8363         if test "X$sysroot" != X; then
8364             case "$gccversion" in
8365                 '') ;;
8366                 *)  case "$dflt" in
8367                         *sysroot*) ;;
8368                         'undef'|*)
8369                             dflt="$dflt --sysroot=$sysroot" ;;
8370                     esac
8371                     ;;
8372             esac
8373         fi
8374
8375         case "$dflt" in
8376             '') dflt='none';;
8377         esac
8378
8379         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8380         . ./myread
8381         case "$ans" in
8382             none) cccdlflags=' ' ;;
8383             *)    cccdlflags="$ans" ;;
8384         esac
8385
8386         cat << EOM
8387
8388 Some systems use ld to create libraries that can be dynamically loaded,
8389 while other systems (such as those using ELF) use $cc.
8390
8391 EOM
8392
8393 : Determine if this is ELF
8394         $cat >try.c <<EOM
8395 /* Test for whether ELF binaries are produced */
8396 #include <fcntl.h>
8397 #$i_stdlib I_STDLIB
8398 #ifdef I_STDLIB
8399 #include <stdlib.h>
8400 #endif
8401 #$i_unistd I_UNISTD
8402 #ifdef I_UNISTD
8403 #include <unistd.h>
8404 #endif
8405 int main() {
8406     char b[4];
8407     int i = open("a.out",O_RDONLY);
8408     if(i == -1)
8409         exit(1); /* fail */
8410     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8411         exit(0); /* succeed (yes, it is ELF) */
8412     exit(1); /* fail */
8413 }
8414 EOM
8415         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8416             bin_ELF="$define"
8417         fi
8418         $rm_try
8419
8420         case "$ld" in
8421             '') if $test $bin_ELF = "$define"; then
8422                     cat <<EOM
8423 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8424 EOM
8425                     dflt="$cc"
8426                 else
8427                     echo "I'll use ld to build dynamic libraries."
8428                     dflt='ld'
8429                 fi
8430                 ;;
8431             *)  dflt="$ld"
8432                 ;;
8433         esac
8434
8435         rp="What command should be used to create dynamic libraries?"
8436         . ./myread
8437         ld="$ans"
8438
8439         cat << EOM
8440
8441 Some systems may require passing special flags to $ld to create a
8442 library that can be dynamically loaded.  If your ld flags include
8443 -L/other/path options to locate libraries outside your loader's normal
8444 search path, you may need to specify those -L options here as well.  To
8445 use no flags, say "none".
8446
8447 EOM
8448         case "$lddlflags" in
8449             '') case "$osname" in
8450                     haiku) dflt='-shared' ;;
8451                     hpux) dflt='-b';
8452                           case "$gccversion" in
8453                               '') dflt="$dflt +vnocompatwarnings" ;;
8454                           esac
8455                           ;;
8456                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8457                     solaris) # See [perl #66604].
8458                             # On Solaris 11, gcc -m64 on amd64
8459                             # appears not to understand -G.  gcc versions at
8460                             # least as old as 3.4.3 support -shared, so just
8461                             # use that with Solaris 11 and later, but keep
8462                             # the old behavior for older Solaris versions.
8463                             case "$gccversion" in
8464                                 '') dflt='-G' ;;
8465                                 *)  case "$osvers" in
8466                                         2.?|2.10) dflt='-G' ;;
8467                                         *) dflt='-shared' ;;
8468                                     esac
8469                                     ;;
8470                             esac
8471                             ;;
8472                     sunos) dflt='-assert nodefinitions' ;;
8473                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8474                     *)     dflt='none' ;;
8475                 esac
8476                 ;;
8477             *) dflt="$lddlflags" ;;
8478         esac
8479
8480         : Only do this for gcc, since, for example, qcc has no concept
8481         : of --sysroot.
8482         if $test "X$sysroot" != X; then
8483             case "$gccversion" in
8484                 '') ;;
8485                 *)  dflt="$dflt --sysroot $sysroot" ;;
8486             esac
8487         fi
8488
8489         : Try to guess additional flags to pick up local libraries.
8490         : Be careful not to append to a plain 'none'
8491         case "$dflt" in
8492             none) dflt='' ;;
8493         esac
8494         for thisflag in $ldflags; do
8495             case "$thisflag" in
8496                 -L*|-R*|-Wl,-R*)
8497                     case " $dflt " in
8498                         *" $thisflag "*) ;;
8499                         *) dflt="$dflt $thisflag" ;;
8500                     esac
8501                     ;;
8502             esac
8503         done
8504
8505         case "$dflt" in
8506             ''|' ') dflt='none' ;;
8507         esac
8508
8509         case "$ldflags" in
8510             *-fstack-protector-strong*)
8511                 case "$dflt" in
8512                     *-fstack-protector-strong*) ;; # Don't add it again
8513                     *) dflt="$dflt -fstack-protector-strong" ;;
8514                 esac
8515                 ;;
8516             *-fstack-protector*)
8517                 case "$dflt" in
8518                     *-fstack-protector*) ;; # Don't add it again
8519                     *) dflt="$dflt -fstack-protector" ;;
8520                 esac
8521                 ;;
8522         esac
8523
8524         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8525         . ./myread
8526         case "$ans" in
8527             none) lddlflags=' ' ;;
8528             *) lddlflags="$ans" ;;
8529         esac
8530
8531         cat <<EOM
8532
8533 Some systems may require passing special flags to $cc to indicate that
8534 the resulting executable will use dynamic linking.  To use no flags,
8535 say "none".
8536
8537 EOM
8538         case "$ccdlflags" in
8539             '') case "$osname" in
8540                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8541                     sunos)             dflt='none'   ;;
8542                     *)                 dflt='none'   ;;
8543                 esac ;;
8544             ' ') dflt='none' ;;
8545             *)   dflt="$ccdlflags" ;;
8546         esac
8547         rp="Any special flags to pass to $cc to use dynamic linking?"
8548         . ./myread
8549         case "$ans" in
8550             none) ccdlflags=' ' ;;
8551             *)    ccdlflags="$ans" ;;
8552         esac
8553         ;;
8554
8555     *)  usedl="$undef"
8556         ld='ld'
8557         dlsrc='dl_none.xs'
8558         lddlflags=''
8559         ccdlflags=''
8560         ;;
8561 esac
8562
8563 ld_can_script="$undef"
8564 case "$bin_ELF$usedl" in
8565     $define$define)
8566         # Abuse try.h and a.out names for neat cleanup
8567         $cat >try.c <<EOM
8568 void foo() {}
8569 void bar() {}
8570 EOM
8571         $cat >try.h <<EOM
8572 LIBTEST_42 {
8573  global:
8574   foo;
8575  local: *;
8576  };
8577 EOM
8578         if $cc $cccdlflags $ccdlflags $ccflags \
8579                $ldflags $lddlflags -o a.out try.c \
8580                -Wl,--version-script=try.h >/dev/null 2>&1 \
8581            &&  $test -s a.out ; then
8582             echo "ld supports scripting" >&4
8583             ld_can_script="$define"
8584         else
8585             echo "ld does not support scripting" >&4
8586         fi
8587         $rm_try
8588         ;;
8589 esac
8590
8591 : Do we want a shared libperl?
8592 also=''
8593 case "$usedl" in
8594 $undef)
8595         # No dynamic loading being used, so don't bother even to prompt.
8596         useshrplib='false'
8597         ;;
8598 *)      case "$useshrplib" in
8599         '')     case "$osname" in
8600                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8601                         dflt=y
8602                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8603                         ;;
8604                 *)      dflt=n
8605                         ;;
8606                 esac
8607                 ;;
8608         $define|true|[Yy]*)
8609                 dflt=y
8610                 ;;
8611         *)      dflt=n
8612                 ;;
8613         esac
8614         $cat << EOM
8615
8616 The perl executable is normally obtained by linking perlmain.c with
8617 libperl${_a}, any static extensions (usually just DynaLoader), and
8618 any other libraries needed on this system (such as -lm, etc.).  Since
8619 your system supports dynamic loading, it is probably possible to build
8620 a shared libperl.$so.  If you will have more than one executable linked
8621 to libperl.$so, this will significantly reduce the size of each
8622 executable, but it may have a noticeable effect on performance.  The
8623 default is probably sensible for your system.
8624 $also
8625
8626 EOM
8627         rp="Build a shared libperl.$so (y/n)"
8628         . ./myread
8629         case "$ans" in
8630         true|$define|[Yy]*)
8631                 useshrplib='true'  ;;
8632         *)      useshrplib='false' ;;
8633         esac
8634         ;;
8635 esac
8636
8637 case "$useshrplib" in
8638 true)
8639         case "$userelocatableinc" in
8640         true|define)
8641                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8642                 echo "See INSTALL for an explanation why that won't work." >&4
8643                 exit 4
8644                 ;;
8645         esac
8646         case "$libperl" in
8647         '')
8648                 # Figure out a good name for libperl.so.  Since it gets stored in
8649                 # a version-specific architecture-dependent library, the version
8650                 # number isn't really that important, except for making cc/ld happy.
8651                 #
8652                 # A name such as libperl.so.10.1
8653                 majmin="libperl.$so.$patchlevel.$subversion"
8654                 # A name such as libperl.so.100
8655                 majonly=`echo $patchlevel $subversion |
8656                         $awk '{printf "%d%02d", $1, $2}'`
8657                 majonly=libperl.$so.$majonly
8658                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8659                 # rely on figuring it out from the naming of libc.
8660                 case "${osname}${osvers}" in
8661                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8662                         dflt=libperl.$so
8663                         ;;
8664                 cygwin*) # ld links now against the dll directly
8665                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8666                         majonly=`echo $patchlevel $subversion |
8667                                 $awk '{printf "%03d%03d", $1, $2}'`
8668                         majonly=cygperl5.$majonly.$so
8669                         dflt=$majmin
8670                         ;;
8671                 *)      # Try to guess based on whether libc has major.minor.
8672                         case "$libc" in
8673                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8674                         *libc.$so.[0-9]*) dflt=$majonly ;;
8675                         *)      dflt=libperl.$so ;;
8676                         esac
8677                         ;;
8678                 esac
8679                 ;;
8680         *)      dflt=$libperl
8681                 ;;
8682         esac
8683         cat << EOM
8684
8685 I need to select a good name for the shared libperl.  If your system uses
8686 library names with major and minor numbers, then you might want something
8687 like $majmin.  Alternatively, if your system uses a single version
8688 number for shared libraries, then you might want to use $majonly.
8689 Or, your system might be quite happy with a simple libperl.$so.
8690
8691 Since the shared libperl will get installed into a version-specific
8692 architecture-dependent directory, the version number of the shared perl
8693 library probably isn't important, so the default should be o.k.
8694
8695 EOM
8696         rp='What name do you want to give to the shared libperl?'
8697         . ./myread
8698         libperl=$ans
8699         echo "Ok, I'll use $libperl"
8700         ;;
8701 *)
8702         libperl="libperl${_a}"
8703         ;;
8704 esac
8705
8706 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8707 case "$shrpdir" in
8708 '') ;;
8709 *)      $cat >&4 <<EOM
8710 WARNING:  Use of the shrpdir variable for the installation location of
8711 the shared $libperl is not supported.  It was never documented and
8712 will not work in this version.  Let me (perlbug@perl.org)
8713 know of any problems this may cause.
8714
8715 EOM
8716         case "$shrpdir" in
8717         "$archlibexp/CORE")
8718                 $cat >&4 <<EOM
8719 But your current setting of $shrpdir is
8720 the default anyway, so it's harmless.
8721 EOM
8722                 ;;
8723         *)
8724                 $cat >&4 <<EOM
8725 Further, your current attempted setting of $shrpdir
8726 conflicts with the value of $archlibexp/CORE
8727 that installperl will use.
8728 EOM
8729                 ;;
8730         esac
8731         ;;
8732 esac
8733
8734 # How will the perl executable find the installed shared $libperl?
8735 # Add $xxx to ccdlflags.
8736 # If we can't figure out a command-line option, use $shrpenv to
8737 # set env LD_RUN_PATH.  The main perl makefile uses this.
8738 shrpdir=$archlibexp/CORE
8739 xxx=''
8740 tmp_shrpenv=''
8741 if "$useshrplib"; then
8742     case "$osname" in
8743         aix)
8744                 # We'll set it in Makefile.SH...
8745                 ;;
8746         solaris)
8747                 xxx="-R $shrpdir"
8748                 ;;
8749         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8750                 xxx="-Wl,-R$shrpdir"
8751                 ;;
8752         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8753                 xxx="-Wl,-rpath,$shrpdir"
8754                 ;;
8755         hpux*)
8756                 # hpux doesn't like the default, either.
8757                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8758                 ;;
8759         cygwin)
8760                 # cygwin needs only ldlibpth
8761                 ;;
8762         *)
8763                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8764                 ;;
8765         esac
8766         case "$xxx" in
8767         '') ;;
8768         *)
8769                 # Only add $xxx if it isn't already in ccdlflags.
8770                 case " $ccdlflags " in
8771                 *" $xxx "*)     ;;
8772                 *)      ccdlflags="$ccdlflags $xxx"
8773                         cat <<EOM >&4
8774
8775 Adding $xxx to the flags
8776 passed to $ld so that the perl executable will find the
8777 installed shared $libperl.
8778
8779 EOM
8780                         ;;
8781                 esac
8782                 ;;
8783         esac
8784 fi
8785 # Fix ccdlflags in AIX for building external extensions.
8786 # (For building Perl itself bare -bE:perl.exp is needed,
8787 #  Makefile.SH takes care of this.)
8788 case "$osname" in
8789 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8790 esac
8791 # Respect a hint or command-line value.
8792 case "$shrpenv" in
8793 '') shrpenv="$tmp_shrpenv" ;;
8794 esac
8795 case "$ldlibpthname" in
8796 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8797 none)   ldlibpthname='' ;;
8798 esac
8799
8800 : determine where manual pages are on this system
8801 echo " "
8802 case "$sysman" in
8803 '')
8804         syspath='/usr/share/man/man1 /usr/man/man1'
8805         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8806         syspath="$syspath /usr/man/u_man/man1"
8807         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8808         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8809         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8810         sysman=`./loc . /usr/man/man1 $syspath`
8811         ;;
8812 esac
8813 if $test -d "$sysman"; then
8814         echo "System manual is in $sysman." >&4
8815 else
8816         echo "Could not find manual pages in source form." >&4
8817 fi
8818
8819 : determine where manual pages go
8820 set man1dir man1dir none
8821 eval $prefixit
8822 $cat <<EOM
8823
8824 $spackage has manual pages available in source form.
8825 EOM
8826 case "$nroff" in
8827 nroff)
8828         echo "However, you don't have nroff, so they're probably useless to you."
8829         case "$man1dir" in
8830         '') man1dir="none";;
8831         esac;;
8832 esac
8833 echo "If you don't want the manual sources installed, answer 'none'."
8834 case "$man1dir" in
8835 ' ') dflt=none
8836         ;;
8837 '')
8838         lookpath="$prefixexp/share/man/man1"
8839         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8840         lookpath="$lookpath $prefixexp/man/p_man/man1"
8841         lookpath="$lookpath $prefixexp/man/u_man/man1"
8842         lookpath="$lookpath $prefixexp/man/man.1"
8843         case "$sysman" in
8844         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8845         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8846         esac
8847         set dflt
8848         eval $prefixup
8849         ;;
8850 *)  dflt="$man1dir"
8851         ;;
8852 esac
8853 echo " "
8854 fn=dn+~
8855 rp="Where do the main $spackage manual pages (source) go?"
8856 . ./getfile
8857 if $test "X$man1direxp" != "X$ansexp"; then
8858         installman1dir=''
8859 fi
8860 prefixvar=man1dir
8861 . ./setprefixvar
8862
8863 case "$man1dir" in
8864 '')     man1dir=' '
8865         installman1dir='';;
8866 esac
8867
8868 : What suffix to use on installed man pages
8869
8870 case "$man1dir" in
8871 ' ')
8872         man1ext='0'
8873         ;;
8874 *)
8875         rp="What suffix should be used for the main $spackage man pages?"
8876         case "$man1ext" in
8877         '')     case "$man1dir" in
8878                 *1)  dflt=1 ;;
8879                 *1p) dflt=1p ;;
8880                 *1pm) dflt=1pm ;;
8881                 *l) dflt=l;;
8882                 *n) dflt=n;;
8883                 *o) dflt=o;;
8884                 *p) dflt=p;;
8885                 *C) dflt=C;;
8886                 *L) dflt=L;;
8887                 *L1) dflt=L1;;
8888                 *) dflt=1;;
8889                 esac
8890                 ;;
8891         *)      dflt="$man1ext";;
8892         esac
8893         . ./myread
8894         man1ext="$ans"
8895         ;;
8896 esac
8897
8898 : see if we can have long filenames
8899 echo " "
8900 first=123456789abcdef
8901 $rm -f $first
8902 if (echo hi >$first) 2>/dev/null; then
8903         if $test -f 123456789abcde; then
8904                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8905                 val="$undef"
8906         else
8907                 echo 'You can have filenames longer than 14 characters.'>&4
8908                 val="$define"
8909         fi
8910 else
8911         $cat <<'EOM'
8912 You can't have filenames longer than 14 chars.
8913 You can't even think about them!
8914 EOM
8915         val="$undef"
8916 fi
8917 set d_flexfnam
8918 eval $setvar
8919 $rm -rf 123456789abcde*
8920
8921 : determine where library module manual pages go
8922 set man3dir man3dir none
8923 eval $prefixit
8924 $cat <<EOM
8925
8926 $spackage has manual pages for many of the library modules.
8927 EOM
8928
8929 case "$nroff" in
8930 nroff)
8931         $cat <<'EOM'
8932 However, you don't have nroff, so they're probably useless to you.
8933 EOM
8934         case "$man3dir" in
8935         '') man3dir="none";;
8936         esac;;
8937 esac
8938
8939 case "$d_flexfnam" in
8940 undef)
8941         $cat <<'EOM'
8942 However, your system can't handle the long file names like File::Basename.3.
8943 EOM
8944         case "$man3dir" in
8945         '') man3dir="none";;
8946         esac;;
8947 esac
8948
8949 echo "If you don't want the manual sources installed, answer 'none'."
8950 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8951 case "$man3dir" in
8952 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8953         if $test -d "$privlib/man/man3"; then
8954                 cat <<EOM >&4
8955
8956 WARNING:  Previous versions of perl installed man3 pages into
8957 $privlib/man/man3.  This version will suggest a
8958 new default of $dflt.
8959 EOM
8960                 tdflt=$dflt
8961                 dflt='n'
8962                 rp='Do you wish to preserve the old behavior?(y/n)'
8963                 . ./myread
8964                 case "$ans" in
8965                 y*) dflt="$privlib/man/man3" ;;
8966                 *)  dflt=$tdflt ;;
8967                 esac
8968     fi
8969         ;;
8970 *)      dflt="$man3dir" ;;
8971 esac
8972 case "$dflt" in
8973 ' ') dflt=none ;;
8974 esac
8975 echo " "
8976 fn=dn+~
8977 rp="Where do the $package library man pages (source) go?"
8978 . ./getfile
8979 prefixvar=man3dir
8980 . ./setprefixvar
8981
8982 case "$man3dir" in
8983 '')     man3dir=' '
8984         installman3dir='';;
8985 esac
8986
8987 : What suffix to use on installed man pages
8988 case "$man3dir" in
8989 ' ')
8990         man3ext='0'
8991         ;;
8992 *)
8993         rp="What suffix should be used for the $package library man pages?"
8994         case "$man3ext" in
8995         '')     case "$man3dir" in
8996                 *3)  dflt=3 ;;
8997                 *3p) dflt=3p ;;
8998                 *3pm) dflt=3pm ;;
8999                 *l) dflt=l;;
9000                 *n) dflt=n;;
9001                 *o) dflt=o;;
9002                 *p) dflt=p;;
9003                 *C) dflt=C;;
9004                 *L) dflt=L;;
9005                 *L3) dflt=L3;;
9006                 *) dflt=3;;
9007                 esac
9008                 ;;
9009         *)      dflt="$man3ext";;
9010         esac
9011         . ./myread
9012         man3ext="$ans"
9013         ;;
9014 esac
9015
9016 : see if we have to deal with yellow pages, now NIS.
9017 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9018         case "$hostcat" in
9019         nidump*) ;;
9020         *)
9021                 case "$hostcat" in
9022                 *ypcat*) dflt=y;;
9023                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9024                                 dflt=y
9025                         else
9026                                 dflt=n
9027                         fi;;
9028                 *) dflt=n;;
9029                 esac
9030                 echo " "
9031                 rp='Are you getting the hosts file via yellow pages?'
9032                 . ./myread
9033                 case "$ans" in
9034                 y*) hostcat='ypcat hosts';;
9035                 *) hostcat='cat /etc/hosts';;
9036                 esac
9037                 ;;
9038         esac
9039 fi
9040 case "$hostcat" in
9041 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9042 esac
9043 case "$groupcat" in
9044 '') test -f /etc/group && groupcat='cat /etc/group';;
9045 esac
9046 case "$passcat" in
9047 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9048 esac
9049
9050 : now get the host name
9051 echo " "
9052 echo "Figuring out host name..." >&4
9053 case "$myhostname" in
9054 '') cont=true
9055         echo 'Maybe "hostname" will work...'
9056         if tans=`sh -c hostname 2>&1` ; then
9057                 myhostname=$tans
9058                 phostname=hostname
9059                 cont=''
9060         fi
9061         ;;
9062 *) cont='';;
9063 esac
9064 if $test "$cont"; then
9065         if ./xenix; then
9066                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9067                 if tans=`cat /etc/systemid 2>&1` ; then
9068                         myhostname=$tans
9069                         phostname='cat /etc/systemid'
9070                         echo "Whadyaknow.  Xenix always was a bit strange..."
9071                         cont=''
9072                 fi
9073         elif $test -r /etc/systemid; then
9074                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9075         fi
9076 fi
9077 if $test "$cont"; then
9078         echo 'No, maybe "uuname -l" will work...'
9079         if tans=`sh -c 'uuname -l' 2>&1` ; then
9080                 myhostname=$tans
9081                 phostname='uuname -l'
9082         else
9083                 echo 'Strange.  Maybe "uname -n" will work...'
9084                 if tans=`sh -c 'uname -n' 2>&1` ; then
9085                         myhostname=$tans
9086                         phostname='uname -n'
9087                 else
9088                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9089                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9090                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9091                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9092                         else
9093                                 case "$myhostname" in
9094                                 '') echo "Does this machine have an identity crisis or something?"
9095                                         phostname='';;
9096                                 *)
9097                                         echo "Well, you said $myhostname before..."
9098                                         phostname='echo $myhostname';;
9099                                 esac
9100                         fi
9101                 fi
9102         fi
9103 fi
9104 case "$myhostname" in
9105 '') myhostname=noname ;;
9106 esac
9107 : you do not want to know about this
9108 set $myhostname
9109 myhostname=$1
9110
9111 : verify guess
9112 if $test "$myhostname" ; then
9113         dflt=y
9114         rp='Your host name appears to be "'$myhostname'".'" Right?"
9115         . ./myread
9116         case "$ans" in
9117         y*) ;;
9118         *) myhostname='';;
9119         esac
9120 fi
9121
9122 : bad guess or no guess
9123 while $test "X$myhostname" = X ; do
9124         dflt=''
9125         rp="Please type the (one word) name of your host:"
9126         . ./myread
9127         myhostname="$ans"
9128 done
9129
9130 : translate upper to lower if necessary
9131 case "$myhostname" in
9132 *[A-Z]*)
9133         echo "(Normalizing case in your host name)"
9134         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9135         ;;
9136 esac
9137
9138 case "$myhostname" in
9139 *.*)
9140         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9141         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9142         echo "(Trimming domain name from host name--host name is now $myhostname)"
9143         ;;
9144 *) case "$mydomain" in
9145         '')
9146                 {
9147                         test "X$hostcat" = "Xypcat hosts" &&
9148                         ypmatch "$myhostname" hosts 2>/dev/null |\
9149                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9150                         $test -s hosts
9151                 } || {
9152                         test "X$hostcat" != "X" &&
9153                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9154                                         /[       ]$myhostname[  . ]/p" > hosts
9155                 }
9156                 tmp_re="[       . ]"
9157                 if $test -f hosts; then
9158                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9159                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9160                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9161                                 hosts | $sort | $uniq | \
9162                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9163                         case `$echo X$dflt` in
9164                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9165                                 dflt=.
9166                                 ;;
9167                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9168                                 ;;
9169                         esac
9170                 else
9171                         echo "(I cannot locate a hosts database anywhere)"
9172                         dflt=.
9173                 fi
9174                 case "$dflt" in
9175                 .)
9176                         tans=`./loc resolv.conf X /etc /usr/etc`
9177                         if $test -f "$tans"; then
9178                                 echo "(Attempting domain name extraction from $tans)"
9179                                 dflt=.`$sed -n -e 's/   / /g' \
9180                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9181                                   -e 1q 2>/dev/null`
9182                                 case "$dflt" in
9183                                 .) dflt=.`$sed -n -e 's/        / /g' \
9184                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9185                                      -e 1q 2>/dev/null`
9186                                         ;;
9187                                 esac
9188                         fi
9189                         ;;
9190                 esac
9191                 case "$dflt" in
9192                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9193                         dflt=.`sh -c domainname 2>/dev/null`
9194                         case "$dflt" in
9195                         '') dflt='.';;
9196                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9197                         esac
9198                         ;;
9199                 esac
9200                 case "$dflt$osname" in
9201                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9202                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9203                         ;;
9204                 esac
9205                 case "$dflt" in
9206                 .) echo "(Lost all hope -- silly guess then)"
9207                         dflt='.nonet'
9208                         ;;
9209                 esac
9210                 $rm -f hosts
9211                 ;;
9212         *) dflt="$mydomain";;
9213         esac;;
9214 esac
9215 echo " "
9216 rp="What is your domain name?"
9217 . ./myread
9218 tans="$ans"
9219 case "$ans" in
9220 '') ;;
9221 .*) ;;
9222 *) tans=".$tans";;
9223 esac
9224 mydomain="$tans"
9225
9226 : translate upper to lower if necessary
9227 case "$mydomain" in
9228 *[A-Z]*)
9229         echo "(Normalizing case in your domain name)"
9230         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9231         ;;
9232 esac
9233
9234 : a little sanity check here
9235 case "$phostname" in
9236 '') ;;
9237 *)
9238         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9239         $myhostname$mydomain|$myhostname) ;;
9240         *)
9241                 case "$phostname" in
9242                 sed*)
9243                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9244                         ;;
9245                 *)
9246                         echo "(That doesn't agree with your $phostname command, by the way.)"
9247                         ;;
9248                 esac
9249         ;;
9250         esac
9251         ;;
9252 esac
9253
9254 : determine the e-mail address of the user who is running us
9255 $cat <<EOM
9256
9257 I need to get your e-mail address in Internet format if possible, i.e.
9258 something like user@host.domain. Please answer accurately since I have
9259 no easy means to double check it. The default value provided below
9260 is most probably close to reality but may not be valid from outside
9261 your organization...
9262
9263 EOM
9264 cont=x
9265 while test "$cont"; do
9266         case "$MAILDOMAIN" in
9267         '')
9268                 if $test -s /etc/mailname; then
9269                         maildomain=`$cat /etc/mailname`
9270                 else
9271                         maildomain="$myhostname$mydomain"
9272                 fi
9273                 ;;
9274         *)  maildomain="$MAILDOMAIN";;
9275         esac
9276         case "$cf_email" in
9277         '') dflt="$cf_by@$maildomain";;
9278         *)  dflt="$cf_email";;
9279         esac
9280         rp='What is your e-mail address?'
9281         . ./myread
9282         cf_email="$ans"
9283         case "$cf_email" in
9284         *@*.*) cont='' ;;
9285         *)
9286                 rp='Address does not look like an Internet one.  Use it anyway?'
9287                 case "$fastread" in
9288                 yes) dflt=y ;;
9289                 *) dflt=n ;;
9290                 esac
9291                 . ./myread
9292                 case "$ans" in
9293                 y*) cont='' ;;
9294                 *) echo " " ;;
9295                 esac
9296                 ;;
9297         esac
9298 done
9299
9300 : Ask e-mail of administrator
9301 $cat <<EOM
9302
9303 If you or somebody else will be maintaining perl at your site, please
9304 fill in the correct e-mail address here so that they may be contacted
9305 if necessary. Currently, the "perlbug" program included with perl
9306 will send mail to this address in addition to perlbug@perl.org. You may
9307 enter "none" for no administrator.
9308
9309 EOM
9310 case "$perladmin" in
9311 '') dflt="$cf_email";;
9312 *) dflt="$perladmin";;
9313 esac
9314 rp='Perl administrator e-mail address'
9315 . ./myread
9316 perladmin="$ans"
9317
9318 : determine whether to only install version-specific parts.
9319 echo " "
9320 $cat <<EOM
9321 Do you want to install only the version-specific parts of the perl
9322 distribution?  Usually you do *not* want to do this.
9323 EOM
9324 case "$versiononly" in
9325 "$define"|[Yy]*|true) dflt='y' ;;
9326 *) dflt='n';
9327 esac
9328 rp="Do you want to install only the version-specific parts of perl?"
9329 . ./myread
9330 case "$ans" in
9331 [yY]*)  val="$define";;
9332 *)      val="$undef" ;;
9333 esac
9334 set versiononly
9335 eval $setvar
9336
9337 case "$versiononly" in
9338 "$define") inc_version_list=''
9339            inc_version_list_init=0
9340            ;;
9341 esac
9342
9343 : figure out how to guarantee perl startup
9344 : XXX Note that this currently takes advantage of the bug that binexp ignores
9345 :     the Configure -Dinstallprefix setting, which in turn means that under
9346 :     relocatable @INC, initialinstalllocation is what binexp started as.
9347 case "$startperl" in
9348 '')
9349         case "$sharpbang" in
9350         *!)
9351                 $cat <<EOH
9352
9353 I can use the #! construct to start perl on your system. This will
9354 make startup of perl scripts faster, but may cause problems if you
9355 want to share those scripts and perl is not in a standard place
9356 ($initialinstalllocation/perl) on all your platforms. The alternative
9357 is to force a shell by starting the script with a single ':' character.
9358
9359 EOH
9360                 case "$versiononly" in
9361                 "$define")      dflt="$initialinstalllocation/perl$version";;
9362                 *)              dflt="$initialinstalllocation/perl";;
9363                 esac
9364                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9365                 . ./myread
9366                 case "$ans" in
9367                 none)   startperl=": # use perl";;
9368                 *)      startperl="#!$ans"
9369                         if $test 30 -lt `echo "$ans" | wc -c`; then
9370                                 $cat >&4 <<EOM
9371
9372 WARNING:  Some systems limit the #! command to 32 characters.
9373 If you experience difficulty running Perl scripts with #!, try
9374 installing Perl in a directory with a shorter pathname.
9375
9376 EOM
9377                         fi ;;
9378                 esac
9379                 ;;
9380         *) startperl=": # use perl"
9381                 ;;
9382         esac
9383         ;;
9384 esac
9385 echo "I'll use $startperl to start perl scripts."
9386
9387 : figure best path for perl in scripts
9388 case "$perlpath" in
9389 '')
9390         case "$versiononly" in
9391         "$define")      perlpath="$initialinstalllocation/perl$version";;
9392         *)              perlpath="$initialinstalllocation/perl";;
9393         esac
9394         case "$startperl" in
9395         *!*) ;;
9396         *)
9397                 $cat <<EOH
9398
9399 I will use the "eval 'exec'" idiom to start Perl on your system.
9400 I can use the full path of your Perl binary for this purpose, but
9401 doing so may cause problems if you want to share those scripts and
9402 Perl is not always in a standard place ($initialinstalllocation/perl).
9403
9404 EOH
9405                 dflt="$initialinstalllocation/perl"
9406                 rp="What path shall I use in \"eval 'exec'\"?"
9407                 . ./myread
9408                 perlpath="$ans"
9409                 ;;
9410         esac
9411         ;;
9412 esac
9413 case "$startperl" in
9414 *!*)    ;;
9415 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9416 esac
9417
9418 : determine where public executable scripts go
9419 set scriptdir scriptdir
9420 eval $prefixit
9421 case "$scriptdir" in
9422 '')
9423         dflt="$bin"
9424         : guess some guesses
9425         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9426         $test -d /usr/share/bin     && dflt=/usr/share/bin
9427         $test -d /usr/local/script  && dflt=/usr/local/script
9428         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9429         $test -d $prefixexp/script  && dflt=$prefixexp/script
9430         set dflt
9431         eval $prefixup
9432         ;;
9433 *)  dflt="$scriptdir"
9434         ;;
9435 esac
9436 $cat <<EOM
9437
9438 Some installations have a separate directory just for executable scripts so
9439 that they can mount it across multiple architectures but keep the scripts in
9440 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9441 Or you might just lump your scripts in with all your other executables.
9442
9443 EOM
9444 fn=d~
9445 rp='Where do you keep publicly executable scripts?'
9446 . ./getfile
9447 if $test "X$ansexp" != "X$scriptdirexp"; then
9448         installscript=''
9449 fi
9450 installscriptdir=''
9451 prefixvar=scriptdir
9452 . ./setprefixvar
9453 : A little fix up for an irregularly named variable.
9454 installscript="$installscriptdir"
9455
9456 : determine where add-on public executables go
9457 case "$sitebin" in
9458 '')     dflt=$siteprefix/bin ;;
9459 *)      dflt=$sitebin ;;
9460 esac
9461 fn=d~
9462 rp='Pathname where the add-on public executables should be installed?'
9463 . ./getfile
9464 prefixvar=sitebin
9465 . ./setprefixvar
9466
9467 : determine where add-on html pages go
9468 : There is no standard location, so try to copy the previously-selected
9469 : directory structure for the core html pages.
9470 case "$sitehtml1dir" in
9471 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9472 *)     dflt=$sitehtml1dir ;;
9473 esac
9474 case "$dflt" in
9475 ''|' ') dflt=none ;;
9476 esac
9477 fn=dn+~
9478 rp='Pathname where the site-specific html pages should be installed?'
9479 . ./getfile
9480 prefixvar=sitehtml1dir
9481 . ./setprefixvar
9482
9483 : determine where add-on library html pages go
9484 : There is no standard location, so try to copy the previously-selected
9485 : directory structure for the core html pages.
9486 case "$sitehtml3dir" in
9487 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9488 *)     dflt=$sitehtml3dir ;;
9489 esac
9490 case "$dflt" in
9491 ''|' ') dflt=none ;;
9492 esac
9493 fn=dn+~
9494 rp='Pathname where the site-specific library html pages should be installed?'
9495 . ./getfile
9496 prefixvar=sitehtml3dir
9497 . ./setprefixvar
9498
9499 : determine where add-on manual pages go
9500 case "$siteman1dir" in
9501 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9502 *)      dflt=$siteman1dir ;;
9503 esac
9504 case "$dflt" in
9505 ''|' ') dflt=none ;;
9506 esac
9507 fn=dn+~
9508 rp='Pathname where the site-specific manual pages should be installed?'
9509 . ./getfile
9510 prefixvar=siteman1dir
9511 . ./setprefixvar
9512
9513 : determine where add-on library man pages go
9514 case "$siteman3dir" in
9515 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9516 *)      dflt=$siteman3dir ;;
9517 esac
9518 case "$dflt" in
9519 ''|' ') dflt=none ;;
9520 esac
9521 fn=dn+~
9522 rp='Pathname where the site-specific library manual pages should be installed?'
9523 . ./getfile
9524 prefixvar=siteman3dir
9525 . ./setprefixvar
9526
9527 : determine where add-on public executable scripts go
9528 case "$sitescript" in
9529 '')     dflt=$siteprefix/script
9530         $test -d $dflt || dflt=$sitebin ;;
9531 *)  dflt="$sitescript" ;;
9532 esac
9533 fn=d~+
9534 rp='Pathname where add-on public executable scripts should be installed?'
9535 . ./getfile
9536 prefixvar=sitescript
9537 . ./setprefixvar
9538
9539 : see if backtrace exists
9540 set backtrace d_backtrace
9541 eval $inlibc
9542
9543 : add flags if using c backtrace
9544 case "$usecbacktrace" in
9545   "") usecbacktrace=$undef ;;
9546   [yY]*|true|$define)
9547     case "$d_backtrace" in
9548       [yY]*|true|$define)
9549         case " $ccflags " in
9550           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9551           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9552           esac
9553         ;;
9554       *)
9555         echo "This system does not support backtrace" >&4
9556         usecbacktrace=$undef
9557         ;;
9558       esac
9559     ;;
9560   esac
9561
9562 : Check if faststdio is requested and available
9563 case "$usefaststdio" in
9564 $define|true|[yY]*|'')
9565         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9566         case "$xversion" in
9567         [68])   dflt='y' ;;
9568         *)      dflt='n' ;;
9569         esac
9570         ;;
9571 *) dflt='n';;
9572 esac
9573 cat <<EOM
9574
9575 Perl can be built to use 'fast stdio', which means using the stdio
9576 library but also directly manipulating the stdio buffers to enable
9577 faster I/O.  Using stdio is better for backward compatibility (especially
9578 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9579 interface has been preferred instead of stdio.
9580
9581 If this doesn't make any sense to you, just accept the default '$dflt'.
9582 EOM
9583 rp='Use the "fast stdio" if available?'
9584 . ./myread
9585 case "$ans" in
9586 y|Y)    val="$define" ;;
9587 *)      val="$undef" ;;
9588 esac
9589 set usefaststdio
9590 eval $setvar
9591
9592
9593 : define an is-a-typedef? function
9594 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9595 case "$inclist" in
9596 "") inclist="sys/types.h";;
9597 esac;
9598 eval "varval=\$$var";
9599 case "$varval" in
9600 "")
9601         $rm -f temp.c;
9602         for inc in $inclist; do
9603                 echo "#include <$inc>" >>temp.c;
9604         done;
9605         echo "#ifdef $type" >> temp.c;
9606         echo "printf(\"We have $type\");" >> temp.c;
9607         echo "#endif" >> temp.c;
9608         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9609         if $contains $type temp.E >/dev/null 2>&1; then
9610                 eval "$var=\$type";
9611         else
9612                 eval "$var=\$def";
9613         fi;
9614         $rm -f temp.?;;
9615 *) eval "$var=\$varval";;
9616 esac'
9617
9618 : define an is-a-typedef? function that prompts if the type is not available.
9619 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9620 case "$inclist" in
9621 "") inclist="sys/types.h";;
9622 esac;
9623 eval "varval=\$$var";
9624 case "$varval" in
9625 "")
9626         $rm -f temp.c;
9627         for inc in $inclist; do
9628                 echo "#include <$inc>" >>temp.c;
9629         done;
9630         echo "#ifdef $type" >> temp.c;
9631         echo "printf(\"We have $type\");" >> temp.c;
9632         echo "#endif" >> temp.c;
9633         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9634         echo " " ;
9635         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9636         if $contains $type temp.E >/dev/null 2>&1; then
9637                 echo "$type found." >&4;
9638                 eval "$var=\$type";
9639         else
9640                 echo "$type NOT found." >&4;
9641                 dflt="$def";
9642                 . ./myread ;
9643                 eval "$var=\$ans";
9644         fi;
9645         $rm -f temp.?;;
9646 *) eval "$var=\$varval";;
9647 esac'
9648
9649 : see what type lseek is declared as in the kernel
9650 rp="What is the type used for lseek's offset on this system?"
9651 set off_t lseektype long stdio.h sys/types.h
9652 eval $typedef_ask
9653
9654 echo " "
9655 echo "Checking to see how big your file offsets are..." >&4
9656 $cat >try.c <<EOCP
9657 #include <sys/types.h>
9658 #include <stdio.h>
9659 int main()
9660 {
9661     printf("%d\n", (int)sizeof($lseektype));
9662     return(0);
9663 }
9664 EOCP
9665 set try
9666 if eval $compile_ok; then
9667         lseeksize=`$run ./try`
9668         echo "Your file offsets are $lseeksize bytes long."
9669 else
9670         dflt=$longsize
9671         echo " "
9672         echo "(I can't seem to compile the test program.  Guessing...)"
9673         rp="What is the size of your file offsets (in bytes)?"
9674         . ./myread
9675         lseeksize="$ans"
9676 fi
9677 $rm_try
9678
9679 : see what type file positions are declared as in the library
9680 rp="What is the type for file position used by fsetpos()?"
9681 set fpos_t fpostype long stdio.h sys/types.h
9682 eval $typedef_ask
9683
9684 : Check size for Fpos_t
9685 echo " "
9686 case "$fpostype" in
9687 *_t) zzz="$fpostype"    ;;
9688 *)   zzz="fpos_t"       ;;
9689 esac
9690 echo "Checking the size of $zzz..." >&4
9691 cat > try.c <<EOCP
9692 #include <sys/types.h>
9693 #include <stdio.h>
9694 #$i_stdlib I_STDLIB
9695 #ifdef I_STDLIB
9696 #include <stdlib.h>
9697 #endif
9698 int main() {
9699     printf("%d\n", (int)sizeof($fpostype));
9700     exit(0);
9701 }
9702 EOCP
9703 set try
9704 if eval $compile_ok; then
9705         yyy=`$run ./try`
9706         case "$yyy" in
9707         '')     fpossize=4
9708                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9709                 ;;
9710         *)      fpossize=$yyy
9711                 echo "Your $zzz is $fpossize bytes long."
9712                 ;;
9713         esac
9714 else
9715         dflt="$longsize"
9716         echo " " >&4
9717         echo "(I can't compile the test program.  Guessing...)" >&4
9718         rp="What is the size of your file positions (in bytes)?"
9719         . ./myread
9720         fpossize="$ans"
9721 fi
9722
9723 : Check for large file support
9724 # Backward compatibility (uselfs is deprecated).
9725 case "$uselfs" in
9726 "$define"|true|[yY]*)
9727         cat <<EOM >&4
9728
9729 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9730 EOM
9731         uselargefiles="$define"
9732         ;;
9733 esac
9734
9735 case "$lseeksize:$fpossize" in
9736 8:8) cat <<EOM
9737
9738 You can have files larger than 2 gigabytes.
9739 EOM
9740    val="$define" ;;
9741 *)    case "$uselargefiles" in
9742    "$undef"|false|[nN]*) dflt='n' ;;
9743    *)   dflt='y' ;;
9744    esac
9745    cat <<EOM
9746
9747 Perl can be built to understand large files (files larger than 2 gigabytes)
9748 on some systems.  To do so, Configure can be run with -Duselargefiles.
9749
9750 If this doesn't make any sense to you, just accept the default '$dflt'.
9751 EOM
9752    rp='Try to understand large files, if available?'
9753    . ./myread
9754    case "$ans" in
9755    y|Y)         val="$define" ;;
9756    *)           val="$undef"  ;;
9757    esac
9758    ;;
9759 esac
9760 set uselargefiles
9761 eval $setvar
9762 : Look for a hint-file generated 'call-back-unit'.  If the
9763 : user has specified that a large files perl is to be built,
9764 : we may need to set or change some other defaults.
9765 if $test -f uselargefiles.cbu; then
9766         echo "Your platform has some specific hints regarding large file builds, using them..."
9767         . ./uselargefiles.cbu
9768 fi
9769 case "$uselargefiles" in
9770 "$define")
9771         if $test -f uselargefiles.cbu; then
9772                 echo " "
9773                 echo "Rechecking to see how big your file offsets are..." >&4
9774                 $cat >try.c <<EOCP
9775 #include <sys/types.h>
9776 #include <stdio.h>
9777 int main()
9778 {
9779     printf("%d\n", (int)sizeof($lseektype));
9780     return(0);
9781 }
9782 EOCP
9783                 set try
9784                 if eval $compile_ok; then
9785                         lseeksize=`$run ./try`
9786                         $echo "Your file offsets are now $lseeksize bytes long."
9787                 else
9788                         dflt="$lseeksize"
9789                         echo " "
9790                         echo "(I can't seem to compile the test program.  Guessing...)"
9791                         rp="What is the size of your file offsets (in bytes)?"
9792                         . ./myread
9793                         lseeksize="$ans"
9794                 fi
9795                 case "$fpostype" in
9796                 *_t) zzz="$fpostype"    ;;
9797                 *)   zzz="fpos_t"       ;;
9798                 esac
9799                 $echo $n "Rechecking the size of $zzz...$c" >&4
9800                 $cat > try.c <<EOCP
9801 #include <sys/types.h>
9802 #include <stdio.h>
9803 #$i_stdlib I_STDLIB
9804 #ifdef I_STDLIB
9805 #include <stdlib.h>
9806 #endif
9807 int main() {
9808     printf("%d\n", (int)sizeof($fpostype));
9809     return(0);
9810 }
9811 EOCP
9812                 set try
9813                 if eval $compile_ok; then
9814                         yyy=`$run ./try`
9815                         dflt="$lseeksize"
9816                         case "$yyy" in
9817                         '')     echo " "
9818                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9819                                 ;;
9820                         *)      fpossize=$yyy
9821                                 echo " $fpossize bytes." >&4
9822                                 ;;
9823                         esac
9824                 else
9825                         dflt="$fpossize"
9826                         echo " "
9827                         echo "(I can't compile the test program.  Guessing...)" >&4
9828                         rp="What is the size of your file positions (in bytes)?"
9829                         . ./myread
9830                         fpossize="$ans"
9831                 fi
9832                 $rm_try
9833         fi
9834         ;;
9835 esac
9836
9837 : Check if we want perlio
9838 useperlio="$define"
9839
9840 : Set the vendorbin variables
9841 case "$vendorprefix" in
9842 '')     d_vendorbin="$undef"
9843         vendorbin=''
9844         vendorbinexp=''
9845         ;;
9846 *)      d_vendorbin="$define"
9847         : determine where vendor-supplied executables go.
9848         case "$vendorbin" in
9849         '') dflt=$vendorprefix/bin ;;
9850         *)      dflt="$vendorbin" ;;
9851         esac
9852         fn=d~+
9853         rp='Pathname for the vendor-supplied executables directory?'
9854         . ./getfile
9855         vendorbin="$ans"
9856         vendorbinexp="$ansexp"
9857         ;;
9858 esac
9859 prefixvar=vendorbin
9860 . ./installprefix
9861
9862 : Set the vendorhtml1dir variables
9863 case "$vendorprefix" in
9864 '')     vendorhtml1dir=''
9865         vendorhtml1direxp=''
9866         ;;
9867 *)      : determine where vendor-supplied html pages go.
9868         : There is no standard location, so try to copy the previously-selected
9869         : directory structure for the core html pages.
9870         : XXX Better default suggestions would be welcome.
9871         case "$vendorhtml1dir" in
9872         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9873         *)      dflt=$vendorhtml1dir ;;
9874         esac
9875         case "$dflt" in
9876         ''|' ') dflt=none ;;
9877         esac
9878         fn=dn+~
9879         rp='Pathname for the vendor-supplied html pages?'
9880         . ./getfile
9881         vendorhtml1dir="$ans"
9882         vendorhtml1direxp="$ansexp"
9883         ;;
9884 esac
9885 : Use ' ' for none so value is preserved next time through Configure
9886 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9887 prefixvar=vendorhtml1dir
9888 . ./installprefix
9889
9890 : Set the vendorhtml3dir variables
9891 case "$vendorprefix" in
9892 '')     vendorhtml3dir=''
9893         vendorhtml3direxp=''
9894         ;;
9895 *)      : determine where vendor-supplied module html pages go.
9896         : There is no standard location, so try to copy the previously-selected
9897         : directory structure for the core html pages.
9898         : XXX Better default suggestions would be welcome.
9899         case "$vendorhtml3dir" in
9900         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9901         *)      dflt=$vendorhtml3dir ;;
9902         esac
9903         case "$dflt" in
9904         ''|' ') dflt=none ;;
9905         esac
9906         fn=dn+~
9907         rp='Pathname for the vendor-supplied html pages?'
9908         . ./getfile
9909         vendorhtml3dir="$ans"
9910         vendorhtml3direxp="$ansexp"
9911         ;;
9912 esac
9913 : Use ' ' for none so value is preserved next time through Configure
9914 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9915 prefixvar=vendorhtml3dir
9916 . ./installprefix
9917
9918 : Set the vendorman1dir variables
9919 case "$vendorprefix" in
9920 '')     vendorman1dir=''
9921         vendorman1direxp=''
9922         ;;
9923 *)      : determine where vendor-supplied manual pages go.
9924         case "$vendorman1dir" in
9925         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9926         *)      dflt=$vendorman1dir ;;
9927         esac
9928         case "$dflt" in
9929         ''|' ') dflt=none ;;
9930         esac
9931         fn=nd~+
9932         rp='Pathname for the vendor-supplied manual section 1 pages?'
9933         . ./getfile
9934         vendorman1dir="$ans"
9935         vendorman1direxp="$ansexp"
9936         ;;
9937 esac
9938 : Use ' ' for none so value is preserved next time through Configure
9939 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9940 prefixvar=vendorman1dir
9941 . ./installprefix
9942
9943 : Set the vendorman3dir variables
9944 case "$vendorprefix" in
9945 '')     vendorman3dir=''
9946         vendorman3direxp=''
9947         ;;
9948 *)      : determine where vendor-supplied module manual pages go.
9949         case "$vendorman3dir" in
9950         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9951         *)      dflt=$vendorman3dir ;;
9952         esac
9953         case "$dflt" in
9954         ''|' ') dflt=none ;;
9955         esac
9956         fn=nd~+
9957         rp='Pathname for the vendor-supplied manual section 3 pages?'
9958         . ./getfile
9959         vendorman3dir="$ans"
9960         vendorman3direxp="$ansexp"
9961         ;;
9962 esac
9963 : Use ' ' for none so value is preserved next time through Configure
9964 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9965 prefixvar=vendorman3dir
9966 . ./installprefix
9967
9968 : Set the vendorscript variables
9969 case "$vendorprefix" in
9970 '')     d_vendorscript="$undef"
9971         vendorscript=''
9972         vendorscriptexp=''
9973         ;;
9974 *)      d_vendorscript="$define"
9975         : determine where vendor-supplied scripts go.
9976         case "$vendorscript" in
9977         '')     dflt=$vendorprefix/script
9978                 $test -d $dflt || dflt=$vendorbin ;;
9979         *)  dflt="$vendorscript" ;;
9980         esac
9981         $cat <<EOM
9982
9983 The installation process will create a directory for
9984 vendor-supplied scripts.
9985
9986 EOM
9987         fn=d~+
9988         rp='Pathname for the vendor-supplied scripts directory?'
9989         . ./getfile
9990         vendorscript="$ans"
9991         vendorscriptexp="$ansexp"
9992         ;;
9993 esac
9994 prefixvar=vendorscript
9995 . ./installprefix
9996
9997 : script used to emit important warnings
9998 cat >warn <<EOS
9999 $startsh
10000 if test \$# -gt 0; then
10001         echo "\$@" >msg
10002 else
10003         cat >msg
10004 fi
10005 echo "*** WARNING:" >&4
10006 sed -e 's/^/*** /' <msg >&4
10007 echo "*** " >&4
10008 cat msg >>config.msg
10009 echo " " >>config.msg
10010 rm -f msg
10011 EOS
10012 chmod +x warn
10013 $eunicefix warn
10014
10015 : see which of string.h or strings.h is needed
10016 echo " "
10017 strings=`./findhdr string.h`
10018 if $test "$strings" && $test -r "$strings"; then
10019         echo "Using <string.h> instead of <strings.h>." >&4
10020         val="$define"
10021 else
10022         val="$undef"
10023         strings=`./findhdr strings.h`
10024         if $test "$strings" && $test -r "$strings"; then
10025                 echo "Using <strings.h> instead of <string.h>." >&4
10026         else
10027                 ./warn "No string header found -- You'll surely have problems."
10028         fi
10029 fi
10030 set i_string
10031 eval $setvar
10032 case "$i_string" in
10033 "$undef") strings=`./findhdr strings.h`;;
10034 *)        strings=`./findhdr string.h`;;
10035 esac
10036
10037 : see if qgcvt exists
10038 set qgcvt d_qgcvt
10039 eval $inlibc
10040
10041 : Check what kind of doubles your system has
10042 $echo "Checking the kind of doubles you have..." >&4
10043 $cat >try.c <<EOP
10044 #$i_stdlib I_STDLIB
10045 #define DOUBLESIZE $doublesize
10046 #ifdef I_STDLIB
10047 #include <stdlib.h>
10048 #endif
10049 #include <stdio.h>
10050 static const double d = -0.1;
10051 int main() {
10052   unsigned const char* b = (unsigned const char*)(&d);
10053 #if DOUBLESIZE == 4
10054   if (b[0] == 0xCD && b[3] == 0xBD) {
10055     /* IEEE 754 32-bit little-endian */
10056     printf("1\n");
10057     exit(0);
10058   }
10059   if (b[0] == 0xBD && b[3] == 0xCD) {
10060     /* IEEE 754 32-bit big-endian */
10061     printf("2\n");
10062     exit(0);
10063   }
10064 #endif
10065 #if DOUBLESIZE == 8
10066   if (b[0] == 0x9A && b[7] == 0xBF) {
10067     /* IEEE 754 64-bit little-endian */
10068     printf("3\n");
10069     exit(0);
10070   }
10071   if (b[0] == 0xBF && b[7] == 0x9A) {
10072     /* IEEE 754 64-bit big-endian */
10073     printf("4\n");
10074     exit(0);
10075   }
10076   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10077    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10078     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10079     * 99 99 b9 bf 9a 99 99 99 */
10080     printf("7\n");
10081     exit(0);
10082   }
10083   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10084    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10085     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10086     * 99 99 99 9a bf b9 99 99 */
10087     printf("8\n");
10088     exit(0);
10089   }
10090 #endif
10091 #if DOUBLESIZE == 16
10092   if (b[0] == 0x9A && b[15] == 0xBF) {
10093     /* IEEE 754 128-bit little-endian */
10094     printf("5\n");
10095     exit(0);
10096   }
10097   if (b[0] == 0xBF && b[15] == 0x9A) {
10098     /* IEEE 754 128-bit big-endian */
10099     printf("6\n");
10100     exit(0);
10101   }
10102 #endif
10103   /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
10104    * Whether those environments can still build Perl is debatable. */
10105   printf("-1\n"); /* unknown */
10106   exit(0);
10107 }
10108 EOP
10109 set try
10110 if eval $compile; then
10111     doublekind=`$run ./try`
10112 else
10113     doublekind=-1
10114 fi
10115 case "$doublekind" in
10116 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10117 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10118 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10119 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10120 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10121 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10122 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10123 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10124 *) echo "Cannot figure out your double.  You VAX, or something?" >&4 ;;
10125 esac
10126 $rm_try
10127
10128 : Check print/scan long double stuff
10129 echo " "
10130
10131 if $test X"$d_longdbl" = X"$define"; then
10132
10133 echo "Checking how to print long doubles..." >&4
10134
10135 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10136         $cat >try.c <<'EOCP'
10137 #include <sys/types.h>
10138 #include <stdio.h>
10139 int main() {
10140   double d = 123.456;
10141   printf("%.3f\n", d);
10142 }
10143 EOCP
10144         set try
10145         if eval $compile; then
10146                 yyy=`$run ./try`
10147                 case "$yyy" in
10148                 123.456)
10149                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10150                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10151                         echo "We will use %f."
10152                         ;;
10153                 esac
10154         fi
10155 fi
10156
10157 if $test X"$sPRIfldbl" = X; then
10158         $cat >try.c <<'EOCP'
10159 #include <sys/types.h>
10160 #include <stdio.h>
10161 int main() {
10162   long double d = 123.456;
10163   printf("%.3Lf\n", d);
10164 }
10165 EOCP
10166         set try
10167         if eval $compile; then
10168                 yyy=`$run ./try`
10169                 case "$yyy" in
10170                 123.456)
10171                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10172                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10173                         echo "We will use %Lf."
10174                         ;;
10175                 esac
10176         fi
10177 fi
10178
10179 if $test X"$sPRIfldbl" = X; then
10180         $cat >try.c <<'EOCP'
10181 #include <sys/types.h>
10182 #include <stdio.h>
10183 int main() {
10184   long double d = 123.456;
10185   printf("%.3llf\n", d);
10186 }
10187 EOCP
10188         set try
10189         if eval $compile; then
10190                 yyy=`$run ./try`
10191                 case "$yyy" in
10192                 123.456)
10193                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10194                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10195                         echo "We will use %llf."
10196                         ;;
10197                 esac
10198         fi
10199 fi
10200
10201 if $test X"$sPRIfldbl" = X; then
10202         $cat >try.c <<'EOCP'
10203 #include <sys/types.h>
10204 #include <stdio.h>
10205 int main() {
10206   long double d = 123.456;
10207   printf("%.3lf\n", d);
10208 }
10209 EOCP
10210         set try
10211         if eval $compile; then
10212                 yyy=`$run ./try`
10213                 case "$yyy" in
10214                 123.456)
10215                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10216                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10217                         echo "We will use %lf."
10218                         ;;
10219                 esac
10220         fi
10221 fi
10222
10223 if $test X"$sPRIfldbl" = X; then
10224         echo "Cannot figure out how to print long doubles." >&4
10225 else
10226         sSCNfldbl=$sPRIfldbl    # expect consistency
10227 fi
10228
10229 $rm_try
10230
10231 fi # d_longdbl
10232
10233 case "$sPRIfldbl" in
10234 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10235         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10236         d_SCNfldbl="$undef";
10237         ;;
10238 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10239         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10240         d_SCNfldbl="$define";
10241         ;;
10242 esac
10243
10244 : Before committing on uselongdouble, see whether that looks sane.
10245 if $test "$uselongdouble" = "$define"; then
10246     message=""
10247     echo " "
10248     echo "Checking if your long double math functions work right..." >&4
10249     $cat > try.c <<EOF
10250 #include <math.h>
10251 #include <stdio.h>
10252 int main() {
10253   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10254 }
10255 EOF
10256     case "$osname:$gccversion" in
10257     aix:)       saveccflags="$ccflags"
10258                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10259     esac
10260     set try
10261     if eval $compile_ok; then
10262       yyy=`$run ./try`
10263     fi
10264     case "$yyy" in
10265     3) echo "Your long double math functions are working correctly." >&4 ;;
10266     *) echo "Your long double math functions are broken, not using long doubles." >&4
10267        uselongdouble=$undef
10268        ;;
10269     esac
10270     $rm_try
10271     case "$osname:$gccversion" in
10272     aix:)       ccflags="$saveccflags" ;; # restore
10273     esac
10274 fi
10275
10276 : Check how to convert floats to strings.
10277
10278 if test "X$d_Gconvert" = X; then
10279
10280 echo " "
10281 echo "Checking for an efficient way to convert floats to strings."
10282 echo " " > try.c
10283 case "$uselongdouble" in
10284 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10285 esac
10286 case "$d_longdbl" in
10287 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10288 esac
10289 case "$d_PRIgldbl" in
10290 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10291 esac
10292 $cat >>try.c <<EOP
10293 #ifdef TRY_gconvert
10294 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10295 char *myname = "gconvert";
10296 #endif
10297 #ifdef TRY_gcvt
10298 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10299 char *myname = "gcvt";
10300 #endif
10301 #ifdef TRY_qgcvt
10302 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10303 char *myname = "qgcvt";
10304 #define DOUBLETYPE long double
10305 #endif
10306 #ifdef TRY_sprintf
10307 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10308 #ifdef HAS_PRIgldbl
10309 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10310 #else
10311 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10312 #endif
10313 #else
10314 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10315 #endif
10316 char *myname = "sprintf";
10317 #endif
10318
10319 #ifndef DOUBLETYPE
10320 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10321 #define DOUBLETYPE long double
10322 #else
10323 #define DOUBLETYPE double
10324 #endif
10325 #endif
10326
10327 #include <stdio.h>
10328
10329 #$i_stdlib I_STDLIB
10330 #ifdef I_STDLIB
10331 #include <stdlib.h>
10332 #endif
10333 #$i_string I_STRING
10334 #ifdef I_STRING
10335 #  include <string.h>
10336 #else
10337 #  include <strings.h>
10338 #endif
10339
10340 int checkit(char *expect, char *got)
10341 {
10342     if (strcmp(expect, got)) {
10343                 printf("%s oddity:  Expected %s, got %s\n",
10344                         myname, expect, got);
10345                 exit(1);
10346         }
10347 }
10348
10349 int main()
10350 {
10351         char buf[64];
10352         buf[63] = '\0';
10353
10354         /* This must be 1st test on (which?) platform */
10355         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10356         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10357         checkit("0.1", buf);
10358
10359         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10360         checkit("0.01", buf);
10361
10362         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10363         checkit("0.001", buf);
10364
10365         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10366         checkit("0.0001", buf);
10367
10368         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10369         if (strlen(buf) > 5)
10370             checkit("9e-005", buf); /* for Microsoft ?? */
10371         else
10372             checkit("9e-05", buf);
10373
10374         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10375         checkit("1", buf);
10376
10377         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10378         checkit("1.1", buf);
10379
10380         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10381         checkit("1.01", buf);
10382
10383         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10384         checkit("1.001", buf);
10385
10386         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10387         checkit("1.0001", buf);
10388
10389         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10390         checkit("1.00001", buf);
10391
10392         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10393         checkit("1.000001", buf);
10394
10395         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10396         checkit("0", buf);
10397
10398         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10399         checkit("-1", buf);
10400
10401         /* Some Linux gcvt's give 1.e+5 here. */
10402         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10403         checkit("100000", buf);
10404
10405         /* Some Linux gcvt's give -1.e+5 here. */
10406         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10407         checkit("-100000", buf);
10408
10409         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10410         checkit("123.456", buf);
10411
10412         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10413         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10414         /* 34 should be enough to scare even long double
10415          * places into using the e notation. */
10416         if (strlen(buf) > 5)
10417             checkit("1e+034", buf); /* for Microsoft */
10418         else
10419             checkit("1e+34", buf);
10420
10421         /* For Perl, if you add additional tests here, also add them to
10422          * t/base/num.t for benefit of platforms not using Configure or
10423          * overriding d_Gconvert */
10424
10425         exit(0);
10426 }
10427 EOP
10428 : first add preferred functions to our list
10429 xxx_list=""
10430 for xxx_convert in $gconvert_preference; do
10431     case $xxx_convert in
10432     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10433     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10434     esac
10435 done
10436 : then add any others
10437 for xxx_convert in gconvert gcvt sprintf; do
10438     case "$xxx_list" in
10439     *$xxx_convert*) ;;
10440     *) xxx_list="$xxx_list $xxx_convert" ;;
10441     esac
10442 done
10443
10444 case "$d_longdbl$uselongdouble" in
10445 "$define$define")
10446     : again, add preferred functions to our list first
10447     xxx_ld_list=""
10448     for xxx_convert in $gconvert_ld_preference; do
10449         case $xxx_convert in
10450         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10451         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10452         esac
10453     done
10454     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10455     for xxx_convert in qgcvt sprintf $xxx_list; do
10456         case "$xxx_ld_list" in
10457         $xxx_convert*|*" $xxx_convert"*) ;;
10458         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10459         esac
10460     done
10461     : if sprintf cannot do long doubles, move it to the end
10462     if test "$d_PRIgldbl" != "$define"; then
10463         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10464     fi
10465     : if no qgcvt, remove it
10466     if test "$d_qgcvt" != "$define"; then
10467         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10468     fi
10469     : use the ld_list
10470     xxx_list="$xxx_ld_list"
10471     ;;
10472 esac
10473
10474 for xxx_convert in $xxx_list; do
10475         echo "Trying $xxx_convert..."
10476         $rm -f try try$_o core
10477         set try -DTRY_$xxx_convert
10478         if eval $compile; then
10479                 echo "$xxx_convert() found." >&4
10480                 if $run ./try; then
10481                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10482                         break;
10483                 else
10484                         echo "...But $xxx_convert didn't work as I expected."
10485                         xxx_convert=''
10486                 fi
10487         else
10488                 echo "$xxx_convert NOT found." >&4
10489         fi
10490 done
10491
10492 if test X$xxx_convert = X; then
10493     echo "*** WHOA THERE!!! ***" >&4
10494     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10495     xxx_convert=sprintf
10496 fi
10497
10498 case "$xxx_convert" in
10499 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10500 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10501 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10502 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10503    "$define$define$define")
10504       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10505    "$define$define$undef")
10506       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10507    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10508    esac
10509    ;;
10510 esac
10511
10512 fi
10513 $rm_try
10514
10515 : see if _fwalk exists
10516 set fwalk d__fwalk
10517 eval $inlibc
10518
10519 : Initialize h_fcntl
10520 h_fcntl=false
10521
10522 : Initialize h_sysfile
10523 h_sysfile=false
10524
10525 : access call always available on UNIX
10526 set access d_access
10527 eval $inlibc
10528
10529 : locate the flags for 'access()'
10530 case "$d_access" in
10531 "$define")
10532         echo " "
10533         $cat >access.c <<EOCP
10534 #include <sys/types.h>
10535 #ifdef I_FCNTL
10536 #include <fcntl.h>
10537 #endif
10538 #ifdef I_SYS_FILE
10539 #include <sys/file.h>
10540 #endif
10541 #ifdef I_UNISTD
10542 #include <unistd.h>
10543 #endif
10544 #$i_stdlib I_STDLIB
10545 #ifdef I_STDLIB
10546 #include <stdlib.h>
10547 #endif
10548 int main() {
10549         exit(R_OK);
10550 }
10551 EOCP
10552         : check sys/file.h first, no particular reason here
10553         if $test `./findhdr sys/file.h` && \
10554                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10555                 h_sysfile=true;
10556                 echo "<sys/file.h> defines the *_OK access constants." >&4
10557         elif $test `./findhdr fcntl.h` && \
10558                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10559                 h_fcntl=true;
10560                 echo "<fcntl.h> defines the *_OK access constants." >&4
10561         elif $test `./findhdr unistd.h` && \
10562                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10563                 echo "<unistd.h> defines the *_OK access constants." >&4
10564         else
10565                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10566         fi
10567         ;;
10568 esac
10569 $rm -f access*
10570
10571 : see if accessx exists
10572 set accessx d_accessx
10573 eval $inlibc
10574
10575 : see if acosh exists
10576 set acosh d_acosh
10577 eval $inlibc
10578
10579 : see if aintl exists
10580 set aintl d_aintl
10581 eval $inlibc
10582
10583 : see if alarm exists
10584 set alarm d_alarm
10585 eval $inlibc
10586
10587 : see if 64bit time functions exists
10588
10589 set ctime64 d_ctime64
10590 eval $inlibc
10591
10592 set localtime64 d_localtime64
10593 eval $inlibc
10594
10595 set gmtime64 d_gmtime64
10596 eval $inlibc
10597
10598 set mktime64 d_mktime64
10599 eval $inlibc
10600
10601 set difftime64 d_difftime64
10602 eval $inlibc
10603
10604 set asctime64 d_asctime64
10605 eval $inlibc
10606
10607 : see if POSIX threads are available
10608 set pthread.h i_pthread
10609 eval $inhdr
10610
10611 : define a function to check prototypes
10612 $cat > protochk <<EOSH
10613 $startsh
10614 cc="$cc"
10615 optimize="$optimize"
10616 ccflags="$ccflags"
10617 prototype="$prototype"
10618 define="$define"
10619 rm_try="$rm_try"
10620 usethreads=$usethreads
10621 i_pthread=$i_pthread
10622 pthread_h_first=$pthread_h_first
10623 EOSH
10624
10625 $cat >> protochk <<'EOSH'
10626
10627 $rm_try
10628 foo="$1"
10629 shift
10630 while test $# -ge 2; do
10631         case "$1" in
10632                 $define) echo "#include <$2>" >> try.c ;;
10633                 literal) echo "$2" >> try.c ;;
10634         esac
10635     # Extra magic for the benefit of systems that need pthread.h
10636     # to be included early to correctly detect threadsafe functions.
10637     # Such functions must guarantee themselves, though, that the usethreads
10638     # and i_pthread have been defined, before calling protochk.
10639     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10640         echo "#include <pthread.h>" >> try.c
10641         pthread_h_done=yes
10642     fi
10643     shift 2
10644 done
10645 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10646 cat >> try.c <<'EOCP'
10647 #ifdef CAN_PROTOTYPE
10648 #define _(args) args
10649 #else
10650 #define _(args) ()
10651 #endif
10652 EOCP
10653 echo "$foo" >> try.c
10654 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10655 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10656 status=$?
10657 $rm_try
10658 exit $status
10659 EOSH
10660 chmod +x protochk
10661 $eunicefix protochk
10662
10663 : Define hasproto macro for Configure internal use
10664 hasproto='varname=$1; func=$2; shift; shift;
10665 while $test $# -ge 2; do
10666         case "$1" in
10667         $define) echo "#include <$2>";;
10668         esac ;
10669     shift 2;
10670 done > try.c;
10671 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10672 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10673         echo "$func() prototype found.";
10674         val="$define";
10675 else
10676         echo "$func() prototype NOT found.";
10677         val="$undef";
10678 fi;
10679 set $varname;
10680 eval $setvar;
10681 $rm_try tryout.c'
10682
10683 : see if sys/types.h has to be included
10684 set sys/types.h i_systypes
10685 eval $inhdr
10686
10687 : see if sys/select.h has to be included
10688 set sys/select.h i_sysselct
10689 eval $inhdr
10690
10691 : Define hasfield macro for Configure internal use
10692 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10693 while $test $# -ge 2; do
10694         case "$1" in
10695         $define) echo "#include <$2>";;
10696         esac ;
10697     shift 2;
10698 done > try.c;
10699 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10700 set try;
10701 if eval $compile; then
10702         val="$define";
10703 else
10704         val="$undef";
10705 fi;
10706 set $varname;
10707 eval $setvar;
10708 $rm_try'
10709
10710 : see if we should include time.h, sys/time.h, or both
10711 echo " "
10712 if test "X$timeincl" = X; then
10713         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10714         $echo $n "I'm now running the test program...$c"
10715         $cat >try.c <<EOCP
10716 #include <sys/types.h>
10717 #ifdef I_TIME
10718 #include <time.h>
10719 #endif
10720 #ifdef I_SYSTIME
10721 #ifdef SYSTIMEKERNEL
10722 #define KERNEL
10723 #endif
10724 #include <sys/time.h>
10725 #endif
10726 #ifdef I_SYSSELECT
10727 #include <sys/select.h>
10728 #endif
10729 #$i_stdlib I_STDLIB
10730 #ifdef I_STDLIB
10731 #include <stdlib.h>
10732 #endif
10733 int main()
10734 {
10735         struct tm foo;
10736 #ifdef S_TIMEVAL
10737         struct timeval bar;
10738 #endif
10739 #ifdef S_TIMEZONE
10740         struct timezone tzp;
10741 #endif
10742         if (foo.tm_sec == foo.tm_sec)
10743                 exit(0);
10744 #ifdef S_TIMEVAL
10745         if (bar.tv_sec == bar.tv_sec)
10746                 exit(0);
10747 #endif
10748         exit(1);
10749 }
10750 EOCP
10751         flags=''
10752         for s_timezone in '-DS_TIMEZONE' ''; do
10753         sysselect=''
10754         for s_timeval in '-DS_TIMEVAL' ''; do
10755         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10756         for i_time in '' '-DI_TIME'; do
10757         for i_systime in '-DI_SYSTIME' ''; do
10758                 case "$flags" in
10759                 '') $echo $n ".$c"
10760                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10761                         if eval $compile; then
10762                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10763                                 shift
10764                                 flags="$*"
10765                                 echo " "
10766                                 $echo $n "Succeeded with $flags$c"
10767                         fi
10768                         ;;
10769                 esac
10770         done
10771         done
10772         done
10773         done
10774         done
10775         timeincl=''
10776         echo " "
10777         case "$flags" in
10778         *SYSTIMEKERNEL*) i_systimek="$define"
10779                 timeincl=`./findhdr sys/time.h`
10780                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10781         *) i_systimek="$undef";;
10782         esac
10783         case "$flags" in
10784         *I_TIME*) i_time="$define"
10785                 timeincl=`./findhdr time.h`" $timeincl"
10786                 echo "We'll include <time.h>." >&4;;
10787         *) i_time="$undef";;
10788         esac
10789         case "$flags" in
10790         *I_SYSTIME*) i_systime="$define"
10791                 timeincl=`./findhdr sys/time.h`" $timeincl"
10792                 echo "We'll include <sys/time.h>." >&4;;
10793         *) i_systime="$undef";;
10794         esac
10795         $rm_try
10796 fi
10797 : see if struct tm knows about tm_zone
10798 case "$i_systime$i_time" in
10799 *$define*)
10800         echo " "
10801         echo "Checking to see if your struct tm has tm_zone field..." >&4
10802         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10803         eval $hasfield
10804         ;;
10805 *)      val="$undef"
10806         set d_tm_tm_zone
10807         eval $setvar
10808         ;;
10809 esac
10810 case "$d_tm_tm_zone" in
10811 "$define")      echo "Yes, it does."   ;;
10812 *)              echo "No, it doesn't." ;;
10813 esac
10814 : see if struct tm knows about tm_gmtoff
10815 case "$i_systime$i_time" in
10816 *$define*)
10817         echo " "
10818         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10819         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10820         eval $hasfield
10821         ;;
10822 *)      val="$undef"
10823         set d_tm_tm_gmtoff
10824         eval $setvar
10825         ;;
10826 esac
10827 case "$d_tm_tm_gmtoff" in
10828 "$define")      echo "Yes, it does."   ;;
10829 *)              echo "No, it doesn't." ;;
10830 esac
10831
10832 : see if asctime_r exists
10833 set asctime_r d_asctime_r
10834 eval $inlibc
10835 case "$d_asctime_r" in
10836 "$define")
10837         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10838         case "$d_asctime_r_proto:$usethreads" in
10839         ":define")      d_asctime_r_proto=define
10840                 set d_asctime_r_proto asctime_r $hdrs
10841                 eval $hasproto ;;
10842         *)      ;;
10843         esac
10844         case "$d_asctime_r_proto" in
10845         define)
10846         case "$asctime_r_proto" in
10847         ''|0) try='char* asctime_r(const struct tm*, char*);'
10848         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10849         esac
10850         case "$asctime_r_proto" in
10851         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10852         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10853         esac
10854         case "$asctime_r_proto" in
10855         ''|0) try='int asctime_r(const struct tm*, char*);'
10856         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10857         esac
10858         case "$asctime_r_proto" in
10859         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10860         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10861         esac
10862         case "$asctime_r_proto" in
10863         ''|0)   d_asctime_r=undef
10864                 asctime_r_proto=0
10865                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10866         * )     case "$asctime_r_proto" in
10867                 REENTRANT_PROTO*) ;;
10868                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10869                 esac
10870                 echo "Prototype: $try" ;;
10871         esac
10872         ;;
10873         *)      case "$usethreads" in
10874                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10875                 esac
10876                 d_asctime_r=undef
10877                 asctime_r_proto=0
10878                 ;;
10879         esac
10880         ;;
10881 *)      asctime_r_proto=0
10882         ;;
10883 esac
10884
10885 : see if asinh exists
10886 set asinh d_asinh
10887 eval $inlibc
10888
10889 : see if atanh exists
10890 set atanh d_atanh
10891 eval $inlibc
10892
10893 : see if atolf exists
10894 set atolf d_atolf
10895 eval $inlibc
10896
10897 : see if atoll exists
10898 set atoll d_atoll
10899 eval $inlibc
10900
10901 : Look for GCC-style attribute format
10902 case "$d_attribute_format" in
10903 '')
10904 echo " "
10905 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10906 $cat >attrib.c <<'EOCP'
10907 #include <stdio.h>
10908 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10909 EOCP
10910 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10911         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10912                 echo "Your C compiler doesn't support __attribute__((format))."
10913                 val="$undef"
10914         else
10915                 echo "Your C compiler supports __attribute__((format))."
10916                 val="$define"
10917         fi
10918 else
10919         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10920         val="$undef"
10921 fi
10922 ;;
10923 *) val="$d_attribute_format" ;;
10924 esac
10925 set d_attribute_format
10926 eval $setvar
10927 $rm -f attrib*
10928
10929 : Look for GCC-style attribute format with null format allowed
10930 case "$d_printf_format_null" in
10931 '') case "$d_attribute_format" in
10932     $define)
10933         echo " "
10934         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10935 $cat >attrib.c <<EOCP
10936 #include <stdio.h>
10937 #$i_stdlib I_STDLIB
10938 #ifdef I_STDLIB
10939 #include <stdlib.h>
10940 #endif
10941 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10942 int null_printf (char* pat,...) { return (int)pat; }
10943 int main () { exit(null_printf(NULL)); }
10944 EOCP
10945         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10946             : run the executable in case it produces a run-time warning
10947             if $run ./attrib >>attrib.out 2>&1; then
10948                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10949                     echo "Your C compiler doesn't allow __printf__ format to be null."
10950                     val="$undef"
10951                 else
10952                     echo "Your C compiler allows __printf__ format to be null."
10953                     val="$define"
10954                 fi
10955             else
10956             echo "Your C compiler executable failed with __printf__ format null."
10957             val="$undef"
10958         fi
10959     else
10960         echo "Your C compiler fails with __printf__ format null."
10961         val="$undef"
10962     fi
10963     ;;
10964     *)  val="$undef" ;;
10965     esac
10966 ;;
10967 *)  val="$d_printf_format_null" ;;
10968 esac
10969 set d_printf_format_null
10970 eval $setvar
10971 $rm -f attrib*
10972
10973 : Look for GCC-style attribute malloc
10974 case "$d_attribute_malloc" in
10975 '')
10976 echo " "
10977 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10978 $cat >attrib.c <<'EOCP'
10979 #include <stdio.h>
10980 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10981 EOCP
10982 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10983         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10984                 echo "Your C compiler doesn't support __attribute__((malloc))."
10985                 val="$undef"
10986         else
10987                 echo "Your C compiler supports __attribute__((malloc))."
10988                 val="$define"
10989         fi
10990 else
10991         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10992         val="$undef"
10993 fi
10994 ;;
10995 *) val="$d_attribute_malloc" ;;
10996 esac
10997 set d_attribute_malloc
10998 eval $setvar
10999 $rm -f attrib*
11000
11001 : Look for GCC-style attribute nonnull
11002 case "$d_attribute_nonnull" in
11003 '')
11004 echo " "
11005 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11006 $cat >attrib.c <<'EOCP'
11007 #include <stdio.h>
11008 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11009 EOCP
11010 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11011         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11012                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11013                 val="$undef"
11014         else
11015                 echo "Your C compiler supports __attribute__((nonnull))."
11016                 val="$define"
11017         fi
11018 else
11019         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11020         val="$undef"
11021 fi
11022 ;;
11023 *) val="$d_attribute_nonnull" ;;
11024 esac
11025 set d_attribute_nonnull
11026 eval $setvar
11027 $rm -f attrib*
11028
11029 : Look for GCC-style attribute noreturn
11030 case "$d_attribute_noreturn" in
11031 '')
11032 echo " "
11033 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11034 $cat >attrib.c <<'EOCP'
11035 #include <stdio.h>
11036 void fall_over_dead( void ) __attribute__((noreturn));
11037 EOCP
11038 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11039         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11040                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11041                 val="$undef"
11042         else
11043                 echo "Your C compiler supports __attribute__((noreturn))."
11044                 val="$define"
11045         fi
11046 else
11047         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11048         val="$undef"
11049 fi
11050 ;;
11051 *) val="$d_attribute_noreturn" ;;
11052 esac
11053 set d_attribute_noreturn
11054 eval $setvar
11055 $rm -f attrib*
11056
11057 : Look for GCC-style attribute pure
11058 case "$d_attribute_pure" in
11059 '')
11060 echo " "
11061 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11062 $cat >attrib.c <<'EOCP'
11063 #include <stdio.h>
11064 int square( int n ) __attribute__((pure));
11065 EOCP
11066 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11067         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11068                 echo "Your C compiler doesn't support __attribute__((pure))."
11069                 val="$undef"
11070         else
11071                 echo "Your C compiler supports __attribute__((pure))."
11072                 val="$define"
11073         fi
11074 else
11075         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11076         val="$undef"
11077 fi
11078 ;;
11079 *) val="$d_attribute_pure" ;;
11080 esac
11081 set d_attribute_pure
11082 eval $setvar
11083 $rm -f attrib*
11084
11085 : Look for GCC-style attribute unused
11086 case "$d_attribute_unused" in
11087 '')
11088 echo " "
11089 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11090 $cat >attrib.c <<'EOCP'
11091 #include <stdio.h>
11092 int do_something( int dummy __attribute__((unused)), int n );
11093 EOCP
11094 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11095         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11096                 echo "Your C compiler doesn't support __attribute__((unused))."
11097                 val="$undef"
11098         else
11099                 echo "Your C compiler supports __attribute__((unused))."
11100                 val="$define"
11101         fi
11102 else
11103         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11104         val="$undef"
11105 fi
11106 ;;
11107 *) val="$d_attribute_unused" ;;
11108 esac
11109 set d_attribute_unused
11110 eval $setvar
11111 $rm -f attrib*
11112
11113 : Look for GCC-style attribute deprecated
11114 case "$d_attribute_deprecated" in
11115 '')
11116 echo " "
11117 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11118 $cat >attrib.c <<'EOCP'
11119 #include <stdio.h>
11120 int I_am_deprecated(void) __attribute__((deprecated));
11121 EOCP
11122 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11123         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11124                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11125                 val="$undef"
11126         else
11127                 echo "Your C compiler supports __attribute__((deprecated))."
11128                 val="$define"
11129         fi
11130 else
11131         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11132         val="$undef"
11133 fi
11134 ;;
11135 *) val="$d_attribute_deprecated" ;;
11136 esac
11137 set d_attribute_deprecated
11138 eval $setvar
11139 $rm -f attrib*
11140
11141 : Look for GCC-style attribute warn_unused_result
11142 case "$d_attribute_warn_unused_result" in
11143 '')
11144 echo " "
11145 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11146 $cat >attrib.c <<'EOCP'
11147 #include <stdio.h>
11148 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11149 EOCP
11150 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11151         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11152                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11153                 val="$undef"
11154         else
11155                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11156                 val="$define"
11157         fi
11158 else
11159         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11160         val="$undef"
11161 fi
11162 ;;
11163 *) val="$d_attribute_warn_unused_result" ;;
11164 esac
11165 set d_attribute_warn_unused_result
11166 eval $setvar
11167 $rm -f attrib*
11168
11169 : see if bcmp exists
11170 set bcmp d_bcmp
11171 eval $inlibc
11172
11173 : see if bcopy exists
11174 set bcopy d_bcopy
11175 eval $inlibc
11176
11177 : see if getpgrp exists
11178 set getpgrp d_getpgrp
11179 eval $inlibc
11180
11181 case "$d_getpgrp" in
11182 "$define")
11183         echo " "
11184         echo "Checking to see which flavor of getpgrp is in use..."
11185         $cat >try.c <<EOP
11186 #$i_unistd I_UNISTD
11187 #include <sys/types.h>
11188 #ifdef I_UNISTD
11189 #  include <unistd.h>
11190 #endif
11191 #$i_stdlib I_STDLIB
11192 #ifdef I_STDLIB
11193 #include <stdlib.h>
11194 #endif
11195 int main()
11196 {
11197         if (getuid() == 0) {
11198                 printf("(I see you are running Configure as super-user...)\n");
11199                 setuid(1);
11200         }
11201 #ifdef TRY_BSD_PGRP
11202         if (getpgrp(1) == 0)
11203                 exit(0);
11204 #else
11205         if (getpgrp() > 0)
11206                 exit(0);
11207 #endif
11208         exit(1);
11209 }
11210 EOP
11211         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11212                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11213                 val="$define"
11214         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11215                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11216                 val="$undef"
11217         else
11218                 echo "I can't seem to compile and run the test program."
11219                 if ./usg; then
11220                         xxx="a USG one, i.e. you use getpgrp()."
11221                 else
11222                         # SVR4 systems can appear rather BSD-ish.
11223                         case "$i_unistd" in
11224                         $undef)
11225                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11226                                 val="$define"
11227                                 ;;
11228                         $define)
11229                                 xxx="probably a USG one, i.e. you use getpgrp()."
11230                                 val="$undef"
11231                                 ;;
11232                         esac
11233                 fi
11234                 echo "Assuming your getpgrp is $xxx" >&4
11235         fi
11236         ;;
11237 *) val="$undef";;
11238 esac
11239 set d_bsdgetpgrp
11240 eval $setvar
11241 $rm_try
11242
11243 : see if setpgrp exists
11244 set setpgrp d_setpgrp
11245 eval $inlibc
11246
11247 case "$d_setpgrp" in
11248 "$define")
11249         echo " "
11250         echo "Checking to see which flavor of setpgrp is in use..."
11251         $cat >try.c <<EOP
11252 #$i_unistd I_UNISTD
11253 #include <sys/types.h>
11254 #ifdef I_UNISTD
11255 #  include <unistd.h>
11256 #endif
11257 #$i_stdlib I_STDLIB
11258 #ifdef I_STDLIB
11259 #include <stdlib.h>
11260 #endif
11261 int main()
11262 {
11263         if (getuid() == 0) {
11264                 printf("(I see you are running Configure as super-user...)\n");
11265                 setuid(1);
11266         }
11267 #ifdef TRY_BSD_PGRP
11268         if (-1 == setpgrp(1, 1))
11269                 exit(0);
11270 #else
11271         if (setpgrp() != -1)
11272                 exit(0);
11273 #endif
11274         exit(1);
11275 }
11276 EOP
11277         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11278                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11279                 val="$define"
11280         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11281                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11282                 val="$undef"
11283         else
11284                 echo "(I can't seem to compile and run the test program.)"
11285                 if ./usg; then
11286                         xxx="a USG one, i.e. you use setpgrp()."
11287                 else
11288                         # SVR4 systems can appear rather BSD-ish.
11289                         case "$i_unistd" in
11290                         $undef)
11291                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11292                                 val="$define"
11293                                 ;;
11294                         $define)
11295                                 xxx="probably a USG one, i.e. you use setpgrp()."
11296                                 val="$undef"
11297                                 ;;
11298                         esac
11299                 fi
11300                 echo "Assuming your setpgrp is $xxx" >&4
11301         fi
11302         ;;
11303 *) val="$undef";;
11304 esac
11305 set d_bsdsetpgrp
11306 eval $setvar
11307 $rm_try
11308
11309 : Look for GCC-style __builtin_choose_expr
11310 case "$d_builtin_choose_expr" in
11311 '')
11312     echo " "
11313     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11314     $cat >try.c <<'EOCP'
11315 #include <assert.h>
11316 #include <stdlib.h>
11317 #include <stdio.h>
11318
11319 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11320
11321 int main(void) {
11322     assert( SYRINX(1) == 2112 );
11323     assert( SYRINX(1) != 5150 );
11324     assert( SYRINX(0) == 5150 );
11325     assert( SYRINX(0) != 2112 );
11326     puts( "All good!" );
11327     exit(0);
11328 }
11329
11330 EOCP
11331     set try
11332     if eval $compile && $run ./try; then
11333         echo "Your C compiler supports __builtin_choose_expr."
11334         val="$define"
11335     else
11336         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11337         val="$undef"
11338     fi
11339 ;;
11340 *) val="$d_builtin_choose_expr" ;;
11341 esac
11342
11343 set d_builtin_choose_expr
11344 eval $setvar
11345 $rm_try
11346
11347 : Look for GCC-style __builtin_expect
11348 case "$d_builtin_expect" in
11349 '')
11350     echo " "
11351     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11352     $cat >try.c <<'EOCP'
11353 int main(void) {
11354     int n = 50;
11355     if ( __builtin_expect(n, 0) ) n = 1;
11356     /* Remember shell exit code truth is 0, C truth is non-zero */
11357     return !(n == 1);
11358 }
11359 EOCP
11360     set try
11361     if eval $compile && $run ./try; then
11362         echo "Your C compiler supports __builtin_expect."
11363         val="$define"
11364     else
11365         echo "Your C compiler doesn't seem to understand __builtin_expect."
11366         val="$undef"
11367     fi
11368     ;;
11369 *) val="$d_builtin_expect" ;;
11370 esac
11371
11372 set d_builtin_expect
11373 eval $setvar
11374 $rm_try
11375
11376 : see if bzero exists
11377 set bzero d_bzero
11378 eval $inlibc
11379
11380 : see if stdarg is available
11381 echo " "
11382 if $test `./findhdr stdarg.h`; then
11383         echo "<stdarg.h> found." >&4
11384         valstd="$define"
11385 else
11386         echo "<stdarg.h> NOT found." >&4
11387         valstd="$undef"
11388 fi
11389
11390 : see if varargs is available
11391 echo " "
11392 if $test `./findhdr varargs.h`; then
11393         echo "<varargs.h> found." >&4
11394 else
11395         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11396 fi
11397
11398 : set up the varargs testing programs
11399 $cat > varargs.c <<EOP
11400 #ifdef I_STDARG
11401 #include <stdarg.h>
11402 #endif
11403 #ifdef I_VARARGS
11404 #include <varargs.h>
11405 #endif
11406
11407 #ifdef I_STDARG
11408 int f(char *p, ...)
11409 #else
11410 int f(va_alist)
11411 va_dcl
11412 #endif
11413 {
11414         va_list ap;
11415 #ifndef I_STDARG
11416         char *p;
11417 #endif
11418 #ifdef I_STDARG
11419         va_start(ap,p);
11420 #else
11421         va_start(ap);
11422         p = va_arg(ap, char *);
11423 #endif
11424         va_end(ap);
11425         return 0;
11426 }
11427 EOP
11428 $cat > varargs <<EOP
11429 $startsh
11430 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11431         echo "true"
11432 else
11433         echo "false"
11434 fi
11435 $rm -f varargs$_o
11436 EOP
11437 chmod +x varargs
11438
11439 : now check which varargs header should be included
11440 echo " "
11441 i_varhdr=''
11442 val=''
11443 case "$valstd" in
11444 "$define")
11445         if `./varargs I_STDARG`; then
11446                 val='stdarg.h'
11447         elif `./varargs I_VARARGS`; then
11448                 val='varargs.h'
11449         fi
11450         ;;
11451 *)
11452         if `./varargs I_VARARGS`; then
11453                 val='varargs.h'
11454         fi
11455         ;;
11456 esac
11457 case "$val" in
11458 '')
11459         echo " "
11460         echo "*** WHOA THERE!!! ***" >&4
11461         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11462         case "$knowitall" in
11463         '')
11464         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11465                 exit 1
11466                 ;;
11467         esac
11468 echo "I could not find the definition for va_dcl... You have problems..." >&4
11469         val="$undef"; set i_stdarg; eval $setvar
11470         val="$undef"; set i_varargs; eval $setvar
11471         ;;
11472 *)
11473         set i_varhdr
11474         eval $setvar
11475         case "$i_varhdr" in
11476         stdarg.h)
11477                 val="$define"; set i_stdarg; eval $setvar
11478                 val="$undef"; set i_varargs; eval $setvar
11479                 ;;
11480         varargs.h)
11481                 val="$undef"; set i_stdarg; eval $setvar
11482                 val="$define"; set i_varargs; eval $setvar
11483                 ;;
11484         esac
11485         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11486 esac
11487 $rm -f varargs*
11488
11489 : see if the Compiler supports C99 variadic macros
11490 case "$i_stdarg$i_stdlib" in
11491     "$define$define")
11492     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11493     $cat >try.c <<EOCP
11494 #include <stdio.h>
11495 #include <stdarg.h>
11496
11497 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11498
11499 int main() {
11500   char buf[20];
11501   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11502   puts(buf);
11503   return 0;
11504 }
11505 EOCP
11506     set try
11507     if eval $compile && $run ./try 2>&1 >/dev/null; then
11508         case "`$run ./try`" in
11509             "123 456 789")
11510             echo "You have C99 variadic macros." >&4
11511             d_c99_variadic_macros="$define"
11512             ;;
11513             *)
11514             echo "You don't have functional C99 variadic macros." >&4
11515             d_c99_variadic_macros="$undef"
11516             ;;
11517         esac
11518     else
11519         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11520         d_c99_variadic_macros="$undef"
11521     fi
11522     $rm_try
11523     ;;
11524     *)
11525     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11526     d_c99_variadic_macros="$undef"
11527     ;;
11528 esac
11529
11530 : see if signal is declared as pointer to function returning int or void
11531 echo " "
11532 xxx=`./findhdr signal.h`
11533 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11534 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11535         echo "You have int (*signal())() instead of void." >&4
11536         val="$undef"
11537 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11538         echo "You have void (*signal())()." >&4
11539         val="$define"
11540 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11541         echo "You have int (*signal())() instead of void." >&4
11542         val="$undef"
11543 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11544         echo "You have void (*signal())()." >&4
11545         val="$define"
11546 else
11547         case "$d_voidsig" in
11548         '')
11549         echo "I can't determine whether signal handler returns void or int..." >&4
11550                 dflt=void
11551                 rp="What type does your signal handler return?"
11552                 . ./myread
11553                 case "$ans" in
11554                 v*) val="$define";;
11555                 *) val="$undef";;
11556                 esac;;
11557         "$define")
11558                 echo "As you already told me, signal handler returns void." >&4
11559                 val="$define"
11560                 ;;
11561         *)      echo "As you already told me, signal handler returns int." >&4
11562                 val="$undef"
11563                 ;;
11564         esac
11565 fi
11566 set d_voidsig
11567 eval $setvar
11568 case "$d_voidsig" in
11569 "$define") signal_t="void";;
11570 *) signal_t="int";;
11571 esac
11572 $rm -f $$.tmp
11573
11574 : check for ability to cast large floats to 32-bit ints.
11575 echo " "
11576 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11577 if $test "$intsize" -ge 4; then
11578         xxx=int
11579 else
11580         xxx=long
11581 fi
11582 $cat >try.c <<EOCP
11583 #include <stdio.h>
11584 #$i_stdlib I_STDLIB
11585 #ifdef I_STDLIB
11586 #include <stdlib.h>
11587 #endif
11588 #include <sys/types.h>
11589 #include <signal.h>
11590 $signal_t blech(int s) { exit(3); }
11591 int main()
11592 {
11593         $xxx i32;
11594         double f, g;
11595         int result = 0;
11596         char str[16];
11597         signal(SIGFPE, blech);
11598
11599         /* Don't let compiler optimize the test away.  Store the number
11600            in a writable string for gcc to pass to sscanf under HP-UX.
11601         */
11602         sprintf(str, "2147483647");
11603         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11604         g = 10 * f;
11605         i32  = ($xxx) g;
11606
11607         /* x86 processors will probably give 0x8000 0000, which is a
11608            sign change.  We don't want that.  We want to mimic SPARC
11609            behavior here, which is to preserve the sign and give
11610            back 0x7fff ffff.
11611         */
11612         if (i32 != ($xxx) f)
11613                 result |= 1;
11614         exit(result);
11615 }
11616 EOCP
11617 set try
11618 if eval $compile_ok; then
11619         $run ./try 2>/dev/null
11620         yyy=$?
11621 else
11622         echo "(I can't seem to compile the test program--assuming it can't)"
11623         yyy=1
11624 fi
11625 case "$yyy" in
11626 0)      val="$define"
11627         echo "Yup, it can."
11628         ;;
11629 *)      val="$undef"
11630         echo "Nope, it can't."
11631         ;;
11632 esac
11633 set d_casti32
11634 eval $setvar
11635 $rm_try
11636
11637 : check for ability to cast negative floats to unsigned
11638 echo " "
11639 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11640 $cat >try.c <<EOCP
11641 #include <stdio.h>
11642 #$i_stdlib I_STDLIB
11643 #ifdef I_STDLIB
11644 #include <stdlib.h>
11645 #endif
11646 #include <sys/types.h>
11647 #include <signal.h>
11648 $signal_t blech(int s) { exit(7); }
11649 $signal_t blech_in_list(int s) { exit(4); }
11650 unsigned long dummy_long(unsigned long p) { return p; }
11651 unsigned int dummy_int(unsigned int p) { return p; }
11652 unsigned short dummy_short(unsigned short p) { return p; }
11653 int main()
11654 {
11655         double f;
11656         unsigned long along;
11657         unsigned int aint;
11658         unsigned short ashort;
11659         int result = 0;
11660         char str[16];
11661
11662         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11663            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11664            optimized the whole file away
11665         */
11666         /* Store the number in a writable string for gcc to pass to
11667            sscanf under HP-UX.
11668         */
11669         sprintf(str, "-123");
11670         sscanf(str, "%lf", &f);  /* f = -123.; */
11671
11672         signal(SIGFPE, blech);
11673         along = (unsigned long)f;
11674         aint = (unsigned int)f;
11675         ashort = (unsigned short)f;
11676         if (along != (unsigned long)-123)
11677                 result |= 1;
11678         if (aint != (unsigned int)-123)
11679                 result |= 1;
11680         if (ashort != (unsigned short)-123)
11681                 result |= 1;
11682         sprintf(str, "1073741824.");
11683         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11684         f = f + f;
11685         along = 0;
11686         along = (unsigned long)f;
11687         if (along != 0x80000000)
11688                 result |= 2;
11689         f -= 1.;
11690         along = 0;
11691         along = (unsigned long)f;
11692         if (along != 0x7fffffff)
11693                 result |= 1;
11694         f += 2.;
11695         along = 0;
11696         along = (unsigned long)f;
11697         if (along != 0x80000001)
11698                 result |= 2;
11699         if (result)
11700                 exit(result);
11701         signal(SIGFPE, blech_in_list);
11702         sprintf(str, "123.");
11703         sscanf(str, "%lf", &f);  /* f = 123.; */
11704         along = dummy_long((unsigned long)f);
11705         aint = dummy_int((unsigned int)f);
11706         ashort = dummy_short((unsigned short)f);
11707         if (along != (unsigned long)123)
11708                 result |= 4;
11709         if (aint != (unsigned int)123)
11710                 result |= 4;
11711         if (ashort != (unsigned short)123)
11712                 result |= 4;
11713         exit(result);
11714
11715 }
11716 EOCP
11717 set try
11718 if eval $compile_ok; then
11719         $run ./try 2>/dev/null
11720         castflags=$?
11721 else
11722         echo "(I can't seem to compile the test program--assuming it can't)"
11723         castflags=7
11724 fi
11725 case "$castflags" in
11726 0)      val="$define"
11727         echo "Yup, it can."
11728         ;;
11729 *)      val="$undef"
11730         echo "Nope, it can't."
11731         ;;
11732 esac
11733 set d_castneg
11734 eval $setvar
11735 $rm_try
11736
11737 : see if cbrt exists
11738 set cbrt d_cbrt
11739 eval $inlibc
11740
11741 : see if vprintf exists
11742 echo " "
11743 if set vprintf val -f d_vprintf; eval $csym; $val; then
11744         echo 'vprintf() found.' >&4
11745         val="$define"
11746         $cat >try.c <<EOF
11747 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11748 #$i_varargs I_VARARGS
11749
11750 #$i_stdlib I_STDLIB
11751 #$i_unistd I_UNISTD
11752
11753 #ifdef I_STDARG
11754 #  include <stdarg.h>
11755 #else /* I_VARARGS */
11756 #  include <varargs.h>
11757 #endif
11758
11759 #ifdef I_UNISTD
11760 #  include <unistd.h>
11761 #endif
11762
11763 #ifdef I_STDLIB
11764 #  include <stdlib.h>
11765 #endif
11766
11767 #include <stdio.h> /* vsprintf prototype */
11768
11769 #ifdef I_STDARG
11770 void xxx(int n, ...)
11771 {
11772     va_list args;
11773     char buf[10];
11774     va_start(args, n);
11775     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11776 }
11777 int main() { xxx(1, "foo"); }
11778
11779 #else /* I_VARARGS */
11780
11781 xxx(va_alist)
11782 va_dcl
11783 {
11784     va_list args;
11785     char buf[10];
11786     va_start(args);
11787     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11788 }
11789 int main() { xxx("foo"); }
11790
11791 #endif
11792
11793 EOF
11794         set try
11795         if eval $compile_ok; then
11796                 if $run ./try; then
11797                         echo "Your vsprintf() returns (int)." >&4
11798                         val2="$undef"
11799                 else
11800                         echo "Your vsprintf() returns (char*)." >&4
11801                         val2="$define"
11802                 fi
11803         else
11804                 echo 'I am unable to compile the vsprintf() test program.' >&4
11805                 # We shouldn't get here.  If we do, assume the standard signature,
11806                 # not the old BSD one.
11807                 echo 'Guessing that vsprintf() returns (int).' >&4
11808                 val2="$undef"
11809         fi
11810 else
11811         echo 'vprintf() NOT found.' >&4
11812         val="$undef"
11813         val2="$undef"
11814 fi
11815 $rm_try
11816 set d_vprintf
11817 eval $setvar
11818 val=$val2
11819 set d_charvspr
11820 eval $setvar
11821
11822 : see if chown exists
11823 set chown d_chown
11824 eval $inlibc
11825
11826 : see if chroot exists
11827 set chroot d_chroot
11828 eval $inlibc
11829
11830 : see if chsize exists
11831 set chsize d_chsize
11832 eval $inlibc
11833
11834 : see if class exists
11835 set class d_class
11836 eval $inlibc
11837
11838 : see if clearenv exists
11839 set clearenv d_clearenv
11840 eval $inlibc
11841
11842 : Define hasstruct macro for Configure internal use
11843 hasstruct='varname=$1; struct=$2; shift; shift;
11844 while $test $# -ge 2; do
11845         case "$1" in
11846         $define) echo "#include <$2>";;
11847         esac ;
11848     shift 2;
11849 done > try.c;
11850 echo "int main () { struct $struct foo; }" >> try.c;
11851 set try;
11852 if eval $compile; then
11853         val="$define";
11854 else
11855         val="$undef";
11856 fi;
11857 set $varname;
11858 eval $setvar;
11859 $rm_try'
11860
11861 : see whether socket exists
11862 socketlib=''
11863 sockethdr=''
11864 echo " "
11865 $echo $n "Hmm... $c" >&4
11866 if set socket val -f d_socket; eval $csym; $val; then
11867     echo "Looks like you have Berkeley networking support." >&4
11868     d_socket="$define"
11869     if set setsockopt val -f; eval $csym; $val; then
11870         d_oldsock="$undef"
11871     else
11872         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11873         d_oldsock="$define"
11874     fi
11875 else
11876     if $contains socklib libc.list >/dev/null 2>&1; then
11877         echo "Looks like you have Berkeley networking support." >&4
11878         d_socket="$define"
11879         : we will have to assume that it supports the 4.2 BSD interface
11880         d_oldsock="$undef"
11881     else
11882         echo "You don't have Berkeley networking in libc$_a..." >&4
11883         if test "X$d_socket" = "X$define"; then
11884             echo "...but you seem to believe that you have sockets." >&4
11885         else
11886             for net in net socket
11887             do
11888                 if test -f $sysroot/usr/lib/lib$net$_a; then
11889                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11890                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11891                     if $contains socket libc.list >/dev/null 2>&1; then
11892                         d_socket="$define"
11893                         socketlib="-l$net"
11894                         case "$net" in
11895                         net)
11896                             echo "...but the Wollongong group seems to have hacked it in." >&4
11897                             sockethdr="-I$sysroot/usr/netinclude"
11898                             ;;
11899                         esac
11900                         echo "Found Berkeley sockets interface in lib$net." >&4
11901                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11902                             d_oldsock="$undef"
11903                         else
11904                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11905                             d_oldsock="$define"
11906                         fi
11907                         break
11908                     fi
11909                 fi
11910             done
11911             if test "X$d_socket" != "X$define"; then
11912                echo "or anywhere else I see." >&4
11913                d_socket="$undef"
11914                d_oldsock="$undef"
11915             fi
11916         fi
11917     fi
11918 fi
11919
11920 : see if socketpair exists
11921 set socketpair d_sockpair
11922 eval $inlibc
11923
11924
11925 echo " "
11926 echo "Checking the availability sa_len in the sock struct ..." >&4
11927 $cat >try.c <<EOF
11928 #include <sys/types.h>
11929 #include <sys/socket.h>
11930 int main() {
11931 struct sockaddr sa;
11932 return (sa.sa_len);
11933 }
11934 EOF
11935 val="$undef"
11936 set try; if eval $compile; then
11937     val="$define"
11938 fi
11939 set d_sockaddr_sa_len; eval $setvar
11940 $rm_try
11941
11942 echo " "
11943 echo "Checking the availability struct sockaddr_in6 ..." >&4
11944 $cat >try.c <<EOF
11945 #include <sys/types.h>
11946 #include <sys/socket.h>
11947 #include <netinet/in.h>
11948 int main() {
11949 struct sockaddr_in6 sin6;
11950 return (sin6.sin6_family);
11951 }
11952 EOF
11953 val="$undef"
11954 set try; if eval $compile; then
11955     val="$define"
11956 fi
11957 set d_sockaddr_in6; eval $setvar
11958 $rm_try
11959
11960 echo " "
11961 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11962 $cat >try.c <<EOF
11963 #include <sys/types.h>
11964 #include <sys/socket.h>
11965 #include <netinet/in.h>
11966 int main() {
11967 struct sockaddr_in6 sin6;
11968 return (sin6.sin6_scope_id);
11969 }
11970 EOF
11971 val="$undef"
11972 set try; if eval $compile; then
11973     val="$define"
11974 fi
11975 set d_sin6_scope_id; eval $setvar
11976 $rm_try
11977
11978 echo " "
11979 echo "Checking the availability struct ip_mreq ..." >&4
11980 $cat >try.c <<EOF
11981 #include <sys/types.h>
11982 #include <sys/socket.h>
11983 #include <netinet/in.h>
11984 int main() {
11985 struct ip_mreq mreq;
11986 return (mreq.imr_multiaddr.s_addr);
11987 }
11988 EOF
11989 val="$undef"
11990 set try; if eval $compile; then
11991        val="$define"
11992 fi
11993 set d_ip_mreq; eval $setvar
11994 $rm_try
11995
11996 echo " "
11997 echo "Checking the availability struct ip_mreq_source ..." >&4
11998 $cat >try.c <<EOF
11999 #include <sys/types.h>
12000 #include <sys/socket.h>
12001 #include <netinet/in.h>
12002 int main() {
12003 struct ip_mreq_source mreq;
12004 return (mreq.imr_multiaddr.s_addr);
12005 }
12006 EOF
12007 val="$undef"
12008 set try; if eval $compile; then
12009        val="$define"
12010 fi
12011 set d_ip_mreq_source; eval $setvar
12012 $rm_try
12013
12014 echo " "
12015 echo "Checking the availability struct ipv6_mreq ..." >&4
12016 $cat >try.c <<EOF
12017 #include <sys/types.h>
12018 #include <sys/socket.h>
12019 #include <netinet/in.h>
12020 int main() {
12021 struct ipv6_mreq mreq;
12022 return (mreq.ipv6mr_interface);
12023 }
12024 EOF
12025 val="$undef"
12026 set try; if eval $compile; then
12027     val="$define"
12028 fi
12029 set d_ipv6_mreq; eval $setvar
12030 $rm_try
12031
12032 echo " "
12033 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12034 $cat >try.c <<EOF
12035 #include <sys/types.h>
12036 #include <sys/socket.h>
12037 #include <netinet/in.h>
12038 int main() {
12039 struct ipv6_mreq_source mreq;
12040 return (mreq.imr_multiaddr.s_addr);
12041 }
12042 EOF
12043 val="$undef"
12044 set try; if eval $compile; then
12045        val="$define"
12046 fi
12047 set d_ipv6_mreq_source; eval $setvar
12048 $rm_try
12049
12050 echo " "
12051 echo "Checking the availability of certain socket constants..." >&4
12052 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12053     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12054     $cat >try.c <<EOF
12055 #include <sys/types.h>
12056 #include <sys/socket.h>
12057 int main() {
12058     int i = $ENUM;
12059 }
12060 EOF
12061     val="$undef"
12062     set try; if eval $compile; then
12063         val="$define"
12064     fi
12065     set d_${enum}; eval $setvar
12066     $rm_try
12067 done
12068
12069 : see if this is a sys/uio.h system
12070 set sys/uio.h i_sysuio
12071 eval $inhdr
12072
12073 : Check for cmsghdr support
12074 echo " "
12075 echo "Checking to see if your system supports struct cmsghdr..." >&4
12076 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12077 eval $hasstruct
12078 case "$d_cmsghdr_s" in
12079 "$define")      echo "Yes, it does."   ;;
12080 *)              echo "No, it doesn't." ;;
12081 esac
12082
12083
12084 : check for const keyword
12085 echo " "
12086 echo 'Checking to see if your C compiler knows about "const"...' >&4
12087 $cat >const.c <<'EOCP'
12088 typedef struct spug { int drokk; } spug;
12089 int main()
12090 {
12091         const char *foo;
12092         const spug y = { 0 };
12093 }
12094 EOCP
12095 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12096         val="$define"
12097         echo "Yup, it does."
12098 else
12099         val="$undef"
12100         echo "Nope, it doesn't."
12101 fi
12102 set d_const
12103 eval $setvar
12104
12105 : see if copysign exists
12106 set copysign d_copysign
12107 eval $inlibc
12108
12109 : see if copysignl exists
12110 set copysignl d_copysignl
12111 eval $inlibc
12112
12113 : see if crypt exists
12114 echo " "
12115 set crypt d_crypt
12116 eval $inlibc
12117 case "$d_crypt" in
12118 $define) cryptlib='' ;;
12119 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12120                 echo 'crypt() found.' >&4
12121                 val="$define"
12122                 cryptlib=''
12123         else
12124                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12125                 if $test -z "$cryptlib"; then
12126                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12127                 else
12128                         cryptlib=-lcrypt
12129                 fi
12130                 if $test -z "$cryptlib"; then
12131                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12132                 else
12133                         cryptlib=-lcrypt
12134                 fi
12135                 if $test -z "$cryptlib"; then
12136                         cryptlib=`./loc libcrypt$_a "" $libpth`
12137                 else
12138                         cryptlib=-lcrypt
12139                 fi
12140                 if $test -z "$cryptlib"; then
12141                         echo 'crypt() NOT found.' >&4
12142                         val="$undef"
12143                 else
12144                         val="$define"
12145                 fi
12146         fi
12147         set d_crypt
12148         eval $setvar
12149         ;;
12150 esac
12151
12152 : see if this is a crypt.h system
12153 set crypt.h i_crypt
12154 eval $inhdr
12155
12156 : see if crypt_r exists
12157 set crypt_r d_crypt_r
12158 eval $inlibc
12159 case "$d_crypt_r" in
12160 "$define")
12161         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12162         case "$d_crypt_r_proto:$usethreads" in
12163         ":define")      d_crypt_r_proto=define
12164                 set d_crypt_r_proto crypt_r $hdrs
12165                 eval $hasproto ;;
12166         *)      ;;
12167         esac
12168         case "$d_crypt_r_proto" in
12169         define)
12170         case "$crypt_r_proto" in
12171         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12172         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12173         esac
12174         case "$crypt_r_proto" in
12175         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12176         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12177         esac
12178         case "$crypt_r_proto" in
12179         ''|0)   d_crypt_r=undef
12180                 crypt_r_proto=0
12181                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12182         * )     case "$crypt_r_proto" in
12183                 REENTRANT_PROTO*) ;;
12184                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12185                 esac
12186                 echo "Prototype: $try" ;;
12187         esac
12188         ;;
12189         *)      case "$usethreads" in
12190                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12191                 esac
12192                 d_crypt_r=undef
12193                 crypt_r_proto=0
12194                 ;;
12195         esac
12196         ;;
12197 *)      crypt_r_proto=0
12198         ;;
12199 esac
12200
12201 : get csh whereabouts
12202 case "$csh" in
12203 'csh') val="$undef" ;;
12204 *) val="$define" ;;
12205 esac
12206 set d_csh
12207 eval $setvar
12208 : Respect a hint or command line value for full_csh.
12209 case "$full_csh" in
12210 '') full_csh=$csh ;;
12211 esac
12212
12213 : see if ctermid exists
12214 set ctermid d_ctermid
12215 eval $inlibc
12216
12217 : see if ctermid_r exists
12218 set ctermid_r d_ctermid_r
12219 eval $inlibc
12220 case "$d_ctermid_r" in
12221 "$define")
12222         hdrs="$i_systypes sys/types.h define stdio.h "
12223         case "$d_ctermid_r_proto:$usethreads" in
12224         ":define")      d_ctermid_r_proto=define
12225                 set d_ctermid_r_proto ctermid_r $hdrs
12226                 eval $hasproto ;;
12227         *)      ;;
12228         esac
12229         case "$d_ctermid_r_proto" in
12230         define)
12231         case "$ctermid_r_proto" in
12232         ''|0) try='char* ctermid_r(char*);'
12233         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12234         esac
12235         case "$ctermid_r_proto" in
12236         ''|0)   d_ctermid_r=undef
12237                 ctermid_r_proto=0
12238                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12239         * )     case "$ctermid_r_proto" in
12240                 REENTRANT_PROTO*) ;;
12241                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12242                 esac
12243                 echo "Prototype: $try" ;;
12244         esac
12245         ;;
12246         *)      case "$usethreads" in
12247                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12248                 esac
12249                 d_ctermid_r=undef
12250                 ctermid_r_proto=0
12251                 ;;
12252         esac
12253         ;;
12254 *)      ctermid_r_proto=0
12255         ;;
12256 esac
12257
12258 : see if ctime_r exists
12259 set ctime_r d_ctime_r
12260 eval $inlibc
12261 case "$d_ctime_r" in
12262 "$define")
12263         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12264         case "$d_ctime_r_proto:$usethreads" in
12265         ":define")      d_ctime_r_proto=define
12266                 set d_ctime_r_proto ctime_r $hdrs
12267                 eval $hasproto ;;
12268         *)      ;;
12269         esac
12270         case "$d_ctime_r_proto" in
12271         define)
12272         case "$ctime_r_proto" in
12273         ''|0) try='char* ctime_r(const time_t*, char*);'
12274         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12275         esac
12276         case "$ctime_r_proto" in
12277         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12278         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12279         esac
12280         case "$ctime_r_proto" in
12281         ''|0) try='int ctime_r(const time_t*, char*);'
12282         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12283         esac
12284         case "$ctime_r_proto" in
12285         ''|0) try='int ctime_r(const time_t*, char*, int);'
12286         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12287         esac
12288         case "$ctime_r_proto" in
12289         ''|0)   d_ctime_r=undef
12290                 ctime_r_proto=0
12291                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12292         * )     case "$ctime_r_proto" in
12293                 REENTRANT_PROTO*) ;;
12294                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12295                 esac
12296                 echo "Prototype: $try" ;;
12297         esac
12298         ;;
12299         *)      case "$usethreads" in
12300                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12301                 esac
12302                 d_ctime_r=undef
12303                 ctime_r_proto=0
12304                 ;;
12305         esac
12306         ;;
12307 *)      ctime_r_proto=0
12308         ;;
12309 esac
12310
12311 : see if cuserid exists
12312 set cuserid d_cuserid
12313 eval $inlibc
12314
12315 : see if this is a limits.h system
12316 set limits.h i_limits
12317 eval $inhdr
12318
12319 : See if number of significant digits in a double precision number is known
12320 echo " "
12321 $cat >dbl_dig.c <<EOM
12322 #$i_limits I_LIMITS
12323 #$i_float I_FLOAT
12324 #ifdef I_LIMITS
12325 #include <limits.h>
12326 #endif
12327 #ifdef I_FLOAT
12328 #include <float.h>
12329 #endif
12330 #ifdef DBL_DIG
12331 printf("Contains DBL_DIG");
12332 #endif
12333 EOM
12334 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12335 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12336         echo "DBL_DIG found." >&4
12337         val="$define"
12338 else
12339         echo "DBL_DIG NOT found." >&4
12340         val="$undef"
12341 fi
12342 $rm -f dbl_dig.?
12343 set d_dbl_dig
12344 eval $setvar
12345
12346 : see if dbm.h is available
12347 : see if dbmclose exists
12348 set dbmclose d_dbmclose
12349 eval $inlibc
12350
12351 case "$d_dbmclose" in
12352 $define)
12353         set dbm.h i_dbm
12354         eval $inhdr
12355         case "$i_dbm" in
12356         $define)
12357                 val="$undef"
12358                 set i_rpcsvcdbm
12359                 eval $setvar
12360                 ;;
12361         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12362                 eval $inhdr
12363                 ;;
12364         esac
12365         ;;
12366 *)      echo "We won't be including <dbm.h>"
12367         val="$undef"
12368         set i_dbm
12369         eval $setvar
12370         val="$undef"
12371         set i_rpcsvcdbm
12372         eval $setvar
12373         ;;
12374 esac
12375
12376 : see if prototype for dbminit is available
12377 echo " "
12378 set d_dbminitproto dbminit $i_dbm dbm.h
12379 eval $hasproto
12380
12381 : see if difftime exists
12382 set difftime d_difftime
12383 eval $inlibc
12384
12385 : see if this is a dirent system
12386 echo " "
12387 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12388         val="$define"
12389         echo "<dirent.h> found." >&4
12390 else
12391         val="$undef"
12392         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12393                 echo "<sys/dir.h> found." >&4
12394                 echo " "
12395         else
12396                 xinc=`./findhdr sys/ndir.h`
12397         fi
12398         echo "<dirent.h> NOT found." >&4
12399 fi
12400 set i_dirent
12401 eval $setvar
12402
12403 : Look for type of directory structure.
12404 echo " "
12405 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12406
12407 case "$direntrytype" in
12408 ''|' ')
12409         case "$i_dirent" in
12410         $define) guess1='struct dirent' ;;
12411         *) guess1='struct direct'  ;;
12412         esac
12413         ;;
12414 *)      guess1="$direntrytype"
12415         ;;
12416 esac
12417
12418 case "$guess1" in
12419 'struct dirent') guess2='struct direct' ;;
12420 *) guess2='struct dirent' ;;
12421 esac
12422
12423 if $contains "$guess1" try.c >/dev/null 2>&1; then
12424         direntrytype="$guess1"
12425         echo "Your directory entries are $direntrytype." >&4
12426 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12427         direntrytype="$guess2"
12428         echo "Your directory entries seem to be $direntrytype." >&4
12429 else
12430         echo "I don't recognize your system's directory entries." >&4
12431         rp="What type is used for directory entries on this system?"
12432         dflt="$guess1"
12433         . ./myread
12434         direntrytype="$ans"
12435 fi
12436 $rm_try
12437
12438 : see if the directory entry stores field length
12439 echo " "
12440 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12441 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12442         echo "Good, your directory entry keeps length information in d_namlen." >&4
12443         val="$define"
12444 else
12445         echo "Your directory entry does not know about the d_namlen field." >&4
12446         val="$undef"
12447 fi
12448 set d_dirnamlen
12449 eval $setvar
12450 $rm_try
12451
12452 : Look for DIR.dd_fd
12453 case "$i_dirent" in
12454 "$define")
12455     echo "Checking to see if DIR has a dd_fd member variable" >&4
12456     $cat >try.c <<EOCP
12457 #$i_stdlib I_STDLIB
12458 #ifdef I_STDLIB
12459 #include <stdlib.h>
12460 #endif
12461 #include <dirent.h>
12462
12463 int main() {
12464     DIR dir;
12465     dir.dd_fd = 1;
12466     return 0;
12467 }
12468 EOCP
12469     val=$undef
12470     set try
12471     if eval $compile; then
12472         echo "Yes, it does."
12473         val="$define"
12474     else
12475         echo "No, it does not."
12476         val="$undef"
12477     fi
12478     ;;
12479 *)
12480     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12481     val="$undef"
12482     ;;
12483 esac
12484 set d_dir_dd_fd
12485 eval $setvar
12486 $rm_try
12487
12488 : see if this is an sysdir system
12489 set sys/dir.h i_sysdir
12490 eval $inhdr
12491
12492 : see if this is an sysndir system
12493 set sys/ndir.h i_sysndir
12494 eval $inhdr
12495
12496 : Look for dirfd
12497 echo " "
12498 $cat >dirfd.c <<EOM
12499 #include <stdio.h>
12500 #$i_stdlib I_STDLIB
12501 #ifdef I_STDLIB
12502 #include <stdlib.h>
12503 #endif
12504 #$i_dirent I_DIRENT             /**/
12505 #$i_sysdir I_SYS_DIR            /**/
12506 #$i_sysndir I_SYS_NDIR          /**/
12507 #$i_systypes I_SYS_TYPES        /**/
12508 #if defined(I_SYS_TYPES)
12509 #include <sys/types.h>
12510 #endif
12511 #if defined(I_DIRENT)
12512 #include <dirent.h>
12513 #else
12514 #ifdef I_SYS_NDIR
12515 #include <sys/ndir.h>
12516 #else
12517 #ifdef I_SYS_DIR
12518 #ifdef hp9000s500
12519 #include <ndir.h>       /* may be wrong in the future */
12520 #else
12521 #include <sys/dir.h>
12522 #endif
12523 #endif
12524 #endif
12525 #endif
12526 int main() {
12527         DIR *dirp = opendir(".");
12528         if (dirfd(dirp) >= 0)
12529                 exit(0);
12530         else
12531                 exit(1);
12532 }
12533 EOM
12534 val=$undef
12535 set dirfd
12536 if eval $compile; then
12537         val="$define"
12538 fi
12539 case "$val" in
12540 $define)        echo "dirfd() found." >&4       ;;
12541 *)              echo "dirfd() NOT found." >&4   ;;
12542 esac
12543 set d_dirfd
12544 eval $setvar
12545 $rm -f dirfd*
12546
12547 : see if dladdr exists
12548 set dladdr d_dladdr
12549 eval $inlibc
12550
12551 : see if dlerror exists
12552 xxx_runnm="$runnm"
12553 runnm=false
12554 set dlerror d_dlerror
12555 eval $inlibc
12556 runnm="$xxx_runnm"
12557
12558 : see if dlfcn is available
12559 set dlfcn.h i_dlfcn
12560 eval $inhdr
12561
12562 : Check what extension to use for shared libs
12563 case "$usedl" in
12564 $define|y|true)
12565         $cat << EOM
12566
12567 On a few systems, the dynamically loaded modules that perl generates and uses
12568 will need a different extension than shared libs. The default will probably
12569 be appropriate.
12570
12571 EOM
12572         case "$dlext" in
12573         '')     dflt="$so" ;;
12574         *)      dflt="$dlext" ;;
12575         esac
12576         rp='What is the extension of dynamically loaded modules'
12577         . ./myread
12578         dlext="$ans"
12579         ;;
12580 *)
12581         dlext="none"
12582         ;;
12583 esac
12584
12585 : Check if dlsym need a leading underscore
12586 echo " "
12587 val="$undef"
12588
12589 case "$dlsrc" in
12590 dl_dlopen.xs)
12591         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12592         $cat >dyna.c <<'EOM'
12593 fred () { }
12594 EOM
12595
12596 $cat >fred.c<<EOM
12597
12598 #include <stdio.h>
12599 #$i_stdlib I_STDLIB
12600 #ifdef I_STDLIB
12601 #include <stdlib.h>
12602 #endif
12603 #$i_dlfcn I_DLFCN
12604 #ifdef I_DLFCN
12605 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12606 #else
12607 #include <sys/types.h>
12608 #include <nlist.h>
12609 #include <link.h>
12610 #endif
12611
12612 extern int fred() ;
12613
12614 int main()
12615 {
12616     void * handle ;
12617     void * symbol ;
12618 #ifndef RTLD_LAZY
12619     int mode = 1 ;
12620 #else
12621     int mode = RTLD_LAZY ;
12622 #endif
12623     handle = dlopen("./dyna.$dlext", mode) ;
12624     if (handle == NULL) {
12625         printf ("1\n") ;
12626         fflush (stdout) ;
12627         exit(0);
12628     }
12629     symbol = dlsym(handle, "fred") ;
12630     if (symbol == NULL) {
12631         /* try putting a leading underscore */
12632         symbol = dlsym(handle, "_fred") ;
12633         if (symbol == NULL) {
12634             printf ("2\n") ;
12635             fflush (stdout) ;
12636             exit(0);
12637         }
12638         printf ("3\n") ;
12639     }
12640     else
12641         printf ("4\n") ;
12642     fflush (stdout) ;
12643     exit(0);
12644 }
12645 EOM
12646         : Call the object file tmp-dyna.o in case dlext=o.
12647         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12648                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12649                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12650                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12651                 xxx=`$run ./fred`
12652                 case $xxx in
12653                 1)      echo "Test program failed using dlopen." >&4
12654                         echo "Perhaps you should not use dynamic loading." >&4;;
12655                 2)      echo "Test program failed using dlsym." >&4
12656                         echo "Perhaps you should not use dynamic loading." >&4;;
12657                 3)      echo "dlsym needs a leading underscore" >&4
12658                         val="$define" ;;
12659                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12660                 esac
12661         else
12662                 echo "I can't compile and run the test program." >&4
12663                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12664         fi
12665         ;;
12666 esac
12667
12668 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12669
12670 set d_dlsymun
12671 eval $setvar
12672
12673 : see if drand48_r exists
12674 set drand48_r d_drand48_r
12675 eval $inlibc
12676 case "$d_drand48_r" in
12677 "$define")
12678         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12679         case "$d_drand48_r_proto:$usethreads" in
12680         ":define")      d_drand48_r_proto=define
12681                 set d_drand48_r_proto drand48_r $hdrs
12682                 eval $hasproto ;;
12683         *)      ;;
12684         esac
12685         case "$d_drand48_r_proto" in
12686         define)
12687         case "$drand48_r_proto" in
12688         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12689         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12690         esac
12691         case "$drand48_r_proto" in
12692         ''|0)   d_drand48_r=undef
12693                 drand48_r_proto=0
12694                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12695         * )     case "$drand48_r_proto" in
12696                 REENTRANT_PROTO*) ;;
12697                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12698                 esac
12699                 echo "Prototype: $try" ;;
12700         esac
12701         ;;
12702         *)      case "$usethreads" in
12703                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12704                 esac
12705                 d_drand48_r=undef
12706                 drand48_r_proto=0
12707                 ;;
12708         esac
12709         ;;
12710 *)      drand48_r_proto=0
12711         ;;
12712 esac
12713
12714 : see if prototype for drand48 is available
12715 echo " "
12716 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12717 eval $hasproto
12718
12719 : see if dup2 exists
12720 set dup2 d_dup2
12721 eval $inlibc
12722
12723 : see if eaccess exists
12724 set eaccess d_eaccess
12725 eval $inlibc
12726
12727 : see if endgrent exists
12728 set endgrent d_endgrent
12729 eval $inlibc
12730
12731 : see if this is an grp system
12732 set grp.h i_grp
12733 eval $inhdr
12734
12735 case "$i_grp" in
12736 $define)
12737         xxx=`./findhdr grp.h`
12738         $cppstdin $cppflags $cppminus < $xxx >$$.h
12739
12740         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12741                 val="$define"
12742         else
12743                 val="$undef"
12744         fi
12745         set d_grpasswd
12746         eval $setvar
12747
12748         $rm -f $$.h
12749         ;;
12750 *)
12751         val="$undef";
12752         set d_grpasswd; eval $setvar
12753         ;;
12754 esac
12755
12756 : see if endgrent_r exists
12757 set endgrent_r d_endgrent_r
12758 eval $inlibc
12759 case "$d_endgrent_r" in
12760 "$define")
12761         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12762         case "$d_endgrent_r_proto:$usethreads" in
12763         ":define")      d_endgrent_r_proto=define
12764                 set d_endgrent_r_proto endgrent_r $hdrs
12765                 eval $hasproto ;;
12766         *)      ;;
12767         esac
12768         case "$d_endgrent_r_proto" in
12769         define)
12770         case "$endgrent_r_proto" in
12771         ''|0) try='int endgrent_r(FILE**);'
12772         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12773         esac
12774         case "$endgrent_r_proto" in
12775         ''|0) try='void endgrent_r(FILE**);'
12776         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12777         esac
12778         case "$endgrent_r_proto" in
12779         ''|0)   d_endgrent_r=undef
12780                 endgrent_r_proto=0
12781                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12782         * )     case "$endgrent_r_proto" in
12783                 REENTRANT_PROTO*) ;;
12784                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12785                 esac
12786                 echo "Prototype: $try" ;;
12787         esac
12788         ;;
12789         *)      case "$usethreads" in
12790                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12791                 esac
12792                 d_endgrent_r=undef
12793                 endgrent_r_proto=0
12794                 ;;
12795         esac
12796         ;;
12797 *)      endgrent_r_proto=0
12798         ;;
12799 esac
12800
12801 : see if endhostent exists
12802 set endhostent d_endhent
12803 eval $inlibc
12804
12805 : see if this is a netdb.h system
12806 set netdb.h i_netdb
12807 eval $inhdr
12808
12809 : see if endhostent_r exists
12810 set endhostent_r d_endhostent_r
12811 eval $inlibc
12812 case "$d_endhostent_r" in
12813 "$define")
12814         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12815         case "$d_endhostent_r_proto:$usethreads" in
12816         ":define")      d_endhostent_r_proto=define
12817                 set d_endhostent_r_proto endhostent_r $hdrs
12818                 eval $hasproto ;;
12819         *)      ;;
12820         esac
12821         case "$d_endhostent_r_proto" in
12822         define)
12823         case "$endhostent_r_proto" in
12824         ''|0) try='int endhostent_r(struct hostent_data*);'
12825         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12826         esac
12827         case "$endhostent_r_proto" in
12828         ''|0) try='void endhostent_r(struct hostent_data*);'
12829         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12830         esac
12831         case "$endhostent_r_proto" in
12832         ''|0)   d_endhostent_r=undef
12833                 endhostent_r_proto=0
12834                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12835         * )     case "$endhostent_r_proto" in
12836                 REENTRANT_PROTO*) ;;
12837                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12838                 esac
12839                 echo "Prototype: $try" ;;
12840         esac
12841         ;;
12842         *)      case "$usethreads" in
12843                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12844                 esac
12845                 d_endhostent_r=undef
12846                 endhostent_r_proto=0
12847                 ;;
12848         esac
12849         ;;
12850 *)      endhostent_r_proto=0
12851         ;;
12852 esac
12853
12854 : see if endnetent exists
12855 set endnetent d_endnent
12856 eval $inlibc
12857
12858 : see if endnetent_r exists
12859 set endnetent_r d_endnetent_r
12860 eval $inlibc
12861 case "$d_endnetent_r" in
12862 "$define")
12863         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12864         case "$d_endnetent_r_proto:$usethreads" in
12865         ":define")      d_endnetent_r_proto=define
12866                 set d_endnetent_r_proto endnetent_r $hdrs
12867                 eval $hasproto ;;
12868         *)      ;;
12869         esac
12870         case "$d_endnetent_r_proto" in
12871         define)
12872         case "$endnetent_r_proto" in
12873         ''|0) try='int endnetent_r(struct netent_data*);'
12874         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12875         esac
12876         case "$endnetent_r_proto" in
12877         ''|0) try='void endnetent_r(struct netent_data*);'
12878         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12879         esac
12880         case "$endnetent_r_proto" in
12881         ''|0)   d_endnetent_r=undef
12882                 endnetent_r_proto=0
12883                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12884         * )     case "$endnetent_r_proto" in
12885                 REENTRANT_PROTO*) ;;
12886                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12887                 esac
12888                 echo "Prototype: $try" ;;
12889         esac
12890         ;;
12891         *)      case "$usethreads" in
12892                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12893                 esac
12894                 d_endnetent_r=undef
12895                 endnetent_r_proto=0
12896                 ;;
12897         esac
12898         ;;
12899 *)      endnetent_r_proto=0
12900         ;;
12901 esac
12902
12903 : see if endprotoent exists
12904 set endprotoent d_endpent
12905 eval $inlibc
12906
12907 : see if endprotoent_r exists
12908 set endprotoent_r d_endprotoent_r
12909 eval $inlibc
12910 case "$d_endprotoent_r" in
12911 "$define")
12912         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12913         case "$d_endprotoent_r_proto:$usethreads" in
12914         ":define")      d_endprotoent_r_proto=define
12915                 set d_endprotoent_r_proto endprotoent_r $hdrs
12916                 eval $hasproto ;;
12917         *)      ;;
12918         esac
12919         case "$d_endprotoent_r_proto" in
12920         define)
12921         case "$endprotoent_r_proto" in
12922         ''|0) try='int endprotoent_r(struct protoent_data*);'
12923         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12924         esac
12925         case "$endprotoent_r_proto" in
12926         ''|0) try='void endprotoent_r(struct protoent_data*);'
12927         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12928         esac
12929         case "$endprotoent_r_proto" in
12930         ''|0)   d_endprotoent_r=undef
12931                 endprotoent_r_proto=0
12932                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12933         * )     case "$endprotoent_r_proto" in
12934                 REENTRANT_PROTO*) ;;
12935                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12936                 esac
12937                 echo "Prototype: $try" ;;
12938         esac
12939         ;;
12940         *)      case "$usethreads" in
12941                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12942                 esac
12943                 d_endprotoent_r=undef
12944                 endprotoent_r_proto=0
12945                 ;;
12946         esac
12947         ;;
12948 *)      endprotoent_r_proto=0
12949         ;;
12950 esac
12951
12952 : see if endpwent exists
12953 set endpwent d_endpwent
12954 eval $inlibc
12955
12956 : see if this is a pwd.h system
12957 set pwd.h i_pwd
12958 eval $inhdr
12959
12960 case "$i_pwd" in
12961 $define)
12962         xxx=`./findhdr pwd.h`
12963         $cppstdin $cppflags $cppminus < $xxx >$$.h
12964
12965         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12966                 val="$define"
12967         else
12968                 val="$undef"
12969         fi
12970         set d_pwquota
12971         eval $setvar
12972
12973         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12974                 val="$define"
12975         else
12976                 val="$undef"
12977         fi
12978         set d_pwage
12979         eval $setvar
12980
12981         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12982                 val="$define"
12983         else
12984                 val="$undef"
12985         fi
12986         set d_pwchange
12987         eval $setvar
12988
12989         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12990                 val="$define"
12991         else
12992                 val="$undef"
12993         fi
12994         set d_pwclass
12995         eval $setvar
12996
12997         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12998                 val="$define"
12999         else
13000                 val="$undef"
13001         fi
13002         set d_pwexpire
13003         eval $setvar
13004
13005         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13006                 val="$define"
13007         else
13008                 val="$undef"
13009         fi
13010         set d_pwcomment
13011         eval $setvar
13012
13013         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13014                 val="$define"
13015         else
13016                 val="$undef"
13017         fi
13018         set d_pwgecos
13019         eval $setvar
13020
13021         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13022                 val="$define"
13023         else
13024                 val="$undef"
13025         fi
13026         set d_pwpasswd
13027         eval $setvar
13028
13029         $rm -f $$.h
13030         ;;
13031 *)
13032         val="$undef";
13033         set d_pwquota; eval $setvar
13034         set d_pwage; eval $setvar
13035         set d_pwchange; eval $setvar
13036         set d_pwclass; eval $setvar
13037         set d_pwexpire; eval $setvar
13038         set d_pwcomment; eval $setvar
13039         set d_pwgecos; eval $setvar
13040         set d_pwpasswd; eval $setvar
13041         ;;
13042 esac
13043
13044 : see if endpwent_r exists
13045 set endpwent_r d_endpwent_r
13046 eval $inlibc
13047 case "$d_endpwent_r" in
13048 "$define")
13049         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13050         case "$d_endpwent_r_proto:$usethreads" in
13051         ":define")      d_endpwent_r_proto=define
13052                 set d_endpwent_r_proto endpwent_r $hdrs
13053                 eval $hasproto ;;
13054         *)      ;;
13055         esac
13056         case "$d_endpwent_r_proto" in
13057         define)
13058         case "$endpwent_r_proto" in
13059         ''|0) try='int endpwent_r(FILE**);'
13060         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13061         esac
13062         case "$endpwent_r_proto" in
13063         ''|0) try='void endpwent_r(FILE**);'
13064         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13065         esac
13066         case "$endpwent_r_proto" in
13067         ''|0)   d_endpwent_r=undef
13068                 endpwent_r_proto=0
13069                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13070         * )     case "$endpwent_r_proto" in
13071                 REENTRANT_PROTO*) ;;
13072                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13073                 esac
13074                 echo "Prototype: $try" ;;
13075         esac
13076         ;;
13077         *)      case "$usethreads" in
13078                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13079                 esac
13080                 d_endpwent_r=undef
13081                 endpwent_r_proto=0
13082                 ;;
13083         esac
13084         ;;
13085 *)      endpwent_r_proto=0
13086         ;;
13087 esac
13088
13089 : see if endservent exists
13090 set endservent d_endsent
13091 eval $inlibc
13092
13093 : see if endservent_r exists
13094 set endservent_r d_endservent_r
13095 eval $inlibc
13096 case "$d_endservent_r" in
13097 "$define")
13098         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13099         case "$d_endservent_r_proto:$usethreads" in
13100         ":define")      d_endservent_r_proto=define
13101                 set d_endservent_r_proto endservent_r $hdrs
13102                 eval $hasproto ;;
13103         *)      ;;
13104         esac
13105         case "$d_endservent_r_proto" in
13106         define)
13107         case "$endservent_r_proto" in
13108         ''|0) try='int endservent_r(struct servent_data*);'
13109         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13110         esac
13111         case "$endservent_r_proto" in
13112         ''|0) try='void endservent_r(struct servent_data*);'
13113         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13114         esac
13115         case "$endservent_r_proto" in
13116         ''|0)   d_endservent_r=undef
13117                 endservent_r_proto=0
13118                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13119         * )     case "$endservent_r_proto" in
13120                 REENTRANT_PROTO*) ;;
13121                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13122                 esac
13123                 echo "Prototype: $try" ;;
13124         esac
13125         ;;
13126         *)      case "$usethreads" in
13127                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13128                 esac
13129                 d_endservent_r=undef
13130                 endservent_r_proto=0
13131                 ;;
13132         esac
13133         ;;
13134 *)      endservent_r_proto=0
13135         ;;
13136 esac
13137
13138 : Locate the flags for 'open()'
13139 echo " "
13140 $cat >try.c <<EOCP
13141 #include <sys/types.h>
13142 #ifdef I_FCNTL
13143 #include <fcntl.h>
13144 #endif
13145 #ifdef I_SYS_FILE
13146 #include <sys/file.h>
13147 #endif
13148 #$i_stdlib I_STDLIB
13149 #ifdef I_STDLIB
13150 #include <stdlib.h>
13151 #endif
13152 int main() {
13153         if(O_RDONLY);
13154 #ifdef O_TRUNC
13155         exit(0);
13156 #else
13157         exit(1);
13158 #endif
13159 }
13160 EOCP
13161 : check sys/file.h first to get FREAD on Sun
13162 if $test `./findhdr sys/file.h` && \
13163                 set try -DI_SYS_FILE && eval $compile; then
13164         h_sysfile=true;
13165         echo "<sys/file.h> defines the O_* constants..." >&4
13166         if $run ./try; then
13167                 echo "and you have the 3 argument form of open()." >&4
13168                 val="$define"
13169         else
13170                 echo "but not the 3 argument form of open().  Oh, well." >&4
13171                 val="$undef"
13172         fi
13173 elif $test `./findhdr fcntl.h` && \
13174                 set try -DI_FCNTL && eval $compile; then
13175         h_fcntl=true;
13176         echo "<fcntl.h> defines the O_* constants..." >&4
13177         if $run ./try; then
13178                 echo "and you have the 3 argument form of open()." >&4
13179                 val="$define"
13180         else
13181                 echo "but not the 3 argument form of open().  Oh, well." >&4
13182                 val="$undef"
13183         fi
13184 else
13185         val="$undef"
13186         echo "I can't find the O_* constant definitions!  You got problems." >&4
13187 fi
13188 set d_open3
13189 eval $setvar
13190 $rm_try
13191
13192 : see if this is a sys/file.h system
13193 val=''
13194 set sys/file.h val
13195 eval $inhdr
13196
13197 : do we need to include sys/file.h ?
13198 case "$val" in
13199 "$define")
13200         echo " "
13201         if $h_sysfile; then
13202                 val="$define"
13203                 echo "We'll be including <sys/file.h>." >&4
13204         else
13205                 val="$undef"
13206                 echo "We won't be including <sys/file.h>." >&4
13207         fi
13208         ;;
13209 *)
13210         h_sysfile=false
13211         ;;
13212 esac
13213 set i_sysfile
13214 eval $setvar
13215
13216 : see if fcntl.h is there
13217 val=''
13218 set fcntl.h val
13219 eval $inhdr
13220
13221 : see if we can include fcntl.h
13222 case "$val" in
13223 "$define")
13224         echo " "
13225         if $h_fcntl; then
13226                 val="$define"
13227                 echo "We'll be including <fcntl.h>." >&4
13228         else
13229                 val="$undef"
13230                 if $h_sysfile; then
13231         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13232                 else
13233                         echo "We won't be including <fcntl.h>." >&4
13234                 fi
13235         fi
13236         ;;
13237 *)
13238         h_fcntl=false
13239         val="$undef"
13240         ;;
13241 esac
13242 set i_fcntl
13243 eval $setvar
13244
13245 : see if fork exists
13246 set fork d_fork
13247 eval $inlibc
13248
13249 : see if pipe exists
13250 set pipe d_pipe
13251 eval $inlibc
13252
13253 : check for non-blocking I/O stuff
13254 case "$h_sysfile" in
13255 true) echo "#include <sys/file.h>" > head.c;;
13256 *)
13257        case "$h_fcntl" in
13258        true) echo "#include <fcntl.h>" > head.c;;
13259        *) echo "#include <sys/fcntl.h>" > head.c;;
13260        esac
13261        ;;
13262 esac
13263 echo " "
13264 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13265 case "$o_nonblock" in
13266 '')
13267         $cat head.c > try.c
13268         $cat >>try.c <<EOCP
13269 #include <stdio.h>
13270 #$i_stdlib I_STDLIB
13271 #ifdef I_STDLIB
13272 #include <stdlib.h>
13273 #endif
13274 #$i_fcntl I_FCNTL
13275 #ifdef I_FCNTL
13276 #include <fcntl.h>
13277 #endif
13278 int main() {
13279 #ifdef O_NONBLOCK
13280         printf("O_NONBLOCK\n");
13281         exit(0);
13282 #endif
13283 #ifdef O_NDELAY
13284         printf("O_NDELAY\n");
13285         exit(0);
13286 #endif
13287 #ifdef FNDELAY
13288         printf("FNDELAY\n");
13289         exit(0);
13290 #endif
13291         exit(0);
13292 }
13293 EOCP
13294         set try
13295         if eval $compile_ok; then
13296                 o_nonblock=`$run ./try`
13297                 case "$o_nonblock" in
13298                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13299                 *) echo "Seems like we can use $o_nonblock.";;
13300                 esac
13301         else
13302                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13303         fi
13304         ;;
13305 *) echo "Using $hint value $o_nonblock.";;
13306 esac
13307 $rm_try
13308
13309 echo " "
13310 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13311 case "$eagain" in
13312 '')
13313         case "$d_fork:$d_pipe:$d_alarm" in
13314         define:define)
13315         $cat head.c > try.c
13316         $cat >>try.c <<EOCP
13317 #include <errno.h>
13318 #include <sys/types.h>
13319 #include <signal.h>
13320 #include <stdio.h>
13321 #$i_stdlib I_STDLIB
13322 #ifdef I_STDLIB
13323 #include <stdlib.h>
13324 #endif
13325 #$i_fcntl I_FCNTL
13326 #ifdef I_FCNTL
13327 #include <fcntl.h>
13328 #endif
13329 #define MY_O_NONBLOCK $o_nonblock
13330 #ifndef errno  /* XXX need better Configure test */
13331 extern int errno;
13332 #endif
13333 #$i_unistd I_UNISTD
13334 #ifdef I_UNISTD
13335 #include <unistd.h>
13336 #endif
13337 #$i_string I_STRING
13338 #ifdef I_STRING
13339 #include <string.h>
13340 #else
13341 #include <strings.h>
13342 #endif
13343 $signal_t blech(int x) { exit(3); }
13344 EOCP
13345         $cat >> try.c <<'EOCP'
13346 int main()
13347 {
13348         int pd[2];
13349         int pu[2];
13350         char buf[1];
13351         char string[100];
13352         int ret;
13353
13354         ret = pipe(pd); /* Down: child -> parent */
13355         if (ret != 0)
13356                 exit(3);
13357         ret = pipe(pu); /* Up: parent -> child */
13358         if (ret != 0)
13359                 exit(3);
13360         if (0 != fork()) {
13361                 close(pd[1]);   /* Parent reads from pd[0] */
13362                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13363 #ifdef F_SETFL
13364                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13365                         exit(1);
13366 #else
13367                 exit(4);
13368 #endif
13369                 signal(SIGALRM, blech);
13370                 alarm(5);
13371                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13372                         exit(2);
13373                 sprintf(string, "%d\n", ret);
13374                 ret = write(2, string, strlen(string));
13375                 if (ret != strlen(string))
13376                         exit(3);
13377                 alarm(0);
13378 #ifdef EAGAIN
13379                 if (errno == EAGAIN) {
13380                         printf("EAGAIN\n");
13381                         goto ok;
13382                 }
13383 #endif
13384 #ifdef EWOULDBLOCK
13385                 if (errno == EWOULDBLOCK)
13386                         printf("EWOULDBLOCK\n");
13387 #endif
13388         ok:
13389                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13390                 if (ret != 1)
13391                         exit(3);
13392                 sleep(2);                               /* Give it time to close our pipe */
13393                 alarm(5);
13394                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13395                 alarm(0);
13396                 sprintf(string, "%d\n", ret);
13397                 ret = write(4, string, strlen(string));
13398                 if (ret != strlen(string))
13399                         exit(3);
13400                 exit(0);
13401         }
13402
13403         close(pd[0]);                   /* We write to pd[1] */
13404         close(pu[1]);                   /* We read from pu[0] */
13405         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13406         if (ret != 1)
13407                 exit(3);
13408         close(pd[1]);                   /* Pipe pd is now fully closed! */
13409         exit(0);                                /* Bye bye, thank you for playing! */
13410 }
13411 EOCP
13412         set try
13413         if eval $compile_ok; then
13414                 echo "$startsh" >mtry
13415                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13416                 chmod +x mtry
13417                 $run ./mtry >/dev/null 2>&1
13418                 case $? in
13419                 0) eagain=`$cat try.out`;;
13420                 1) echo "Could not perform non-blocking setting!";;
13421                 2) echo "I did a successful read() for something that was not there!";;
13422                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13423                 4) echo "Could not find F_SETFL!";;
13424                 *) echo "Something terribly wrong happened during testing.";;
13425                 esac
13426                 rd_nodata=`$cat try.ret`
13427                 echo "A read() system call with no data present returns $rd_nodata."
13428                 case "$rd_nodata" in
13429                 0|-1) ;;
13430                 *)
13431                         echo "(That's peculiar, fixing that to be -1.)"
13432                         rd_nodata=-1
13433                         ;;
13434                 esac
13435                 case "$eagain" in
13436                 '')
13437                         echo "Forcing errno EAGAIN on read() with no data available."
13438                         eagain=EAGAIN
13439                         ;;
13440                 *)
13441                         echo "Your read() sets errno to $eagain when no data is available."
13442                         ;;
13443                 esac
13444                 status=`$cat try.err`
13445                 case "$status" in
13446                 0) echo "And it correctly returns 0 to signal EOF.";;
13447                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13448                 *) echo "However, your read() returns '$status' on EOF??";;
13449                 esac
13450                 val="$define"
13451                 if test "$status" = "$rd_nodata"; then
13452                         echo "WARNING: you can't distinguish between EOF and no data!"
13453                         val="$undef"
13454                 fi
13455         else
13456                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13457                 eagain=EAGAIN
13458         fi
13459         ;;
13460         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13461                 eagain=EAGAIN
13462                 val="$define"
13463                 ;;
13464         esac
13465         set d_eofnblk
13466         eval $setvar
13467         ;;
13468 *)
13469         echo "Using $hint value $eagain."
13470         echo "Your read() returns $rd_nodata when no data is present."
13471         case "$d_eofnblk" in
13472         "$define") echo "And you can see EOF because read() returns 0.";;
13473         "$undef") echo "But you can't see EOF status from read() returned value.";;
13474         *)
13475                 echo "(Assuming you can't see EOF status from read anyway.)"
13476                 d_eofnblk=$undef
13477                 ;;
13478         esac
13479         ;;
13480 esac
13481 $rm_try head.c mtry
13482
13483 : see if erf exists
13484 set erf d_erf
13485 eval $inlibc
13486
13487 : see if erfc exists
13488 set erfc d_erfc
13489 eval $inlibc
13490
13491 : see if exp2 exists
13492 set exp2 d_exp2
13493 eval $inlibc
13494
13495 : see if expm1 exists
13496 set expm1 d_expm1
13497 eval $inlibc
13498
13499 : see if _ptr and _cnt from stdio act std
13500 echo " "
13501
13502 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13503         echo "(Looks like you have stdio.h from BSD.)"
13504         case "$stdio_ptr" in
13505         '') stdio_ptr='((fp)->_p)'
13506                 ptr_lval=$define
13507                 ;;
13508         *)      ptr_lval=$d_stdio_ptr_lval;;
13509         esac
13510         case "$stdio_cnt" in
13511         '') stdio_cnt='((fp)->_r)'
13512                 cnt_lval=$define
13513                 ;;
13514         *)      cnt_lval=$d_stdio_cnt_lval;;
13515         esac
13516         case "$stdio_base" in
13517         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13518         esac
13519         case "$stdio_bufsiz" in
13520         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13521         esac
13522 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13523         echo "(Looks like you have stdio.h from Linux.)"
13524         case "$stdio_ptr" in
13525         '') stdio_ptr='((fp)->_IO_read_ptr)'
13526                 ptr_lval=$define
13527                 ;;
13528         *)      ptr_lval=$d_stdio_ptr_lval;;
13529         esac
13530         case "$stdio_cnt" in
13531         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13532                 cnt_lval=$undef
13533                 ;;
13534         *)      cnt_lval=$d_stdio_cnt_lval;;
13535         esac
13536         case "$stdio_base" in
13537         '') stdio_base='((fp)->_IO_read_base)';;
13538         esac
13539         case "$stdio_bufsiz" in
13540         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13541         esac
13542 else
13543         case "$stdio_ptr" in
13544         '') stdio_ptr='((fp)->_ptr)'
13545                 ptr_lval=$define
13546                 ;;
13547         *)      ptr_lval=$d_stdio_ptr_lval;;
13548         esac
13549         case "$stdio_cnt" in
13550         '') stdio_cnt='((fp)->_cnt)'
13551                 cnt_lval=$define
13552                 ;;
13553         *)      cnt_lval=$d_stdio_cnt_lval;;
13554         esac
13555         case "$stdio_base" in
13556         '') stdio_base='((fp)->_base)';;
13557         esac
13558         case "$stdio_bufsiz" in
13559         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13560         esac
13561 fi
13562
13563 : test whether _ptr and _cnt really work
13564 echo "Checking how std your stdio is..." >&4
13565 $cat >try.c <<EOP
13566 #include <stdio.h>
13567 #$i_stdlib I_STDLIB
13568 #ifdef I_STDLIB
13569 #include <stdlib.h>
13570 #endif
13571 #define FILE_ptr(fp)    $stdio_ptr
13572 #define FILE_cnt(fp)    $stdio_cnt
13573 int main() {
13574         FILE *fp = fopen("try.c", "r");
13575         char c = getc(fp);
13576         if (
13577                 18 <= FILE_cnt(fp) &&
13578                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13579         )
13580                 exit(0);
13581         exit(1);
13582 }
13583 EOP
13584 val="$undef"
13585 set try
13586 if eval $compile && $to try.c; then
13587         if $run ./try; then
13588                 echo "Your stdio acts pretty std."
13589                 val="$define"
13590         else
13591                 echo "Your stdio isn't very std."
13592         fi
13593 else
13594         echo "Your stdio doesn't appear very std."
13595 fi
13596 $rm_try
13597
13598 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13599 # direct buffer manipulation no longer works.  The Configure tests
13600 # should be changed to correctly detect this, but until then,
13601 # the following check should at least let perl compile and run.
13602 # (This quick fix should be updated before 5.8.1.)
13603 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13604 # A. Dougherty, June 3, 2002.
13605 case "$d_gnulibc" in
13606 $define)
13607         case "$gnulibc_version" in
13608         2.[01]*)  ;;
13609         2.2) ;;
13610         2.2.[0-9]) ;;
13611         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13612                 val="$undef"
13613                 ;;
13614         esac
13615         ;;
13616 esac
13617 set d_stdstdio
13618 eval $setvar
13619
13620 : Can _ptr be used as an lvalue?
13621 case "$d_stdstdio$ptr_lval" in
13622 $define$define) val=$define ;;
13623 *) val=$undef ;;
13624 esac
13625 set d_stdio_ptr_lval
13626 eval $setvar
13627
13628 : Can _cnt be used as an lvalue?
13629 case "$d_stdstdio$cnt_lval" in
13630 $define$define) val=$define ;;
13631 *) val=$undef ;;
13632 esac
13633 set d_stdio_cnt_lval
13634 eval $setvar
13635
13636
13637 : test whether setting _ptr sets _cnt as a side effect
13638 d_stdio_ptr_lval_sets_cnt="$undef"
13639 d_stdio_ptr_lval_nochange_cnt="$undef"
13640 case "$d_stdio_ptr_lval$d_stdstdio" in
13641 $define$define)
13642         echo "Checking to see what happens if we set the stdio ptr..." >&4
13643 $cat >try.c <<EOP
13644 #include <stdio.h>
13645 /* Can we scream? */
13646 /* Eat dust sed :-) */
13647 /* In the buffer space, no one can hear you scream. */
13648 #$i_stdlib I_STDLIB
13649 #ifdef I_STDLIB
13650 #include <stdlib.h>
13651 #endif
13652 #define FILE_ptr(fp)    $stdio_ptr
13653 #define FILE_cnt(fp)    $stdio_cnt
13654 #include <sys/types.h>
13655 int main() {
13656         FILE *fp = fopen("try.c", "r");
13657         int c;
13658         char *ptr;
13659         size_t cnt;
13660         if (!fp) {
13661             puts("Fail even to read");
13662             exit(1);
13663         }
13664         c = getc(fp); /* Read away the first # */
13665         if (c == EOF) {
13666             puts("Fail even to read");
13667             exit(1);
13668         }
13669         if (!(
13670                 18 <= FILE_cnt(fp) &&
13671                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13672         )) {
13673                 puts("Fail even to read");
13674                 exit (1);
13675         }
13676         ptr = (char*) FILE_ptr(fp);
13677         cnt = (size_t)FILE_cnt(fp);
13678
13679         FILE_ptr(fp) += 42;
13680
13681         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13682                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13683                 exit (1);
13684         }
13685         if (FILE_cnt(fp) <= 20) {
13686                 printf ("Fail (<20 chars to test)");
13687                 exit (1);
13688         }
13689         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13690                 puts("Fail compare");
13691                 exit (1);
13692         }
13693         if (cnt == FILE_cnt(fp)) {
13694                 puts("Pass_unchanged");
13695                 exit (0);
13696         }
13697         if (FILE_cnt(fp) == (cnt - 42)) {
13698                 puts("Pass_changed");
13699                 exit (0);
13700         }
13701         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13702         return 1;
13703
13704 }
13705 EOP
13706         set try
13707         if eval $compile && $to try.c; then
13708                 case `$run ./try` in
13709                 Pass_changed)
13710                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13711                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13712                 Pass_unchanged)
13713                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13714                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13715                 Fail*)
13716                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13717                 *)
13718                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13719         esac
13720         else
13721                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13722         fi
13723         $rm_try
13724         ;;
13725 esac
13726
13727 : see if _base is also standard
13728 val="$undef"
13729 case "$d_stdstdio" in
13730 $define)
13731         $cat >try.c <<EOP
13732 #include <stdio.h>
13733 #$i_stdlib I_STDLIB
13734 #ifdef I_STDLIB
13735 #include <stdlib.h>
13736 #endif
13737 #define FILE_base(fp)   $stdio_base
13738 #define FILE_bufsiz(fp) $stdio_bufsiz
13739 int main() {
13740         FILE *fp = fopen("try.c", "r");
13741         char c = getc(fp);
13742         if (
13743                 19 <= FILE_bufsiz(fp) &&
13744                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13745         )
13746                 exit(0);
13747         exit(1);
13748 }
13749 EOP
13750         set try
13751         if eval $compile && $to try.c; then
13752                 if $run ./try; then
13753                         echo "And its _base field acts std."
13754                         val="$define"
13755                 else
13756                         echo "But its _base field isn't std."
13757                 fi
13758         else
13759                 echo "However, it seems to be lacking the _base field."
13760         fi
13761         $rm_try
13762         ;;
13763 esac
13764 set d_stdiobase
13765 eval $setvar
13766
13767 : see if fast_stdio exists
13768 val="$undef"
13769 case "$d_stdstdio:$d_stdio_ptr_lval" in
13770 "$define:$define")
13771         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13772         *$define*)
13773                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13774                 val="$define"
13775                 ;;
13776         esac
13777         ;;
13778 esac
13779 set d_faststdio
13780 eval $setvar
13781
13782
13783
13784 : see if fchdir exists
13785 set fchdir d_fchdir
13786 eval $inlibc
13787
13788 : see if fchmod exists
13789 set fchmod d_fchmod
13790 eval $inlibc
13791
13792 : see if fchown exists
13793 set fchown d_fchown
13794 eval $inlibc
13795
13796 : see if this is an fcntl system
13797 set fcntl d_fcntl
13798 eval $inlibc
13799
13800 : See if fcntl-based locking works.
13801 echo " "
13802 $cat >try.c <<EOCP
13803 #$i_stdlib I_STDLIB
13804 #ifdef I_STDLIB
13805 #include <stdlib.h>
13806 #endif
13807 #include <unistd.h>
13808 #include <fcntl.h>
13809 #include <signal.h>
13810 $signal_t blech(int x) { exit(3); }
13811 int main() {
13812 #if defined(F_SETLK) && defined(F_SETLKW)
13813      struct flock flock;
13814      int retval, fd;
13815      fd = open("try.c", O_RDONLY);
13816      flock.l_type = F_RDLCK;
13817      flock.l_whence = SEEK_SET;
13818      flock.l_start = flock.l_len = 0;
13819      signal(SIGALRM, blech);
13820      alarm(10);
13821      retval = fcntl(fd, F_SETLK, &flock);
13822      close(fd);
13823      (retval < 0 ? exit(2) : exit(0));
13824 #else
13825      exit(2);
13826 #endif
13827 }
13828 EOCP
13829 echo "Checking if fcntl-based file locking works... "
13830 case "$d_fcntl" in
13831 "$define")
13832         set try
13833         if eval $compile_ok; then
13834                 if $run ./try; then
13835                         echo "Yes, it seems to work."
13836                         val="$define"
13837                 else
13838                         echo "Nope, it didn't work."
13839                         val="$undef"
13840                         case "$?" in
13841                         3) $cat >&4 <<EOM
13842 ***
13843 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13844 *** This is (almost) impossible.
13845 *** If your NFS lock daemons are not feeling well, something like
13846 *** this may happen, please investigate.  Cannot continue, aborting.
13847 ***
13848 EOM
13849                                 exit 1
13850                                 ;;
13851                         esac
13852                 fi
13853         else
13854                 echo "I'm unable to compile the test program, so I'll assume not."
13855                 val="$undef"
13856         fi
13857         ;;
13858 *) val="$undef";
13859         echo "Nope, since you don't even have fcntl()."
13860         ;;
13861 esac
13862 set d_fcntl_can_lock
13863 eval $setvar
13864 $rm_try
13865
13866 : check for fd_set items
13867 $cat <<EOM
13868
13869 Checking to see how well your C compiler handles fd_set and friends ...
13870 EOM
13871 $cat >try.c <<EOCP
13872 #$i_stdlib I_STDLIB
13873 #ifdef I_STDLIB
13874 #include <stdlib.h>
13875 #endif
13876 #$i_systime I_SYS_TIME
13877 #$i_sysselct I_SYS_SELECT
13878 #$d_socket HAS_SOCKET
13879 #include <sys/types.h>
13880 #ifdef HAS_SOCKET
13881 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13882 #endif
13883 #ifdef I_SYS_TIME
13884 #include <sys/time.h>
13885 #endif
13886 #ifdef I_SYS_SELECT
13887 #include <sys/select.h>
13888 #endif
13889 int main() {
13890         fd_set fds;
13891
13892 #ifdef TRYBITS
13893         if(fds.fds_bits);
13894 #endif
13895
13896 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13897         exit(0);
13898 #else
13899         exit(1);
13900 #endif
13901 }
13902 EOCP
13903 set try -DTRYBITS
13904 if eval $compile; then
13905         d_fds_bits="$define"
13906         d_fd_set="$define"
13907         echo "Well, your system knows about the normal fd_set typedef..." >&4
13908         if $run ./try; then
13909                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13910                 d_fd_macros="$define"
13911         else
13912                 $cat >&4 <<'EOM'
13913 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13914 EOM
13915                 d_fd_macros="$undef"
13916         fi
13917 else
13918         $cat <<'EOM'
13919 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13920 EOM
13921         set try
13922         if eval $compile; then
13923                 d_fds_bits="$undef"
13924                 d_fd_set="$define"
13925                 echo "Well, your system has some sort of fd_set available..." >&4
13926                 if $run ./try; then
13927                         echo "and you have the normal fd_set macros." >&4
13928                         d_fd_macros="$define"
13929                 else
13930                         $cat <<'EOM'
13931 but not the normal fd_set macros!  Gross!  More work for me...
13932 EOM
13933                         d_fd_macros="$undef"
13934                 fi
13935         else
13936         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13937                 d_fd_set="$undef"
13938                 d_fds_bits="$undef"
13939                 d_fd_macros="$undef"
13940         fi
13941 fi
13942 $rm_try
13943
13944 : see if fdim exists
13945 set fdim d_fdim
13946 eval $inlibc
13947
13948 : see if fegetround exists
13949 set fegetround d_fegetround
13950 eval $inlibc
13951
13952 : see if fgetpos exists
13953 set fgetpos d_fgetpos
13954 eval $inlibc
13955
13956 : see if finite exists
13957 set finite d_finite
13958 eval $inlibc
13959
13960 : see if finitel exists
13961 set finitel d_finitel
13962 eval $inlibc
13963
13964 : see if flock exists
13965 set flock d_flock
13966 eval $inlibc
13967
13968 : see if prototype for flock is available
13969 echo " "
13970 set d_flockproto flock $i_sysfile sys/file.h
13971 eval $hasproto
13972
13973 : see if fma exists
13974 set fma d_fma
13975 eval $inlibc
13976
13977 : see if fmax exists
13978 set fmax d_fmax
13979 eval $inlibc
13980
13981 : see if fmin exists
13982 set fmin d_fmin
13983 eval $inlibc
13984
13985 : see if fp_class exists
13986 set fp_class d_fp_class
13987 eval $inlibc
13988
13989 : see if this is a math.h system
13990 set math.h i_math
13991 eval $inhdr
13992
13993 : check for fpclassify
13994 echo "Checking to see if you have fpclassify..." >&4
13995 $cat >try.c <<EOCP
13996 #$i_math I_MATH
13997 #ifdef I_MATH
13998 #include <math.h>
13999 #endif
14000 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14001 EOCP
14002 set try
14003 if eval $compile; then
14004         val="$define"
14005         echo "You have fpclassify."
14006 else
14007         val="$undef"
14008         echo "You do not have fpclassify."
14009 fi
14010 $rm_try
14011 set d_fpclassify
14012 eval $setvar
14013
14014 : see if fp_classify exists
14015 set fp_classify d_fp_classify
14016 eval $inlibc
14017
14018 : see if fp_classl exists
14019 set fp_classl d_fp_classl
14020 eval $inlibc
14021
14022 : see if pathconf exists
14023 set pathconf d_pathconf
14024 eval $inlibc
14025
14026 : see if fpathconf exists
14027 set fpathconf d_fpathconf
14028 eval $inlibc
14029
14030 : see if fpclass exists
14031 set fpclass d_fpclass
14032 eval $inlibc
14033
14034 : see if fpclassl exists
14035 set fpclassl d_fpclassl
14036 eval $inlibc
14037
14038 : see if fpgetround exists
14039 set fpgetround d_fpgetround
14040 eval $inlibc
14041
14042 : check for fpos64_t
14043 echo " "
14044 echo "Checking to see if you have fpos64_t..." >&4
14045 $cat >try.c <<EOCP
14046 #include <stdio.h>
14047 int main() { fpos64_t x = 7; }
14048 EOCP
14049 set try
14050 if eval $compile; then
14051         val="$define"
14052         echo "You have fpos64_t."
14053 else
14054         val="$undef"
14055         echo "You do not have fpos64_t."
14056         case "$fpossize" in
14057         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14058         esac
14059 fi
14060 $rm_try
14061 set d_fpos64_t
14062 eval $setvar
14063
14064 : see if frexpl exists
14065 set frexpl d_frexpl
14066 eval $inlibc
14067
14068 : see if this is a sys/param system
14069 set sys/param.h i_sysparam
14070 eval $inhdr
14071
14072 : see if fseeko exists
14073 set fseeko d_fseeko
14074 eval $inlibc
14075 case "$longsize" in
14076 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14077 esac
14078
14079 : see if fsetpos exists
14080 set fsetpos d_fsetpos
14081 eval $inlibc
14082
14083 : see if fsync exists
14084 set fsync d_fsync
14085 eval $inlibc
14086
14087 : see if ftello exists
14088 set ftello d_ftello
14089 eval $inlibc
14090 case "$longsize" in
14091 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14092 esac
14093
14094 : check for a working futimes
14095 d_futimes="$undef"
14096 echo " "
14097 echo "Checking if you have a working futimes()" >&4
14098 $cat >try.c <<EOCP
14099 #include <stdio.h>
14100 #include <sys/time.h>
14101 #include <errno.h>
14102 #include <fcntl.h>
14103
14104 int main ()
14105 {
14106     int fd, rv;
14107     fd = open ("try.c", O_RDWR);
14108     if (-1 == fd) exit (1);
14109     rv = futimes (fd, NULL);
14110     exit (rv == -1 ? errno : 0);
14111 }
14112 EOCP
14113 set try
14114 if eval $compile; then
14115     `$run ./try`
14116     rc=$?
14117     case "$rc" in
14118         0)  echo "Yes, you have" >&4
14119             d_futimes="$define"
14120             ;;
14121         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14122             ;;
14123     esac
14124 else
14125     echo "No, it does not (probably harmless)" >&4
14126 fi
14127 $rm_try
14128
14129 : see if ndbm.h is available
14130 set ndbm.h i_ndbm
14131 eval $inhdr
14132 : Compatibility location for RedHat 7.1
14133 set gdbm/ndbm.h i_gdbmndbm
14134 eval $inhdr
14135 : Compatibility location for Debian 4.0
14136 set gdbm-ndbm.h i_gdbm_ndbm
14137 eval $inhdr
14138
14139 val="$undef"
14140 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14141         : see if dbm_open exists
14142         set dbm_open d_dbm_open
14143         eval $inlibc
14144         case "$d_dbm_open" in
14145         $undef)
14146                 i_ndbm="$undef"
14147                 i_gdbmndbm="$undef"
14148                 i_gdbm_ndbm="$undef"
14149                 echo "We won't be including <ndbm.h>"
14150                 val="$undef"
14151                 ;;
14152         *) val="$define"
14153            ;;
14154         esac
14155 fi
14156 set d_ndbm
14157 eval $setvar
14158
14159 ndbm_hdr_protochk='name=$1; hdr=$2;
14160 eval "ihdr=\$""i_$name";
14161 val="$undef";
14162 if $test "$ihdr" = "$define"; then
14163         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14164         case "$d_cplusplus" in
14165         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14166         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14167         esac;
14168         case "$val" in
14169         $define) $echo "Your <$hdr> seems to have prototypes";;
14170         *) $echo "Your <$hdr> does not seem to have prototypes";;
14171         esac;
14172 fi;
14173 set "d_${name}_h_uses_prototypes";
14174 eval $setvar'
14175
14176 set ndbm ndbm.h
14177 eval $ndbm_hdr_protochk
14178 set gdbmndbm gdbm/ndbm.h
14179 eval $ndbm_hdr_protochk
14180 set gdbm_ndbm gdbm-ndbm.h
14181 eval $ndbm_hdr_protochk
14182
14183 : see if getaddrinfo exists
14184 set getaddrinfo d_getaddrinfo
14185 eval $inlibc
14186
14187 : see if getcwd exists
14188 set getcwd d_getcwd
14189 eval $inlibc
14190
14191 : see if getespwnam exists
14192 set getespwnam d_getespwnam
14193 eval $inlibc
14194
14195 : see if getgrent exists
14196 set getgrent d_getgrent
14197 eval $inlibc
14198
14199 : see if getgrent_r exists
14200 set getgrent_r d_getgrent_r
14201 eval $inlibc
14202 case "$d_getgrent_r" in
14203 "$define")
14204         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14205         case "$d_getgrent_r_proto:$usethreads" in
14206         ":define")      d_getgrent_r_proto=define
14207                 set d_getgrent_r_proto getgrent_r $hdrs
14208                 eval $hasproto ;;
14209         *)      ;;
14210         esac
14211         case "$d_getgrent_r_proto" in
14212         define)
14213         case "$getgrent_r_proto" in
14214         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14215         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14216         esac
14217         case "$getgrent_r_proto" in
14218         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14219         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14220         esac
14221         case "$getgrent_r_proto" in
14222         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14223         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14224         esac
14225         case "$getgrent_r_proto" in
14226         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14227         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14228         esac
14229         case "$getgrent_r_proto" in
14230         ''|0) try='int getgrent_r(struct group*, char*, int);'
14231         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14232         esac
14233         case "$getgrent_r_proto" in
14234         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14235         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14236         esac
14237         case "$getgrent_r_proto" in
14238         ''|0)   d_getgrent_r=undef
14239                 getgrent_r_proto=0
14240                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14241         * )     case "$getgrent_r_proto" in
14242                 REENTRANT_PROTO*) ;;
14243                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14244                 esac
14245                 echo "Prototype: $try" ;;
14246         esac
14247         ;;
14248         *)      case "$usethreads" in
14249                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14250                 esac
14251                 d_getgrent_r=undef
14252                 getgrent_r_proto=0
14253                 ;;
14254         esac
14255         ;;
14256 *)      getgrent_r_proto=0
14257         ;;
14258 esac
14259
14260 : see if getgrgid_r exists
14261 set getgrgid_r d_getgrgid_r
14262 eval $inlibc
14263 case "$d_getgrgid_r" in
14264 "$define")
14265         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14266         case "$d_getgrgid_r_proto:$usethreads" in
14267         ":define")      d_getgrgid_r_proto=define
14268                 set d_getgrgid_r_proto getgrgid_r $hdrs
14269                 eval $hasproto ;;
14270         *)      ;;
14271         esac
14272         case "$d_getgrgid_r_proto" in
14273         define)
14274         case "$getgrgid_r_proto" in
14275         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14276         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14277         esac
14278         case "$getgrgid_r_proto" in
14279         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14280         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14281         esac
14282         case "$getgrgid_r_proto" in
14283         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14284         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14285         esac
14286         case "$getgrgid_r_proto" in
14287         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14288         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14289         esac
14290         case "$getgrgid_r_proto" in
14291         ''|0)   d_getgrgid_r=undef
14292                 getgrgid_r_proto=0
14293                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14294         * )     case "$getgrgid_r_proto" in
14295                 REENTRANT_PROTO*) ;;
14296                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14297                 esac
14298                 echo "Prototype: $try" ;;
14299         esac
14300         ;;
14301         *)      case "$usethreads" in
14302                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14303                 esac
14304                 d_getgrgid_r=undef
14305                 getgrgid_r_proto=0
14306                 ;;
14307         esac
14308         ;;
14309 *)      getgrgid_r_proto=0
14310         ;;
14311 esac
14312
14313 : see if getgrnam_r exists
14314 set getgrnam_r d_getgrnam_r
14315 eval $inlibc
14316 case "$d_getgrnam_r" in
14317 "$define")
14318         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14319         case "$d_getgrnam_r_proto:$usethreads" in
14320         ":define")      d_getgrnam_r_proto=define
14321                 set d_getgrnam_r_proto getgrnam_r $hdrs
14322                 eval $hasproto ;;
14323         *)      ;;
14324         esac
14325         case "$d_getgrnam_r_proto" in
14326         define)
14327         case "$getgrnam_r_proto" in
14328         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14329         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14330         esac
14331         case "$getgrnam_r_proto" in
14332         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14333         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14334         esac
14335         case "$getgrnam_r_proto" in
14336         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14337         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14338         esac
14339         case "$getgrnam_r_proto" in
14340         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14341         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14342         esac
14343         case "$getgrnam_r_proto" in
14344         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14345         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14346         esac
14347         case "$getgrnam_r_proto" in
14348         ''|0)   d_getgrnam_r=undef
14349                 getgrnam_r_proto=0
14350                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14351         * )     case "$getgrnam_r_proto" in
14352                 REENTRANT_PROTO*) ;;
14353                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14354                 esac
14355                 echo "Prototype: $try" ;;
14356         esac
14357         ;;
14358         *)      case "$usethreads" in
14359                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14360                 esac
14361                 d_getgrnam_r=undef
14362                 getgrnam_r_proto=0
14363                 ;;
14364         esac
14365         ;;
14366 *)      getgrnam_r_proto=0
14367         ;;
14368 esac
14369
14370 : see if gethostbyaddr exists
14371 set gethostbyaddr d_gethbyaddr
14372 eval $inlibc
14373
14374 : see if gethostbyname exists
14375 set gethostbyname d_gethbyname
14376 eval $inlibc
14377
14378 : see if gethostent exists
14379 set gethostent d_gethent
14380 eval $inlibc
14381
14382 : see how we will look up host name
14383 echo " "
14384 call=''
14385 if set gethostname val -f d_gethname; eval $csym; $val; then
14386         echo 'gethostname() found.' >&4
14387         d_gethname="$define"
14388         call=gethostname
14389 fi
14390 if set uname val -f d_uname; eval $csym; $val; then
14391         if ./xenix; then
14392                 $cat <<'EOM'
14393 uname() was found, but you're running xenix, and older versions of xenix
14394 have a broken uname(). If you don't really know whether your xenix is old
14395 enough to have a broken system call, use the default answer.
14396
14397 EOM
14398                 dflt=y
14399                 case "$d_uname" in
14400                 "$define") dflt=n;;
14401                 esac
14402                 rp='Is your uname() broken?'
14403                 . ./myread
14404                 case "$ans" in
14405                 n*) d_uname="$define"; call=uname;;
14406                 esac
14407         else
14408                 echo 'uname() found.' >&4
14409                 d_uname="$define"
14410                 case "$call" in
14411                 '') call=uname ;;
14412                 esac
14413         fi
14414 fi
14415 case "$d_gethname" in
14416 '') d_gethname="$undef";;
14417 esac
14418 case "$d_uname" in
14419 '') d_uname="$undef";;
14420 esac
14421 case "$d_uname$d_gethname" in
14422 *define*)
14423         dflt=n
14424         cat <<EOM
14425
14426 Every now and then someone has a $call() that lies about the hostname
14427 but can't be fixed for political or economic reasons.  If you wish, I can
14428 pretend $call() isn't there and maybe compute hostname at run-time
14429 thanks to the '$phostname' command.
14430
14431 EOM
14432         rp="Shall I ignore $call() from now on?"
14433         . ./myread
14434         case "$ans" in
14435         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14436         esac;;
14437 esac
14438 case "$phostname" in
14439 '') aphostname='';;
14440 *) case "$aphostname" in
14441         /*) ;;
14442         *) set X $phostname
14443                 shift
14444                 file=$1
14445                 shift
14446                 file=`./loc $file $file $pth`
14447                 aphostname=`echo $file $*`
14448                 ;;
14449         esac
14450         ;;
14451 esac
14452 case "$d_uname$d_gethname" in
14453 *define*) ;;
14454 *)
14455         case "$phostname" in
14456         '')
14457                 echo "There will be no way for $package to get your hostname." >&4;;
14458         *)
14459         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14460                 ;;
14461         esac;;
14462 esac
14463 case "$d_phostname" in
14464 '') d_phostname="$undef";;
14465 esac
14466
14467 : see if gethostbyaddr_r exists
14468 set gethostbyaddr_r d_gethostbyaddr_r
14469 eval $inlibc
14470 case "$d_gethostbyaddr_r" in
14471 "$define")
14472         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14473         case "$d_gethostbyaddr_r_proto:$usethreads" in
14474         ":define")      d_gethostbyaddr_r_proto=define
14475                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14476                 eval $hasproto ;;
14477         *)      ;;
14478         esac
14479         case "$d_gethostbyaddr_r_proto" in
14480         define)
14481         case "$gethostbyaddr_r_proto" in
14482         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14483         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14484         esac
14485         case "$gethostbyaddr_r_proto" in
14486         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14487         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14488         esac
14489         case "$gethostbyaddr_r_proto" in
14490         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14491         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14492         esac
14493         case "$gethostbyaddr_r_proto" in
14494         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14495         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14496         esac
14497         case "$gethostbyaddr_r_proto" in
14498         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14499         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14500         esac
14501         case "$gethostbyaddr_r_proto" in
14502         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14503         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14504         esac
14505         case "$gethostbyaddr_r_proto" in
14506         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14507         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14508         esac
14509         case "$gethostbyaddr_r_proto" in
14510         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14511         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14512         esac
14513         case "$gethostbyaddr_r_proto" in
14514         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14515         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14516         esac
14517         case "$gethostbyaddr_r_proto" in
14518         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14519         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14520         esac
14521         case "$gethostbyaddr_r_proto" in
14522         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14523         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14524         esac
14525         case "$gethostbyaddr_r_proto" in
14526         ''|0)   d_gethostbyaddr_r=undef
14527                 gethostbyaddr_r_proto=0
14528                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14529         * )     case "$gethostbyaddr_r_proto" in
14530                 REENTRANT_PROTO*) ;;
14531                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14532                 esac
14533                 echo "Prototype: $try" ;;
14534         esac
14535         ;;
14536         *)      case "$usethreads" in
14537                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14538                 esac
14539                 d_gethostbyaddr_r=undef
14540                 gethostbyaddr_r_proto=0
14541                 ;;
14542         esac
14543         ;;
14544 *)      gethostbyaddr_r_proto=0
14545         ;;
14546 esac
14547
14548 : see if gethostbyname_r exists
14549 set gethostbyname_r d_gethostbyname_r
14550 eval $inlibc
14551 case "$d_gethostbyname_r" in
14552 "$define")
14553         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14554         case "$d_gethostbyname_r_proto:$usethreads" in
14555         ":define")      d_gethostbyname_r_proto=define
14556                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14557                 eval $hasproto ;;
14558         *)      ;;
14559         esac
14560         case "$d_gethostbyname_r_proto" in
14561         define)
14562         case "$gethostbyname_r_proto" in
14563         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14564         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14565         esac
14566         case "$gethostbyname_r_proto" in
14567         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14568         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14569         esac
14570         case "$gethostbyname_r_proto" in
14571         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14572         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14573         esac
14574         case "$gethostbyname_r_proto" in
14575         ''|0)   d_gethostbyname_r=undef
14576                 gethostbyname_r_proto=0
14577                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14578         * )     case "$gethostbyname_r_proto" in
14579                 REENTRANT_PROTO*) ;;
14580                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14581                 esac
14582                 echo "Prototype: $try" ;;
14583         esac
14584         ;;
14585         *)      case "$usethreads" in
14586                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14587                 esac
14588                 d_gethostbyname_r=undef
14589                 gethostbyname_r_proto=0
14590                 ;;
14591         esac
14592         ;;
14593 *)      gethostbyname_r_proto=0
14594         ;;
14595 esac
14596
14597 : see if gethostent_r exists
14598 set gethostent_r d_gethostent_r
14599 eval $inlibc
14600 case "$d_gethostent_r" in
14601 "$define")
14602         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14603         case "$d_gethostent_r_proto:$usethreads" in
14604         ":define")      d_gethostent_r_proto=define
14605                 set d_gethostent_r_proto gethostent_r $hdrs
14606                 eval $hasproto ;;
14607         *)      ;;
14608         esac
14609         case "$d_gethostent_r_proto" in
14610         define)
14611         case "$gethostent_r_proto" in
14612         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14613         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14614         esac
14615         case "$gethostent_r_proto" in
14616         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14617         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14618         esac
14619         case "$gethostent_r_proto" in
14620         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14621         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14622         esac
14623         case "$gethostent_r_proto" in
14624         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14625         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14626         esac
14627         case "$gethostent_r_proto" in
14628         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14629         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14630         esac
14631         case "$gethostent_r_proto" in
14632         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14633         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14634         esac
14635         case "$gethostent_r_proto" in
14636         ''|0)   d_gethostent_r=undef
14637                 gethostent_r_proto=0
14638                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14639         * )     case "$gethostent_r_proto" in
14640                 REENTRANT_PROTO*) ;;
14641                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14642                 esac
14643                 echo "Prototype: $try" ;;
14644         esac
14645         ;;
14646         *)      case "$usethreads" in
14647                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14648                 esac
14649                 d_gethostent_r=undef
14650                 gethostent_r_proto=0
14651                 ;;
14652         esac
14653         ;;
14654 *)      gethostent_r_proto=0
14655         ;;
14656 esac
14657
14658 : see if prototypes for various gethostxxx netdb.h functions are available
14659 echo " "
14660 set d_gethostprotos gethostent $i_netdb netdb.h
14661 eval $hasproto
14662
14663 : see if getitimer exists
14664 set getitimer d_getitimer
14665 eval $inlibc
14666
14667 : see if getlogin exists
14668 set getlogin d_getlogin
14669 eval $inlibc
14670
14671 : see if getlogin_r exists
14672 set getlogin_r d_getlogin_r
14673 eval $inlibc
14674 case "$d_getlogin_r" in
14675 "$define")
14676         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14677         case "$d_getlogin_r_proto:$usethreads" in
14678         ":define")      d_getlogin_r_proto=define
14679                 set d_getlogin_r_proto getlogin_r $hdrs
14680                 eval $hasproto ;;
14681         *)      ;;
14682         esac
14683         case "$d_getlogin_r_proto" in
14684         define)
14685         case "$getlogin_r_proto" in
14686         ''|0) try='int getlogin_r(char*, size_t);'
14687         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14688         esac
14689         case "$getlogin_r_proto" in
14690         ''|0) try='int getlogin_r(char*, int);'
14691         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14692         esac
14693         case "$getlogin_r_proto" in
14694         ''|0) try='char* getlogin_r(char*, size_t);'
14695         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14696         esac
14697         case "$getlogin_r_proto" in
14698         ''|0) try='char* getlogin_r(char*, int);'
14699         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14700         esac
14701         case "$getlogin_r_proto" in
14702         ''|0)   d_getlogin_r=undef
14703                 getlogin_r_proto=0
14704                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14705         * )     case "$getlogin_r_proto" in
14706                 REENTRANT_PROTO*) ;;
14707                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14708                 esac
14709                 echo "Prototype: $try" ;;
14710         esac
14711         ;;
14712         *)      case "$usethreads" in
14713                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14714                 esac
14715                 d_getlogin_r=undef
14716                 getlogin_r_proto=0
14717                 ;;
14718         esac
14719         ;;
14720 *)      getlogin_r_proto=0
14721         ;;
14722 esac
14723
14724 : see if getnameinfo exists
14725 set getnameinfo d_getnameinfo
14726 eval $inlibc
14727
14728 : see if getnetbyaddr exists
14729 set getnetbyaddr d_getnbyaddr
14730 eval $inlibc
14731
14732 : see if getnetbyname exists
14733 set getnetbyname d_getnbyname
14734 eval $inlibc
14735
14736 : see if getnetent exists
14737 set getnetent d_getnent
14738 eval $inlibc
14739
14740 : see if getnetbyaddr_r exists
14741 set getnetbyaddr_r d_getnetbyaddr_r
14742 eval $inlibc
14743 case "$d_getnetbyaddr_r" in
14744 "$define")
14745         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14746         case "$d_getnetbyaddr_r_proto:$usethreads" in
14747         ":define")      d_getnetbyaddr_r_proto=define
14748                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14749                 eval $hasproto ;;
14750         *)      ;;
14751         esac
14752         case "$d_getnetbyaddr_r_proto" in
14753         define)
14754         case "$getnetbyaddr_r_proto" in
14755         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14756         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14757         esac
14758         case "$getnetbyaddr_r_proto" in
14759         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14760         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14761         esac
14762         case "$getnetbyaddr_r_proto" in
14763         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14764         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14765         esac
14766         case "$getnetbyaddr_r_proto" in
14767         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14768         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14769         esac
14770         case "$getnetbyaddr_r_proto" in
14771         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14772         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14773         esac
14774         case "$getnetbyaddr_r_proto" in
14775         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14776         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14777         esac
14778         case "$getnetbyaddr_r_proto" in
14779         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14780         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14781         esac
14782         case "$getnetbyaddr_r_proto" in
14783         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14784         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14785         esac
14786         case "$getnetbyaddr_r_proto" in
14787         ''|0)   d_getnetbyaddr_r=undef
14788                 getnetbyaddr_r_proto=0
14789                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14790         * )     case "$getnetbyaddr_r_proto" in
14791                 REENTRANT_PROTO*) ;;
14792                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14793                 esac
14794                 echo "Prototype: $try" ;;
14795         esac
14796         ;;
14797         *)      case "$usethreads" in
14798                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14799                 esac
14800                 d_getnetbyaddr_r=undef
14801                 getnetbyaddr_r_proto=0
14802                 ;;
14803         esac
14804         ;;
14805 *)      getnetbyaddr_r_proto=0
14806         ;;
14807 esac
14808
14809 : see if getnetbyname_r exists
14810 set getnetbyname_r d_getnetbyname_r
14811 eval $inlibc
14812 case "$d_getnetbyname_r" in
14813 "$define")
14814         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14815         case "$d_getnetbyname_r_proto:$usethreads" in
14816         ":define")      d_getnetbyname_r_proto=define
14817                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14818                 eval $hasproto ;;
14819         *)      ;;
14820         esac
14821         case "$d_getnetbyname_r_proto" in
14822         define)
14823         case "$getnetbyname_r_proto" in
14824         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14825         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14826         esac
14827         case "$getnetbyname_r_proto" in
14828         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14829         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14830         esac
14831         case "$getnetbyname_r_proto" in
14832         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14833         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14834         esac
14835         case "$getnetbyname_r_proto" in
14836         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14837         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14838         esac
14839         case "$getnetbyname_r_proto" in
14840         ''|0)   d_getnetbyname_r=undef
14841                 getnetbyname_r_proto=0
14842                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14843         * )     case "$getnetbyname_r_proto" in
14844                 REENTRANT_PROTO*) ;;
14845                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14846                 esac
14847                 echo "Prototype: $try" ;;
14848         esac
14849         ;;
14850         *)      case "$usethreads" in
14851                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14852                 esac
14853                 d_getnetbyname_r=undef
14854                 getnetbyname_r_proto=0
14855                 ;;
14856         esac
14857         ;;
14858 *)      getnetbyname_r_proto=0
14859         ;;
14860 esac
14861
14862 : see if getnetent_r exists
14863 set getnetent_r d_getnetent_r
14864 eval $inlibc
14865 case "$d_getnetent_r" in
14866 "$define")
14867         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14868         case "$d_getnetent_r_proto:$usethreads" in
14869         ":define")      d_getnetent_r_proto=define
14870                 set d_getnetent_r_proto getnetent_r $hdrs
14871                 eval $hasproto ;;
14872         *)      ;;
14873         esac
14874         case "$d_getnetent_r_proto" in
14875         define)
14876         case "$getnetent_r_proto" in
14877         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14878         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14879         esac
14880         case "$getnetent_r_proto" in
14881         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14882         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14883         esac
14884         case "$getnetent_r_proto" in
14885         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14886         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14887         esac
14888         case "$getnetent_r_proto" in
14889         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14890         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14891         esac
14892         case "$getnetent_r_proto" in
14893         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14894         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14895         esac
14896         case "$getnetent_r_proto" in
14897         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14898         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14899         esac
14900         case "$getnetent_r_proto" in
14901         ''|0)   d_getnetent_r=undef
14902                 getnetent_r_proto=0
14903                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14904         * )     case "$getnetent_r_proto" in
14905                 REENTRANT_PROTO*) ;;
14906                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14907                 esac
14908                 echo "Prototype: $try" ;;
14909         esac
14910         ;;
14911         *)      case "$usethreads" in
14912                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14913                 esac
14914                 d_getnetent_r=undef
14915                 getnetent_r_proto=0
14916                 ;;
14917         esac
14918         ;;
14919 *)      getnetent_r_proto=0
14920         ;;
14921 esac
14922
14923 : see if prototypes for various getnetxxx netdb.h functions are available
14924 echo " "
14925 set d_getnetprotos getnetent $i_netdb netdb.h
14926 eval $hasproto
14927
14928 : see if getpagesize exists
14929 set getpagesize d_getpagsz
14930 eval $inlibc
14931
14932 : Optional checks for getprotobyname and getprotobynumber
14933
14934 : see if getprotobyname exists
14935 set getprotobyname d_getpbyname
14936 eval $inlibc
14937
14938 : see if getprotobynumber exists
14939 set getprotobynumber d_getpbynumber
14940 eval $inlibc
14941
14942 : see if getprotoent exists
14943 set getprotoent d_getpent
14944 eval $inlibc
14945
14946 : see if getpgid exists
14947 set getpgid d_getpgid
14948 eval $inlibc
14949
14950 : see if getpgrp2 exists
14951 set getpgrp2 d_getpgrp2
14952 eval $inlibc
14953
14954 : see if getppid exists
14955 set getppid d_getppid
14956 eval $inlibc
14957
14958 : see if getpriority exists
14959 set getpriority d_getprior
14960 eval $inlibc
14961
14962 : see if getprotobyname_r exists
14963 set getprotobyname_r d_getprotobyname_r
14964 eval $inlibc
14965 case "$d_getprotobyname_r" in
14966 "$define")
14967         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14968         case "$d_getprotobyname_r_proto:$usethreads" in
14969         ":define")      d_getprotobyname_r_proto=define
14970                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14971                 eval $hasproto ;;
14972         *)      ;;
14973         esac
14974         case "$d_getprotobyname_r_proto" in
14975         define)
14976         case "$getprotobyname_r_proto" in
14977         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14978         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14979         esac
14980         case "$getprotobyname_r_proto" in
14981         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14982         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14983         esac
14984         case "$getprotobyname_r_proto" in
14985         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14986         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14987         esac
14988         case "$getprotobyname_r_proto" in
14989         ''|0)   d_getprotobyname_r=undef
14990                 getprotobyname_r_proto=0
14991                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14992         * )     case "$getprotobyname_r_proto" in
14993                 REENTRANT_PROTO*) ;;
14994                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14995                 esac
14996                 echo "Prototype: $try" ;;
14997         esac
14998         ;;
14999         *)      case "$usethreads" in
15000                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15001                 esac
15002                 d_getprotobyname_r=undef
15003                 getprotobyname_r_proto=0
15004                 ;;
15005         esac
15006         ;;
15007 *)      getprotobyname_r_proto=0
15008         ;;
15009 esac
15010
15011 : see if getprotobynumber_r exists
15012 set getprotobynumber_r d_getprotobynumber_r
15013 eval $inlibc
15014 case "$d_getprotobynumber_r" in
15015 "$define")
15016         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15017         case "$d_getprotobynumber_r_proto:$usethreads" in
15018         ":define")      d_getprotobynumber_r_proto=define
15019                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15020                 eval $hasproto ;;
15021         *)      ;;
15022         esac
15023         case "$d_getprotobynumber_r_proto" in
15024         define)
15025         case "$getprotobynumber_r_proto" in
15026         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15027         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15028         esac
15029         case "$getprotobynumber_r_proto" in
15030         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15031         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15032         esac
15033         case "$getprotobynumber_r_proto" in
15034         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15035         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15036         esac
15037         case "$getprotobynumber_r_proto" in
15038         ''|0)   d_getprotobynumber_r=undef
15039                 getprotobynumber_r_proto=0
15040                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15041         * )     case "$getprotobynumber_r_proto" in
15042                 REENTRANT_PROTO*) ;;
15043                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15044                 esac
15045                 echo "Prototype: $try" ;;
15046         esac
15047         ;;
15048         *)      case "$usethreads" in
15049                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15050                 esac
15051                 d_getprotobynumber_r=undef
15052                 getprotobynumber_r_proto=0
15053                 ;;
15054         esac
15055         ;;
15056 *)      getprotobynumber_r_proto=0
15057         ;;
15058 esac
15059
15060 : see if getprotoent_r exists
15061 set getprotoent_r d_getprotoent_r
15062 eval $inlibc
15063 case "$d_getprotoent_r" in
15064 "$define")
15065         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15066         case "$d_getprotoent_r_proto:$usethreads" in
15067         ":define")      d_getprotoent_r_proto=define
15068                 set d_getprotoent_r_proto getprotoent_r $hdrs
15069                 eval $hasproto ;;
15070         *)      ;;
15071         esac
15072         case "$d_getprotoent_r_proto" in
15073         define)
15074         case "$getprotoent_r_proto" in
15075         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15076         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15077         esac
15078         case "$getprotoent_r_proto" in
15079         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15080         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15081         esac
15082         case "$getprotoent_r_proto" in
15083         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15084         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15085         esac
15086         case "$getprotoent_r_proto" in
15087         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15088         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15089         esac
15090         case "$getprotoent_r_proto" in
15091         ''|0)   d_getprotoent_r=undef
15092                 getprotoent_r_proto=0
15093                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15094         * )     case "$getprotoent_r_proto" in
15095                 REENTRANT_PROTO*) ;;
15096                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15097                 esac
15098                 echo "Prototype: $try" ;;
15099         esac
15100         ;;
15101         *)      case "$usethreads" in
15102                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15103                 esac
15104                 d_getprotoent_r=undef
15105                 getprotoent_r_proto=0
15106                 ;;
15107         esac
15108         ;;
15109 *)      getprotoent_r_proto=0
15110         ;;
15111 esac
15112
15113 : see if prototypes for various getprotoxxx netdb.h functions are available
15114 echo " "
15115 set d_getprotoprotos getprotoent $i_netdb netdb.h
15116 eval $hasproto
15117
15118 : see if getprpwnam exists
15119 set getprpwnam d_getprpwnam
15120 eval $inlibc
15121
15122 : see if getpwent exists
15123 set getpwent d_getpwent
15124 eval $inlibc
15125
15126 : see if getpwent_r exists
15127 set getpwent_r d_getpwent_r
15128 eval $inlibc
15129 case "$d_getpwent_r" in
15130 "$define")
15131         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15132         case "$d_getpwent_r_proto:$usethreads" in
15133         ":define")      d_getpwent_r_proto=define
15134                 set d_getpwent_r_proto getpwent_r $hdrs
15135                 eval $hasproto ;;
15136         *)      ;;
15137         esac
15138         case "$d_getpwent_r_proto" in
15139         define)
15140         case "$getpwent_r_proto" in
15141         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15142         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15143         esac
15144         case "$getpwent_r_proto" in
15145         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15146         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15147         esac
15148         case "$getpwent_r_proto" in
15149         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15150         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15151         esac
15152         case "$getpwent_r_proto" in
15153         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15154         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15155         esac
15156         case "$getpwent_r_proto" in
15157         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15158         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15159         esac
15160         case "$getpwent_r_proto" in
15161         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15162         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15163         esac
15164         case "$getpwent_r_proto" in
15165         ''|0)   d_getpwent_r=undef
15166                 getpwent_r_proto=0
15167                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15168         * )     case "$getpwent_r_proto" in
15169                 REENTRANT_PROTO*) ;;
15170                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15171                 esac
15172                 echo "Prototype: $try" ;;
15173         esac
15174         ;;
15175         *)      case "$usethreads" in
15176                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15177                 esac
15178                 d_getpwent_r=undef
15179                 getpwent_r_proto=0
15180                 ;;
15181         esac
15182         ;;
15183 *)      getpwent_r_proto=0
15184         ;;
15185 esac
15186
15187 : see if getpwnam_r exists
15188 set getpwnam_r d_getpwnam_r
15189 eval $inlibc
15190 case "$d_getpwnam_r" in
15191 "$define")
15192         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15193         case "$d_getpwnam_r_proto:$usethreads" in
15194         ":define")      d_getpwnam_r_proto=define
15195                 set d_getpwnam_r_proto getpwnam_r $hdrs
15196                 eval $hasproto ;;
15197         *)      ;;
15198         esac
15199         case "$d_getpwnam_r_proto" in
15200         define)
15201         case "$getpwnam_r_proto" in
15202         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15203         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15204         esac
15205         case "$getpwnam_r_proto" in
15206         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15207         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15208         esac
15209         case "$getpwnam_r_proto" in
15210         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15211         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15212         esac
15213         case "$getpwnam_r_proto" in
15214         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15215         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15216         esac
15217         case "$getpwnam_r_proto" in
15218         ''|0)   d_getpwnam_r=undef
15219                 getpwnam_r_proto=0
15220                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15221         * )     case "$getpwnam_r_proto" in
15222                 REENTRANT_PROTO*) ;;
15223                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15224                 esac
15225                 echo "Prototype: $try" ;;
15226         esac
15227         ;;
15228         *)      case "$usethreads" in
15229                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15230                 esac
15231                 d_getpwnam_r=undef
15232                 getpwnam_r_proto=0
15233                 ;;
15234         esac
15235         ;;
15236 *)      getpwnam_r_proto=0
15237         ;;
15238 esac
15239
15240 : see if getpwuid_r exists
15241 set getpwuid_r d_getpwuid_r
15242 eval $inlibc
15243 case "$d_getpwuid_r" in
15244 "$define")
15245         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15246         case "$d_getpwuid_r_proto:$usethreads" in
15247         ":define")      d_getpwuid_r_proto=define
15248                 set d_getpwuid_r_proto getpwuid_r $hdrs
15249                 eval $hasproto ;;
15250         *)      ;;
15251         esac
15252         case "$d_getpwuid_r_proto" in
15253         define)
15254         case "$getpwuid_r_proto" in
15255         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15256         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15257         esac
15258         case "$getpwuid_r_proto" in
15259         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15260         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15261         esac
15262         case "$getpwuid_r_proto" in
15263         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15264         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15265         esac
15266         case "$getpwuid_r_proto" in
15267         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15268         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15269         esac
15270         case "$getpwuid_r_proto" in
15271         ''|0)   d_getpwuid_r=undef
15272                 getpwuid_r_proto=0
15273                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15274         * )     case "$getpwuid_r_proto" in
15275                 REENTRANT_PROTO*) ;;
15276                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15277                 esac
15278                 echo "Prototype: $try" ;;
15279         esac
15280         ;;
15281         *)      case "$usethreads" in
15282                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15283                 esac
15284                 d_getpwuid_r=undef
15285                 getpwuid_r_proto=0
15286                 ;;
15287         esac
15288         ;;
15289 *)      getpwuid_r_proto=0
15290         ;;
15291 esac
15292
15293 : Optional checks for getsbyname and getsbyport
15294
15295 : see if getservbyname exists
15296 set getservbyname d_getsbyname
15297 eval $inlibc
15298
15299 : see if getservbyport exists
15300 set getservbyport d_getsbyport
15301 eval $inlibc
15302
15303 : see if getservent exists
15304 set getservent d_getsent
15305 eval $inlibc
15306
15307 : see if getservbyname_r exists
15308 set getservbyname_r d_getservbyname_r
15309 eval $inlibc
15310 case "$d_getservbyname_r" in
15311 "$define")
15312         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15313         case "$d_getservbyname_r_proto:$usethreads" in
15314         ":define")      d_getservbyname_r_proto=define
15315                 set d_getservbyname_r_proto getservbyname_r $hdrs
15316                 eval $hasproto ;;
15317         *)      ;;
15318         esac
15319         case "$d_getservbyname_r_proto" in
15320         define)
15321         case "$getservbyname_r_proto" in
15322         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15323         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15324         esac
15325         case "$getservbyname_r_proto" in
15326         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15327         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15328         esac
15329         case "$getservbyname_r_proto" in
15330         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15331         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15332         esac
15333         case "$getservbyname_r_proto" in
15334         ''|0)   d_getservbyname_r=undef
15335                 getservbyname_r_proto=0
15336                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15337         * )     case "$getservbyname_r_proto" in
15338                 REENTRANT_PROTO*) ;;
15339                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15340                 esac
15341                 echo "Prototype: $try" ;;
15342         esac
15343         ;;
15344         *)      case "$usethreads" in
15345                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15346                 esac
15347                 d_getservbyname_r=undef
15348                 getservbyname_r_proto=0
15349                 ;;
15350         esac
15351         ;;
15352 *)      getservbyname_r_proto=0
15353         ;;
15354 esac
15355
15356 : see if getservbyport_r exists
15357 set getservbyport_r d_getservbyport_r
15358 eval $inlibc
15359 case "$d_getservbyport_r" in
15360 "$define")
15361         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15362         case "$d_getservbyport_r_proto:$usethreads" in
15363         ":define")      d_getservbyport_r_proto=define
15364                 set d_getservbyport_r_proto getservbyport_r $hdrs
15365                 eval $hasproto ;;
15366         *)      ;;
15367         esac
15368         case "$d_getservbyport_r_proto" in
15369         define)
15370         case "$getservbyport_r_proto" in
15371         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15372         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15373         esac
15374         case "$getservbyport_r_proto" in
15375         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15376         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15377         esac
15378         case "$getservbyport_r_proto" in
15379         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15380         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15381         esac
15382         case "$getservbyport_r_proto" in
15383         ''|0)   d_getservbyport_r=undef
15384                 getservbyport_r_proto=0
15385                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15386         * )     case "$getservbyport_r_proto" in
15387                 REENTRANT_PROTO*) ;;
15388                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15389                 esac
15390                 echo "Prototype: $try" ;;
15391         esac
15392         ;;
15393         *)      case "$usethreads" in
15394                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15395                 esac
15396                 d_getservbyport_r=undef
15397                 getservbyport_r_proto=0
15398                 ;;
15399         esac
15400         ;;
15401 *)      getservbyport_r_proto=0
15402         ;;
15403 esac
15404
15405 : see if getservent_r exists
15406 set getservent_r d_getservent_r
15407 eval $inlibc
15408 case "$d_getservent_r" in
15409 "$define")
15410         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15411         case "$d_getservent_r_proto:$usethreads" in
15412         ":define")      d_getservent_r_proto=define
15413                 set d_getservent_r_proto getservent_r $hdrs
15414                 eval $hasproto ;;
15415         *)      ;;
15416         esac
15417         case "$d_getservent_r_proto" in
15418         define)
15419         case "$getservent_r_proto" in
15420         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15421         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15422         esac
15423         case "$getservent_r_proto" in
15424         ''|0) try='int getservent_r(struct servent*, char*, int);'
15425         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15426         esac
15427         case "$getservent_r_proto" in
15428         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15429         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15430         esac
15431         case "$getservent_r_proto" in
15432         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15433         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15434         esac
15435         case "$getservent_r_proto" in
15436         ''|0)   d_getservent_r=undef
15437                 getservent_r_proto=0
15438                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15439         * )     case "$getservent_r_proto" in
15440                 REENTRANT_PROTO*) ;;
15441                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15442                 esac
15443                 echo "Prototype: $try" ;;
15444         esac
15445         ;;
15446         *)      case "$usethreads" in
15447                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15448                 esac
15449                 d_getservent_r=undef
15450                 getservent_r_proto=0
15451                 ;;
15452         esac
15453         ;;
15454 *)      getservent_r_proto=0
15455         ;;
15456 esac
15457
15458 : see if prototypes for various getservxxx netdb.h functions are available
15459 echo " "
15460 set d_getservprotos getservent $i_netdb netdb.h
15461 eval $hasproto
15462
15463 : see if getspnam exists
15464 set getspnam d_getspnam
15465 eval $inlibc
15466
15467 : see if this is a shadow.h system
15468 set shadow.h i_shadow
15469 eval $inhdr
15470
15471 : see if getspnam_r exists
15472 set getspnam_r d_getspnam_r
15473 eval $inlibc
15474 case "$d_getspnam_r" in
15475 "$define")
15476         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15477         case "$d_getspnam_r_proto:$usethreads" in
15478         ":define")      d_getspnam_r_proto=define
15479                 set d_getspnam_r_proto getspnam_r $hdrs
15480                 eval $hasproto ;;
15481         *)      ;;
15482         esac
15483         case "$d_getspnam_r_proto" in
15484         define)
15485         case "$getspnam_r_proto" in
15486         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15487         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15488         esac
15489         case "$getspnam_r_proto" in
15490         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15491         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15492         esac
15493         case "$getspnam_r_proto" in
15494         ''|0)   d_getspnam_r=undef
15495                 getspnam_r_proto=0
15496                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15497         * )     case "$getspnam_r_proto" in
15498                 REENTRANT_PROTO*) ;;
15499                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15500                 esac
15501                 echo "Prototype: $try" ;;
15502         esac
15503         ;;
15504         *)      case "$usethreads" in
15505                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15506                 esac
15507                 d_getspnam_r=undef
15508                 getspnam_r_proto=0
15509                 ;;
15510         esac
15511         ;;
15512 *)      getspnam_r_proto=0
15513         ;;
15514 esac
15515
15516 : see if gettimeofday or ftime exists
15517 set gettimeofday d_gettimeod
15518 eval $inlibc
15519 case "$d_gettimeod" in
15520 "$undef")
15521         set ftime d_ftime 
15522         eval $inlibc
15523         ;;
15524 *)
15525         val="$undef"; set d_ftime; eval $setvar
15526         ;;
15527 esac
15528 case "$d_gettimeod$d_ftime" in
15529 "$undef$undef")
15530         echo " "
15531         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15532         ;;
15533 esac
15534
15535 : see if gmtime_r exists
15536 set gmtime_r d_gmtime_r
15537 eval $inlibc
15538 case "$d_gmtime_r" in
15539 "$define")
15540         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15541         case "$d_gmtime_r_proto:$usethreads" in
15542         ":define")      d_gmtime_r_proto=define
15543                 set d_gmtime_r_proto gmtime_r $hdrs
15544                 eval $hasproto ;;
15545         *)      ;;
15546         esac
15547         case "$d_gmtime_r_proto" in
15548         define)
15549         case "$gmtime_r_proto" in
15550         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15551         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15552         esac
15553         case "$gmtime_r_proto" in
15554         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15555         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15556         esac
15557         case "$gmtime_r_proto" in
15558         ''|0)   d_gmtime_r=undef
15559                 gmtime_r_proto=0
15560                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15561         * )     case "$gmtime_r_proto" in
15562                 REENTRANT_PROTO*) ;;
15563                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15564                 esac
15565                 echo "Prototype: $try" ;;
15566         esac
15567         ;;
15568         *)      case "$usethreads" in
15569                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15570                 esac
15571                 d_gmtime_r=undef
15572                 gmtime_r_proto=0
15573                 ;;
15574         esac
15575         ;;
15576 *)      gmtime_r_proto=0
15577         ;;
15578 esac
15579
15580 : see if this is a netinet/in.h or sys/in.h system
15581 set netinet/in.h i_niin sys/in.h i_sysin
15582 eval $inhdr
15583
15584 : see if arpa/inet.h has to be included
15585 set arpa/inet.h i_arpainet
15586 eval $inhdr
15587
15588 : see if htonl --and friends-- exists
15589 val=''
15590 set htonl val
15591 eval $inlibc
15592
15593 : Maybe they are macros.
15594 case "$val" in
15595 $undef)
15596         $cat >htonl.c <<EOM
15597 #include <stdio.h>
15598 #include <sys/types.h>
15599 #$i_niin I_NETINET_IN
15600 #$i_sysin I_SYS_IN
15601 #$i_arpainet I_ARPA_INET
15602 #ifdef I_NETINET_IN
15603 #include <netinet/in.h>
15604 #endif
15605 #ifdef I_SYS_IN
15606 #include <sys/in.h>
15607 #endif
15608 #ifdef I_ARPA_INET
15609 #include <arpa/inet.h>
15610 #endif
15611 #ifdef htonl
15612 printf("Defined as a macro.");
15613 #endif
15614 EOM
15615         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15616         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15617                 val="$define"
15618                 echo "But it seems to be defined as a macro." >&4
15619         fi
15620         $rm -f htonl.?
15621         ;;
15622 esac
15623 set d_htonl
15624 eval $setvar
15625
15626 : see if hypot exists
15627 set hypot d_hypot
15628 eval $inlibc
15629
15630 : see if ilogb exists
15631 set ilogb d_ilogb
15632 eval $inlibc
15633
15634 : see if ilogbl exists
15635 set ilogbl d_ilogbl
15636 eval $inlibc
15637
15638 : index or strchr
15639 echo " "
15640 if set index val -f; eval $csym; $val; then
15641         if set strchr val -f d_strchr; eval $csym; $val; then
15642                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15643                         val="$define"
15644                         vali="$undef"
15645                         echo "strchr() found." >&4
15646                 else
15647                         val="$undef"
15648                         vali="$define"
15649                         echo "index() found." >&4
15650                 fi
15651         else
15652                 val="$undef"
15653                 vali="$define"
15654                 echo "index() found." >&4
15655         fi
15656 else
15657         if set strchr val -f d_strchr; eval $csym; $val; then
15658                 val="$define"
15659                 vali="$undef"
15660                 echo "strchr() found." >&4
15661         else
15662                 echo "No index() or strchr() found!" >&4
15663                 val="$undef"
15664                 vali="$undef"
15665         fi
15666 fi
15667 set d_strchr; eval $setvar
15668 val="$vali"
15669 set d_index; eval $setvar
15670
15671 : check whether inet_aton exists
15672 set inet_aton d_inetaton
15673 eval $inlibc
15674
15675 : see if inet_ntop exists
15676 set inet_ntop d_inetntop
15677 eval $inlibc
15678
15679 : see if inet_pton exists
15680 set inet_pton d_inetpton
15681 eval $inlibc
15682
15683 : Look for isascii
15684 echo " "
15685 $cat >isascii.c <<EOCP
15686 #include <stdio.h>
15687 #include <ctype.h>
15688 #$i_stdlib I_STDLIB
15689 #ifdef I_STDLIB
15690 #include <stdlib.h>
15691 #endif
15692 int main() {
15693         int c = 'A';
15694         if (isascii(c))
15695                 exit(0);
15696         else
15697                 exit(1);
15698 }
15699 EOCP
15700 set isascii
15701 if eval $compile; then
15702         echo "isascii() found." >&4
15703         val="$define"
15704 else
15705         echo "isascii() NOT found." >&4
15706         val="$undef"
15707 fi
15708 set d_isascii
15709 eval $setvar
15710 $rm -f isascii*
15711
15712 : Look for isblank
15713 echo " "
15714 $cat >isblank.c <<'EOCP'
15715 #include <stdio.h>
15716 #include <ctype.h>
15717 int main() {
15718         int c = ' ';
15719         if (isblank(c))
15720                 return 0 ;
15721         else
15722                 return 1 ;
15723 }
15724 EOCP
15725 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15726         echo "isblank() found." >&4
15727         val="$define"
15728 else
15729         echo "isblank() NOT found." >&4
15730         val="$undef"
15731 fi
15732 set d_isblank
15733 eval $setvar
15734 $rm -f isblank*
15735
15736 : check for isfinite
15737 echo "Checking to see if you have isfinite..." >&4
15738 $cat >try.c <<EOCP
15739 #$i_math I_MATH
15740 #ifdef I_MATH
15741 #include <math.h>
15742 #endif
15743 int main() { return isfinite(0.0); }
15744 EOCP
15745 set try
15746 if eval $compile; then
15747         val="$define"
15748         echo "You have isfinite."
15749 else
15750         val="$undef"
15751         echo "You do not have isfinite."
15752 fi
15753 $rm_try
15754 set d_isfinite
15755 eval $setvar
15756
15757 : see if isfinitel exists
15758 set isfinitel d_isfinitel
15759 eval $inlibc
15760
15761 : check for isinf
15762 echo "Checking to see if you have isinf..." >&4
15763 $cat >try.c <<EOCP
15764 #$i_math I_MATH
15765 #ifdef I_MATH
15766 #include <math.h>
15767 #endif
15768 int main() { return isinf(0.0); }
15769 EOCP
15770 set try
15771 if eval $compile; then
15772         val="$define"
15773         echo "You have isinf."
15774 else
15775         val="$undef"
15776         echo "You do not have isinf."
15777 fi
15778 $rm_try
15779 set d_isinf
15780 eval $setvar
15781
15782 : see if isinfl exists
15783 set isinfl d_isinfl
15784 eval $inlibc
15785
15786 : check for isless
15787 echo "Checking to see if you have isless..." >&4
15788 $cat >try.c <<EOCP
15789 #$i_math I_MATH
15790 #ifdef I_MATH
15791 #include <math.h>
15792 #endif
15793 int main() { return isless(0.0); }
15794 EOCP
15795 set try
15796 if eval $compile; then
15797         val="$define"
15798         echo "You have isless."
15799 else
15800         val="$undef"
15801         echo "You do not have isless."
15802 fi
15803 $rm_try
15804 set d_isless
15805 eval $setvar
15806
15807 : check for isnan
15808 echo "Checking to see if you have isnan..." >&4
15809 $cat >try.c <<EOCP
15810 #$i_math I_MATH
15811 #ifdef I_MATH
15812 #include <math.h>
15813 #endif
15814 int main() { return isnan(0.0); }
15815 EOCP
15816 set try
15817 if eval $compile; then
15818         val="$define"
15819         echo "You have isnan."
15820 else
15821         val="$undef"
15822         echo "You do not have isnan."
15823 fi
15824 $rm_try
15825 set d_isnan
15826 eval $setvar
15827
15828 : see if isnanl exists
15829 set isnanl d_isnanl
15830 eval $inlibc
15831
15832 : check for isnormal
15833 echo "Checking to see if you have isnormal..." >&4
15834 $cat >try.c <<EOCP
15835 #$i_math I_MATH
15836 #ifdef I_MATH
15837 #include <math.h>
15838 #endif
15839 int main() { return isnormal(0.0); }
15840 EOCP
15841 set try
15842 if eval $compile; then
15843         val="$define"
15844         echo "You have isnormal."
15845 else
15846         val="$undef"
15847         echo "You do not have isnormal."
15848 fi
15849 $rm_try
15850 set d_isnormal
15851 eval $setvar
15852
15853 : see if j0 exists
15854 set j0 d_j0
15855 eval $inlibc
15856
15857 : see if j0l exists
15858 set j0l d_j0l
15859 eval $inlibc
15860
15861 : see if killpg exists
15862 set killpg d_killpg
15863 eval $inlibc
15864
15865 : see if localeconv exists
15866 set localeconv d_locconv
15867 eval $inlibc
15868
15869 : see if libc has the POSIX.1-2008 currency locale rules
15870 case "$d_locconv:$d_lc_monetary_2008" in
15871 $define:)
15872         $cat >try.c <<EOCP
15873 #include <locale.h>
15874 int main() {
15875         struct lconv *lc = localeconv();
15876         char int_p_cs_precedes = lc->int_p_cs_precedes;
15877         return 0;
15878 }
15879 EOCP
15880         set try
15881         if eval $compile; then
15882                 d_lc_monetary_2008="$define"
15883         else
15884                 d_lc_monetary_2008="$undef"
15885         fi;
15886         $rm_try
15887         ;;
15888 esac
15889
15890 : see if lchown exists
15891 echo " "
15892 $cat > try.c <<'EOCP'
15893 /* System header to define __stub macros and hopefully few prototypes,
15894     which can conflict with char lchown(); below.  */
15895 #include <assert.h>
15896 /* Override any gcc2 internal prototype to avoid an error.  */
15897 /* We use char because int might match the return type of a gcc2
15898    builtin and then its argument prototype would still apply.  */
15899 char lchown();
15900 int main() {
15901     /*  The GNU C library defines this for functions which it implements
15902         to always fail with ENOSYS.  Some functions are actually named
15903         something starting with __ and the normal name is an alias.  */
15904 #if defined (__stub_lchown) || defined (__stub___lchown)
15905 choke me
15906 #else
15907 lchown();
15908 #endif
15909 ; return 0; }
15910 EOCP
15911 set try
15912 if eval $compile; then
15913     $echo "lchown() found." >&4
15914     val="$define"
15915 else
15916     $echo "lchown() NOT found." >&4
15917     val="$undef"
15918 fi
15919 set d_lchown
15920 eval $setvar
15921
15922 : See if number of significant digits in a double precision number is known
15923 echo " "
15924 $cat >ldbl_dig.c <<EOM
15925 #$i_limits I_LIMITS
15926 #$i_float I_FLOAT
15927 #ifdef I_LIMITS
15928 #include <limits.h>
15929 #endif
15930 #ifdef I_FLOAT
15931 #include <float.h>
15932 #endif
15933 #ifdef LDBL_DIG
15934 printf("Contains LDBL_DIG");
15935 #endif
15936 EOM
15937 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15938 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15939         echo "LDBL_DIG found." >&4
15940         val="$define"
15941 else
15942         echo "LDBL_DIG NOT found." >&4
15943         val="$undef"
15944 fi
15945 $rm -f ldbl_dig.?
15946 set d_ldbl_dig
15947 eval $setvar
15948
15949 : see if lgamma exists
15950 set lgamma d_lgamma
15951 eval $inlibc
15952
15953 : see if lgamma_r exists
15954 set lgamma_r d_lgamma_r
15955 eval $inlibc
15956
15957 : check to see if math.h defines _LIB_VERSION
15958 d_libm_lib_version="$undef"
15959 case $i_math in
15960     $define)
15961         echo " "
15962         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15963         $cat >try.c <<EOCP
15964 #include <unistd.h>
15965 #include <math.h>
15966 int main (int argc, char *argv[])
15967 {
15968     printf ("%d\n", _LIB_VERSION);
15969     return (0);
15970     } /* main */
15971 EOCP
15972         set try
15973         if eval $compile; then
15974             foo=`$run ./try`
15975             echo "Yes, it does ($foo)" >&4
15976             d_libm_lib_version="$define"
15977         else
15978             echo "No, it does not (probably harmless)" >&4
15979             fi
15980         $rm_try
15981         ;;
15982
15983     esac
15984
15985 : see if link exists
15986 set link d_link
15987 eval $inlibc
15988
15989 : see if llrint exists
15990 set llrint d_llrint
15991 eval $inlibc
15992
15993 : see if llrintl exists
15994 set llrintl d_llrintl
15995 eval $inlibc
15996
15997 : see if llround exists
15998 set llround d_llround
15999 eval $inlibc
16000
16001 : see if llroundl exists
16002 set llroundl d_llroundl
16003 eval $inlibc
16004
16005 : see if localtime_r exists
16006 set localtime_r d_localtime_r
16007 eval $inlibc
16008 case "$d_localtime_r" in
16009 "$define")
16010         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16011         case "$d_localtime_r_proto:$usethreads" in
16012         ":define")      d_localtime_r_proto=define
16013                 set d_localtime_r_proto localtime_r $hdrs
16014                 eval $hasproto ;;
16015         *)      ;;
16016         esac
16017         case "$d_localtime_r_proto" in
16018         define)
16019         case "$localtime_r_proto" in
16020         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16021         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16022         esac
16023         case "$localtime_r_proto" in
16024         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16025         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16026         esac
16027         case "$localtime_r_proto" in
16028         ''|0)   d_localtime_r=undef
16029                 localtime_r_proto=0
16030                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16031         * )     case "$localtime_r_proto" in
16032                 REENTRANT_PROTO*) ;;
16033                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16034                 esac
16035                 echo "Prototype: $try" ;;
16036         esac
16037         ;;
16038         *)      case "$usethreads" in
16039                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16040                 esac
16041                 d_localtime_r=undef
16042                 localtime_r_proto=0
16043                 ;;
16044         esac
16045         ;;
16046 *)      localtime_r_proto=0
16047         ;;
16048 esac
16049
16050 : see if localtime_r calls tzset
16051 case "$localtime_r_proto" in
16052 REENTRANT_PROTO*)
16053         $cat >try.c <<EOCP
16054 /*  Does our libc's localtime_r call tzset ?
16055  *  return 0 if so, 1 otherwise.
16056  */
16057 #$i_systypes    I_SYS_TYPES
16058 #$i_unistd      I_UNISTD
16059 #$i_time        I_TIME
16060 #$i_stdlib      I_STDLIB
16061 #$i_string      I_STRING
16062 #$i_malloc      I_MALLOC
16063 #ifdef I_SYS_TYPES
16064 #  include <sys/types.h>
16065 #endif
16066 #ifdef I_UNISTD
16067 #  include <unistd.h>
16068 #endif
16069 #ifdef I_TIME
16070 #  include <time.h>
16071 #endif
16072 #ifdef I_STDLIB
16073 #include <stdlib.h>
16074 #endif
16075 #ifdef I_STRING
16076 #  include <string.h>
16077 #else
16078 #  include <strings.h>
16079 #endif
16080 #ifdef I_MALLOC
16081 #  include <malloc.h>
16082 #endif
16083 int main()
16084 {
16085     time_t t = time(0L);
16086     char w_tz[]="TZ" "=GMT+5",
16087          e_tz[]="TZ" "=GMT-5",
16088         *tz_e = (char*)malloc(16),
16089         *tz_w = (char*)malloc(16);
16090     struct tm tm_e, tm_w;
16091     memset(&tm_e,'\0',sizeof(struct tm));
16092     memset(&tm_w,'\0',sizeof(struct tm));
16093     strcpy(tz_e,e_tz);
16094     strcpy(tz_w,w_tz);
16095
16096     putenv(tz_e);
16097     localtime_r(&t, &tm_e);
16098
16099     putenv(tz_w);
16100     localtime_r(&t, &tm_w);
16101
16102     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16103         return 1;
16104     return 0;
16105 }
16106 EOCP
16107         set try
16108         if eval $compile; then
16109             if $run ./try; then
16110                 d_localtime_r_needs_tzset=undef;
16111             else
16112                 d_localtime_r_needs_tzset=define;
16113             fi;
16114         else
16115             d_localtime_r_needs_tzset=undef;
16116         fi;
16117      ;;
16118   *)
16119      d_localtime_r_needs_tzset=undef;
16120      ;;
16121 esac
16122 $rm_try
16123
16124 : see if lockf exists
16125 set lockf d_lockf
16126 eval $inlibc
16127
16128 : see if log1p exists
16129 set log1p d_log1p
16130 eval $inlibc
16131
16132 : see if log2 exists
16133 set log2 d_log2
16134 eval $inlibc
16135
16136 : see if logb exists
16137 set logb d_logb
16138 eval $inlibc
16139
16140 : see if lrint exists
16141 set lrint d_lrint
16142 eval $inlibc
16143
16144 : see if lrintl exists
16145 set lrintl d_lrintl
16146 eval $inlibc
16147
16148 : see if lround exists
16149 set lround d_lround
16150 eval $inlibc
16151
16152 : see if lroundl exists
16153 set lroundl d_lroundl
16154 eval $inlibc
16155
16156 : see if prototype for lseek is available
16157 echo " "
16158 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16159 eval $hasproto
16160
16161 : see if lstat exists
16162 set lstat d_lstat
16163 eval $inlibc
16164
16165 : see if madvise exists
16166 set madvise d_madvise
16167 eval $inlibc
16168
16169 : see if malloc_size exists
16170 set malloc_size d_malloc_size
16171 eval $inlibc
16172
16173 : see if malloc_size_good exists
16174 set malloc_good_size d_malloc_good_size
16175 eval $inlibc
16176
16177 : see if mblen exists
16178 set mblen d_mblen
16179 eval $inlibc
16180
16181 : see if mbstowcs exists
16182 set mbstowcs d_mbstowcs
16183 eval $inlibc
16184
16185 : see if mbtowc exists
16186 set mbtowc d_mbtowc
16187 eval $inlibc
16188
16189 : see if memchr exists
16190 set memchr d_memchr
16191 eval $inlibc
16192
16193 : see if memcmp exists
16194 set memcmp d_memcmp
16195 eval $inlibc
16196
16197 : see if memcpy exists
16198 set memcpy d_memcpy
16199 eval $inlibc
16200
16201 : see if memmove exists
16202 set memmove d_memmove
16203 eval $inlibc
16204
16205 : see if memset exists
16206 set memset d_memset
16207 eval $inlibc
16208
16209 : see if mkdir exists
16210 set mkdir d_mkdir
16211 eval $inlibc
16212
16213 : see if mkdtemp exists
16214 set mkdtemp d_mkdtemp
16215 eval $inlibc
16216
16217 : see if mkfifo exists
16218 set mkfifo d_mkfifo
16219 eval $inlibc
16220
16221 : see if mkstemp exists
16222 set mkstemp d_mkstemp
16223 eval $inlibc
16224
16225 : see if mkstemps exists
16226 set mkstemps d_mkstemps
16227 eval $inlibc
16228
16229 : see if mktime exists
16230 set mktime d_mktime
16231 eval $inlibc
16232
16233 : see if this is a sys/mman.h system
16234 set sys/mman.h i_sysmman
16235 eval $inhdr
16236
16237 : see if mmap exists
16238 set mmap d_mmap
16239 eval $inlibc
16240 : see what shmat returns
16241 : default to something harmless
16242 mmaptype='void *'
16243 case "$i_sysmman$d_mmap" in
16244 "$define$define")
16245         $cat >mmap.c <<'END'
16246 #include <sys/mman.h>
16247 void *mmap();
16248 END
16249         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16250                 mmaptype='void *'
16251         else
16252                 mmaptype='caddr_t'
16253         fi
16254         echo "and it returns ($mmaptype)." >&4
16255         ;;
16256 esac
16257
16258
16259
16260 : see if sqrtl exists
16261 set sqrtl d_sqrtl
16262 eval $inlibc
16263
16264 : see if scalbnl exists
16265 set scalbnl d_scalbnl
16266 eval $inlibc
16267
16268 : see if truncl exists
16269 set truncl d_truncl
16270 eval $inlibc
16271
16272 : see if modfl exists
16273 set modfl d_modfl
16274 eval $inlibc
16275
16276 : see if prototype for modfl is available
16277 echo " "
16278 set d_modflproto modfl $i_math math.h
16279 eval $hasproto
16280
16281 d_modfl_pow32_bug="$undef"
16282
16283 case "$d_longdbl$d_modfl" in
16284 $define$define)
16285         $cat <<EOM
16286 Checking to see whether your modfl() is okay for large values...
16287 EOM
16288 $cat >try.c <<EOCP
16289 #include <math.h>
16290 #include <stdio.h>
16291 EOCP
16292 if $test "X$d_modflproto" != "X$define"; then
16293         $cat >>try.c <<EOCP
16294 /* Sigh. many current glibcs provide the function, but do not prototype it. */
16295 long double modfl (long double, long double *);
16296 EOCP
16297 fi
16298 $cat >>try.c <<EOCP
16299 int main() {
16300     long double nv = 4294967303.15;
16301     long double v, w;
16302     v = modfl(nv, &w);
16303 #ifdef __GLIBC__
16304     printf("glibc");
16305 #endif
16306     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
16307     return 0;
16308 }
16309 EOCP
16310         case "$osname:$gccversion" in
16311         aix:)   saveccflags="$ccflags"
16312                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
16313         esac
16314         set try
16315         if eval $compile; then
16316                 foo=`$run ./try`
16317                 case "$foo" in
16318                 *" 4294967303.150000 1.150000 4294967302.000000")
16319                         echo >&4 "Your modfl() is broken for large values."
16320                         d_modfl_pow32_bug="$define"
16321                         case "$foo" in
16322                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
16323                         ;;
16324                         esac
16325                         ;;
16326                 *" 4294967303.150000 0.150000 4294967303.000000")
16327                         echo >&4 "Your modfl() seems okay for large values."
16328                         ;;
16329                 *)      echo >&4 "I don't understand your modfl() at all."
16330                         d_modfl="$undef"
16331                         ;;
16332                 esac
16333                 $rm_try
16334         else
16335                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
16336                 d_modfl="$undef"
16337         fi
16338         case "$osname:$gccversion" in
16339         aix:)   ccflags="$saveccflags" ;; # restore
16340         esac
16341         ;;
16342 esac
16343
16344 if $test "$uselongdouble" = "$define"; then
16345     message=""
16346     if $test "$d_sqrtl" != "$define"; then
16347         message="$message sqrtl"
16348     fi
16349     if $test "$d_modfl" != "$define"; then
16350         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16351             echo "You have both truncl and copysignl, so I can emulate modfl."
16352         else
16353             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16354                 echo "You have both aintl and copysignl, so I can emulate modfl."
16355             else
16356                 message="$message modfl"
16357             fi
16358         fi
16359     fi
16360     if $test "$d_frexpl" != "$define"; then
16361         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16362             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16363         else
16364             message="$message frexpl"
16365         fi
16366     fi
16367     if $test "$d_ldexpl" != "$define"; then
16368         message="$message ldexpl"
16369     fi
16370
16371     if $test "$message" != ""; then
16372         $cat <<EOM >&4
16373
16374 *** You requested the use of long doubles but you do not seem to have
16375 *** the following mathematical functions needed for long double support:
16376 ***    $message
16377 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16378 *** Cannot continue, aborting.
16379
16380 EOM
16381
16382         exit 1
16383     fi
16384 fi
16385
16386 : see if mprotect exists
16387 set mprotect d_mprotect
16388 eval $inlibc
16389
16390 : see if msgctl exists
16391 set msgctl d_msgctl
16392 eval $inlibc
16393
16394 : see if msgget exists
16395 set msgget d_msgget
16396 eval $inlibc
16397
16398 : see if msgsnd exists
16399 set msgsnd d_msgsnd
16400 eval $inlibc
16401
16402 : see if msgrcv exists
16403 set msgrcv d_msgrcv
16404 eval $inlibc
16405
16406 : see how much of the 'msg*(2)' library is present.
16407 h_msg=true
16408 echo " "
16409 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16410 *"$undef"*) h_msg=false;;
16411 esac
16412 case "$osname" in
16413 freebsd)
16414     case "`ipcs 2>&1`" in
16415     "SVID messages"*"not configured"*)
16416         echo "Your $osname does not have the msg*(2) configured." >&4
16417         h_msg=false
16418         val="$undef"
16419         set msgctl d_msgctl
16420         eval $setvar
16421         set msgget d_msgget
16422         eval $setvar
16423         set msgsnd d_msgsnd
16424         eval $setvar
16425         set msgrcv d_msgrcv
16426         eval $setvar
16427         ;;
16428     esac
16429     ;;
16430 esac
16431 : we could also check for sys/ipc.h ...
16432 if $h_msg && $test `./findhdr sys/msg.h`; then
16433         echo "You have the full msg*(2) library." >&4
16434         val="$define"
16435 else
16436         echo "You don't have the full msg*(2) library." >&4
16437         val="$undef"
16438 fi
16439 set d_msg
16440 eval $setvar
16441
16442 : Check for msghdr_s
16443 echo " "
16444 echo "Checking to see if your system supports struct msghdr..." >&4
16445 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16446 eval $hasstruct
16447 case "$d_msghdr_s" in
16448 "$define")      echo "Yes, it does."   ;;
16449 *)              echo "No, it doesn't." ;;
16450 esac
16451
16452
16453 : see if msync exists
16454 set msync d_msync
16455 eval $inlibc
16456
16457 : see if munmap exists
16458 set munmap d_munmap
16459 eval $inlibc
16460
16461 : see if nan exists
16462 set nan d_nan
16463 eval $inlibc
16464
16465 : see if nearbyint exists
16466 set nearbyint d_nearbyint
16467 eval $inlibc
16468
16469 : see if nextafter exists
16470 set nextafter d_nextafter
16471 eval $inlibc
16472
16473 : see if nexttoward exists
16474 set nexttoward d_nexttoward
16475 eval $inlibc
16476
16477 : see if nice exists
16478 set nice d_nice
16479 eval $inlibc
16480
16481 : see if this is a langinfo.h system
16482 set langinfo.h i_langinfo
16483 eval $inhdr
16484
16485 : see if nl_langinfo exists
16486 set nl_langinfo d_nl_langinfo
16487 eval $inlibc
16488
16489 : see if this is a quadmath.h system
16490 set quadmath.h i_quadmath
16491 eval $inhdr
16492
16493 : check for volatile keyword
16494 echo " "
16495 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16496 $cat >try.c <<'EOCP'
16497 int main()
16498 {
16499         typedef struct _goo_struct goo_struct;
16500         goo_struct * volatile goo = ((goo_struct *)0);
16501         struct _goo_struct {
16502                 long long_int;
16503                 int reg_int;
16504                 char char_var;
16505         };
16506         typedef unsigned short foo_t;
16507         char *volatile foo;
16508         volatile int bar;
16509         volatile foo_t blech;
16510         foo = foo;
16511 }
16512 EOCP
16513 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16514         val="$define"
16515         echo "Yup, it does."
16516 else
16517         val="$undef"
16518         echo "Nope, it doesn't."
16519 fi
16520 set d_volatile
16521 eval $setvar
16522 $rm_try
16523
16524 : Check basic sizes
16525 echo " "
16526 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16527
16528 case "$use64bitint:$d_quad:$quadtype" in
16529 define:define:?*)
16530         ivtype="$quadtype"
16531         uvtype="$uquadtype"
16532         ivsize=8
16533         uvsize=8
16534         ;;
16535 *)      ivtype="long"
16536         uvtype="unsigned long"
16537         ivsize=$longsize
16538         uvsize=$longsize
16539         ;;
16540 esac
16541
16542 case "$uselongdouble:$d_longdbl" in
16543 define:define)
16544         nvtype="long double"
16545         nvsize=$longdblsize
16546         ;;
16547 *)      nvtype=double
16548         nvsize=$doublesize
16549         ;;
16550 esac
16551
16552 case "$usequadmath:$i_quadmath" in
16553 define:define)
16554   nvtype="__float128"
16555   nvsize=16
16556   case "$libs" in
16557   *quadmath*) ;;
16558   *) $cat <<EOM >&4
16559
16560 *** You requested the use of the quadmath library, but you
16561 *** do not seem to have the quadmath library installed.
16562 *** Cannot continue, aborting.
16563 EOM
16564     exit 1
16565     ;;
16566   esac
16567   ;;
16568 define:*) $cat <<EOM >&4
16569
16570 *** You requested the use of the quadmath library, but you
16571 *** do not seem to have the required header, <quadmath.h>.
16572 EOM
16573   case "$gccversion" in
16574   [23].*|4.[0-5]*)
16575    $cat <<EOM >&4
16576 *** Your gcc looks a bit old:
16577 *** $gccversion
16578 EOM
16579     ;;
16580   '')
16581    $cat <<EOM >&4
16582 *** You are not running a gcc.
16583 EOM
16584     ;;
16585   esac
16586   $cat <<EOM >&4
16587 *** For the quadmath library you need at least gcc 4.6.
16588 *** Cannot continue, aborting.
16589 EOM
16590   exit 1
16591   ;;
16592 esac
16593
16594 $echo "(IV will be "$ivtype", $ivsize bytes)"
16595 $echo "(UV will be "$uvtype", $uvsize bytes)"
16596 $echo "(NV will be "$nvtype", $nvsize bytes)"
16597
16598 $cat >try.c <<EOCP
16599 #$i_inttypes I_INTTYPES
16600 #ifdef I_INTTYPES
16601 #include <inttypes.h>
16602 #endif
16603 #include <stdio.h>
16604 int main() {
16605 #ifdef INT8
16606    int8_t i =  INT8_MAX;
16607   uint8_t u = UINT8_MAX;
16608   printf("int8_t\n");
16609 #endif
16610 #ifdef INT16
16611    int16_t i =  INT16_MAX;
16612   uint16_t u = UINT16_MAX;
16613   printf("int16_t\n");
16614 #endif
16615 #ifdef INT32
16616    int32_t i =  INT32_MAX;
16617   uint32_t u = UINT32_MAX;
16618   printf("int32_t\n");
16619 #endif
16620 }
16621 EOCP
16622
16623 i8type="signed char"
16624 u8type="unsigned char"
16625 i8size=1
16626 u8size=1
16627
16628 case "$i16type" in
16629 '')     case "$shortsize" in
16630         2)      i16type=short
16631                 u16type="unsigned short"
16632                 i16size=$shortsize
16633                 u16size=$shortsize
16634                 ;;
16635         esac
16636         ;;
16637 esac
16638 case "$i16type" in
16639 '')     set try -DINT16
16640         if eval $compile; then
16641                 case "`$run ./try`" in
16642                 int16_t)
16643                         i16type=int16_t
16644                         u16type=uint16_t
16645                         i16size=2
16646                         u16size=2
16647                         ;;
16648                 esac
16649         fi
16650         ;;
16651 esac
16652 case "$i16type" in
16653 '')     if $test $shortsize -ge 2; then
16654                 i16type=short
16655                 u16type="unsigned short"
16656                 i16size=$shortsize
16657                 u16size=$shortsize
16658         fi
16659         ;;
16660 esac
16661
16662 case "$i32type" in
16663 '')     case "$longsize" in
16664         4)      i32type=long
16665                 u32type="unsigned long"
16666                 i32size=$longsize
16667                 u32size=$longsize
16668                 ;;
16669         *)      case "$intsize" in
16670                 4)      i32type=int
16671                         u32type="unsigned int"
16672                         i32size=$intsize
16673                         u32size=$intsize
16674                         ;;
16675                 esac
16676                 ;;
16677         esac
16678         ;;
16679 esac
16680 case "$i32type" in
16681 '')     set try -DINT32
16682         if eval $compile; then
16683                 case "`$run ./try`" in
16684                 int32_t)
16685                         i32type=int32_t
16686                         u32type=uint32_t
16687                         i32size=4
16688                         u32size=4
16689                         ;;
16690                 esac
16691         fi
16692         ;;
16693 esac
16694 case "$i32type" in
16695 '')     if $test $intsize -ge 4; then
16696                 i32type=int
16697                 u32type="unsigned int"
16698                 i32size=$intsize
16699                 u32size=$intsize
16700         fi
16701         ;;
16702 esac
16703
16704 case "$i64type" in
16705 '')     case "$d_quad:$quadtype" in
16706         define:?*)
16707                 i64type="$quadtype"
16708                 u64type="$uquadtype"
16709                 i64size=8
16710                 u64size=8
16711                 ;;
16712         esac
16713         ;;
16714 esac
16715
16716 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16717 : volatile so that the compiler has to store it out to memory.
16718 if test X"$d_volatile" = X"$define"; then
16719         volatile=volatile
16720 fi
16721 $cat <<EOP >try.c
16722 #include <stdio.h>
16723 #$i_stdlib I_STDLIB
16724 #ifdef I_STDLIB
16725 #include <stdlib.h>
16726 #endif
16727 #include <sys/types.h>
16728 #include <signal.h>
16729 #ifdef SIGFPE
16730 $volatile int bletched = 0;
16731 $signal_t blech(int s) { bletched = 1; }
16732 #endif
16733 int main() {
16734     $uvtype u = 0;
16735     $nvtype d;
16736     int     n = 8 * $uvsize;
16737     int     i;
16738 #ifdef SIGFPE
16739     signal(SIGFPE, blech);
16740 #endif
16741
16742     for (i = 0; i < n; i++) {
16743       u = u << 1 | ($uvtype)1;
16744       d = ($nvtype)u;
16745       if (($uvtype)d != u)
16746         break;
16747       if (d <= 0)
16748         break;
16749       d = ($nvtype)(u - 1);
16750       if (($uvtype)d != (u - 1))
16751         break;
16752 #ifdef SIGFPE
16753       if (bletched)
16754         break;
16755 #endif
16756     }
16757     printf("%d\n", ((i == n) ? -n : i));
16758     exit(0);
16759 }
16760 EOP
16761 set try
16762
16763 d_nv_preserves_uv="$undef"
16764 if eval $compile; then
16765         nv_preserves_uv_bits="`$run ./try`"
16766 fi
16767 case "$nv_preserves_uv_bits" in
16768 \-[1-9]*)
16769         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16770         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16771         d_nv_preserves_uv="$define"
16772         ;;
16773 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16774         d_nv_preserves_uv="$undef" ;;
16775 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16776         nv_preserves_uv_bits="0" ;;
16777 esac
16778 $rm_try
16779
16780 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16781 : volatile so that the compiler has to store it out to memory.
16782 if test X"$d_volatile" = X"$define"; then
16783         volatile=volatile
16784 fi
16785 $cat <<EOP >try.c
16786 #include <stdio.h>
16787
16788 typedef $nvtype NV;
16789
16790 int
16791 main() {
16792   NV value = 2;
16793   int count = 1;
16794
16795   while(count < 256) {
16796     $volatile NV up = value + 1.0;
16797     $volatile NV negated = -value;
16798     $volatile NV down = negated - 1.0;
16799     $volatile NV got_up = up - value;
16800     int up_good = got_up == 1.0;
16801     int got_down = down - negated;
16802     int down_good = got_down == -1.0;
16803
16804     if (down_good != up_good) {
16805       fprintf(stderr,
16806               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16807               up_good, (double) got_up, down_good, (double) got_down,
16808               count, (double) value);
16809       return 1;
16810     }
16811     if (!up_good) {
16812       while (1) {
16813         if (count > 8) {
16814           count -= 8;
16815           fputs("256.0", stdout);
16816         } else {
16817           count--;
16818           fputs("2.0", stdout);
16819         }
16820         if (!count) {
16821           puts("");
16822           return 0;
16823         }
16824         fputs("*", stdout);
16825       }
16826     }
16827     value *= 2;
16828     ++count;
16829   }
16830   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16831           count, (double) value);
16832   return 1;
16833 }
16834 EOP
16835 set try
16836
16837 nv_overflows_integers_at='0'
16838 if eval $compile; then
16839     xxx="`$run ./try`"
16840     case "$?" in
16841         0)
16842             case "$xxx" in
16843                 2*)  cat >&4 <<EOM
16844 The largest integer your NVs can preserve is equal to $xxx
16845 EOM
16846                     nv_overflows_integers_at="$xxx"
16847                     ;;
16848                 *)  cat >&4 <<EOM
16849 Cannot determine the largest integer value your NVs can hold, unexpected output
16850 '$xxx'
16851 EOM
16852                     ;;
16853             esac
16854             ;;
16855         *)  cat >&4 <<EOM
16856 Cannot determine the largest integer value your NVs can hold
16857 EOM
16858             ;;
16859     esac
16860 fi
16861 $rm_try
16862
16863 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16864 : volatile so that the compiler has to store it out to memory.
16865 if test X"$d_volatile" = X"$define"; then
16866         volatile=volatile
16867 fi
16868 $cat <<EOP >try.c
16869 #include <stdio.h>
16870 #$i_stdlib I_STDLIB
16871 #ifdef I_STDLIB
16872 #include <stdlib.h>
16873 #endif
16874 #$i_string I_STRING
16875 #ifdef I_STRING
16876 #  include <string.h>
16877 #else
16878 #  include <strings.h>
16879 #endif
16880 #include <sys/types.h>
16881 #include <signal.h>
16882 #ifdef SIGFPE
16883 $volatile int bletched = 0;
16884 $signal_t blech(int s) { bletched = 1; }
16885 #endif
16886
16887 int checkit($nvtype d, char *where) {
16888     unsigned char *p = (char *)&d;
16889     unsigned char *end = p + sizeof(d);
16890     int fail = 0;
16891
16892     while (p < end)
16893         fail += *p++;
16894
16895     if (!fail)
16896         return 0;
16897
16898     p = (char *)&d;
16899     printf("No - %s: 0x", where);
16900     while (p < end)
16901         printf ("%02X", *p++);
16902     printf("\n");
16903     return 1;
16904 }
16905
16906 int main(int argc, char **argv) {
16907     $nvtype d = 0.0;
16908     int fail = 0;
16909     fail += checkit(d, "0.0");
16910
16911     /* The compiler shouldn't be assuming that bletched is 0  */
16912     d = bletched;
16913
16914     fail += checkit(d, "bleched");
16915
16916 #ifdef SIGFPE
16917     signal(SIGFPE, blech);
16918 #endif
16919
16920     /* Paranoia - the compiler should have no way of knowing that ANSI says
16921        that argv[argc] will always be NULL.  Actually, if it did assume this it
16922        would be buggy, as this is C and main() can be called from elsewhere in
16923        the program.  */
16924     d = argv[argc] ? 1 : 0;
16925
16926     if (d) {
16927         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16928     }
16929
16930     fail += checkit(d, "ternary");
16931
16932     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16933
16934     if (d != 0.0) {
16935         printf("No - memset doesn't give 0.0\n");
16936         /* This might just blow up:  */
16937         printf("(gives %g)\n", d);
16938         return 1;
16939     }
16940
16941 #ifdef SIGFPE
16942     if (bletched) {
16943         printf("No - something bleched\n");
16944         return 1;
16945     }
16946 #endif
16947     if (fail) {
16948       printf("No - %d fail(s)\n", fail);
16949       return 1;
16950     }
16951     printf("Yes\n");
16952     return 0;
16953 }
16954 EOP
16955 set try
16956
16957 d_nv_zero_is_allbits_zero="$undef"
16958 if eval $compile; then
16959     xxx="`$run ./try`"
16960     case "$?" in
16961         0)
16962             case "$xxx" in
16963                 Yes)  cat >&4 <<EOM
16964 0.0 is represented as all bits zero in memory
16965 EOM
16966                     d_nv_zero_is_allbits_zero="$define"
16967                     ;;
16968                 *)  cat >&4 <<EOM
16969 0.0 is not represented as all bits zero in memory
16970 EOM
16971                     d_nv_zero_is_allbits_zero="$undef"
16972                     ;;
16973             esac
16974             ;;
16975         *)  cat >&4 <<EOM
16976 0.0 is not represented as all bits zero in memory
16977 EOM
16978             d_nv_zero_is_allbits_zero="$undef"
16979             ;;
16980     esac
16981 fi
16982 $rm_try
16983
16984 : check for off64_t
16985 echo " "
16986 echo "Checking to see if you have off64_t..." >&4
16987 $cat >try.c <<EOCP
16988 #include <sys/types.h>
16989 #include <unistd.h>
16990 int main() { off64_t x = 7; }
16991 EOCP
16992 set try
16993 if eval $compile; then
16994         val="$define"
16995         echo "You have off64_t."
16996 else
16997         val="$undef"
16998         echo "You do not have off64_t."
16999         case "$lseeksize" in
17000         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17001         esac
17002 fi
17003 $rm_try
17004 set d_off64_t
17005 eval $setvar
17006
17007 : how to create joinable pthreads
17008 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17009         echo " "
17010         echo "Checking what constant to use for creating joinable pthreads..." >&4
17011         $cat >try.c <<'EOCP'
17012 #include <pthread.h>
17013 int main() {
17014     int detachstate = JOINABLE;
17015 }
17016 EOCP
17017         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17018         if eval $compile; then
17019                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17020                 val="$undef" # Yes, undef.
17021                 set d_old_pthread_create_joinable
17022                 eval $setvar
17023                 val=""
17024                 set old_pthread_create_joinable
17025                 eval $setvar
17026         else
17027                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17028                 if eval $compile; then
17029                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17030                         val="$define"
17031                         set d_old_pthread_create_joinable
17032                         eval $setvar
17033                         val=PTHREAD_CREATE_UNDETACHED
17034                         set old_pthread_create_joinable
17035                         eval $setvar
17036                 else
17037                         set try -DJOINABLE=__UNDETACHED
17038                         if eval $compile; then
17039                                 echo "You seem to use __UNDETACHED." >&4
17040                                 val="$define"
17041                                 set d_old_pthread_create_joinable
17042                                 eval $setvar
17043                                 val=__UNDETACHED
17044                                 set old_pthread_create_joinable
17045                                 eval $setvar
17046                         else
17047                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17048                                 val="$define"
17049                                 set d_old_pthread_create_joinable
17050                                 eval $setvar
17051                                 val=0
17052                                 set old_pthread_create_joinable
17053                                 eval $setvar
17054                         fi
17055                 fi
17056         fi
17057         $rm_try
17058 else
17059     d_old_pthread_create_joinable="$undef"
17060     old_pthread_create_joinable=""
17061 fi
17062
17063 : see if pause exists
17064 set pause d_pause
17065 eval $inlibc
17066
17067 : see if poll exists
17068 set poll d_poll
17069 eval $inlibc
17070
17071 : see if prctl exists
17072 set prctl d_prctl
17073 eval $inlibc
17074
17075 : see if prctl supports PR_SET_NAME
17076 d_prctl_set_name=$undef
17077 case $d_prctl in
17078     $define)
17079         $cat >try.c <<EOM
17080 #ifdef __ANDROID__
17081 #include <unistd.h>
17082 #endif
17083 #include <sys/prctl.h>
17084
17085 int main (int argc, char *argv[])
17086 {
17087     return (prctl (PR_SET_NAME, "Test"));
17088     } /* main */
17089 EOM
17090         set try
17091         if eval $compile_ok && $run ./try; then
17092             echo "Your prctl (PR_SET_NAME, ...) works"
17093             d_prctl_set_name=$define
17094             fi
17095         $rm_try
17096         ;;
17097     esac
17098
17099 : see if readlink exists
17100 set readlink d_readlink
17101 eval $inlibc
17102
17103 : Check if exe is symlink to abs path of executing program
17104 echo " "
17105 procselfexe=''
17106 val="$undef"
17107 case "$d_procselfexe" in
17108 '')
17109 case "$d_readlink" in
17110     "$define")
17111         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
17112         : more tidy to avoid an extra level of symlink
17113         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17114         while test $# -gt 0; do
17115             type=$1; try=$2
17116             shift; shift
17117             if $issymlink $try; then
17118                 $ls -l $try > reflect
17119                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17120                     echo "You have $type-like $try."
17121                     procselfexe='"'$try'"'
17122                     val="$define"
17123                     : This will break out of the loop
17124                     set X; shift
17125                 fi
17126             fi
17127         done
17128         ;;
17129 esac
17130 $rm -f reflect
17131 set d_procselfexe
17132 eval $setvar
17133 ;;
17134 esac
17135
17136 : backward compatibility for d_hvfork
17137 if test X$d_hvfork != X; then
17138         d_vfork="$d_hvfork"
17139         d_hvfork=''
17140 fi
17141 : see if there is a vfork
17142 val=''
17143 set vfork val
17144 eval $inlibc
17145
17146 d_pseudofork=$undef
17147
17148 : Ok, but do we want to use it. vfork is reportedly unreliable in
17149 : perl on Solaris 2.x, and probably elsewhere.
17150 case "$val" in
17151 $define)
17152         echo " "
17153         case "$usevfork" in
17154         false) dflt='n';;
17155         *) dflt='y';;
17156         esac
17157         cat <<'EOM'
17158
17159 Perl can only use a vfork() that doesn't suffer from strict
17160 restrictions on calling functions or modifying global data in
17161 the child.  For example, glibc-2.1 contains such a vfork()
17162 that is unsuitable.  If your system provides a proper fork()
17163 call, chances are that you do NOT want perl to use vfork().
17164
17165 EOM
17166         rp="Do you still want to use vfork()?"
17167         . ./myread
17168         case "$ans" in
17169         y|Y) ;;
17170         *)
17171                 echo "Ok, we won't use vfork()."
17172                 val="$undef"
17173                 ;;
17174         esac
17175         ;;
17176 esac
17177 set d_vfork
17178 eval $setvar
17179 case "$d_vfork" in
17180 $define) usevfork='true';;
17181 *) usevfork='false';;
17182 esac
17183
17184 : see whether the pthread_atfork exists
17185 $cat >try.c <<EOP
17186 #include <pthread.h>
17187 #include <stdio.h>
17188 int main() {
17189 #ifdef  PTHREAD_ATFORK
17190         pthread_atfork(NULL,NULL,NULL);
17191 #endif
17192 }
17193 EOP
17194
17195 : see if pthread_atfork exists
17196 set try -DPTHREAD_ATFORK
17197 if eval $compile; then
17198     val="$define"
17199 else
17200     val="$undef"
17201 fi
17202 case "$usethreads" in
17203 $define)
17204         case "$val" in
17205         $define) echo 'pthread_atfork found.' >&4        ;;
17206         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17207         esac
17208 esac
17209 set d_pthread_atfork
17210 eval $setvar
17211
17212 : see if pthread_attr_setscope exists
17213 set pthread_attr_setscope d_pthread_attr_setscope
17214 eval $inlibc
17215
17216 : see whether the various POSIXish _yields exist
17217 $cat >try.c <<EOP
17218 #include <pthread.h>
17219 #include <stdio.h>
17220 int main() {
17221 #ifdef SCHED_YIELD
17222         sched_yield();
17223 #else
17224 #ifdef PTHREAD_YIELD
17225         pthread_yield();
17226 #else
17227 #ifdef PTHREAD_YIELD_NULL
17228         pthread_yield(NULL);
17229 #endif
17230 #endif
17231 #endif
17232 }
17233 EOP
17234 : see if sched_yield exists
17235 set try -DSCHED_YIELD
17236 if eval $compile; then
17237     val="$define"
17238     sched_yield='sched_yield()'
17239 else
17240     val="$undef"
17241 fi
17242 case "$usethreads" in
17243 $define)
17244         case "$val" in
17245         $define) echo 'sched_yield() found.' >&4        ;;
17246         *)       echo 'sched_yield() NOT found.' >&4    ;;
17247         esac
17248 esac
17249 set d_sched_yield
17250 eval $setvar
17251
17252 : see if pthread_yield exists
17253 set try -DPTHREAD_YIELD
17254 if eval $compile; then
17255     val="$define"
17256     case "$sched_yield" in
17257     '') sched_yield='pthread_yield()' ;;
17258     esac
17259 else
17260     set try -DPTHREAD_YIELD_NULL
17261     if eval $compile; then
17262         val="$define"
17263         case "$sched_yield" in
17264         '') sched_yield='pthread_yield(NULL)' ;;
17265         esac
17266     else
17267         val="$undef"
17268     fi
17269 fi
17270 case "$usethreads" in
17271 $define)
17272         case "$val" in
17273         $define) echo 'pthread_yield() found.' >&4      ;;
17274         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17275         esac
17276         ;;
17277 esac
17278 set d_pthread_yield
17279 eval $setvar
17280 case "$sched_yield" in
17281 '') sched_yield=undef ;;
17282 esac
17283 $rm_try
17284
17285 : check for ptrdiff_t
17286 echo " "
17287 echo "Checking to see if you have ptrdiff_t..." >&4
17288 $cat >try.c <<EOCP
17289 #include <stddef.h>
17290 int main() { ptrdiff_t x = 7; }
17291 EOCP
17292 set try
17293 if eval $compile; then
17294         val="$define"
17295         echo "You have ptrdiff_t."
17296 else
17297         val="$undef"
17298         echo "You do not have ptrdiff_t."
17299 fi
17300 $rm_try
17301 set d_ptrdiff_t
17302 eval $setvar
17303
17304 : see if random_r exists
17305 set random_r d_random_r
17306 eval $inlibc
17307 case "$d_random_r" in
17308 "$define")
17309         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17310         case "$d_random_r_proto:$usethreads" in
17311         ":define")      d_random_r_proto=define
17312                 set d_random_r_proto random_r $hdrs
17313                 eval $hasproto ;;
17314         *)      ;;
17315         esac
17316         case "$d_random_r_proto" in
17317         define)
17318         case "$random_r_proto" in
17319         ''|0) try='int random_r(int*, struct random_data*);'
17320         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17321         esac
17322         case "$random_r_proto" in
17323         ''|0) try='int random_r(long*, struct random_data*);'
17324         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17325         esac
17326         case "$random_r_proto" in
17327         ''|0) try='int random_r(struct random_data*, int32_t*);'
17328         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17329         esac
17330         case "$random_r_proto" in
17331         ''|0)   d_random_r=undef
17332                 random_r_proto=0
17333                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17334         * )     case "$random_r_proto" in
17335                 REENTRANT_PROTO*) ;;
17336                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17337                 esac
17338                 echo "Prototype: $try" ;;
17339         esac
17340         ;;
17341         *)      case "$usethreads" in
17342                 define) echo "random_r has no prototype, not using it." >&4 ;;
17343                 esac
17344                 d_random_r=undef
17345                 random_r_proto=0
17346                 ;;
17347         esac
17348         ;;
17349 *)      random_r_proto=0
17350         ;;
17351 esac
17352
17353 : see if readdir and friends exist
17354 set readdir d_readdir
17355 eval $inlibc
17356 set seekdir d_seekdir
17357 eval $inlibc
17358 set telldir d_telldir
17359 eval $inlibc
17360 set rewinddir d_rewinddir
17361 eval $inlibc
17362
17363 : see if readdir64_r exists
17364 set readdir64_r d_readdir64_r
17365 eval $inlibc
17366 case "$d_readdir64_r" in
17367 "$define")
17368         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17369         case "$d_readdir64_r_proto:$usethreads" in
17370         ":define")      d_readdir64_r_proto=define
17371                 set d_readdir64_r_proto readdir64_r $hdrs
17372                 eval $hasproto ;;
17373         *)      ;;
17374         esac
17375         case "$d_readdir64_r_proto" in
17376         define)
17377         case "$readdir64_r_proto" in
17378         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17379         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17380         esac
17381         case "$readdir64_r_proto" in
17382         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17383         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17384         esac
17385         case "$readdir64_r_proto" in
17386         ''|0)   d_readdir64_r=undef
17387                 readdir64_r_proto=0
17388                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17389         * )     case "$readdir64_r_proto" in
17390                 REENTRANT_PROTO*) ;;
17391                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17392                 esac
17393                 echo "Prototype: $try" ;;
17394         esac
17395         ;;
17396         *)      case "$usethreads" in
17397                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17398                 esac
17399                 d_readdir64_r=undef
17400                 readdir64_r_proto=0
17401                 ;;
17402         esac
17403         ;;
17404 *)      readdir64_r_proto=0
17405         ;;
17406 esac
17407
17408 : see if readdir_r exists
17409 set readdir_r d_readdir_r
17410 eval $inlibc
17411 case "$d_readdir_r" in
17412 "$define")
17413         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17414         case "$d_readdir_r_proto:$usethreads" in
17415         ":define")      d_readdir_r_proto=define
17416                 set d_readdir_r_proto readdir_r $hdrs
17417                 eval $hasproto ;;
17418         *)      ;;
17419         esac
17420         case "$d_readdir_r_proto" in
17421         define)
17422         case "$readdir_r_proto" in
17423         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17424         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17425         esac
17426         case "$readdir_r_proto" in
17427         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17428         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17429         esac
17430         case "$readdir_r_proto" in
17431         ''|0)   d_readdir_r=undef
17432                 readdir_r_proto=0
17433                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17434         * )     case "$readdir_r_proto" in
17435                 REENTRANT_PROTO*) ;;
17436                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17437                 esac
17438                 echo "Prototype: $try" ;;
17439         esac
17440         ;;
17441         *)      case "$usethreads" in
17442                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17443                 esac
17444                 d_readdir_r=undef
17445                 readdir_r_proto=0
17446                 ;;
17447         esac
17448         ;;
17449 *)      readdir_r_proto=0
17450         ;;
17451 esac
17452
17453 : see if readv exists
17454 set readv d_readv
17455 eval $inlibc
17456
17457 : see if recvmsg exists
17458 set recvmsg d_recvmsg
17459 eval $inlibc
17460
17461 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17462 echo " "
17463 if set regcomp val -f d_regcomp; eval $csym; $val; then
17464         echo 'regcomp() found.' >&4
17465         d_regcomp="$define"
17466         d_regcmp="$undef"
17467         d_re_comp="$undef"
17468 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17469         echo 'regcmp() found.' >&4
17470         d_regcmp="$define"
17471         d_regcomp="$undef"
17472         d_re_comp="$undef"
17473 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17474         echo 're_comp() found, assuming re_exec() also exists.' >&4
17475         d_re_comp="$define"
17476         d_regcomp="$undef"
17477         d_regcmp="$undef"
17478 else
17479         $cat >&4 <<EOM
17480 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17481 EOM
17482         d_regcmp="$undef"
17483         d_re_comp="$undef"
17484         d_regcomp="$undef"
17485 fi
17486
17487 : see if remainder exists
17488 set remainder d_remainder
17489 eval $inlibc
17490
17491 : see if remquo exists
17492 set remquo d_remquo
17493 eval $inlibc
17494
17495 : see if rename exists
17496 set rename d_rename
17497 eval $inlibc
17498
17499 : see if rint exists
17500 set rint d_rint
17501 eval $inlibc
17502
17503 : see if rmdir exists
17504 set rmdir d_rmdir
17505 eval $inlibc
17506
17507 : see if round exists
17508 set round d_round
17509 eval $inlibc
17510
17511 : see if memory.h is available.
17512 val=''
17513 set memory.h val
17514 eval $inhdr
17515
17516 : See if it conflicts with string.h
17517 case "$val" in
17518 $define)
17519         case "$strings" in
17520         '') ;;
17521         *)
17522                 $cppstdin $cppflags $cppminus < $strings > mem.h
17523                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17524                         echo " "
17525                         echo "We won't be including <memory.h>."
17526                         val="$undef"
17527                 fi
17528                 $rm -f mem.h
17529                 ;;
17530         esac
17531 esac
17532 set i_memory
17533 eval $setvar
17534
17535 : can bcopy handle overlapping blocks?
17536 echo " "
17537 val="$undef"
17538 case "$d_memmove" in
17539 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17540 *)      case "$d_bcopy" in
17541         "$define")
17542                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17543                 $cat >try.c <<EOCP
17544 #$i_memory I_MEMORY
17545 #$i_stdlib I_STDLIB
17546 #$i_string I_STRING
17547 #$i_unistd I_UNISTD
17548 EOCP
17549         $cat >>try.c <<'EOCP'
17550 #include <stdio.h>
17551 #ifdef I_MEMORY
17552 #  include <memory.h>
17553 #endif
17554 #ifdef I_STDLIB
17555 #  include <stdlib.h>
17556 #endif
17557 #ifdef I_STRING
17558 #  include <string.h>
17559 #else
17560 #  include <strings.h>
17561 #endif
17562 #ifdef I_UNISTD
17563 #  include <unistd.h>  /* Needed for NetBSD */
17564 #endif
17565 int main()
17566 {
17567 char buf[128], abc[128];
17568 char *b;
17569 int len;
17570 int off;
17571 int align;
17572
17573 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17574    try to store the string in read-only memory. */
17575 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17576
17577 for (align = 7; align >= 0; align--) {
17578         for (len = 36; len; len--) {
17579                 b = buf+align;
17580                 bcopy(abc, b, len);
17581                 for (off = 1; off <= len; off++) {
17582                         bcopy(b, b+off, len);
17583                         bcopy(b+off, b, len);
17584                         if (bcmp(b, abc, len))
17585                                 exit(1);
17586                 }
17587         }
17588 }
17589 exit(0);
17590 }
17591 EOCP
17592                 set try
17593                 if eval $compile_ok; then
17594                         if $run ./try 2>/dev/null; then
17595                                 echo "Yes, it can."
17596                                 val="$define"
17597                         else
17598                                 echo "It can't, sorry."
17599                         fi
17600                 else
17601                         echo "(I can't compile the test program, so we'll assume not...)"
17602                 fi
17603                 ;;
17604         esac
17605         $rm_try
17606         ;;
17607 esac
17608 set d_safebcpy
17609 eval $setvar
17610
17611 : can memcpy handle overlapping blocks?
17612 echo " "
17613 val="$undef"
17614 case "$d_memmove" in
17615 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17616 *)      case "$d_memcpy" in
17617         "$define")
17618                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17619                 $cat >try.c <<EOCP
17620 #$i_memory I_MEMORY
17621 #$i_stdlib I_STDLIB
17622 #$i_string I_STRING
17623 #$i_unistd I_UNISTD
17624 EOCP
17625         $cat >>try.c <<'EOCP'
17626 #include <stdio.h>
17627 #ifdef I_MEMORY
17628 #  include <memory.h>
17629 #endif
17630 #ifdef I_STDLIB
17631 #  include <stdlib.h>
17632 #endif
17633 #ifdef I_STRING
17634 #  include <string.h>
17635 #else
17636 #  include <strings.h>
17637 #endif
17638 #ifdef I_UNISTD
17639 #  include <unistd.h>  /* Needed for NetBSD */
17640 #endif
17641 int main()
17642 {
17643 char buf[128], abc[128];
17644 char *b;
17645 int len;
17646 int off;
17647 int align;
17648
17649 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17650    try to store the string in read-only memory. */
17651 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17652
17653 for (align = 7; align >= 0; align--) {
17654         for (len = 36; len; len--) {
17655                 b = buf+align;
17656                 memcpy(b, abc, len);
17657                 for (off = 1; off <= len; off++) {
17658                         memcpy(b+off, b, len);
17659                         memcpy(b, b+off, len);
17660                         if (memcmp(b, abc, len))
17661                                 exit(1);
17662                 }
17663         }
17664 }
17665 exit(0);
17666 }
17667 EOCP
17668                 set try
17669                 if eval $compile_ok; then
17670                         if $run ./try 2>/dev/null; then
17671                                 echo "Yes, it can."
17672                                 val="$define"
17673                         else
17674                                 echo "It can't, sorry."
17675                         fi
17676                 else
17677                         echo "(I can't compile the test program, so we'll assume not...)"
17678                 fi
17679                 ;;
17680         esac
17681         $rm_try
17682         ;;
17683 esac
17684 set d_safemcpy
17685 eval $setvar
17686
17687 : can memcmp be trusted to compare relative magnitude?
17688 val="$undef"
17689 case "$d_memcmp" in
17690 "$define")
17691         echo " "
17692         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17693         $cat >try.c <<EOCP
17694 #$i_memory I_MEMORY
17695 #$i_stdlib I_STDLIB
17696 #$i_string I_STRING
17697 #$i_unistd I_UNISTD
17698 EOCP
17699         $cat >>try.c <<'EOCP'
17700 #include <stdio.h>
17701 #ifdef I_MEMORY
17702 #  include <memory.h>
17703 #endif
17704 #ifdef I_STDLIB
17705 #  include <stdlib.h>
17706 #endif
17707 #ifdef I_STRING
17708 #  include <string.h>
17709 #else
17710 #  include <strings.h>
17711 #endif
17712 #ifdef I_UNISTD
17713 #  include <unistd.h>  /* Needed for NetBSD */
17714 #endif
17715 int main()
17716 {
17717 char a = -1;
17718 char b = 0;
17719 if ((a < b) && memcmp(&a, &b, 1) < 0)
17720         exit(1);
17721 exit(0);
17722 }
17723 EOCP
17724         set try
17725         if eval $compile_ok; then
17726                 if $run ./try 2>/dev/null; then
17727                         echo "Yes, it can."
17728                         val="$define"
17729                 else
17730                         echo "No, it can't (it uses signed chars)."
17731                 fi
17732         else
17733                 echo "(I can't compile the test program, so we'll assume not...)"
17734         fi
17735         ;;
17736 esac
17737 $rm_try
17738 set d_sanemcmp
17739 eval $setvar
17740
17741 : see if prototype for sbrk is available
17742 echo " "
17743 set d_sbrkproto sbrk $i_unistd unistd.h
17744 eval $hasproto
17745
17746 : see if scalbn exists
17747 set scalbn d_scalbn
17748 eval $inlibc
17749
17750 : see if select exists
17751 set select d_select
17752 eval $inlibc
17753
17754 : see if semctl exists
17755 set semctl d_semctl
17756 eval $inlibc
17757
17758 : see if semget exists
17759 set semget d_semget
17760 eval $inlibc
17761
17762 : see if semop exists
17763 set semop d_semop
17764 eval $inlibc
17765
17766 : see how much of the 'sem*(2)' library is present.
17767 h_sem=true
17768 echo " "
17769 case "$d_semctl$d_semget$d_semop" in
17770 *"$undef"*) h_sem=false;;
17771 esac
17772 case "$osname" in
17773 freebsd)
17774     case "`ipcs 2>&1`" in
17775     "SVID messages"*"not configured"*)
17776         echo "Your $osname does not have the sem*(2) configured." >&4
17777         h_sem=false
17778         val="$undef"
17779         set semctl d_semctl
17780         eval $setvar
17781         set semget d_semget
17782         eval $setvar
17783         set semop d_semop
17784         eval $setvar
17785         ;;
17786     esac
17787     ;;
17788 esac
17789 : we could also check for sys/ipc.h ...
17790 if $h_sem && $test `./findhdr sys/sem.h`; then
17791         echo "You have the full sem*(2) library." >&4
17792         val="$define"
17793 else
17794         echo "You don't have the full sem*(2) library." >&4
17795         val="$undef"
17796 fi
17797 set d_sem
17798 eval $setvar
17799
17800 : see whether sys/sem.h defines union semun
17801 echo " "
17802 $cat > try.c <<'END'
17803 #include <sys/types.h>
17804 #include <sys/ipc.h>
17805 #include <sys/sem.h>
17806 int main () { union semun semun; semun.buf = 0; }
17807 END
17808 set try
17809 if eval $compile; then
17810     echo "You have union semun in <sys/sem.h>." >&4
17811     val="$define"
17812 else
17813     echo "You do not have union semun in <sys/sem.h>." >&4
17814     val="$undef"
17815 fi
17816 $rm_try
17817 set d_union_semun
17818 eval $setvar
17819
17820 : see how to do semctl IPC_STAT
17821 case "$d_sem" in
17822 $define)
17823     echo " "
17824     $cat > tryh.h <<END
17825 #ifndef S_IRUSR
17826 #   ifdef S_IREAD
17827 #       define S_IRUSR S_IREAD
17828 #       define S_IWUSR S_IWRITE
17829 #       define S_IXUSR S_IEXEC
17830 #   else
17831 #       define S_IRUSR 0400
17832 #       define S_IWUSR 0200
17833 #       define S_IXUSR 0100
17834 #   endif
17835 #   define S_IRGRP (S_IRUSR>>3)
17836 #   define S_IWGRP (S_IWUSR>>3)
17837 #   define S_IXGRP (S_IXUSR>>3)
17838 #   define S_IROTH (S_IRUSR>>6)
17839 #   define S_IWOTH (S_IWUSR>>6)
17840 #   define S_IXOTH (S_IXUSR>>6)
17841 #endif
17842 #ifndef S_IRWXU
17843 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17844 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17845 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17846 #endif
17847 END
17848     : see whether semctl IPC_STAT can use union semun
17849     case "$d_semctl_semun" in
17850     '')
17851       val="$undef"
17852       $cat > try.c <<END
17853 #include <sys/types.h>
17854 #include <sys/ipc.h>
17855 #include <sys/sem.h>
17856 #include <sys/stat.h>
17857 #include <stdio.h>
17858 #include <errno.h>
17859 #include "tryh.h"
17860 #ifndef errno
17861 extern int errno;
17862 #endif
17863 #$d_union_semun HAS_UNION_SEMUN
17864 int main() {
17865     union semun
17866 #ifndef HAS_UNION_SEMUN
17867     {
17868         int val;
17869         struct semid_ds *buf;
17870         unsigned short *array;
17871     }
17872 #endif
17873     arg;
17874     int sem, st;
17875
17876 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17877     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17878     if (sem > -1) {
17879         struct semid_ds argbuf;
17880         arg.buf = &argbuf;
17881 #       ifdef IPC_STAT
17882         st = semctl(sem, 0, IPC_STAT, arg);
17883         if (st == 0)
17884             printf("semun\n");
17885         else
17886 #       endif /* IPC_STAT */
17887             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17888 #       ifdef IPC_RMID
17889         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17890 #       endif /* IPC_RMID */
17891             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17892     } else
17893 #endif /* IPC_PRIVATE && ... */
17894         printf("semget failed: errno = %d\n", errno);
17895   return 0;
17896 }
17897 END
17898       set try
17899       if eval $compile; then
17900           xxx=`$run ./try`
17901           case "$xxx" in
17902           semun) val="$define" ;;
17903           esac
17904       fi
17905       $rm_try
17906       set d_semctl_semun
17907       eval $setvar
17908       ;;
17909     esac
17910     case "$d_semctl_semun" in
17911     $define)
17912         echo "You can use union semun for semctl IPC_STAT." >&4
17913         also='also'
17914         ;;
17915     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17916         also=''
17917         ;;
17918     esac
17919
17920     : see whether semctl IPC_STAT can use struct semid_ds pointer
17921     case "$d_semctl_semid_ds" in
17922     '')
17923       val="$undef"
17924       $cat > try.c <<'END'
17925 #include <sys/types.h>
17926 #include <sys/ipc.h>
17927 #include <sys/sem.h>
17928 #include <sys/stat.h>
17929 #include "tryh.h"
17930 #include <stdio.h>
17931 #include <errno.h>
17932 #ifndef errno
17933 extern int errno;
17934 #endif
17935 int main() {
17936     struct semid_ds arg;
17937     int sem, st;
17938
17939 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17940     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17941     if (sem > -1) {
17942 #       ifdef IPC_STAT
17943         st = semctl(sem, 0, IPC_STAT, &arg);
17944         if (st == 0)
17945             printf("semid_ds\n");
17946         else
17947 #       endif /* IPC_STAT */
17948             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17949 #       ifdef IPC_RMID
17950         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17951 #       endif /* IPC_RMID */
17952             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17953     } else
17954 #endif /* IPC_PRIVATE && ... */
17955         printf("semget failed: errno = %d\n", errno);
17956
17957     return 0;
17958 }
17959 END
17960       set try
17961       if eval $compile; then
17962           xxx=`$run ./try`
17963           case "$xxx" in
17964           semid_ds) val="$define" ;;
17965           esac
17966       fi
17967       $rm_try
17968       set d_semctl_semid_ds
17969       eval $setvar
17970       ;;
17971     esac
17972     case "$d_semctl_semid_ds" in
17973     $define)
17974         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17975         ;;
17976     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17977         ;;
17978     esac
17979     ;;
17980 *)  val="$undef"
17981
17982     # We do not have the full sem*(2) library, so assume we can not
17983     # use either.
17984
17985     set d_semctl_semun
17986     eval $setvar
17987
17988     set d_semctl_semid_ds
17989     eval $setvar
17990     ;;
17991 esac
17992 $rm_try tryh.h
17993
17994 : see if sendmsg exists
17995 set sendmsg d_sendmsg
17996 eval $inlibc
17997
17998 : see if setegid exists
17999 set setegid d_setegid
18000 eval $inlibc
18001
18002 : see if seteuid exists
18003 set seteuid d_seteuid
18004 eval $inlibc
18005
18006 : see if setgrent exists
18007 set setgrent d_setgrent
18008 eval $inlibc
18009
18010 : see if setgrent_r exists
18011 set setgrent_r d_setgrent_r
18012 eval $inlibc
18013 case "$d_setgrent_r" in
18014 "$define")
18015         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18016         case "$d_setgrent_r_proto:$usethreads" in
18017         ":define")      d_setgrent_r_proto=define
18018                 set d_setgrent_r_proto setgrent_r $hdrs
18019                 eval $hasproto ;;
18020         *)      ;;
18021         esac
18022         case "$d_setgrent_r_proto" in
18023         define)
18024         case "$setgrent_r_proto" in
18025         ''|0) try='int setgrent_r(FILE**);'
18026         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18027         esac
18028         case "$setgrent_r_proto" in
18029         ''|0) try='void setgrent_r(FILE**);'
18030         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18031         esac
18032         case "$setgrent_r_proto" in
18033         ''|0)   d_setgrent_r=undef
18034                 setgrent_r_proto=0
18035                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18036         * )     case "$setgrent_r_proto" in
18037                 REENTRANT_PROTO*) ;;
18038                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18039                 esac
18040                 echo "Prototype: $try" ;;
18041         esac
18042         ;;
18043         *)      case "$usethreads" in
18044                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18045                 esac
18046                 d_setgrent_r=undef
18047                 setgrent_r_proto=0
18048                 ;;
18049         esac
18050         ;;
18051 *)      setgrent_r_proto=0
18052         ;;
18053 esac
18054
18055 : see if sethostent exists
18056 set sethostent d_sethent
18057 eval $inlibc
18058
18059 : see if sethostent_r exists
18060 set sethostent_r d_sethostent_r
18061 eval $inlibc
18062 case "$d_sethostent_r" in
18063 "$define")
18064         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18065         case "$d_sethostent_r_proto:$usethreads" in
18066         ":define")      d_sethostent_r_proto=define
18067                 set d_sethostent_r_proto sethostent_r $hdrs
18068                 eval $hasproto ;;
18069         *)      ;;
18070         esac
18071         case "$d_sethostent_r_proto" in
18072         define)
18073         case "$sethostent_r_proto" in
18074         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18075         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18076         esac
18077         case "$sethostent_r_proto" in
18078         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18079         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18080         esac
18081         case "$sethostent_r_proto" in
18082         ''|0)   d_sethostent_r=undef
18083                 sethostent_r_proto=0
18084                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18085         * )     case "$sethostent_r_proto" in
18086                 REENTRANT_PROTO*) ;;
18087                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18088                 esac
18089                 echo "Prototype: $try" ;;
18090         esac
18091         ;;
18092         *)      case "$usethreads" in
18093                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18094                 esac
18095                 d_sethostent_r=undef
18096                 sethostent_r_proto=0
18097                 ;;
18098         esac
18099         ;;
18100 *)      sethostent_r_proto=0
18101         ;;
18102 esac
18103
18104 : see if setitimer exists
18105 set setitimer d_setitimer
18106 eval $inlibc
18107
18108 : see if setlinebuf exists
18109 set setlinebuf d_setlinebuf
18110 eval $inlibc
18111
18112 : see if setlocale exists
18113 set setlocale d_setlocale
18114 eval $inlibc
18115
18116 : see if locale.h is available
18117 set locale.h i_locale
18118 eval $inhdr
18119
18120 : see if setlocale_r exists
18121 set setlocale_r d_setlocale_r
18122 eval $inlibc
18123 case "$d_setlocale_r" in
18124 "$define")
18125         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18126         case "$d_setlocale_r_proto:$usethreads" in
18127         ":define")      d_setlocale_r_proto=define
18128                 set d_setlocale_r_proto setlocale_r $hdrs
18129                 eval $hasproto ;;
18130         *)      ;;
18131         esac
18132         case "$d_setlocale_r_proto" in
18133         define)
18134         case "$setlocale_r_proto" in
18135         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18136         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18137         esac
18138         case "$setlocale_r_proto" in
18139         ''|0)   d_setlocale_r=undef
18140                 setlocale_r_proto=0
18141                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18142         * )     case "$setlocale_r_proto" in
18143                 REENTRANT_PROTO*) ;;
18144                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18145                 esac
18146                 echo "Prototype: $try" ;;
18147         esac
18148         ;;
18149         *)      case "$usethreads" in
18150                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18151                 esac
18152                 d_setlocale_r=undef
18153                 setlocale_r_proto=0
18154                 ;;
18155         esac
18156         ;;
18157 *)      setlocale_r_proto=0
18158         ;;
18159 esac
18160
18161 : see if setnetent exists
18162 set setnetent d_setnent
18163 eval $inlibc
18164
18165 : see if setnetent_r exists
18166 set setnetent_r d_setnetent_r
18167 eval $inlibc
18168 case "$d_setnetent_r" in
18169 "$define")
18170         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18171         case "$d_setnetent_r_proto:$usethreads" in
18172         ":define")      d_setnetent_r_proto=define
18173                 set d_setnetent_r_proto setnetent_r $hdrs
18174                 eval $hasproto ;;
18175         *)      ;;
18176         esac
18177         case "$d_setnetent_r_proto" in
18178         define)
18179         case "$setnetent_r_proto" in
18180         ''|0) try='int setnetent_r(int, struct netent_data*);'
18181         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18182         esac
18183         case "$setnetent_r_proto" in
18184         ''|0) try='void setnetent_r(int, struct netent_data*);'
18185         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18186         esac
18187         case "$setnetent_r_proto" in
18188         ''|0)   d_setnetent_r=undef
18189                 setnetent_r_proto=0
18190                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18191         * )     case "$setnetent_r_proto" in
18192                 REENTRANT_PROTO*) ;;
18193                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18194                 esac
18195                 echo "Prototype: $try" ;;
18196         esac
18197         ;;
18198         *)      case "$usethreads" in
18199                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18200                 esac
18201                 d_setnetent_r=undef
18202                 setnetent_r_proto=0
18203                 ;;
18204         esac
18205         ;;
18206 *)      setnetent_r_proto=0
18207         ;;
18208 esac
18209
18210 : see if setprotoent exists
18211 set setprotoent d_setpent
18212 eval $inlibc
18213
18214 : see if setpgid exists
18215 set setpgid d_setpgid
18216 eval $inlibc
18217
18218 : see if setpgrp2 exists
18219 set setpgrp2 d_setpgrp2
18220 eval $inlibc
18221
18222 : see if setpriority exists
18223 set setpriority d_setprior
18224 eval $inlibc
18225
18226 : see if setproctitle exists
18227 set setproctitle d_setproctitle
18228 eval $inlibc
18229
18230 : see if setprotoent_r exists
18231 set setprotoent_r d_setprotoent_r
18232 eval $inlibc
18233 case "$d_setprotoent_r" in
18234 "$define")
18235         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18236         case "$d_setprotoent_r_proto:$usethreads" in
18237         ":define")      d_setprotoent_r_proto=define
18238                 set d_setprotoent_r_proto setprotoent_r $hdrs
18239                 eval $hasproto ;;
18240         *)      ;;
18241         esac
18242         case "$d_setprotoent_r_proto" in
18243         define)
18244         case "$setprotoent_r_proto" in
18245         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18246         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18247         esac
18248         case "$setprotoent_r_proto" in
18249         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18250         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18251         esac
18252         case "$setprotoent_r_proto" in
18253         ''|0)   d_setprotoent_r=undef
18254                 setprotoent_r_proto=0
18255                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18256         * )     case "$setprotoent_r_proto" in
18257                 REENTRANT_PROTO*) ;;
18258                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18259                 esac
18260                 echo "Prototype: $try" ;;
18261         esac
18262         ;;
18263         *)      case "$usethreads" in
18264                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18265                 esac
18266                 d_setprotoent_r=undef
18267                 setprotoent_r_proto=0
18268                 ;;
18269         esac
18270         ;;
18271 *)      setprotoent_r_proto=0
18272         ;;
18273 esac
18274
18275 : see if setpwent exists
18276 set setpwent d_setpwent
18277 eval $inlibc
18278
18279 : see if setpwent_r exists
18280 set setpwent_r d_setpwent_r
18281 eval $inlibc
18282 case "$d_setpwent_r" in
18283 "$define")
18284         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18285         case "$d_setpwent_r_proto:$usethreads" in
18286         ":define")      d_setpwent_r_proto=define
18287                 set d_setpwent_r_proto setpwent_r $hdrs
18288                 eval $hasproto ;;
18289         *)      ;;
18290         esac
18291         case "$d_setpwent_r_proto" in
18292         define)
18293         case "$setpwent_r_proto" in
18294         ''|0) try='int setpwent_r(FILE**);'
18295         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18296         esac
18297         case "$setpwent_r_proto" in
18298         ''|0) try='void setpwent_r(FILE**);'
18299         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18300         esac
18301         case "$setpwent_r_proto" in
18302         ''|0)   d_setpwent_r=undef
18303                 setpwent_r_proto=0
18304                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18305         * )     case "$setpwent_r_proto" in
18306                 REENTRANT_PROTO*) ;;
18307                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18308                 esac
18309                 echo "Prototype: $try" ;;
18310         esac
18311         ;;
18312         *)      case "$usethreads" in
18313                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18314                 esac
18315                 d_setpwent_r=undef
18316                 setpwent_r_proto=0
18317                 ;;
18318         esac
18319         ;;
18320 *)      setpwent_r_proto=0
18321         ;;
18322 esac
18323
18324 : see if setregid exists
18325 set setregid d_setregid
18326 eval $inlibc
18327 set setresgid d_setresgid
18328 eval $inlibc
18329
18330 : see if setreuid exists
18331 set setreuid d_setreuid
18332 eval $inlibc
18333 set setresuid d_setresuid
18334 eval $inlibc
18335
18336 : see if setrgid exists
18337 set setrgid d_setrgid
18338 eval $inlibc
18339
18340 : see if setruid exists
18341 set setruid d_setruid
18342 eval $inlibc
18343
18344 : see if setservent exists
18345 set setservent d_setsent
18346 eval $inlibc
18347
18348 : see if setservent_r exists
18349 set setservent_r d_setservent_r
18350 eval $inlibc
18351 case "$d_setservent_r" in
18352 "$define")
18353         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18354         case "$d_setservent_r_proto:$usethreads" in
18355         ":define")      d_setservent_r_proto=define
18356                 set d_setservent_r_proto setservent_r $hdrs
18357                 eval $hasproto ;;
18358         *)      ;;
18359         esac
18360         case "$d_setservent_r_proto" in
18361         define)
18362         case "$setservent_r_proto" in
18363         ''|0) try='int setservent_r(int, struct servent_data*);'
18364         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18365         esac
18366         case "$setservent_r_proto" in
18367         ''|0) try='void setservent_r(int, struct servent_data*);'
18368         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18369         esac
18370         case "$setservent_r_proto" in
18371         ''|0)   d_setservent_r=undef
18372                 setservent_r_proto=0
18373                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18374         * )     case "$setservent_r_proto" in
18375                 REENTRANT_PROTO*) ;;
18376                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18377                 esac
18378                 echo "Prototype: $try" ;;
18379         esac
18380         ;;
18381         *)      case "$usethreads" in
18382                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18383                 esac
18384                 d_setservent_r=undef
18385                 setservent_r_proto=0
18386                 ;;
18387         esac
18388         ;;
18389 *)      setservent_r_proto=0
18390         ;;
18391 esac
18392
18393 : see if setsid exists
18394 set setsid d_setsid
18395 eval $inlibc
18396
18397 : see if setvbuf exists
18398 set setvbuf d_setvbuf
18399 eval $inlibc
18400
18401 : see if shmctl exists
18402 set shmctl d_shmctl
18403 eval $inlibc
18404
18405 : see if shmget exists
18406 set shmget d_shmget
18407 eval $inlibc
18408
18409 : see if shmat exists
18410 set shmat d_shmat
18411 eval $inlibc
18412 : see what shmat returns
18413 case "$d_shmat" in
18414 "$define")
18415         $cat >shmat.c <<'END'
18416 #include <sys/shm.h>
18417 void *shmat();
18418 END
18419         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18420                 shmattype='void *'
18421         else
18422                 shmattype='char *'
18423         fi
18424         echo "and it returns ($shmattype)." >&4
18425         : see if a prototype for shmat is available
18426         xxx=`./findhdr sys/shm.h`
18427         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18428         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18429                 val="$define"
18430         else
18431                 val="$undef"
18432         fi
18433         $rm -f shmat.[co]
18434         ;;
18435 *)
18436         val="$undef"
18437         ;;
18438 esac
18439 set d_shmatprototype
18440 eval $setvar
18441
18442 : see if shmdt exists
18443 set shmdt d_shmdt
18444 eval $inlibc
18445
18446 : see how much of the 'shm*(2)' library is present.
18447 h_shm=true
18448 echo " "
18449 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18450 *"$undef"*) h_shm=false;;
18451 esac
18452 case "$osname" in
18453 freebsd)
18454     case "`ipcs 2>&1`" in
18455     "SVID shared memory"*"not configured"*)
18456         echo "Your $osname does not have the shm*(2) configured." >&4
18457         h_shm=false
18458         val="$undef"
18459         set shmctl d_shmctl
18460         eval $setvar
18461         set shmget d_shmget
18462         eval $setvar
18463         set shmat d_shmat
18464         eval $setvar
18465         set shmdt d_shmdt
18466         eval $setvar
18467         ;;
18468     esac
18469     ;;
18470 esac
18471 : we could also check for sys/ipc.h ...
18472 if $h_shm && $test `./findhdr sys/shm.h`; then
18473         echo "You have the full shm*(2) library." >&4
18474         val="$define"
18475 else
18476         echo "You don't have the full shm*(2) library." >&4
18477         val="$undef"
18478 fi
18479 set d_shm
18480 eval $setvar
18481
18482 : see if we have sigaction
18483 echo " "
18484 if set sigaction val -f d_sigaction; eval $csym; $val; then
18485         echo 'sigaction() found.' >&4
18486         $cat > try.c <<EOP
18487 #include <stdio.h>
18488 #include <sys/types.h>
18489 #include <signal.h>
18490 #$i_stdlib I_STDLIB
18491 #ifdef I_STDLIB
18492 #include <stdlib.h>
18493 #endif
18494 int main()
18495 {
18496     struct sigaction act, oact;
18497     act.sa_flags = 0;
18498     oact.sa_handler = 0;
18499     /* so that act and oact are used */
18500     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18501 }
18502 EOP
18503         set try
18504         if eval $compile_ok; then
18505                 val="$define"
18506         else
18507                 echo "But you don't seem to have a usable struct sigaction." >&4
18508                 val="$undef"
18509         fi
18510 else
18511         echo 'sigaction NOT found.' >&4
18512         val="$undef"
18513 fi
18514 set d_sigaction; eval $setvar
18515 $rm_try
18516
18517 : see if this is a sunmath.h system
18518 set sunmath.h i_sunmath
18519 eval $inhdr
18520
18521 : see if signbit exists
18522 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18523 $cat >try.c <<EOCP
18524 #$i_math I_MATH
18525 #$i_sunmath I_SUNMATH
18526 #ifdef I_MATH
18527 #  include <math.h>
18528 #endif
18529 #ifdef I_SUNMATH  /* Solaris special math library */
18530 #  include <sunmath.h>
18531 #endif
18532 #define NV $nvtype
18533 int main(int argc, char **argv)
18534 {
18535     NV x = 0.0;
18536     NV y = -0.0;
18537     if ((signbit(x) == 0) && (signbit(y) != 0))
18538         return 0;
18539     else
18540         return 1;
18541 }
18542 EOCP
18543 val="$undef"
18544 set try
18545 if eval $compile; then
18546     if $run ./try; then
18547         $echo "Yes." >&4
18548         val="$define"
18549     else
18550         $echo "Signbit seems to be available, but doesn't work as I expected."
18551         $echo "I won't use it." >&4
18552         val="$undef"
18553     fi
18554 else
18555     $echo "Nope." >&4
18556     dflt="$undef"
18557 fi
18558 set d_signbit
18559 eval $setvar
18560 $rm_try
18561
18562 : see if sigprocmask exists
18563 set sigprocmask d_sigprocmask
18564 eval $inlibc
18565
18566 : see if sigsetjmp exists
18567 echo " "
18568 case "$d_sigsetjmp" in
18569 '')
18570         $cat >try.c <<EOP
18571 #include <setjmp.h>
18572 #$i_stdlib I_STDLIB
18573 #ifdef I_STDLIB
18574 #include <stdlib.h>
18575 #endif
18576 sigjmp_buf env;
18577 int set = 1;
18578 int main()
18579 {
18580         if (sigsetjmp(env,1))
18581                 exit(set);
18582         set = 0;
18583         siglongjmp(env, 1);
18584         exit(1);
18585 }
18586 EOP
18587         set try
18588         if eval $compile; then
18589                 if $run ./try >/dev/null 2>&1; then
18590                         echo "POSIX sigsetjmp found." >&4
18591                         val="$define"
18592                 else
18593                         $cat >&4 <<EOM
18594 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18595 I'll ignore them.
18596 EOM
18597                         val="$undef"
18598                 fi
18599         else
18600                 echo "sigsetjmp not found." >&4
18601                 val="$undef"
18602         fi
18603         ;;
18604 *) val="$d_sigsetjmp"
18605         case "$d_sigsetjmp" in
18606         $define) echo "POSIX sigsetjmp found." >&4;;
18607         $undef) echo "sigsetjmp not found." >&4;;
18608         esac
18609         ;;
18610 esac
18611 set d_sigsetjmp
18612 eval $setvar
18613 $rm_try
18614
18615 : see if snprintf exists
18616 set snprintf d_snprintf
18617 eval $inlibc
18618
18619 : see if vsnprintf exists
18620 set vsnprintf d_vsnprintf
18621 eval $inlibc
18622
18623 case "$d_snprintf-$d_vsnprintf" in
18624 "$define-$define")
18625     $cat <<EOM
18626 Checking whether your snprintf() and vsnprintf() work okay...
18627 EOM
18628     $cat >try.c <<'EOCP'
18629 /* v?snprintf testing logic courtesy of Russ Allbery.
18630  * According to C99:
18631  * - if the buffer is too short it still must be \0-terminated
18632  * - if the buffer is too short the potentially required length
18633  *   must be returned and not -1
18634  * - if the buffer is NULL the potentially required length
18635  *   must be returned and not -1 or core dump
18636  */
18637 #include <stdio.h>
18638 #include <stdarg.h>
18639
18640 char buf[2];
18641
18642 int test (char *format, ...)
18643 {
18644     va_list args;
18645     int count;
18646
18647     va_start (args, format);
18648     count = vsnprintf (buf, sizeof buf, format, args);
18649     va_end (args);
18650     return count;
18651 }
18652
18653 int main ()
18654 {
18655     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18656              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18657 }
18658 EOCP
18659     set try
18660     if eval $compile; then
18661         `$run ./try`
18662         case "$?" in
18663         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18664         *) cat <<EOM >&4
18665 Your snprintf() and snprintf() don't seem to be working okay.
18666 EOM
18667            d_snprintf="$undef"
18668            d_vsnprintf="$undef"
18669            ;;
18670         esac
18671     else
18672         echo "(I can't seem to compile the test program--assuming they don't)"
18673         d_snprintf="$undef"
18674         d_vsnprintf="$undef"
18675     fi
18676     $rm_try
18677     ;;
18678 esac
18679
18680 : see if sockatmark exists
18681 set sockatmark d_sockatmark
18682 eval $inlibc
18683
18684 : see if prototype for sockatmark is available
18685 echo " "
18686 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18687 eval $hasproto
18688
18689 : see if socks5_init exists
18690 set socks5_init d_socks5_init
18691 eval $inlibc
18692
18693 : see if sprintf returns the length of the string in the buffer as per ANSI
18694 $echo "Checking whether sprintf returns the length of the string..." >&4
18695 $cat <<EOP >try.c
18696 #include <stdio.h>
18697 #$i_stdlib I_STDLIB
18698 #ifdef I_STDLIB
18699 #include <stdlib.h>
18700 #endif
18701 #$i_string I_STRING
18702 #ifdef I_STRING
18703 #  include <string.h>
18704 #else
18705 #  include <strings.h>
18706 #endif
18707 #$i_math I_MATH
18708 #ifdef I_MATH
18709 #include <math.h>
18710 #endif
18711
18712 char buffer[256];
18713
18714 int check (size_t expect, int test) {
18715   size_t got = strlen(buffer);
18716   if (expect == got)
18717     return 0;
18718
18719   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18720        test, buffer);
18721   exit (test);
18722 }
18723
18724 int main(int argc, char **argv) {
18725   int test = 0;
18726
18727   check(sprintf(buffer, ""), ++test);
18728   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18729   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18730
18731   return 0;
18732 }
18733 EOP
18734 set try
18735
18736 if eval $compile; then
18737     xxx="`$run ./try`"
18738     case "$?" in
18739         0) cat >&4 <<EOM
18740 sprintf returns the length of the string (as ANSI says it should)
18741 EOM
18742         d_sprintf_returns_strlen="$define"
18743         ;;
18744         *) cat >&4 <<EOM
18745 sprintf does not return the length of the string (how old is this system?)
18746 EOM
18747         d_sprintf_returns_strlen="$undef"
18748         ;;
18749     esac
18750 else
18751     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18752     d_sprintf_returns_strlen="$undef"
18753 fi
18754 $rm_try
18755
18756 : see if srand48_r exists
18757 set srand48_r d_srand48_r
18758 eval $inlibc
18759 case "$d_srand48_r" in
18760 "$define")
18761         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18762         case "$d_srand48_r_proto:$usethreads" in
18763         ":define")      d_srand48_r_proto=define
18764                 set d_srand48_r_proto srand48_r $hdrs
18765                 eval $hasproto ;;
18766         *)      ;;
18767         esac
18768         case "$d_srand48_r_proto" in
18769         define)
18770         case "$srand48_r_proto" in
18771         ''|0) try='int srand48_r(long, struct drand48_data*);'
18772         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18773         esac
18774         case "$srand48_r_proto" in
18775         ''|0)   d_srand48_r=undef
18776                 srand48_r_proto=0
18777                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18778         * )     case "$srand48_r_proto" in
18779                 REENTRANT_PROTO*) ;;
18780                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18781                 esac
18782                 echo "Prototype: $try" ;;
18783         esac
18784         ;;
18785         *)      case "$usethreads" in
18786                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18787                 esac
18788                 d_srand48_r=undef
18789                 srand48_r_proto=0
18790                 ;;
18791         esac
18792         ;;
18793 *)      srand48_r_proto=0
18794         ;;
18795 esac
18796
18797 : see if srandom_r exists
18798 set srandom_r d_srandom_r
18799 eval $inlibc
18800 case "$d_srandom_r" in
18801 "$define")
18802         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18803         case "$d_srandom_r_proto:$usethreads" in
18804         ":define")      d_srandom_r_proto=define
18805                 set d_srandom_r_proto srandom_r $hdrs
18806                 eval $hasproto ;;
18807         *)      ;;
18808         esac
18809         case "$d_srandom_r_proto" in
18810         define)
18811         case "$srandom_r_proto" in
18812         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18813         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18814         esac
18815         case "$srandom_r_proto" in
18816         ''|0)   d_srandom_r=undef
18817                 srandom_r_proto=0
18818                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18819         * )     case "$srandom_r_proto" in
18820                 REENTRANT_PROTO*) ;;
18821                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18822                 esac
18823                 echo "Prototype: $try" ;;
18824         esac
18825         ;;
18826         *)      case "$usethreads" in
18827                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18828                 esac
18829                 d_srandom_r=undef
18830                 srandom_r_proto=0
18831                 ;;
18832         esac
18833         ;;
18834 *)      srandom_r_proto=0
18835         ;;
18836 esac
18837
18838 : see if prototype for setresgid is available
18839 echo " "
18840 set d_sresgproto setresgid $i_unistd unistd.h
18841 eval $hasproto
18842
18843 : see if prototype for setresuid is available
18844 echo " "
18845 set d_sresuproto setresuid $i_unistd unistd.h
18846 eval $hasproto
18847
18848 : see if stat exists
18849 set stat d_stat
18850 eval $inlibc
18851
18852 : see if sys/stat.h is available
18853 set sys/stat.h i_sysstat
18854 eval $inhdr
18855
18856 : see if stat knows about block sizes
18857 echo " "
18858 echo "Checking to see if your struct stat has st_blocks field..." >&4
18859 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18860 eval $hasfield
18861
18862 : see what flavor, if any, of static inline is supported
18863 echo " "
18864 echo "Checking to see if your system supports static inline..."
18865 $cat > try.c <<'EOCP'
18866 #include <stdlib.h>
18867 extern int f_via_a(int x);
18868 extern int f_via_b(int x);
18869 int main(int argc, char **argv)
18870 {
18871     int y;
18872
18873     y = f_via_a(0);
18874 #ifdef USE_B
18875     y = f_via_b(0);
18876 #endif
18877     if (y == 42) {
18878         return EXIT_SUCCESS;
18879     }
18880     else {
18881         return EXIT_FAILURE;
18882     }
18883 }
18884 EOCP
18885 $cat > a.c <<'EOCP'
18886 static INLINE int f(int x) {
18887     int y;
18888     y = x + 42;
18889     return y;
18890 }
18891
18892 int f_via_a(int x)
18893 {
18894     return f(x);
18895 }
18896 EOCP
18897 $cat > b.c <<'EOCP'
18898 extern int f(int x);
18899
18900 int f_via_b(int x)
18901 {
18902     return f(x);
18903 }
18904 EOCP
18905
18906 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18907 case "$perl_static_inline" in
18908 '')     # Check the various possibilities, and break out on success.
18909         # For gcc, prefer __inline__, which will still permit
18910         # cflags.SH to add in -ansi.
18911         case "$gccversion" in
18912                 '') xxx="inline __inline__ __inline _inline";;
18913                 *)  xxx="__inline__ inline __inline _inline";;
18914         esac
18915         for inline in $xxx; do
18916                 set try -DINLINE=$inline a.c
18917                 if eval $compile && $run ./try; then
18918                         # Now make sure there is no external linkage of static
18919                         # functions
18920                         set try -DINLINE=$inline -DUSE_B a.c b.c
18921                         if eval $compile && $run ./try; then
18922                                 $echo "Your compiler supports static $inline, " >&4
18923                                 $echo "but it also creates an external definition," >&4
18924                                 $echo "so I won't use it." >&4
18925                                 val=$undef
18926                         else
18927                                 $echo "Your compiler supports static $inline." >&4
18928                                 val=$define
18929                                 perl_static_inline="static $inline";
18930                                 break;
18931                         fi
18932                 else
18933                         $echo "Your compiler does NOT support static $inline." >&4
18934                         val="$undef"
18935                 fi
18936         done
18937         ;;
18938 *inline*) # Some variant of inline exists.
18939         echo "Keeping your $hint value of $perl_static_inline."
18940         val=$define
18941         ;;
18942 static)  # No inline capabilities
18943         echo "Keeping your $hint value of $perl_static_inline."
18944         val=$undef
18945         ;;
18946 *)  # Unrecognized previous value -- blindly trust the supplied
18947         # value and hope it makes sense.  Use old value for
18948         # d_static_inline, if there is one.
18949         echo "Keeping your $hint value of $perl_static_inline."
18950         case "$d_static_inline" in
18951                 '') val=$define ;;
18952                 *)  val=$d_static_inline ;;
18953         esac
18954         ;;
18955 esac
18956 # Fallback to plain 'static' if nothing worked.
18957 case "$perl_static_inline" in
18958 '')
18959         perl_static_inline="static"
18960         val=$undef
18961         ;;
18962 esac
18963 set d_static_inline
18964 eval $setvar
18965 $rm -f a.[co] b.[co]
18966 $rm_try
18967
18968 : Check stream access
18969 $cat >&4 <<EOM
18970 Checking how to access stdio streams by file descriptor number...
18971 EOM
18972 case "$stdio_stream_array" in
18973 '')     $cat >try.c <<EOCP
18974 #include <stdio.h>
18975 int main() {
18976   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18977     printf("yes\n");
18978 }
18979 EOCP
18980         for s in _iob __iob __sF
18981         do
18982                 set try -DSTDIO_STREAM_ARRAY=$s
18983                 if eval $compile; then
18984                         case "`$run ./try`" in
18985                         yes)    stdio_stream_array=$s; break ;;
18986                         esac
18987                 fi
18988         done
18989         $rm_try
18990 esac
18991 case "$stdio_stream_array" in
18992 '')     $cat >&4 <<EOM
18993 I can't figure out how to access stdio streams by file descriptor number.
18994 EOM
18995         d_stdio_stream_array="$undef"
18996         ;;
18997 *)      $cat >&4 <<EOM
18998 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18999 EOM
19000         d_stdio_stream_array="$define"
19001         ;;
19002 esac
19003
19004 : see if strcoll exists
19005 set strcoll d_strcoll
19006 eval $inlibc
19007
19008 : check for structure copying
19009 echo " "
19010 echo "Checking to see if your C compiler can copy structs..." >&4
19011 $cat >try.c <<'EOCP'
19012 int main()
19013 {
19014         struct blurfl {
19015                 int dyick;
19016         } foo, bar;
19017
19018         foo = bar;
19019 }
19020 EOCP
19021 if $cc -c try.c >/dev/null 2>&1 ; then
19022         val="$define"
19023         echo "Yup, it can."
19024 else
19025         val="$undef"
19026         echo "Nope, it can't."
19027 fi
19028 set d_strctcpy
19029 eval $setvar
19030 $rm_try
19031
19032 : see if strerror and/or sys_errlist[] exist
19033 echo " "
19034 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19035     if set strerror val -f d_strerror; eval $csym; $val; then
19036                 echo 'strerror() found.' >&4
19037                 d_strerror="$define"
19038                 d_strerrm='strerror(e)'
19039                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19040                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19041                         d_syserrlst="$define"
19042                 else
19043                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19044                         d_syserrlst="$undef"
19045                 fi
19046     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19047                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19048                 echo 'strerror() found in string header.' >&4
19049                 d_strerror="$define"
19050                 d_strerrm='strerror(e)'
19051                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19052                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19053                                 d_syserrlst="$define"
19054                 else
19055                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19056                         d_syserrlst="$undef"
19057                 fi
19058     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19059                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19060                 d_strerror="$undef"
19061                 d_syserrlst="$define"
19062                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19063     else
19064                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19065                 d_strerror="$undef"
19066                 d_syserrlst="$undef"
19067                 d_strerrm='"unknown"'
19068     fi
19069 fi
19070
19071 : see if strerror_r exists
19072 set strerror_r d_strerror_r
19073 eval $inlibc
19074 case "$d_strerror_r" in
19075 "$define")
19076         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19077         case "$d_strerror_r_proto:$usethreads" in
19078         ":define")      d_strerror_r_proto=define
19079                 set d_strerror_r_proto strerror_r $hdrs
19080                 eval $hasproto ;;
19081         *)      ;;
19082         esac
19083         case "$d_strerror_r_proto" in
19084         define)
19085         case "$strerror_r_proto" in
19086         ''|0) try='int strerror_r(int, char*, size_t);'
19087         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19088         esac
19089         case "$strerror_r_proto" in
19090         ''|0) try='int strerror_r(int, char*, int);'
19091         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19092         esac
19093         case "$strerror_r_proto" in
19094         ''|0) try='char* strerror_r(int, char*, size_t);'
19095         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19096         esac
19097         case "$strerror_r_proto" in
19098         ''|0)   d_strerror_r=undef
19099                 strerror_r_proto=0
19100                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19101         * )     case "$strerror_r_proto" in
19102                 REENTRANT_PROTO*) ;;
19103                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19104                 esac
19105                 echo "Prototype: $try" ;;
19106         esac
19107         ;;
19108         *)      case "$usethreads" in
19109                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19110                 esac
19111                 d_strerror_r=undef
19112                 strerror_r_proto=0
19113                 ;;
19114         esac
19115         ;;
19116 *)      strerror_r_proto=0
19117         ;;
19118 esac
19119
19120 : see if strftime exists
19121 set strftime d_strftime
19122 eval $inlibc
19123
19124 : see if strlcat exists
19125 set strlcat d_strlcat
19126 eval $inlibc
19127
19128 : see if strlcpy exists
19129 set strlcpy d_strlcpy
19130 eval $inlibc
19131
19132 : see if strtod exists
19133 set strtod d_strtod
19134 eval $inlibc
19135
19136 : see if strtol exists
19137 set strtol d_strtol
19138 eval $inlibc
19139
19140 : see if strtold exists
19141 set strtold d_strtold
19142 eval $inlibc
19143
19144 : see if strtoll exists
19145 set strtoll d_strtoll
19146 eval $inlibc
19147
19148 case "$d_longlong-$d_strtoll" in
19149 "$define-$define")
19150         $cat <<EOM
19151 Checking whether your strtoll() works okay...
19152 EOM
19153         $cat >try.c <<'EOCP'
19154 #include <errno.h>
19155 #ifdef __hpux
19156 #define strtoll __strtoll
19157 #endif
19158 #ifdef __EMX__
19159 #define strtoll _strtoll
19160 #endif
19161 #include <stdio.h>
19162 extern long long int strtoll(char *s, char **, int);
19163 static int bad = 0;
19164 int check(char *s, long long ell, int een) {
19165         long long gll;
19166         errno = 0;
19167         gll = strtoll(s, 0, 10);
19168         if (!((gll == ell) && (errno == een)))
19169                 bad++;
19170 }
19171 int main() {
19172         check(" 1",                                      1LL, 0);
19173         check(" 0",                                      0LL, 0);
19174         check("-1",                                     -1LL, 0);
19175         check("-9223372036854775808", -9223372036854775808LL, 0);
19176         check("-9223372036854775808", -9223372036854775808LL, 0);
19177         check(" 9223372036854775807",  9223372036854775807LL, 0);
19178         check("-9223372036854775808", -9223372036854775808LL, 0);
19179         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19180         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19181         if (!bad)
19182                 printf("ok\n");
19183 }
19184 EOCP
19185         set try
19186         if eval $compile; then
19187                 yyy=`$run ./try`
19188                 case "$yyy" in
19189                 ok) echo "Your strtoll() seems to be working okay." ;;
19190                 *) cat <<EOM >&4
19191 Your strtoll() doesn't seem to be working okay.
19192 EOM
19193                    d_strtoll="$undef"
19194                    ;;
19195                 esac
19196         else
19197                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19198                 d_strtoll="$undef"
19199         fi
19200         ;;
19201 esac
19202
19203 : see if strtoq exists
19204 set strtoq d_strtoq
19205 eval $inlibc
19206
19207 : see if strtoul exists
19208 set strtoul d_strtoul
19209 eval $inlibc
19210
19211 case "$d_strtoul" in
19212 "$define")
19213         $cat <<EOM
19214 Checking whether your strtoul() works okay...
19215 EOM
19216         $cat >try.c <<'EOCP'
19217 #include <errno.h>
19218 #include <stdio.h>
19219 extern unsigned long int strtoul(char *s, char **, int);
19220 static int bad = 0;
19221 void check(char *s, unsigned long eul, int een) {
19222         unsigned long gul;
19223         errno = 0;
19224         gul = strtoul(s, 0, 10);
19225         if (!((gul == eul) && (errno == een)))
19226                 bad++;
19227 }
19228 int main() {
19229         check(" 1", 1L, 0);
19230         check(" 0", 0L, 0);
19231 EOCP
19232         case "$longsize" in
19233         8)
19234             $cat >>try.c <<'EOCP'
19235         check("18446744073709551615", 18446744073709551615UL, 0);
19236         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19237 #if 0 /* strtoul() for /^-/ strings is undefined. */
19238         check("-1", 18446744073709551615UL, 0);
19239         check("-18446744073709551614", 2, 0);
19240         check("-18446744073709551615", 1, 0);
19241         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19242         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19243 #endif
19244 EOCP
19245                 ;;
19246         4)
19247                     $cat >>try.c <<'EOCP'
19248         check("4294967295", 4294967295UL, 0);
19249         check("4294967296", 4294967295UL, ERANGE);
19250 #if 0 /* strtoul() for /^-/ strings is undefined. */
19251         check("-1", 4294967295UL, 0);
19252         check("-4294967294", 2, 0);
19253         check("-4294967295", 1, 0);
19254         check("-4294967296", 4294967295UL, ERANGE);
19255         check("-4294967297", 4294967295UL, ERANGE);
19256 #endif
19257 EOCP
19258                 ;;
19259         *)
19260 : Should we write these tests to be more portable by sprintf-ing
19261 : ~0 and then manipulating that char string as input for strtol?
19262                 ;;
19263         esac
19264         $cat >>try.c <<'EOCP'
19265         if (!bad)
19266                 printf("ok\n");
19267         return 0;
19268 }
19269 EOCP
19270         set try
19271         if eval $compile; then
19272                 case "`$run ./try`" in
19273                 ok) echo "Your strtoul() seems to be working okay." ;;
19274                 *) cat <<EOM >&4
19275 Your strtoul() doesn't seem to be working okay.
19276 EOM
19277                    d_strtoul="$undef"
19278                    ;;
19279                 esac
19280         else
19281                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19282                 d_strtoul="$undef"
19283         fi
19284         ;;
19285 esac
19286
19287 : see if strtoull exists
19288 set strtoull d_strtoull
19289 eval $inlibc
19290
19291 case "$d_longlong-$d_strtoull" in
19292 "$define-$define")
19293         $cat <<EOM
19294 Checking whether your strtoull() works okay...
19295 EOM
19296         $cat >try.c <<'EOCP'
19297 #include <errno.h>
19298 #ifdef __hpux
19299 #define strtoull __strtoull
19300 #endif
19301 #include <stdio.h>
19302 extern unsigned long long int strtoull(char *s, char **, int);
19303 static int bad = 0;
19304 int check(char *s, long long eull, int een) {
19305         long long gull;
19306         errno = 0;
19307         gull = strtoull(s, 0, 10);
19308         if (!((gull == eull) && (errno == een)))
19309                 bad++;
19310 }
19311 int main() {
19312         check(" 1",                                        1LL, 0);
19313         check(" 0",                                        0LL, 0);
19314         check("18446744073709551615",  18446744073709551615ULL, 0);
19315         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19316 #if 0 /* strtoull() for /^-/ strings is undefined. */
19317         check("-1",                    18446744073709551615ULL, 0);
19318         check("-18446744073709551614",                     2LL, 0);
19319         check("-18446744073709551615",                     1LL, 0);
19320         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19321         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19322 #endif
19323         if (!bad)
19324                 printf("ok\n");
19325 }
19326 EOCP
19327         set try
19328         if eval $compile; then
19329                 case "`$run ./try`" in
19330                 ok) echo "Your strtoull() seems to be working okay." ;;
19331                 *) cat <<EOM >&4
19332 Your strtoull() doesn't seem to be working okay.
19333 EOM
19334                    d_strtoull="$undef"
19335                    ;;
19336                 esac
19337         else
19338                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19339                 d_strtoull="$undef"
19340         fi
19341         ;;
19342 esac
19343
19344 : see if strtouq exists
19345 set strtouq d_strtouq
19346 eval $inlibc
19347
19348 case "$d_strtouq" in
19349 "$define")
19350         $cat <<EOM
19351 Checking whether your strtouq() works okay...
19352 EOM
19353         $cat >try.c <<'EOCP'
19354 #include <errno.h>
19355 #include <stdio.h>
19356 extern unsigned long long int strtouq(char *s, char **, int);
19357 static int bad = 0;
19358 void check(char *s, unsigned long long eull, int een) {
19359         unsigned long long gull;
19360         errno = 0;
19361         gull = strtouq(s, 0, 10);
19362         if (!((gull == eull) && (errno == een)))
19363                 bad++;
19364 }
19365 int main() {
19366         check(" 1",                                        1LL, 0);
19367         check(" 0",                                        0LL, 0);
19368         check("18446744073709551615",  18446744073709551615ULL, 0);
19369         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19370 #if 0 /* strtouq() for /^-/ strings is undefined. */
19371         check("-1",                    18446744073709551615ULL, 0);
19372         check("-18446744073709551614",                     2LL, 0);
19373         check("-18446744073709551615",                     1LL, 0);
19374         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19375         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19376 #endif
19377         if (!bad)
19378                 printf("ok\n");
19379         return 0;
19380 }
19381 EOCP
19382         set try
19383         if eval $compile; then
19384                 case "`$run ./try`" in
19385                 ok) echo "Your strtouq() seems to be working okay." ;;
19386                 *) cat <<EOM >&4
19387 Your strtouq() doesn't seem to be working okay.
19388 EOM
19389                    d_strtouq="$undef"
19390                    ;;
19391                 esac
19392         else
19393                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19394                 d_strtouq="$undef"
19395         fi
19396         ;;
19397 esac
19398
19399 : see if strxfrm exists
19400 set strxfrm d_strxfrm
19401 eval $inlibc
19402
19403 : see if symlink exists
19404 set symlink d_symlink
19405 eval $inlibc
19406
19407 : see if syscall exists
19408 set syscall d_syscall
19409 eval $inlibc
19410
19411 : see if prototype for syscall is available
19412 echo " "
19413 set d_syscallproto syscall $i_unistd unistd.h
19414 eval $hasproto
19415
19416 : see if sysconf exists
19417 set sysconf d_sysconf
19418 eval $inlibc
19419
19420 : see if system exists
19421 set system d_system
19422 eval $inlibc
19423
19424 : see if tcgetpgrp exists
19425 set tcgetpgrp d_tcgetpgrp
19426 eval $inlibc
19427
19428 : see if tcsetpgrp exists
19429 set tcsetpgrp d_tcsetpgrp
19430 eval $inlibc
19431
19432 : see if prototype for telldir is available
19433 echo " "
19434 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19435 eval $hasproto
19436
19437 : see if tgamma exists
19438 set tgamma d_tgamma
19439 eval $inlibc
19440
19441 : see if time exists
19442 echo " "
19443 if test "X$d_time" = X -o X"$timetype" = X; then
19444     if set time val -f d_time; eval $csym; $val; then
19445                 echo 'time() found.' >&4
19446                 val="$define"
19447                 rp="What is the type returned by time() on this system?"
19448                 set time_t timetype long stdio.h sys/types.h
19449                 eval $typedef_ask
19450     else
19451                 echo 'time() not found, hope that will do.' >&4
19452                 val="$undef"
19453                 timetype='int';
19454     fi
19455     set d_time
19456     eval $setvar
19457 fi
19458
19459 : see if timegm exists
19460 set timegm d_timegm
19461 eval $inlibc
19462
19463 : see if this is a sys/times.h system
19464 set sys/times.h i_systimes
19465 eval $inhdr
19466
19467 : see if times exists
19468 echo " "
19469 if set times val -f d_times; eval $csym; $val; then
19470         echo 'times() found.' >&4
19471         d_times="$define"
19472         inc=''
19473         case "$i_systimes" in
19474         "$define") inc='sys/times.h';;
19475         esac
19476         rp="What is the type returned by times() on this system?"
19477         set clock_t clocktype long stdio.h sys/types.h $inc
19478         eval $typedef_ask
19479 else
19480         echo 'times() NOT found, hope that will do.' >&4
19481         d_times="$undef"
19482         clocktype='int'
19483 fi
19484
19485 : see if tmpnam_r exists
19486 set tmpnam_r d_tmpnam_r
19487 eval $inlibc
19488 case "$d_tmpnam_r" in
19489 "$define")
19490         hdrs="$i_systypes sys/types.h define stdio.h "
19491         case "$d_tmpnam_r_proto:$usethreads" in
19492         ":define")      d_tmpnam_r_proto=define
19493                 set d_tmpnam_r_proto tmpnam_r $hdrs
19494                 eval $hasproto ;;
19495         *)      ;;
19496         esac
19497         case "$d_tmpnam_r_proto" in
19498         define)
19499         case "$tmpnam_r_proto" in
19500         ''|0) try='char* tmpnam_r(char*);'
19501         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19502         esac
19503         case "$tmpnam_r_proto" in
19504         ''|0)   d_tmpnam_r=undef
19505                 tmpnam_r_proto=0
19506                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19507         * )     case "$tmpnam_r_proto" in
19508                 REENTRANT_PROTO*) ;;
19509                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19510                 esac
19511                 echo "Prototype: $try" ;;
19512         esac
19513         ;;
19514         *)      case "$usethreads" in
19515                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19516                 esac
19517                 d_tmpnam_r=undef
19518                 tmpnam_r_proto=0
19519                 ;;
19520         esac
19521         ;;
19522 *)      tmpnam_r_proto=0
19523         ;;
19524 esac
19525
19526 : see if trunc exists
19527 set trunc d_trunc
19528 eval $inlibc
19529
19530 : see if truncate exists
19531 set truncate d_truncate
19532 eval $inlibc
19533
19534 : see if ttyname_r exists
19535 set ttyname_r d_ttyname_r
19536 eval $inlibc
19537 case "$d_ttyname_r" in
19538 "$define")
19539         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19540         case "$d_ttyname_r_proto:$usethreads" in
19541         ":define")      d_ttyname_r_proto=define
19542                 set d_ttyname_r_proto ttyname_r $hdrs
19543                 eval $hasproto ;;
19544         *)      ;;
19545         esac
19546         case "$d_ttyname_r_proto" in
19547         define)
19548         case "$ttyname_r_proto" in
19549         ''|0) try='int ttyname_r(int, char*, size_t);'
19550         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19551         esac
19552         case "$ttyname_r_proto" in
19553         ''|0) try='int ttyname_r(int, char*, int);'
19554         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19555         esac
19556         case "$ttyname_r_proto" in
19557         ''|0) try='char* ttyname_r(int, char*, int);'
19558         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19559         esac
19560         case "$ttyname_r_proto" in
19561         ''|0)   d_ttyname_r=undef
19562                 ttyname_r_proto=0
19563                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19564         * )     case "$ttyname_r_proto" in
19565                 REENTRANT_PROTO*) ;;
19566                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19567                 esac
19568                 echo "Prototype: $try" ;;
19569         esac
19570         ;;
19571         *)      case "$usethreads" in
19572                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19573                 esac
19574                 d_ttyname_r=undef
19575                 ttyname_r_proto=0
19576                 ;;
19577         esac
19578         ;;
19579 *)      ttyname_r_proto=0
19580         ;;
19581 esac
19582
19583 : see if tzname[] exists
19584 echo " "
19585 if set tzname val -a d_tzname; eval $csym; $val; then
19586         val="$define"
19587         echo 'tzname[] found.' >&4
19588 else
19589         val="$undef"
19590         echo 'tzname[] NOT found.' >&4
19591 fi
19592 set d_tzname
19593 eval $setvar
19594
19595 : Check if is a multiplatform env
19596 case "$osname" in
19597 darwin) multiarch="$define" ;;
19598 esac
19599 case "$multiarch" in
19600 ''|[nN]*) multiarch="$undef" ;;
19601 esac
19602
19603 : check for ordering of bytes in a UV
19604 echo " "
19605 case "$multiarch" in
19606 *$define*)
19607         $cat <<EOM
19608 You seem to be doing a multiarchitecture build,
19609 skipping the byteorder check.
19610
19611 EOM
19612         byteorder='ffff'
19613         ;;
19614 *)
19615         case "$byteorder" in
19616         '')
19617                 $cat <<'EOM'
19618 In the following, larger digits indicate more significance.  A big-endian
19619 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19620 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19621 machines may have weird orders like 3412.  A Cray will report 87654321,
19622 an Alpha will report 12345678. If the test program works the default is
19623 probably right.
19624 I'm now running the test program...
19625 EOM
19626                 $cat >try.c <<EOCP
19627 #include <stdio.h>
19628 #$i_stdlib I_STDLIB
19629 #ifdef I_STDLIB
19630 #include <stdlib.h>
19631 #endif
19632 #include <sys/types.h>
19633 typedef $uvtype UV;
19634 int main()
19635 {
19636         int i;
19637         union {
19638                 UV l;
19639                 char c[$uvsize];
19640         } u;
19641
19642         if ($uvsize > 4)
19643                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19644         else
19645                 u.l = (UV)0x04030201;
19646         for (i = 0; i < $uvsize; i++)
19647                 printf("%c", u.c[i]+'0');
19648         printf("\n");
19649         exit(0);
19650 }
19651 EOCP
19652                 xxx_prompt=y
19653                 set try
19654                 if eval $compile && $run ./try > /dev/null; then
19655                         dflt=`$run ./try`
19656                         case "$dflt" in
19657                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19658                                 echo "(The test program ran ok.)"
19659                                 echo "byteorder=$dflt"
19660                                 xxx_prompt=n
19661                         ;;
19662                         ????|????????) echo "(The test program ran ok.)" ;;
19663                         *) echo "(The test program didn't run right for some reason.)" ;;
19664                         esac
19665                 else
19666                         dflt='4321'
19667                         cat <<'EOM'
19668 (I can't seem to compile the test program.  Guessing big-endian...)
19669 EOM
19670                 fi
19671                 case "$xxx_prompt" in
19672                 y)
19673                         rp="What is the order of bytes in $uvtype?"
19674                         . ./myread
19675                         byteorder="$ans"
19676                         ;;
19677                 *)      byteorder=$dflt
19678                         ;;
19679                 esac
19680                 ;;
19681         esac
19682         $rm_try
19683         ;;
19684 esac
19685
19686 : Checking 32bit alignedness
19687 $cat <<EOM
19688
19689 Checking to see whether you can access character data unalignedly...
19690 EOM
19691 case "$d_u32align" in
19692 '')   $cat >try.c <<EOCP
19693 #include <stdio.h>
19694 #$i_stdlib I_STDLIB
19695 #ifdef I_STDLIB
19696 #include <stdlib.h>
19697 #endif
19698 #define U32 $u32type
19699 #define BYTEORDER 0x$byteorder
19700 #define U8 $u8type
19701 #include <signal.h>
19702 #ifdef SIGBUS
19703 $signal_t bletch(int s) { exit(4); }
19704 #endif
19705 int main() {
19706 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19707     volatile U8 buf[8];
19708     volatile U32 *up;
19709     int i;
19710
19711     if (sizeof(U32) != 4) {
19712         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19713         exit(1);
19714     }
19715
19716     fflush(stdout);
19717
19718 #ifdef SIGBUS
19719     signal(SIGBUS, bletch);
19720 #endif
19721
19722     buf[0] = 0;
19723     buf[1] = 0;
19724     buf[2] = 0;
19725     buf[3] = 1;
19726     buf[4] = 0;
19727     buf[5] = 0;
19728     buf[6] = 0;
19729     buf[7] = 1;
19730
19731     for (i = 0; i < 4; i++) {
19732         up = (U32*)(buf + i);
19733         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19734                (*up == 1 << (8*(3-i)))  /* little-endian */
19735               )
19736            )
19737         {
19738             printf("read failed (%x)\n", *up);
19739             exit(2);
19740         }
19741     }
19742
19743     /* write test */
19744     for (i = 0; i < 4; i++) {
19745         up = (U32*)(buf + i);
19746         *up = 0xBeef;
19747         if (*up != 0xBeef) {
19748             printf("write failed (%x)\n", *up);
19749             exit(3);
19750         }
19751     }
19752
19753     exit(0);
19754 #else
19755     printf("1\n");
19756     exit(1);
19757 #endif
19758     return 0;
19759 }
19760 EOCP
19761 set try
19762 if eval $compile_ok; then
19763         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19764         $run ./try 2>&1 >/dev/null
19765         case "$?" in
19766         0)      cat >&4 <<EOM
19767 You can access character data pretty unalignedly.
19768 EOM
19769                 d_u32align="$undef"
19770                 ;;
19771         *)      cat >&4 <<EOM
19772 It seems that you must access character data in an aligned manner.
19773 EOM
19774                 d_u32align="$define"
19775                 ;;
19776         esac
19777 else
19778         rp='Can you access character data at unaligned addresses?'
19779         dflt='n'
19780         . ./myread
19781         case "$ans" in
19782         [yY]*)  d_u32align="$undef"  ;;
19783         *)      d_u32align="$define" ;;
19784         esac
19785 fi
19786 $rm_try
19787 ;;
19788 esac
19789
19790 : see if ualarm exists
19791 set ualarm d_ualarm
19792 eval $inlibc
19793
19794 : see if umask exists
19795 set umask d_umask
19796 eval $inlibc
19797
19798 : see if unordered exists
19799 set unordered d_unordered
19800 eval $inlibc
19801
19802 : see if unsetenv exists
19803 set unsetenv d_unsetenv
19804 eval $inlibc
19805
19806 : see if usleep exists
19807 set usleep d_usleep
19808 eval $inlibc
19809
19810 : see if prototype for usleep is available
19811 echo " "
19812 set d_usleepproto usleep $i_unistd unistd.h
19813 eval $hasproto
19814
19815 : see if closedir exists
19816 set closedir d_closedir
19817 eval $inlibc
19818
19819 case "$d_closedir" in
19820 "$define")
19821         echo " "
19822         echo "Checking whether closedir() returns a status..." >&4
19823         cat > try.c <<EOM
19824 #$i_dirent I_DIRENT             /**/
19825 #$i_sysdir I_SYS_DIR            /**/
19826 #$i_sysndir I_SYS_NDIR          /**/
19827 #$i_systypes I_SYS_TYPES        /**/
19828
19829 #if defined(I_SYS_TYPES)
19830 #include <sys/types.h>
19831 #endif
19832 #if defined(I_DIRENT)
19833 #include <dirent.h>
19834 #else
19835 #ifdef I_SYS_NDIR
19836 #include <sys/ndir.h>
19837 #else
19838 #ifdef I_SYS_DIR
19839 #ifdef hp9000s500
19840 #include <ndir.h>       /* may be wrong in the future */
19841 #else
19842 #include <sys/dir.h>
19843 #endif
19844 #endif
19845 #endif
19846 #endif
19847 int main() { return closedir(opendir(".")); }
19848 EOM
19849         set try
19850         if eval $compile_ok; then
19851                 if $run ./try > /dev/null 2>&1 ; then
19852                         echo "Yes, it does."
19853                         val="$undef"
19854                 else
19855                         echo "No, it doesn't."
19856                         val="$define"
19857                 fi
19858         else
19859                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19860                 val="$define"
19861         fi
19862         ;;
19863 *)
19864         val="$undef";
19865         ;;
19866 esac
19867 set d_void_closedir
19868 eval $setvar
19869 $rm_try
19870
19871 : see if there is a wait4
19872 set wait4 d_wait4
19873 eval $inlibc
19874
19875 : see if waitpid exists
19876 set waitpid d_waitpid
19877 eval $inlibc
19878
19879 : look for wcscmp
19880 echo " "
19881 $cat >try.c <<'EOCP'
19882 #include <stdio.h>
19883 #include <wchar.h>
19884 int main ()
19885 {
19886     wchar_t *s = L" ";
19887     return (wcscmp (s, s) ? 1 : 0);
19888     }
19889 EOCP
19890 set try
19891 val="$undef"
19892 if eval $compile; then
19893     `$run ./try`
19894     case "$?" in
19895         0)  echo "A working wcscmp() found." >&4
19896             val="$define" ;;
19897         *)  echo "wcscmp() found, but it doesn't work" >&4
19898             ;;
19899         esac
19900 else
19901     echo "wcscmp() NOT found." >&4
19902     fi
19903 set d_wcscmp
19904 eval $setvar
19905 $rm_try
19906
19907 : see if wcstombs exists
19908 set wcstombs d_wcstombs
19909 eval $inlibc
19910
19911 : look for wcsxfrm
19912 echo " "
19913 $cat >try.c <<'EOCP'
19914 #include <errno.h>
19915 #include <wchar.h>
19916 int main ()
19917 {
19918     wchar_t dst[4], *src = L" ";
19919     errno = 0;
19920     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19921     }
19922 EOCP
19923 set try
19924 val="$undef"
19925 if eval $compile; then
19926     `$run ./try`
19927     case "$?" in
19928         0)  echo "A working wcsxfrm() found." >&4
19929             val="$define" ;;
19930         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19931             ;;
19932         esac
19933 else
19934     echo "wcsxfrm() NOT found." >&4
19935     fi
19936 set d_wcsxfrm
19937 eval $setvar
19938 $rm_try
19939
19940 : see if wctomb exists
19941 set wctomb d_wctomb
19942 eval $inlibc
19943
19944 : see if writev exists
19945 set writev d_writev
19946 eval $inlibc
19947
19948 : check for alignment requirements
19949 echo " "
19950 case "$alignbytes" in
19951     '') echo "Checking alignment constraints..." >&4
19952         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19953             $cat >try.c <<'EOCP'
19954 typedef long double NV;
19955 EOCP
19956         else
19957             $cat >try.c <<'EOCP'
19958 typedef double NV;
19959 EOCP
19960         fi
19961         $cat >>try.c <<'EOCP'
19962 #include <stdio.h>
19963 struct foobar {
19964     char foo;
19965     NV bar;
19966 } try_algn;
19967 int main()
19968 {
19969     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19970     return(0);
19971 }
19972 EOCP
19973         set try
19974         if eval $compile_ok; then
19975             dflt=`$run ./try`
19976         else
19977             dflt='8'
19978             echo "(I can't seem to compile the test program...)"
19979         fi
19980         case "$multiarch" in
19981             *$define*)
19982                 : The usual safe value is 8, but Darwin with -Duselongdouble
19983                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19984                 : Configure to pick a larger value if needed.
19985                 if $test "$dflt" -lt 8; then
19986                     dflt='8'
19987                     echo "Setting alignment to 8 for multiarch support.">&4
19988                 fi
19989                 ;;
19990         esac
19991         ;;
19992     *) dflt="$alignbytes"
19993         ;;
19994 esac
19995 rp="Doubles must be aligned on a how-many-byte boundary?"
19996 . ./myread
19997 alignbytes="$ans"
19998 $rm_try
19999
20000 : set the base revision
20001 baserev=5.0
20002
20003 : length of character in bytes. Is always 1, otherwise it is not C
20004 : This used to be a test using sizeof
20005 charsize=1
20006
20007 : Check for the number of bits in a character
20008 case "$charbits" in
20009 '')     echo "Checking how long a character is (in bits)..." >&4
20010         $cat >try.c <<EOCP
20011 #include <stdio.h>
20012 int main ()
20013 {
20014     int n;
20015     unsigned char c;
20016     for (c = 1, n = 0; c; c <<= 1, n++) ;
20017     printf ("%d\n", n);
20018     return (0);
20019     }
20020 EOCP
20021         set try
20022         if eval $compile_ok; then
20023                 dflt=`$run ./try`
20024         else
20025                 dflt='8'
20026                 echo "(I can't seem to compile the test program.  Guessing...)"
20027         fi
20028         ;;
20029 *)
20030         dflt="$charbits"
20031         ;;
20032 esac
20033 rp="What is the length of a character (in bits)?"
20034 . ./myread
20035 charbits="$ans"
20036 $rm_try
20037 case "$charbits" in
20038 8)      ;;
20039 *)      cat >&4 << EOM
20040 Your system has an unsigned character size of $charbits bits, which
20041 is rather unusual (normally it is 8 bits).  Perl likely will not work
20042 correctly on your system, with subtle bugs in various places.
20043 EOM
20044         rp='Do you really want to continue?'
20045         dflt='n'
20046         . ./myread
20047         case "$ans" in
20048                 [yY])   echo >&4 "Okay, continuing."    ;;
20049                 *)      exit 1                          ;;
20050         esac
20051 esac
20052
20053 : how do we concatenate cpp tokens here?
20054 echo " "
20055 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20056 $cat >cpp_stuff.c <<'EOCP'
20057 #define RCAT(a,b)a/**/b
20058 #define ACAT(a,b)a ## b
20059 RCAT(Rei,ser)
20060 ACAT(Cir,cus)
20061 EOCP
20062 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20063 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20064         echo "Oh!  Smells like ANSI's been here." >&4
20065         echo "We can catify or stringify, separately or together!"
20066         cpp_stuff=42
20067 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20068         echo "Ah, yes!  The good old days!" >&4
20069         echo "However, in the good old days we don't know how to stringify and"
20070         echo "catify at the same time."
20071         cpp_stuff=1
20072 else
20073         $cat >&4 <<EOM
20074 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20075 You're going to have to edit the values of CAT[2-5] in config.h...
20076 EOM
20077         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20078 fi
20079 $rm -f cpp_stuff.*
20080
20081 : see if this is a db.h system
20082 set db.h i_db
20083 eval $inhdr
20084
20085 case "$i_db" in
20086 $define)
20087         : Check db version.
20088         echo " "
20089         echo "Checking Berkeley DB version ..." >&4
20090         $cat >try.c <<EOCP
20091 #$d_const HASCONST
20092 #ifndef HASCONST
20093 #define const
20094 #endif
20095 #include <sys/types.h>
20096 #include <stdio.h>
20097 #$i_stdlib I_STDLIB
20098 #ifdef I_STDLIB
20099 #include <stdlib.h>
20100 #endif
20101 #include <db.h>
20102 int main(int argc, char *argv[])
20103 {
20104 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20105     int Major, Minor, Patch ;
20106     unsigned long Version ;
20107     (void)db_version(&Major, &Minor, &Patch) ;
20108     if (argc == 2) {
20109         printf("%d %d %d %d %d %d\n",
20110                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20111                Major, Minor, Patch);
20112         exit(0);
20113     }
20114     printf("You have Berkeley DB Version 2 or greater.\n");
20115
20116     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20117                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20118     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20119                 Major, Minor, Patch) ;
20120
20121     /* check that db.h & libdb are compatible */
20122     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20123         printf("db.h and libdb are incompatible.\n") ;
20124         exit(3);
20125     }
20126
20127     printf("db.h and libdb are compatible.\n") ;
20128
20129     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20130                 + DB_VERSION_PATCH ;
20131
20132     /* needs to be >= 2.3.4 */
20133     if (Version < 2003004) {
20134     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20135         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20136         exit(2);
20137     }
20138
20139     exit(0);
20140 #else
20141 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20142     if (argc == 2) {
20143         printf("1 0 0\n");
20144         exit(0);
20145     }
20146     printf("You have Berkeley DB Version 1.\n");
20147     exit(0);    /* DB version < 2: the coast is clear. */
20148 #else
20149     exit(1);    /* <db.h> not Berkeley DB? */
20150 #endif
20151 #endif
20152 }
20153 EOCP
20154         set try
20155         if eval $compile_ok && $run ./try; then
20156                 echo 'Looks OK.' >&4
20157                 set `$run ./try 1`
20158                 db_version_major=$1
20159                 db_version_minor=$2
20160                 db_version_patch=$3
20161         else
20162                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20163                 i_db=$undef
20164                 case " $libs " in
20165                 *"-ldb "*)
20166                         : Remove db from list of libraries to use
20167                         echo "Removing unusable -ldb from library list" >&4
20168                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20169                         shift
20170                         libs="$*"
20171                         echo "libs = $libs" >&4
20172                         ;;
20173                 esac
20174         fi
20175         $rm_try
20176         ;;
20177 esac
20178
20179 case "$i_db" in
20180 define)
20181         : Check the return type needed for hash
20182         echo " "
20183         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20184         $cat >try.c <<EOCP
20185 #$d_const HASCONST
20186 #ifndef HASCONST
20187 #define const
20188 #endif
20189 #include <sys/types.h>
20190 #include <db.h>
20191
20192 #ifndef DB_VERSION_MAJOR
20193 u_int32_t hash_cb (const void* ptr, size_t size)
20194 {
20195 }
20196 HASHINFO info;
20197 int main()
20198 {
20199         info.hash = hash_cb;
20200 }
20201 #endif
20202 EOCP
20203         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20204                 if $contains warning try.out >>/dev/null 2>&1 ; then
20205                         db_hashtype='int'
20206                 else
20207                         db_hashtype='u_int32_t'
20208                 fi
20209         else
20210                 : XXX Maybe we should just give up here.
20211                 db_hashtype=u_int32_t
20212                 $cat try.out >&4
20213                 echo "Help:  I can't seem to compile the db test program." >&4
20214                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20215         fi
20216         $rm_try
20217         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20218         ;;
20219 *)      db_hashtype=u_int32_t
20220         ;;
20221 esac
20222 case "$i_db" in
20223 define)
20224         : Check the return type needed for prefix
20225         echo " "
20226         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20227         cat >try.c <<EOCP
20228 #$d_const HASCONST
20229 #ifndef HASCONST
20230 #define const
20231 #endif
20232 #include <sys/types.h>
20233 #include <db.h>
20234
20235 #ifndef DB_VERSION_MAJOR
20236 size_t prefix_cb (const DBT *key1, const DBT *key2)
20237 {
20238 }
20239 BTREEINFO info;
20240 int main()
20241 {
20242         info.prefix = prefix_cb;
20243 }
20244 #endif
20245 EOCP
20246         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20247                 if $contains warning try.out >>/dev/null 2>&1 ; then
20248                         db_prefixtype='int'
20249                 else
20250                         db_prefixtype='size_t'
20251                 fi
20252         else
20253                 db_prefixtype='size_t'
20254                 : XXX Maybe we should just give up here.
20255                 $cat try.out >&4
20256                 echo "Help:  I can't seem to compile the db test program." >&4
20257                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20258         fi
20259         $rm_try
20260         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20261         ;;
20262 *)      db_prefixtype='size_t'
20263         ;;
20264 esac
20265
20266 : Check what kind of inf/nan your system has
20267 $echo "Checking the kind of infinities and nans you have..." >&4
20268 $cat >try.c <<EOP
20269 #define DOUBLESIZE $doublesize
20270 #$d_longdbl HAS_LONG_DOUBLE
20271 #ifdef HAS_LONG_DOUBLE
20272 #define LONGDBLSIZE $longdblsize
20273 #define LONGDBLKIND $longdblkind
20274 #endif
20275 #$i_math I_MATH
20276 #ifdef I_MATH
20277 #include <math.h>
20278 #endif
20279 #include <stdio.h>
20280 /* Note that whether the sign bit is on or off
20281  * for NaN depends on the CPU/FPU, and possibly
20282  * can be affected by the build toolchain.
20283  *
20284  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20285  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20286  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20287  * (respectively) as opposed to the more usual
20288  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20289  */
20290 static void bytes(unsigned char *p, unsigned int n) {
20291   int i;
20292   for (i = 0; i < n; i++) {
20293     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20294   }
20295 }
20296 int main(int argc, char *argv[]) {
20297    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20298     * because some compilers are 'smart' and not only warn but refuse to
20299     * compile such 'illegal' values. */
20300    double dinf = exp(1e9);
20301    double dnan = sqrt(-1.0);
20302 #ifdef HAS_LONG_DOUBLE
20303    long double ldinf = (long double)exp(1e9);
20304    long double ldnan = (long double)sqrt(-1.0);
20305 #endif
20306   if (argc == 2) {
20307     switch (argv[1][0]) {
20308     case '1': bytes(&dinf, sizeof(dinf)); break;
20309     case '2': bytes(&dnan, sizeof(dnan)); break;
20310 #ifdef HAS_LONG_DOUBLE
20311 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20312 /* the 80-bit long doubles might have garbage in their excess bytes */
20313     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20314 # endif
20315     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20316     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20317 #endif
20318     }
20319   }
20320   return 0;
20321 }
20322 EOP
20323 set try
20324 if eval $compile; then
20325     doubleinfbytes=`$run ./try 1`
20326     doublenanbytes=`$run ./try 2`
20327     case "$d_longdbl" in
20328     $define)
20329       longdblinfbytes=`$run ./try 3`
20330       longdblnanbytes=`$run ./try 4`
20331       ;;
20332     esac
20333 else
20334     # Defaults in case the above test program failed.
20335     case "$doublekind" in
20336     1) # IEEE 754 32-bit LE
20337        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20338        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20339        ;;
20340     2) # IEEE 754 32-bit BE
20341        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20342        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20343        ;;
20344     3) # IEEE 754 64-bit LE
20345        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20346        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20347        ;;
20348     4) # IEEE 754 64-bit BE
20349        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20350        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20351        ;;
20352     5) # IEEE 754 128-bit LE
20353        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20354        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20355        ;;
20356     6) # IEEE 754 128-bit BE
20357        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20358        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20359        ;;
20360     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20361        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20362        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20363        ;;
20364     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20365        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20366        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20367        ;;
20368     *) # No idea.
20369        doubleinfbytes=$undef
20370        doublenanbytes=$undef
20371        ;;
20372     esac
20373     case "$longdblkind" in
20374     1) # IEEE 754 128-bit LE
20375        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20376        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20377        ;;
20378     2) # IEEE 754 128-bit BE
20379        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20380        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20381        ;;
20382     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20383        case "$longdblsize" in
20384        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20385            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20386            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20387            ;;
20388        16) # x86_64
20389            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20390            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20391            ;;
20392        *)  # No idea.
20393            longdblinfbytes=$undef
20394            longdblnanbytes=$undef
20395        ;;
20396        esac
20397        ;;
20398     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20399        case "$longdblsize" in
20400        12) # 32-bit system
20401            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20402            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20403            ;;
20404        16) # 64-bit system
20405            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20406            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20407            ;;
20408        *)  # No idea.
20409            longdblinfbytes=$undef
20410            longdblnanbytes=$undef
20411        ;;
20412        esac
20413        ;;
20414     5) # 128-bit LE "double double"
20415        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20416        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20417        ;;
20418     6) # 128-bit BE "double double"
20419        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20420        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20421        ;;
20422     *) # No idea.
20423        longdblinfbytes=$undef
20424        longdblnanbytes=$undef
20425        ;;
20426     esac
20427 fi
20428 $rm_try
20429
20430 : Check the length of the double mantissa
20431 $echo "Checking how many mantissa bits your doubles have..." >&4
20432 $cat >try.c <<EOP
20433 #$i_float I_FLOAT
20434 #$i_sunmath I_SUNMATH
20435 #ifdef I_FLOAT
20436 # include <float.h>
20437 #endif
20438 #ifdef I_SUNMATH
20439 # include <sunmath.h>
20440 #endif
20441 #ifdef DBL_MANT_DIG
20442 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20443 #endif
20444 #include <stdio.h>
20445 int main(int argc, char *argv[]) {
20446 #ifdef BITS
20447   printf("%d\n", BITS);
20448 #endif
20449   return 0;
20450 }
20451 EOP
20452 set try
20453 if eval $compile; then
20454     doublemantbits=`$run ./try`
20455 else
20456     doublemantbits="$undef"
20457 fi
20458 $rm_try
20459
20460 : Check the length of the longdouble mantissa
20461 $echo "Checking how many mantissa bits your long doubles have..." >&4
20462 $cat >try.c <<EOP
20463 #$i_float I_FLOAT
20464 #$i_sunmath I_SUNMATH
20465 #ifdef I_FLOAT
20466 # include <float.h>
20467 #endif
20468 #ifdef I_SUNMATH
20469 # include <sunmath.h>
20470 #endif
20471 #$d_longdbl HAS_LONG_DOUBLE
20472 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20473 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20474 /* This format has no implicit bit.  Beware, however, that for
20475  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20476  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20477  * and the top bit must have been one since 387, zero is plain invalid.
20478  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20479 #  define BITS LDBL_MANT_DIG
20480 # elif ($longdblkind == 5 || $longdblkind == 6) /* double double */
20481 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20482  * reason e.g. Irix thinks 107.  But in any case, we want only
20483  * the number of real bits, the implicit bits are of no interest.  */
20484 #  define BITS 2 * (DBL_MANT_DIG - 1)
20485 # else
20486 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20487 # endif
20488 #endif
20489 #include <stdio.h>
20490 int main(int argc, char *argv[]) {
20491 #ifdef BITS
20492   printf("%d\n", BITS);
20493 #endif
20494   return 0;
20495 }
20496 EOP
20497 set try
20498 if eval $compile; then
20499     longdblmantbits=`$run ./try`
20500 else
20501     longdblmantbits="$undef"
20502 fi
20503 $rm_try
20504
20505 : Check the length of the NV mantissa
20506 $echo "Checking how many mantissa bits your NVs have..." >&4
20507 if test "X$usequadmath" = "X$define"; then
20508   nvmantbits=112 # 128-1-15
20509 else
20510   if test "X$nvsize" = "X$doublesize"; then
20511     nvmantbits="$doublemantbits"
20512   else
20513      if test "X$nvsize" = "X$longdblsize"; then
20514        nvmantbits="$longdblmantbits"
20515      else
20516        nvmantbits="$undef"
20517      fi
20518   fi
20519 fi
20520
20521 : How can we generate normalized random numbers ?
20522 echo " "
20523 echo "Using our internal random number implementation..." >&4
20524
20525 case "$ccflags" in
20526 *-Dmy_rand=*|*-Dmy_srand=*)
20527         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20528         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20529         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20530         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20531         ;;
20532 esac
20533
20534 randfunc=Perl_drand48
20535 drand01="Perl_drand48()"
20536 seedfunc="Perl_drand48_init"
20537 randbits=48
20538 randseedtype=U32
20539
20540 : Determine if this is an EBCDIC system
20541 echo " "
20542 echo "Determining whether or not we are on an EBCDIC system..." >&4
20543 $cat >try.c <<'EOM'
20544 int main()
20545 {
20546   if ('M'==0xd4) return 0;
20547   return 1;
20548 }
20549 EOM
20550
20551 val=$undef
20552 set try
20553 if eval $compile_ok; then
20554         if $run ./try; then
20555                 echo "You seem to speak EBCDIC." >&4
20556                 val="$define"
20557         else
20558                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20559         fi
20560 else
20561         echo "I'm unable to compile the test program." >&4
20562         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20563 fi
20564 $rm_try
20565 set ebcdic
20566 eval $setvar
20567
20568 : Check how to flush
20569 echo " "
20570 $cat >&4 <<EOM
20571 Checking how to flush all pending stdio output...
20572 EOM
20573 # I only know how to find the first 32 possibly open files on SunOS.
20574 # See also hints/sunos_4_1.sh and util.c  --AD
20575 case "$osname" in
20576 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20577 esac
20578 $cat >>try.c <<EOCP
20579 #include <stdio.h>
20580 #$i_stdlib I_STDLIB
20581 #ifdef I_STDLIB
20582 #include <stdlib.h>
20583 #endif
20584 #$i_unistd I_UNISTD
20585 #ifdef I_UNISTD
20586 # include <unistd.h>
20587 #endif
20588 #$d_sysconf HAS_SYSCONF
20589 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20590 #ifdef HAS_STDIO_STREAM_ARRAY
20591 # define STDIO_STREAM_ARRAY $stdio_stream_array
20592 #endif
20593 int main() {
20594   FILE* p;
20595   unlink("try.out");
20596   p = fopen("try.out", "w");
20597 #ifdef TRY_FPUTC
20598   fputc('x', p);
20599 #else
20600 # ifdef TRY_FPRINTF
20601   fprintf(p, "x");
20602 # endif
20603 #endif
20604 #ifdef TRY_FFLUSH_NULL
20605   fflush(NULL);
20606 #endif
20607 #ifdef TRY_FFLUSH_ALL
20608   {
20609     long open_max = -1;
20610 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20611     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20612 # else
20613 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20614     open_max = sysconf(_SC_OPEN_MAX);
20615 #  else
20616 #   ifdef FOPEN_MAX
20617     open_max = FOPEN_MAX;
20618 #   else
20619 #    ifdef OPEN_MAX
20620     open_max = OPEN_MAX;
20621 #    else
20622 #     ifdef _NFILE
20623     open_max = _NFILE;
20624 #     endif
20625 #    endif
20626 #   endif
20627 #  endif
20628 # endif
20629 # ifdef HAS_STDIO_STREAM_ARRAY
20630     if (open_max > 0) {
20631       long i;
20632       for (i = 0; i < open_max; i++)
20633             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20634                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20635                 STDIO_STREAM_ARRAY[i]._flag)
20636                 fflush(&STDIO_STREAM_ARRAY[i]);
20637     }
20638   }
20639 # endif
20640 #endif
20641   _exit(42);
20642 }
20643 EOCP
20644 : first we have to find out how _not_ to flush
20645 $to try.c
20646 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20647     output=''
20648     set try -DTRY_FPUTC
20649     if eval $compile; then
20650             $run ./try 2>/dev/null
20651             code="$?"
20652             $from try.out
20653             if $test ! -s try.out -a "X$code" = X42; then
20654                 output=-DTRY_FPUTC
20655             fi
20656     fi
20657     case "$output" in
20658     '')
20659             set try -DTRY_FPRINTF
20660             if eval $compile; then
20661                     $run ./try 2>/dev/null
20662                     code="$?"
20663                     $from try.out
20664                     if $test ! -s try.out -a "X$code" = X42; then
20665                         output=-DTRY_FPRINTF
20666                     fi
20667             fi
20668         ;;
20669     esac
20670 fi
20671 : check for fflush NULL behavior
20672 case "$fflushNULL" in
20673 '')     set try -DTRY_FFLUSH_NULL $output
20674         if eval $compile; then
20675                 $run ./try 2>/dev/null
20676                 code="$?"
20677                 $from try.out
20678                 if $test -s try.out -a "X$code" = X42; then
20679                         fflushNULL="`$cat try.out`"
20680                 else
20681                         if $test "X$code" != X42; then
20682                                 $cat >&4 <<EOM
20683 (If this test failed, don't worry, we'll try another method shortly.)
20684 EOM
20685                         fi
20686                 fi
20687         fi
20688         $rm -f core try.core core.try.*
20689         case "$fflushNULL" in
20690         x)      $cat >&4 <<EOM
20691 Your fflush(NULL) works okay for output streams.
20692 Let's see if it clobbers input pipes...
20693 EOM
20694 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20695 # bug that improperly flushes the input end of pipes.  So we avoid the
20696 # autoflush on fork/system/exec support for now. :-(
20697 $cat >tryp.c <<EOCP
20698 #include <stdio.h>
20699 int
20700 main(int argc, char **argv)
20701 {
20702     char buf[1024];
20703     int i;
20704     char *bp = buf;
20705     while (1) {
20706         while ((i = getc(stdin)) != -1
20707                && (*bp++ = i) != '\n'
20708                && bp < &buf[1024])
20709         /* DO NOTHING */ ;
20710         *bp = '\0';
20711         fprintf(stdout, "%s", buf);
20712         fflush(NULL);
20713         if (i == -1)
20714             return 0;
20715         bp = buf;
20716     }
20717 }
20718 EOCP
20719                 fflushNULL="$define"
20720                 set tryp
20721                 if eval $compile; then
20722                     $rm -f tryp.out
20723                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20724                     if $test "X$targethost" != X; then
20725                         $to tryp.c
20726                         $to tryp
20727                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20728                     else
20729                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20730                     fi
20731                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20732                        $cat >&4 <<EOM
20733 fflush(NULL) seems to behave okay with input streams.
20734 EOM
20735                         fflushNULL="$define"
20736                     else
20737                         $cat >&4 <<EOM
20738 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20739 EOM
20740                         fflushNULL="$undef"
20741                     fi
20742                 fi
20743                 $rm -f core tryp.c tryp.core core.tryp.*
20744                 ;;
20745         '')     $cat >&4 <<EOM
20746 Your fflush(NULL) isn't working (contrary to ANSI C).
20747 EOM
20748                 fflushNULL="$undef"
20749                 ;;
20750         *)      $cat >&4 <<EOM
20751 Cannot figure out whether your fflush(NULL) works or not.
20752 I'm assuming it doesn't (contrary to ANSI C).
20753 EOM
20754                 fflushNULL="$undef"
20755                 ;;
20756         esac
20757         ;;
20758 $define|true|[yY]*)
20759         fflushNULL="$define"
20760         ;;
20761 *)
20762         fflushNULL="$undef"
20763         ;;
20764 esac
20765 : check explicit looping only if NULL did not work, and if the pipe
20766 : bug does not show up on an explicit flush too
20767 case "$fflushNULL" in
20768 "$undef")
20769         $cat >tryp.c <<EOCP
20770 #include <stdio.h>
20771 int
20772 main(int argc, char **argv)
20773 {
20774     char buf[1024];
20775     int i;
20776     char *bp = buf;
20777     while (1) {
20778         while ((i = getc(stdin)) != -1
20779                && (*bp++ = i) != '\n'
20780                && bp < &buf[1024])
20781         /* DO NOTHING */ ;
20782         *bp = '\0';
20783         fprintf(stdout, "%s", buf);
20784         fflush(stdin);
20785         if (i == -1)
20786             return 0;
20787         bp = buf;
20788     }
20789 }
20790 EOCP
20791         set tryp
20792         if eval $compile; then
20793             $rm -f tryp.out
20794             if $test "X$targethost" != X; then
20795                 $to tryp.c
20796                 $to tryp
20797                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20798             else
20799                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20800             fi
20801             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20802                $cat >&4 <<EOM
20803 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20804 EOM
20805                 : now check for fflushall behaviour
20806                 case "$fflushall" in
20807                 '')     set try -DTRY_FFLUSH_ALL $output
20808                         if eval $compile; then
20809                                 $cat >&4 <<EOM
20810 (Now testing the other method--but note that this also may fail.)
20811 EOM
20812                                 $run ./try 2>/dev/null
20813                                 code=$?
20814                                 $from try.out
20815                                 if $test -s try.out -a "X$code" = X42; then
20816                                         fflushall="`$cat try.out`"
20817                                 fi
20818                         fi
20819                         $rm_try
20820                         case "$fflushall" in
20821                         x)      $cat >&4 <<EOM
20822 Whew. Flushing explicitly all the stdio streams works.
20823 EOM
20824                                 fflushall="$define"
20825                                 ;;
20826                         '')     $cat >&4 <<EOM
20827 Sigh. Flushing explicitly all the stdio streams doesn't work.
20828 EOM
20829                                 fflushall="$undef"
20830                                 ;;
20831                         *)      $cat >&4 <<EOM
20832 Cannot figure out whether flushing stdio streams explicitly works or not.
20833 I'm assuming it doesn't.
20834 EOM
20835                                 fflushall="$undef"
20836                                 ;;
20837                         esac
20838                         ;;
20839                 "$define"|true|[yY]*)
20840                         fflushall="$define"
20841                         ;;
20842                 *)
20843                         fflushall="$undef"
20844                         ;;
20845                 esac
20846             else
20847                 $cat >&4 <<EOM
20848 All is futile.  Even fflush(stdin) clobbers input pipes!
20849 EOM
20850                 fflushall="$undef"
20851             fi
20852         else
20853             fflushall="$undef"
20854         fi
20855         $rm -f core tryp.c tryp.core core.tryp.*
20856         ;;
20857 *)      fflushall="$undef"
20858         ;;
20859 esac
20860
20861 case "$fflushNULL$fflushall" in
20862 undefundef)
20863         $cat <<EOM
20864 OK, I give up.  I cannot figure out how to flush pending stdio output.
20865 We won't be flushing handles at all before fork/exec/popen.
20866 EOM
20867         ;;
20868 esac
20869 $rm_try tryp
20870
20871 : Store the full pathname to the ar program for use in the C program
20872 : Respect a hint or command line value for full_ar.
20873 case "$full_ar" in
20874 '') full_ar=$ar ;;
20875 esac
20876
20877 : Store the full pathname to the sed program for use in the C program
20878 full_sed=$sed
20879
20880 : see what type gids are declared as in the kernel
20881 echo " "
20882 echo "Looking for the type for group ids returned by getgid()."
20883 set gid_t gidtype xxx stdio.h sys/types.h
20884 eval $typedef
20885 case "$gidtype" in
20886 xxx)
20887         xxx=`./findhdr sys/user.h`
20888         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20889         case $1 in
20890         unsigned) dflt="$1 $2" ;;
20891         *) dflt="$1" ;;
20892         esac
20893         ;;
20894 *) dflt="$gidtype";;
20895 esac
20896 case "$gidtype" in
20897 gid_t) echo "gid_t found." ;;
20898 *)      rp="What is the type for group ids returned by getgid()?"
20899         . ./myread
20900         gidtype="$ans"
20901         ;;
20902 esac
20903
20904 : Check the size of GID
20905 echo " "
20906 case "$gidtype" in
20907 *_t) zzz="$gidtype"     ;;
20908 *)   zzz="gid"          ;;
20909 esac
20910 echo "Checking the size of $zzz..." >&4
20911 cat > try.c <<EOCP
20912 #include <sys/types.h>
20913 #include <stdio.h>
20914 #$i_stdlib I_STDLIB
20915 #ifdef I_STDLIB
20916 #include <stdlib.h>
20917 #endif
20918 int main() {
20919     printf("%d\n", (int)sizeof($gidtype));
20920     exit(0);
20921 }
20922 EOCP
20923 set try
20924 if eval $compile_ok; then
20925         yyy=`$run ./try`
20926         case "$yyy" in
20927         '')     gidsize=4
20928                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20929                 ;;
20930         *)      gidsize=$yyy
20931                 echo "Your $zzz is $gidsize bytes long."
20932                 ;;
20933         esac
20934 else
20935         gidsize=4
20936         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20937 fi
20938
20939
20940 : Check if GID is signed
20941 echo " "
20942 case "$gidtype" in
20943 *_t) zzz="$gidtype"     ;;
20944 *)   zzz="gid"          ;;
20945 esac
20946 echo "Checking the sign of $zzz..." >&4
20947 cat > try.c <<EOCP
20948 #include <sys/types.h>
20949 #include <stdio.h>
20950 int main() {
20951         $gidtype foo = -1;
20952         if (foo < 0)
20953                 printf("-1\n");
20954         else
20955                 printf("1\n");
20956 }
20957 EOCP
20958 set try
20959 if eval $compile; then
20960         yyy=`$run ./try`
20961         case "$yyy" in
20962         '')     gidsign=1
20963                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20964                 ;;
20965         *)      gidsign=$yyy
20966                 case "$gidsign" in
20967                  1) echo "Your $zzz is unsigned." ;;
20968                 -1) echo "Your $zzz is signed."   ;;
20969                 esac
20970                 ;;
20971         esac
20972 else
20973         gidsign=1
20974         echo "(I can't compile the test program--guessing unsigned.)" >&4
20975 fi
20976
20977
20978 : Check 64bit sizes
20979 echo " "
20980
20981 if $test X"$quadtype" != X; then
20982
20983 echo "Checking how to print 64-bit integers..." >&4
20984
20985 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20986         $cat >try.c <<'EOCP'
20987 #include <sys/types.h>
20988 #include <stdio.h>
20989 int main() {
20990   int q = 12345678901;
20991   printf("%ld\n", q);
20992 }
20993 EOCP
20994         set try
20995         if eval $compile; then
20996                 yyy=`$run ./try`
20997                 case "$yyy" in
20998                 12345678901)
20999                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21000                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21001                         echo "We will use %d."
21002                         ;;
21003                 esac
21004         fi
21005 fi
21006
21007 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21008         $cat >try.c <<'EOCP'
21009 #include <sys/types.h>
21010 #include <stdio.h>
21011 int main() {
21012   long q = 12345678901;
21013   printf("%ld\n", q);
21014 }
21015 EOCP
21016         set try
21017         if eval $compile; then
21018                 yyy=`$run ./try`
21019                 case "$yyy" in
21020                 12345678901)
21021                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21022                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21023                         echo "We will use %ld."
21024                         ;;
21025                 esac
21026         fi
21027 fi
21028
21029 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21030         $cat >try.c <<'EOCP'
21031 #include <sys/types.h>
21032 #include <inttypes.h>
21033 #include <stdio.h>
21034 int main() {
21035   int64_t q = 12345678901;
21036   printf("%" PRId64 "\n", q);
21037 }
21038 EOCP
21039         set try
21040         if eval $compile; then
21041                 yyy=`$run ./try`
21042                 case "$yyy" in
21043                 12345678901)
21044                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21045                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21046                         echo "We will use the C9X style."
21047                         ;;
21048                 esac
21049         fi
21050 fi
21051
21052 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21053         $cat >try.c <<EOCP
21054 #include <sys/types.h>
21055 #include <stdio.h>
21056 int main() {
21057   $quadtype q = 12345678901;
21058   printf("%Ld\n", q);
21059 }
21060 EOCP
21061         set try
21062         if eval $compile; then
21063                 yyy=`$run ./try`
21064                 case "$yyy" in
21065                 12345678901)
21066                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21067                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21068                         echo "We will use %Ld."
21069                         ;;
21070                 esac
21071         fi
21072 fi
21073
21074 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21075         $cat >try.c <<'EOCP'
21076 #include <sys/types.h>
21077 #include <stdio.h>
21078 int main() {
21079   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21080   printf("%lld\n", q);
21081 }
21082 EOCP
21083         set try
21084         if eval $compile; then
21085                 yyy=`$run ./try`
21086                 case "$yyy" in
21087                 12345678901)
21088                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21089                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21090                         echo "We will use the %lld style."
21091                         ;;
21092                 esac
21093         fi
21094 fi
21095
21096 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21097         $cat >try.c <<EOCP
21098 #include <sys/types.h>
21099 #include <stdio.h>
21100 int main() {
21101   $quadtype q = 12345678901;
21102   printf("%qd\n", q);
21103 }
21104 EOCP
21105         set try
21106         if eval $compile; then
21107                 yyy=`$run ./try`
21108                 case "$yyy" in
21109                 12345678901)
21110                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21111                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21112                         echo "We will use %qd."
21113                         ;;
21114                 esac
21115         fi
21116 fi
21117
21118 if $test X"$sPRId64" = X; then
21119         echo "Cannot figure out how to print 64-bit integers." >&4
21120 fi
21121 $rm_try
21122
21123 fi
21124
21125 case "$sPRId64" in
21126 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21127         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21128         ;;
21129 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21130         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21131         ;;
21132 esac
21133
21134 : Check format strings for internal types
21135 echo " "
21136 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21137
21138 if $test X"$ivsize" = X8; then
21139         ivdformat="$sPRId64"
21140         uvuformat="$sPRIu64"
21141         uvoformat="$sPRIo64"
21142         uvxformat="$sPRIx64"
21143         uvXUformat="$sPRIXU64"
21144 else
21145         if $test X"$ivsize" = X"$longsize"; then
21146                 ivdformat='"ld"'
21147                 uvuformat='"lu"'
21148                 uvoformat='"lo"'
21149                 uvxformat='"lx"'
21150                 uvXUformat='"lX"'
21151         else
21152                 if $test X"$ivsize" = X"$intsize"; then
21153                         ivdformat='"d"'
21154                         uvuformat='"u"'
21155                         uvoformat='"o"'
21156                         uvxformat='"x"'
21157                         uvXUformat='"X"'
21158                 else
21159                         : far out
21160                         if $test X"$ivsize" = X"$shortsize"; then
21161                                 ivdformat='"hd"'
21162                                 uvuformat='"hu"'
21163                                 uvoformat='"ho"'
21164                                 uvxformat='"hx"'
21165                                 uvXUformat='"hX"'
21166                         fi
21167                 fi
21168         fi
21169 fi
21170
21171 if $test X"$usequadmath" = X"$define"; then
21172     nveformat='"Qe"'
21173     nvfformat='"Qf"'
21174     nvgformat='"Qg"'
21175     nvEUformat='"QE"'
21176     nvFUformat='"QF"'
21177     nvGUformat='"QG"'
21178 else
21179     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21180         nveformat="$sPRIeldbl"
21181         nvfformat="$sPRIfldbl"
21182         nvgformat="$sPRIgldbl"
21183         nvEUformat="$sPRIEUldbl"
21184         nvFUformat="$sPRIFUldbl"
21185         nvGUformat="$sPRIGUldbl"
21186     else
21187         nveformat='"e"'
21188         nvfformat='"f"'
21189         nvgformat='"g"'
21190         nvEUformat='"E"'
21191         nvFUformat='"F"'
21192         nvGUformat='"G"'
21193     fi
21194 fi
21195
21196 case "$ivdformat" in
21197 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21198     exit 1
21199     ;;
21200 esac
21201
21202 : Check format string for GID
21203
21204 echo " "
21205 $echo "Checking the format string to be used for gids..." >&4
21206
21207 case "$gidsign" in
21208 -1)     if $test X"$gidsize" = X"$ivsize"; then
21209                 gidformat="$ivdformat"
21210         else
21211                 if $test X"$gidsize" = X"$longsize"; then
21212                         gidformat='"ld"'
21213                 else
21214                         if $test X"$gidsize" = X"$intsize"; then
21215                                 gidformat='"d"'
21216                         else
21217                                 if $test X"$gidsize" = X"$shortsize"; then
21218                                         gidformat='"hd"'
21219                                 fi
21220                         fi
21221                 fi
21222         fi
21223         ;;
21224 *)      if $test X"$gidsize" = X"$uvsize"; then
21225                 gidformat="$uvuformat"
21226         else
21227                 if $test X"$gidsize" = X"$longsize"; then
21228                         gidformat='"lu"'
21229                 else
21230                         if $test X"$gidsize" = X"$intsize"; then
21231                                 gidformat='"u"'
21232                         else
21233                                 if $test X"$gidsize" = X"$shortsize"; then
21234                                         gidformat='"hu"'
21235                                 fi
21236                         fi
21237                 fi
21238         fi
21239         ;;
21240 esac
21241
21242 : see if getgroups exists
21243 set getgroups d_getgrps
21244 eval $inlibc
21245
21246 : see if setgroups exists
21247 set setgroups d_setgrps
21248 eval $inlibc
21249
21250 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21251 echo " "
21252 case "$d_getgrps$d_setgrps" in
21253 *define*)
21254         case "$groupstype" in
21255         '') dflt="$gidtype" ;;
21256         *)  dflt="$groupstype" ;;
21257         esac
21258         $cat <<EOM
21259 What type of pointer is the second argument to getgroups() and setgroups()?
21260 Usually this is the same as group ids, $gidtype, but not always.
21261
21262 EOM
21263         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21264         . ./myread
21265         groupstype="$ans"
21266         ;;
21267 *)  groupstype="$gidtype";;
21268 esac
21269
21270 : check whether make sets MAKE
21271 echo " "
21272 echo "Checking if your $make program sets \$(MAKE)..." >&4
21273 case "$make_set_make" in
21274 '')
21275         $sed 's/^X //' > testmake.mak << 'EOF'
21276 Xall:
21277 X       @echo 'maketemp="$(MAKE)"'
21278 EOF
21279         case "`$make -f testmake.mak 2>/dev/null`" in
21280         *maketemp=*) make_set_make='#' ;;
21281         *)      make_set_make="MAKE=$make" ;;
21282         esac
21283         $rm -f testmake.mak
21284         ;;
21285 esac
21286 case "$make_set_make" in
21287 '#') echo "Yup, it does.";;
21288 *) echo "Nope, it doesn't.";;
21289 esac
21290
21291 : see what type is used for mode_t
21292 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21293 set mode_t modetype int stdio.h sys/types.h
21294 eval $typedef_ask
21295
21296 : see if we need va_copy
21297 echo " "
21298 case "$i_stdarg" in
21299 "$define")
21300         $cat >try.c <<EOCP
21301 #include <stdarg.h>
21302 #include <stdio.h>
21303 #$i_stdlib I_STDLIB
21304 #ifdef I_STDLIB
21305 #include <stdlib.h>
21306 #endif
21307 #include <signal.h>
21308
21309 int
21310 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21311 {
21312   return vfprintf(f, fmt, *valp);
21313 }
21314
21315 int
21316 myvfprintf(FILE *f, const  char *fmt, va_list val)
21317 {
21318   return ivfprintf(f, fmt, &val);
21319 }
21320
21321 int
21322 myprintf(char *fmt, ...)
21323 {
21324   va_list val;
21325   va_start(val, fmt);
21326   return myvfprintf(stdout, fmt, val);
21327 }
21328
21329 int
21330 main(int ac, char **av)
21331 {
21332   signal(SIGSEGV, exit);
21333
21334   myprintf("%s%cs all right, then\n", "that", '\'');
21335   exit(0);
21336 }
21337 EOCP
21338         set try
21339         if eval $compile && $run ./try 2>&1 >/dev/null; then
21340                 case "`$run ./try`" in
21341                 "that's all right, then")
21342                         okay=yes
21343                         ;;
21344                 esac
21345         fi
21346         case "$okay" in
21347         yes)    echo "It seems that you don't need va_copy()." >&4
21348                 need_va_copy="$undef"
21349                 ;;
21350         *)      echo "It seems that va_copy() or similar will be needed." >&4
21351                 need_va_copy="$define"
21352                 ;;
21353         esac
21354         $rm_try
21355         ;;
21356 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21357         need_va_copy="$undef"
21358         ;;
21359 esac
21360
21361 : see what type is used for size_t
21362 rp="What is the type used for the length parameter for string functions?"
21363 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21364 eval $typedef_ask
21365
21366 : check for type of arguments to gethostbyaddr.
21367 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21368         case "$d_gethbyaddr" in
21369         $define)
21370                 $cat <<EOM
21371
21372 Checking to see what type of arguments are accepted by gethostbyaddr().
21373 EOM
21374                 hdrs="$define sys/types.h
21375                         $d_socket sys/socket.h
21376                         $i_niin netinet/in.h
21377                         $i_netdb netdb.h
21378                         $i_unistd unistd.h"
21379                 : The first arg can 'char *' or 'void *'
21380                 : The second arg is some of integral type
21381                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21382                         for yyy in size_t long int; do
21383                                 case "$netdb_host_type" in
21384                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21385                                         if ./protochk "$try" $hdrs; then
21386                                                 echo "Your system accepts $xxx for the first arg."
21387                                                 echo "...and $yyy for the second arg."
21388                                                 netdb_host_type="$xxx"
21389                                                 netdb_hlen_type="$yyy"
21390                                         fi
21391                                         ;;
21392                                 esac
21393                         done
21394                 done
21395                 : In case none of those worked, prompt the user.
21396                 case "$netdb_host_type" in
21397                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21398                         dflt='char *'
21399                         . ./myread
21400                         netdb_host_type=$ans
21401                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21402                         dflt="$sizetype"
21403                         . ./myread
21404                         netdb_hlen_type=$ans
21405                         ;;
21406                 esac
21407                 ;;
21408         *)      : no gethostbyaddr, so pick harmless defaults
21409                 netdb_host_type='char *'
21410                 netdb_hlen_type="$sizetype"
21411                 ;;
21412         esac
21413         # Remove the "const" if needed. -- but then we'll have a
21414         # prototype clash!
21415         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21416 fi
21417
21418 : check for type of argument to gethostbyname.
21419 if test "X$netdb_name_type" = X ; then
21420         case "$d_gethbyname" in
21421         $define)
21422                 $cat <<EOM
21423
21424 Checking to see what type of argument is accepted by gethostbyname().
21425 EOM
21426                 hdrs="$define sys/types.h
21427                         $d_socket sys/socket.h
21428                         $i_niin netinet/in.h
21429                         $i_netdb netdb.h
21430                         $i_unistd unistd.h"
21431                 for xxx in "const char *" "char *"; do
21432                         case "$netdb_name_type" in
21433                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21434                                 if ./protochk "$try" $hdrs; then
21435                                         echo "Your system accepts $xxx."
21436                                         netdb_name_type="$xxx"
21437                                 fi
21438                                 ;;
21439                         esac
21440                 done
21441                 : In case none of those worked, prompt the user.
21442                 case "$netdb_name_type" in
21443                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21444                         dflt='char *'
21445                         . ./myread
21446                         netdb_name_type=$ans
21447                         ;;
21448                 esac
21449                 ;;
21450         *)      : no gethostbyname, so pick harmless default
21451                 netdb_name_type='char *'
21452                 ;;
21453         esac
21454 fi
21455
21456 : check for type of 1st argument to getnetbyaddr.
21457 if test "X$netdb_net_type" = X ; then
21458         case "$d_getnbyaddr" in
21459         $define)
21460                 $cat <<EOM
21461
21462 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21463 EOM
21464                 hdrs="$define sys/types.h
21465                         $d_socket sys/socket.h
21466                         $i_niin netinet/in.h
21467                         $i_netdb netdb.h
21468                         $i_unistd unistd.h"
21469                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21470                         case "$netdb_net_type" in
21471                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21472                                 if ./protochk "$try" $hdrs; then
21473                                         echo "Your system accepts $xxx."
21474                                         netdb_net_type="$xxx"
21475                                 fi
21476                                 ;;
21477                         esac
21478                 done
21479                 : In case none of those worked, prompt the user.
21480                 case "$netdb_net_type" in
21481                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21482                         dflt='long'
21483                         . ./myread
21484                         netdb_net_type=$ans
21485                         ;;
21486                 esac
21487                 ;;
21488         *)      : no getnetbyaddr, so pick harmless default
21489                 netdb_net_type='long'
21490                 ;;
21491         esac
21492 fi
21493 : locate the preferred pager for this system
21494 fn=f/
21495 case "$pager" in
21496 '')
21497         dflt=''
21498         case "$pg" in
21499         /*) dflt=$pg;;
21500         [a-zA-Z]:/*) dflt=$pg;;
21501         esac
21502         case "$more" in
21503         /*) dflt=$more;;
21504         [a-zA-Z]:/*) dflt=$more;;
21505         esac
21506         case "$less" in
21507         /*) dflt=$less;;
21508         [a-zA-Z]:/*) dflt=$less;;
21509         esac
21510         case "$dflt" in
21511         '') dflt=/usr/ucb/more;;
21512         esac
21513         ;;
21514 *)      dflt="$pager"
21515         ;;
21516 esac
21517 fn="f/($dflt)"
21518 echo " "
21519 rp='What pager is used on your system?'
21520 . ./getfile
21521 pager="$ans"
21522
21523 : see what type pids are declared as in the kernel
21524 rp="What is the type of process ids on this system?"
21525 set pid_t pidtype int stdio.h sys/types.h
21526 eval $typedef_ask
21527
21528 : see if ar generates random libraries by itself
21529 echo " "
21530 echo "Checking how to generate random libraries on your machine..." >&4
21531 echo 'int bar1() { return bar2(); }' > bar1.c
21532 echo 'int bar2() { return 2; }' > bar2.c
21533 $cat > foo.c <<EOP
21534 #$i_stdlib I_STDLIB
21535 #ifdef I_STDLIB
21536 #include <stdlib.h>
21537 #endif
21538 int main() { printf("%d\n", bar1()); exit(0); }
21539 EOP
21540 $cc $ccflags -c bar1.c >/dev/null 2>&1
21541 $cc $ccflags -c bar2.c >/dev/null 2>&1
21542 $cc $ccflags -c foo.c >/dev/null 2>&1
21543 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21544 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21545         $run ./foobar >/dev/null 2>&1; then
21546         echo "$ar appears to generate random libraries itself."
21547         orderlib=false
21548         if [ "X$ranlib" = "X" ]; then
21549             ranlib=":"
21550         fi
21551 elif $ar s bar$_a >/dev/null 2>&1 &&
21552         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21553         $run ./foobar >/dev/null 2>&1; then
21554                 echo "a table of contents needs to be added with '$ar s'."
21555                 orderlib=false
21556                 ranlib="$ar s"
21557 elif $ar ts bar$_a >/dev/null 2>&1 &&
21558         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21559         $run ./foobar >/dev/null 2>&1; then
21560                 echo "a table of contents needs to be added with '$ar ts'."
21561                 orderlib=false
21562                 ranlib="$ar ts"
21563 else
21564         case "$ranlib" in
21565         :) ranlib='';;
21566         '')
21567                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21568                 $test -f $ranlib || ranlib=''
21569                 ;;
21570         esac
21571         if $test -n "$ranlib"; then
21572                 echo "your system has '$ranlib'; we'll use that."
21573                 orderlib=false
21574         else
21575                 echo "your system doesn't seem to support random libraries"
21576                 echo "so we'll use lorder and tsort to order the libraries."
21577                 orderlib=true
21578                 ranlib=":"
21579         fi
21580 fi
21581 $rm -f foo* bar*
21582
21583 : see if this is a values.h system
21584 set values.h i_values
21585 eval $inhdr
21586
21587 : Check the max offset that gmtime and localtime accept
21588 echo "Checking max offsets that gmtime () accepts"
21589
21590 case $i_values in
21591     define) yyy="#include <values.h>" ;;
21592     *)      yyy="" ;;
21593     esac
21594
21595 case "$sGMTIME_min/$sGMTIME_max" in
21596     0/0|/)
21597         $cat >try.c <<EOCP
21598 #include <sys/types.h>
21599 #include <stdio.h>
21600 #include <time.h>
21601 $yyy
21602
21603 int i;
21604 struct tm *tmp;
21605 time_t pt;
21606
21607 void gm_check (time_t t, int min_year, int max_year)
21608 {
21609     tmp = gmtime (&t);
21610     if ( tmp == NULL ||
21611         /* Check tm_year overflow */
21612          tmp->tm_year < min_year || tmp->tm_year > max_year)
21613         tmp = NULL;
21614     else
21615         pt = t;
21616     } /* gm_check */
21617
21618 int check_max ()
21619 {
21620     tmp = NULL;
21621     pt  = 0;
21622 #ifdef MAXLONG
21623     gm_check (MAXLONG, 69, 0x7fffffff);
21624 #endif
21625     if (tmp == NULL || tmp->tm_year < 0) {
21626         for (i = 63; i >= 0; i--) {
21627             time_t x = pt | ((time_t)1 << i);
21628             if (x < 0 || x < pt) continue;
21629             gm_check (x, 69, 0x7fffffff);
21630             }
21631         }
21632     printf ("sGMTIME_max=%ld\n", pt);
21633     return (0);
21634     } /* check_max */
21635
21636 int check_min ()
21637 {
21638     tmp = NULL;
21639     pt  = 0;
21640 #ifdef MINLONG
21641     gm_check (MINLONG, -1900, 70);
21642 #endif
21643     if (tmp == NULL) {
21644         for (i = 36; i >= 0; i--) {
21645             time_t x = pt - ((time_t)1 << i);
21646             if (x > 0) continue;
21647             gm_check (x, -1900, 70);
21648             }
21649         }
21650     printf ("sGMTIME_min=%ld\n", pt);
21651     return (0);
21652     } /* check_min */
21653
21654 int main (int argc, char *argv[])
21655 {
21656     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21657     check_max ();
21658     check_min ();
21659     return (0);
21660     } /* main */
21661 EOCP
21662         set try
21663         if eval $compile; then
21664             eval `$run ./try 2>/dev/null`
21665         else
21666             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21667             fi
21668         $rm_try
21669         ;;
21670     esac
21671
21672 echo "Checking max offsets that localtime () accepts"
21673
21674 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21675     0/0|/)
21676         $cat >try.c <<EOCP
21677 #include <sys/types.h>
21678 #include <stdio.h>
21679 #include <time.h>
21680 $yyy
21681
21682 int i;
21683 struct tm *tmp;
21684 time_t pt;
21685
21686 void local_check (time_t t, int min_year, int max_year)
21687 {
21688     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21689         tmp = NULL;
21690     else
21691         tmp = localtime (&t);
21692     if ( tmp == NULL ||
21693         /* Check tm_year overflow */
21694          tmp->tm_year < min_year || tmp->tm_year > max_year)
21695         tmp = NULL;
21696     else
21697         pt = t;
21698     } /* local_check */
21699
21700 int check_max ()
21701 {
21702     tmp = NULL;
21703     pt  = 0;
21704 #ifdef MAXLONG
21705     local_check (MAXLONG, 69, 0x7fffffff);
21706 #endif
21707     if (tmp == NULL || tmp->tm_year < 0) {
21708         for (i = 63; i >= 0; i--) {
21709             time_t x = pt | ((time_t)1 << i);
21710             if (x < 0 || x < pt) continue;
21711             local_check (x, 69, 0x7fffffff);
21712             }
21713         }
21714     printf ("sLOCALTIME_max=%ld\n", pt);
21715     return (0);
21716    } /* check_max */
21717
21718 int check_min ()
21719 {
21720     tmp = NULL;
21721     pt  = 0;
21722 #ifdef MINLONG
21723     local_check (MINLONG, -1900, 70);
21724 #endif
21725     if (tmp == NULL) {
21726         for (i = 36; i >= 0; i--) {
21727             time_t x = pt - ((time_t)1 << i);
21728             if (x > 0) continue;
21729             local_check (x, -1900, 70);
21730             }
21731         }
21732     printf ("sLOCALTIME_min=%ld\n", pt);
21733     return (0);
21734     } /* check_min */
21735
21736 int main (int argc, char *argv[])
21737 {
21738     check_max ();
21739     check_min ();
21740     return (0);
21741     } /* main */
21742 EOCP
21743         set try
21744         if eval $compile; then
21745             eval `$run ./try 2>/dev/null`
21746         else
21747             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21748             fi
21749         $rm_try
21750         ;;
21751     esac
21752
21753 : check for type of arguments to select.
21754 case "$selecttype" in
21755 '') case "$d_select" in
21756         $define)
21757                 echo " "
21758                 $cat <<EOM
21759 Checking to see what type of arguments are accepted by select().
21760 EOM
21761                 hdrs="$define sys/types.h
21762                         $i_systime sys/time.h
21763                         $i_sysselct sys/select.h
21764                         $d_socket sys/socket.h"
21765                 : The first arg can be int, unsigned, or size_t
21766                 : The last arg may or may not be 'const'
21767                 val=''
21768                 : void pointer has been seen but using that
21769                 : breaks the selectminbits test
21770                 for xxx in 'fd_set *' 'int *'; do
21771                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21772                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21773                                         case "$val" in
21774                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21775                                                 if ./protochk "$try" $hdrs; then
21776                                                         echo "Your system accepts $xxx."
21777                                                         val="$xxx"
21778                                                 fi
21779                                                 ;;
21780                                         esac
21781                                 done
21782                         done
21783                 done
21784                 case "$val" in
21785                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21786                         case "$d_fd_set" in
21787                                 $define) dflt="fd_set *" ;;
21788                                 *)              dflt="int *" ;;
21789                         esac
21790                         . ./myread
21791                         val=$ans
21792                         ;;
21793                 esac
21794                 selecttype="$val"
21795                 ;;
21796         *)      : no select, so pick a harmless default
21797                 selecttype='int *'
21798                 ;;
21799         esac
21800         ;;
21801 esac
21802
21803 : check for the select 'width'
21804 case "$selectminbits" in
21805 '') safebits=`expr $ptrsize \* 8`
21806     case "$d_select" in
21807         $define)
21808                 $cat <<EOM
21809
21810 Checking to see on how many bits at a time your select() operates...
21811 EOM
21812                 $cat >try.c <<EOCP
21813 #include <sys/types.h>
21814 #$i_time I_TIME
21815 #$i_systime I_SYS_TIME
21816 #$i_systimek I_SYS_TIME_KERNEL
21817 #ifdef I_TIME
21818 #   include <time.h>
21819 #endif
21820 #ifdef I_SYS_TIME
21821 #   ifdef I_SYS_TIME_KERNEL
21822 #       define KERNEL
21823 #   endif
21824 #   include <sys/time.h>
21825 #   ifdef I_SYS_TIME_KERNEL
21826 #       undef KERNEL
21827 #   endif
21828 #endif
21829 #$i_sysselct I_SYS_SELECT
21830 #ifdef I_SYS_SELECT
21831 #include <sys/select.h>
21832 #endif
21833 #$d_socket HAS_SOCKET
21834 #ifdef HAS_SOCKET
21835 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21836 #endif
21837 #include <stdio.h>
21838 #$i_stdlib I_STDLIB
21839 #ifdef I_STDLIB
21840 #include <stdlib.h>
21841 #endif
21842 $selecttype b;
21843 #define S sizeof(*(b))
21844 #define MINBITS 64
21845 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21846 #define NBITS  (NBYTES * 8)
21847 int main() {
21848     char *s = (char *)malloc(NBYTES);
21849     struct timeval t;
21850     int i;
21851     FILE* fp;
21852     int fd;
21853
21854     if (!s)
21855         exit(1);
21856     fclose(stdin);
21857     fp = fopen("try.c", "r");
21858     if (fp == 0)
21859       exit(2);
21860     fd = fileno(fp);
21861     if (fd < 0)
21862       exit(3);
21863     b = ($selecttype)s;
21864     for (i = 0; i < NBITS; i++)
21865         FD_SET(i, b);
21866     t.tv_sec  = 0;
21867     t.tv_usec = 0;
21868     select(fd + 1, b, 0, 0, &t);
21869     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21870     free(s);
21871     printf("%d\n", i + 1);
21872     return 0;
21873 }
21874 EOCP
21875                 set try
21876                 if eval $compile_ok; then
21877                         selectminbits=`$run ./try 2>/dev/null`
21878                         case "$selectminbits" in
21879                         '')     cat >&4 <<EOM
21880 Cannot figure out on how many bits at a time your select() operates.
21881 I'll play safe and guess it is $safebits bits.
21882 EOM
21883                                 selectminbits=$safebits
21884                                 bits="$safebits bits"
21885                                 ;;
21886                         1)      bits="1 bit" ;;
21887                         *)      bits="$selectminbits bits" ;;
21888                         esac
21889                         echo "Your select() operates on $bits at a time." >&4
21890                 else
21891                         rp='What is the minimum number of bits your select() operates on?'
21892                         case "$byteorder" in
21893                         12345678)       dflt=64 ;;
21894                         1234)           dflt=32 ;;
21895                         *)              dflt=1  ;;
21896                         esac
21897                         . ./myread
21898                         val=$ans
21899                         selectminbits="$val"
21900                 fi
21901                 $rm_try
21902                 ;;
21903         *)      : no select, so pick a harmless default
21904                 selectminbits=$safebits
21905                 ;;
21906         esac
21907         ;;
21908 esac
21909
21910 : Trace out the files included by signal.h, then look for SIGxxx names.
21911 case "$sig_num_init" in
21912 '')
21913 if [ "X$fieldn" = X ]; then
21914         : Just make some guesses.  We check them later.
21915         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21916 else
21917         xxx=`echo '#include <signal.h>' |
21918         $cppstdin $cppminus $cppflags 2>/dev/null |
21919         $grep '^[       ]*#.*include' |
21920         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21921                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21922 fi
21923 xxxfiles=''
21924 for xx in $xxx /dev/null ; do
21925         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21926 done
21927 case "$xxxfiles" in
21928 '')     xxxfiles=`./findhdr signal.h` ;;
21929 esac
21930 xxx=`awk '
21931 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21932         print substr($2, 4, 20)
21933 }
21934 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21935         print substr($3, 4, 20)
21936 }' $xxxfiles`
21937 : Append some common names just in case the awk scan failed.
21938 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21939 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21940 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21941 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21942 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21943
21944 : generate a few handy files for later
21945 $cat > signal.c <<EOCP
21946 #include <sys/types.h>
21947 #include <signal.h>
21948 #$i_stdlib I_STDLIB
21949 #ifdef I_STDLIB
21950 #include <stdlib.h>
21951 #endif
21952 #include <stdio.h>
21953 int main() {
21954
21955 /* Strange style to avoid deeply-nested #if/#else/#endif */
21956 #ifndef NSIG
21957 #  ifdef _NSIG
21958 #    define NSIG (_NSIG)
21959 #  endif
21960 #endif
21961
21962 #ifndef NSIG
21963 #  ifdef SIGMAX
21964 #    define NSIG (SIGMAX+1)
21965 #  endif
21966 #endif
21967
21968 #ifndef NSIG
21969 #  ifdef SIG_MAX
21970 #    define NSIG (SIG_MAX+1)
21971 #  endif
21972 #endif
21973
21974 #ifndef NSIG
21975 #  ifdef _SIG_MAX
21976 #    define NSIG (_SIG_MAX+1)
21977 #  endif
21978 #endif
21979
21980 #ifndef NSIG
21981 #  ifdef MAXSIG
21982 #    define NSIG (MAXSIG+1)
21983 #  endif
21984 #endif
21985
21986 #ifndef NSIG
21987 #  ifdef MAX_SIG
21988 #    define NSIG (MAX_SIG+1)
21989 #  endif
21990 #endif
21991
21992 #ifndef NSIG
21993 #  ifdef SIGARRAYSIZE
21994 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21995 #  endif
21996 #endif
21997
21998 #ifndef NSIG
21999 #  ifdef _sys_nsig
22000 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22001 #  endif
22002 #endif
22003
22004 /* Default to some arbitrary number that's big enough to get most
22005    of the common signals.
22006 */
22007 #ifndef NSIG
22008 #    define NSIG 50
22009 #endif
22010
22011 printf("NSIG %d\n", NSIG);
22012
22013 #ifndef JUST_NSIG
22014
22015 EOCP
22016
22017 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22018 {
22019         printf "#ifdef SIG"; printf $1; printf "\n"
22020         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22021         printf $1; printf ");\n"
22022         printf "#endif\n"
22023 }
22024 END {
22025         printf "#endif /* JUST_NSIG */\n";
22026         printf "exit(0);\n}\n";
22027 }
22028 ' >>signal.c
22029 $cat >signal.awk <<'EOP'
22030 BEGIN { ndups = 0 }
22031 $1 ~ /^NSIG$/ { nsig = $2 }
22032 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22033     if ($2 > maxsig) { maxsig = $2 }
22034     if (sig_name[$2]) {
22035         dup_name[ndups] = $1
22036         dup_num[ndups] = $2
22037         ndups++
22038     }
22039     else {
22040         sig_name[$2] = $1
22041         sig_num[$2] = $2
22042     }
22043 }
22044 END {
22045     if (nsig == 0) {
22046         nsig = maxsig + 1
22047     }
22048     printf("NSIG %d\n", nsig);
22049     for (n = 1; n < nsig; n++) {
22050         if (sig_name[n]) {
22051             printf("%s %d\n", sig_name[n], sig_num[n])
22052         }
22053         else {
22054             printf("NUM%d %d\n", n, n)
22055         }
22056     }
22057     for (n = 0; n < ndups; n++) {
22058         printf("%s %d\n", dup_name[n], dup_num[n])
22059     }
22060 }
22061 EOP
22062 $cat >signal_cmd <<EOS
22063 $startsh
22064 if $test -s signal.lst; then
22065     echo "Using your existing signal.lst file"
22066         exit 0
22067 fi
22068 xxx="$xxx"
22069 EOS
22070 $cat >>signal_cmd <<'EOS'
22071
22072 set signal
22073 if eval $compile_ok; then
22074         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22075                 $uniq | $awk -f signal.awk >signal.lst
22076 else
22077         echo "(I can't seem be able to compile the whole test program)" >&4
22078         echo "(I'll try it in little pieces.)" >&4
22079         set signal -DJUST_NSIG
22080         if eval $compile_ok; then
22081                 $run ./signal$_exe > signal.nsg
22082                 $cat signal.nsg
22083         else
22084                 echo "I can't seem to figure out how many signals you have." >&4
22085                 echo "Guessing 50." >&4
22086                 echo 'NSIG 50' > signal.nsg
22087         fi
22088         : Now look at all the signal names, one at a time.
22089         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22090                 $cat > signal.c <<EOCP
22091 #include <sys/types.h>
22092 #include <signal.h>
22093 #include <stdio.h>
22094 int main() {
22095 printf("$xx %d\n", SIG${xx});
22096 return 0;
22097 }
22098 EOCP
22099                 set signal
22100                 if eval $compile; then
22101                         echo "SIG${xx} found."
22102                         $run ./signal$_exe  >> signal.ls1
22103                 else
22104                         echo "SIG${xx} NOT found."
22105                 fi
22106         done
22107         if $test -s signal.ls1; then
22108                 $cat signal.nsg signal.ls1 |
22109                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22110         fi
22111
22112 fi
22113 if $test -s signal.lst; then
22114         :
22115 else
22116         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22117         echo 'kill -l' >signal
22118         set X `csh -f <signal`
22119         $rm -f signal
22120         shift
22121         case $# in
22122         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22123         esac
22124         echo $@ | $tr ' ' $trnl | \
22125             $awk '{ printf "%s %d\n", $1, ++s; }
22126                   END { printf "NSIG %d\n", ++s }' >signal.lst
22127 fi
22128 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22129 EOS
22130 chmod a+x signal_cmd
22131 $eunicefix signal_cmd
22132
22133 : generate list of signal names
22134 echo " "
22135 case "$sig_name_init" in
22136 '') doinit=yes ;;
22137 *)  case "$sig_num_init" in
22138     ''|*,*) doinit=yes ;;
22139     esac ;;
22140 esac
22141 case "$doinit" in
22142 yes)
22143         echo "Generating a list of signal names and numbers..." >&4
22144         . ./signal_cmd
22145         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22146         sig_name=`$awk 'BEGIN { printf "ZERO " }
22147                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22148         sig_num=`$awk  'BEGIN { printf "0 " }
22149                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22150         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22151                              !/^NSIG/   { printf "\"%s\", ", $1 }
22152                              END        { printf "0\n" }' signal.lst`
22153         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22154                              !/^NSIG/   { printf "%d, ", $2}
22155                              END        { printf "0\n"}' signal.lst`
22156         ;;
22157 esac
22158 echo "The following $sig_count signals are available:"
22159 echo " "
22160 echo $sig_name | $awk \
22161 'BEGIN { linelen = 0 }
22162 {
22163         for (i = 1; i <= NF; i++) {
22164                 name = "SIG" $i " "
22165                 linelen = linelen + length(name)
22166                 if (linelen > 70) {
22167                         printf "\n"
22168                         linelen = length(name)
22169                 }
22170                 printf "%s", name
22171         }
22172         printf "\n"
22173 }'
22174 sig_size=`echo $sig_name | awk '{print NF}'`
22175 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22176 ;;
22177 esac
22178
22179 : Check size of size
22180 echo " "
22181 case "$sizetype" in
22182 *_t) zzz="$sizetype"    ;;
22183 *)   zzz="filesize"     ;;
22184 esac
22185 echo "Checking the size of $zzz..." >&4
22186 cat > try.c <<EOCP
22187 #include <sys/types.h>
22188 #include <stdio.h>
22189 #$i_stdlib I_STDLIB
22190 #ifdef I_STDLIB
22191 #include <stdlib.h>
22192 #endif
22193 int main() {
22194     printf("%d\n", (int)sizeof($sizetype));
22195     exit(0);
22196 }
22197 EOCP
22198 set try
22199 if eval $compile_ok; then
22200         yyy=`$run ./try`
22201         case "$yyy" in
22202         '')     sizesize=4
22203                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22204                 ;;
22205         *)      sizesize=$yyy
22206                 echo "Your $zzz size is $sizesize bytes."
22207                 ;;
22208         esac
22209 else
22210         sizesize=4
22211         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22212 fi
22213
22214
22215 : check for socklen_t
22216 echo " "
22217 echo "Checking to see if you have socklen_t..." >&4
22218 $cat >try.c <<EOCP
22219 #include <sys/types.h>
22220 #$d_socket HAS_SOCKET
22221 #ifdef HAS_SOCKET
22222 #include <sys/socket.h>
22223 #endif
22224 int main() { socklen_t x = 16; }
22225 EOCP
22226 set try
22227 if eval $compile; then
22228         val="$define"
22229         echo "You have socklen_t."
22230 else
22231         val="$undef"
22232         echo "You do not have socklen_t."
22233         case "$sizetype" in
22234         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22235         esac
22236 fi
22237 $rm_try
22238 set d_socklen_t
22239 eval $setvar
22240
22241 : see if this is a socks.h system
22242 set socks.h i_socks
22243 eval $inhdr
22244
22245 : check for type of the size argument to socket calls
22246 case "$d_socket" in
22247 "$define")
22248         $cat <<EOM
22249
22250 Checking to see what type is the last argument of accept().
22251 EOM
22252         yyy=''
22253         case "$d_socklen_t" in
22254         "$define") yyy="$yyy socklen_t"
22255         esac
22256         yyy="$yyy $sizetype int long unsigned"
22257         for xxx in $yyy; do
22258                 case "$socksizetype" in
22259                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22260                         case "$usesocks" in
22261                         "$define")
22262                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22263                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22264                                         socksizetype="$xxx"
22265                                 fi
22266                                 ;;
22267                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22268                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22269                                         socksizetype="$xxx"
22270                                 fi
22271                                 ;;
22272                         esac
22273                         ;;
22274                 esac
22275         done
22276 : In case none of those worked, prompt the user.
22277         case "$socksizetype" in
22278         '')     rp='What is the type for socket address structure sizes?'
22279                 dflt='int'
22280                 . ./myread
22281                 socksizetype=$ans
22282                 ;;
22283         esac
22284         ;;
22285 *)      : no sockets, so pick relatively harmless default
22286         socksizetype='int'
22287         ;;
22288 esac
22289
22290 : see what type is used for signed size_t
22291 set ssize_t ssizetype int stdio.h sys/types.h
22292 eval $typedef
22293 dflt="$ssizetype"
22294 $cat > try.c <<EOM
22295 #include <stdio.h>
22296 #$i_stdlib I_STDLIB
22297 #ifdef I_STDLIB
22298 #include <stdlib.h>
22299 #endif
22300 #include <sys/types.h>
22301 #define Size_t $sizetype
22302 #define SSize_t $dflt
22303 int main()
22304 {
22305         if (sizeof(Size_t) == sizeof(SSize_t))
22306                 printf("$dflt\n");
22307         else if (sizeof(Size_t) == sizeof(int))
22308                 printf("int\n");
22309         else
22310                 printf("long\n");
22311         exit(0);
22312 }
22313 EOM
22314 echo " "
22315 set try
22316 if eval $compile_ok && $run ./try > /dev/null; then
22317         ssizetype=`$run ./try`
22318         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22319 else
22320         $cat >&4 <<EOM
22321 Help! I can't compile and run the ssize_t test program: please enlighten me!
22322 (This is probably a misconfiguration in your system or libraries, and
22323 you really ought to fix it.  Still, I'll try anyway.)
22324
22325 I need a type that is the same size as $sizetype, but is guaranteed to
22326 be signed.  Common values are ssize_t, int and long.
22327
22328 EOM
22329         rp="What signed type is the same size as $sizetype?"
22330         . ./myread
22331         ssizetype="$ans"
22332 fi
22333 $rm_try
22334
22335 : Check the size of st_ino
22336 $echo " "
22337 $echo "Checking the size of st_ino..." >&4
22338 $cat > try.c <<EOCP
22339 #include <sys/stat.h>
22340 #include <stdio.h>
22341 #$i_stdlib I_STDLIB
22342 #ifdef I_STDLIB
22343 #include <stdlib.h>
22344 #endif
22345 int main() {
22346     struct stat st;
22347     printf("%d\n", (int)sizeof(st.st_ino));
22348     exit(0);
22349 }
22350 EOCP
22351 set try
22352 if eval $compile_ok; then
22353         val=`$run ./try`
22354         case "$val" in
22355         '')     st_ino_size=4
22356                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22357                 ;;
22358         *)      st_ino_size=$val
22359                 $echo "Your st_ino is $st_ino_size bytes long."
22360                 ;;
22361         esac
22362 else
22363         st_ino_size=4
22364         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22365 fi
22366 $rm_try
22367
22368 : Check if st_ino is signed
22369 $echo " "
22370 $echo "Checking the sign of st_ino..." >&4
22371 $cat > try.c <<EOCP
22372 #include <sys/stat.h>
22373 #include <stdio.h>
22374 int main() {
22375         struct stat foo;
22376         foo.st_ino = -1;
22377         if (foo.st_ino < 0)
22378                 printf("-1\n");
22379         else
22380                 printf("1\n");
22381 }
22382 EOCP
22383 set try
22384 if eval $compile; then
22385         val=`$run ./try`
22386         case "$val" in
22387         '')     st_ino_sign=1
22388                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22389                 ;;
22390         *)      st_ino_sign=$val
22391                 case "$st_ino_sign" in
22392                  1) $echo "Your st_ino is unsigned." ;;
22393                 -1) $echo "Your st_ino is signed."   ;;
22394                 esac
22395                 ;;
22396         esac
22397 else
22398         st_ino_sign=1
22399         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22400 fi
22401 $rm_try
22402
22403 : see what type of char stdio uses.
22404 echo " "
22405 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22406 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22407         echo "Your stdio uses unsigned chars." >&4
22408         stdchar="unsigned char"
22409 else
22410         echo "Your stdio uses signed chars." >&4
22411         stdchar="char"
22412 fi
22413 $rm -f stdioh
22414
22415 : see what type uids are declared as in the kernel
22416 echo " "
22417 echo "Looking for the type for user ids returned by getuid()."
22418 set uid_t uidtype xxx stdio.h sys/types.h
22419 eval $typedef
22420 case "$uidtype" in
22421 xxx)
22422         xxx=`./findhdr sys/user.h`
22423         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
22424         case $1 in
22425         unsigned) dflt="$1 $2" ;;
22426         *) dflt="$1" ;;
22427         esac
22428         ;;
22429 *) dflt="$uidtype";;
22430 esac
22431 case "$uidtype" in
22432 uid_t)  echo "uid_t found." ;;
22433 *)      rp="What is the type for user ids returned by getuid()?"
22434         . ./myread
22435         uidtype="$ans"
22436         ;;
22437 esac
22438
22439 : Check size of UID
22440 echo " "
22441 case "$uidtype" in
22442 *_t) zzz="$uidtype"     ;;
22443 *)   zzz="uid"          ;;
22444 esac
22445 echo "Checking the size of $zzz..." >&4
22446 cat > try.c <<EOCP
22447 #include <sys/types.h>
22448 #include <stdio.h>
22449 #$i_stdlib I_STDLIB
22450 #ifdef I_STDLIB
22451 #include <stdlib.h>
22452 #endif
22453 int main() {
22454     printf("%d\n", (int)sizeof($uidtype));
22455     exit(0);
22456 }
22457 EOCP
22458 set try
22459 if eval $compile_ok; then
22460         yyy=`$run ./try`
22461         case "$yyy" in
22462         '')     uidsize=4
22463                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22464                 ;;
22465         *)      uidsize=$yyy
22466                 echo "Your $zzz is $uidsize bytes long."
22467                 ;;
22468         esac
22469 else
22470         uidsize=4
22471         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22472 fi
22473
22474 : Check if UID is signed
22475 echo " "
22476 case "$uidtype" in
22477 *_t) zzz="$uidtype"     ;;
22478 *)   zzz="uid"          ;;
22479 esac
22480 echo "Checking the sign of $zzz..." >&4
22481 cat > try.c <<EOCP
22482 #include <sys/types.h>
22483 #include <stdio.h>
22484 int main() {
22485         $uidtype foo = -1;
22486         if (foo < 0)
22487                 printf("-1\n");
22488         else
22489                 printf("1\n");
22490 }
22491 EOCP
22492 set try
22493 if eval $compile; then
22494         yyy=`$run ./try`
22495         case "$yyy" in
22496         '')     uidsign=1
22497                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22498                 ;;
22499         *)      uidsign=$yyy
22500                 case "$uidsign" in
22501                  1) echo "Your $zzz is unsigned." ;;
22502                 -1) echo "Your $zzz is signed."   ;;
22503                 esac
22504                 ;;
22505         esac
22506 else
22507         uidsign=1
22508         echo "(I can't compile the test program--guessing unsigned.)" >&4
22509 fi
22510
22511
22512 : Check format string for UID
22513 echo " "
22514 $echo "Checking the format string to be used for uids..." >&4
22515
22516 case "$uidsign" in
22517 -1)     if $test X"$uidsize" = X"$ivsize"; then
22518                 uidformat="$ivdformat"
22519         else
22520                 if $test X"$uidsize" = X"$longsize"; then
22521                         uidformat='"ld"'
22522                 else
22523                         if $test X"$uidsize" = X"$intsize"; then
22524                                 uidformat='"d"'
22525                         else
22526                                 if $test X"$uidsize" = X"$shortsize"; then
22527                                         uidformat='"hd"'
22528                                 fi
22529                         fi
22530                 fi
22531         fi
22532         ;;
22533 *)      if $test X"$uidsize" = X"$uvsize"; then
22534                 uidformat="$uvuformat"
22535         else
22536                 if $test X"$uidsize" = X"$longsize"; then
22537                         uidformat='"lu"'
22538                 else
22539                         if $test X"$uidsize" = X"$intsize"; then
22540                                 uidformat='"u"'
22541                         else
22542                                 if $test X"$uidsize" = X"$shortsize"; then
22543                                         uidformat='"hu"'
22544                                 fi
22545                         fi
22546                 fi
22547         fi
22548         ;;
22549 esac
22550
22551 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22552 echo " "
22553 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22554 $cat >try.c <<'EOM'
22555 /* Intentionally a long probe as I'd like to sanity check that the exact
22556    approach is going to work, as thinking it will work, but only having it
22557    part working at runtime is worse than not having it.  */
22558
22559 #include <sys/types.h>
22560 #include <sys/sysctl.h>
22561 #include <sys/param.h>
22562 #include <stdio.h>
22563 #include <string.h>
22564 #include <stdlib.h>
22565 #include <unistd.h>
22566
22567 int
22568 main(int argc, char **argv) {
22569     char *buffer;
22570     char *argv_leaf = strrchr(argv[0], '/');
22571     char *buffer_leaf;
22572     size_t size = 0;
22573     int mib[4];
22574
22575     mib[0] = CTL_KERN;
22576     mib[1] = KERN_PROC;
22577     mib[2] = KERN_PROC_PATHNAME;
22578     mib[3] = -1;
22579
22580     if (!argv_leaf) {
22581         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22582         return 1;
22583     }
22584
22585     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22586         perror("sysctl");
22587         return 2;
22588     }
22589
22590     if (size < strlen(argv_leaf) + 1) {
22591         fprintf(stderr, "size %lu is too short for a path\n",
22592                 (unsigned long) size);
22593         return 3;
22594     }
22595
22596     if (size > MAXPATHLEN * MAXPATHLEN) {
22597         fprintf(stderr, "size %lu is too long for a path\n",
22598                 (unsigned long) size);
22599         return 4;
22600     }
22601
22602     buffer = malloc(size);
22603     if (!buffer) {
22604         perror("malloc");
22605         return 5;
22606     }
22607
22608     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22609         perror("sysctl");
22610         return 6;
22611     }
22612
22613     if (strlen(buffer) + 1 != size) {
22614         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22615                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22616         return 7;
22617     }
22618
22619
22620     if (*buffer != '/') {
22621         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22622         return 8;
22623     }
22624
22625     if (strstr(buffer, "/./")) {
22626         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22627         return 9;
22628     }
22629
22630     if (strstr(buffer, "/../")) {
22631         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22632         return 10;
22633     }
22634
22635     buffer_leaf = strrchr(buffer, '/');
22636     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22637         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22638         return 11;
22639     }
22640
22641     free(buffer);
22642
22643     return 0;
22644 }
22645 EOM
22646
22647 val=$undef
22648 set try
22649 if eval $compile; then
22650         if $run ./try; then
22651                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22652                 val="$define"
22653         else
22654                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22655                 val="$undef"
22656         fi
22657 else
22658         echo "I'm unable to compile the test program." >&4
22659         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22660         val="$undef"
22661 fi
22662 $rm_try
22663 set usekernprocpathname
22664 eval $setvar
22665
22666 : Determine if we can use _NSGetExecutablePath to find executing program
22667 echo " "
22668 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22669 $cat >try.c <<'EOM'
22670 /* Intentionally a long probe as I'd like to sanity check that the exact
22671    approach is going to work, as thinking it will work, but only having it
22672    part working at runtime is worse than not having it.  */
22673 #include <mach-o/dyld.h>
22674 #include <stdio.h>
22675 #include <stdlib.h>
22676 #include <sys/param.h>
22677 #include <string.h>
22678
22679 int
22680 main(int argc, char **argv) {
22681     char buf[1];
22682     uint32_t size = sizeof(buf);
22683     int result;
22684     char *buffer;
22685     char *tidied;
22686     char *argv_leaf = strrchr(argv[0], '/');
22687     char *tidied_leaf;
22688
22689     if (!argv_leaf) {
22690         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22691         return 1;
22692     }
22693
22694     _NSGetExecutablePath(buf, &size);
22695     if (size > MAXPATHLEN * MAXPATHLEN) {
22696         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22697                 (unsigned int) size);
22698         return 2;
22699     }
22700
22701     buffer = malloc(size);
22702     if (!buffer) {
22703         perror("malloc");
22704         return 3;
22705     }
22706
22707     result = _NSGetExecutablePath(buffer, &size);
22708     if (result != 0) {
22709         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22710                 result, (unsigned int) size);
22711         return 4;
22712     }
22713
22714     tidied = realpath(buffer, NULL);
22715     if (!tidied) {
22716         perror("realpath");
22717         return 5;
22718     }
22719
22720     free(buffer);
22721
22722     if (*tidied != '/') {
22723         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22724         return 6;
22725     }
22726
22727     if (strstr(tidied, "/./")) {
22728         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22729         return 7;
22730     }
22731
22732     if (strstr(tidied, "/../")) {
22733         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22734         return 8;
22735     }
22736
22737     tidied_leaf = strrchr(tidied, '/');
22738     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22739         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22740         return 9;
22741     }
22742
22743     free(tidied);
22744
22745     return 0;
22746 }
22747 EOM
22748
22749 val=$undef
22750 set try
22751 if eval $compile; then
22752         if $run ./try; then
22753                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22754                 val="$define"
22755         else
22756                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22757         fi
22758 else
22759         echo "I'm unable to compile the test program." >&4
22760         echo "I'll assume no _NSGetExecutablePath here." >&4
22761 fi
22762 $rm_try
22763 set usensgetexecutablepath
22764 eval $setvar
22765
22766 : Check if site customization support was requested
22767 case "$usesitecustomize" in
22768     $define|true|[Yy]*)
22769         usesitecustomize="$define"
22770         ;;
22771     *)
22772         usesitecustomize="$undef"
22773         ;;
22774     esac
22775
22776 : see if prototypes support variable argument declarations
22777 echo " "
22778 case "$prototype$i_stdarg" in
22779 $define$define)
22780         echo "It appears we'll be able to prototype varargs functions." >&4
22781         val="$define"
22782         ;;
22783 *)
22784         echo "Too bad... We won't be using prototyped varargs functions..." >&4
22785         val="$undef"
22786         ;;
22787 esac
22788 set vaproto
22789 eval $setvar
22790
22791 : determine compiler compiler
22792 case "$yacc" in
22793 '')
22794         dflt=yacc;;
22795 *)
22796         dflt="$yacc";;
22797 esac
22798 echo " "
22799 comp='yacc'
22800 if $test -f "$byacc$_exe"; then
22801         dflt="$byacc"
22802         comp="byacc or $comp"
22803 fi
22804 if $test -f "$bison$_exe"; then
22805         comp="$comp or bison -y"
22806 fi
22807 rp="Which compiler compiler ($comp) shall I use?"
22808 . ./myread
22809 yacc="$ans"
22810 case "$yacc" in
22811 *bis*)
22812         case "$yacc" in
22813         *-y*) ;;
22814         *)
22815                 yacc="$yacc -y"
22816                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22817                 ;;
22818         esac
22819         ;;
22820 esac
22821
22822 : see if this is a assert.h system
22823 set assert.h i_assert
22824 eval $inhdr
22825
22826 : see if this is a bfd.h system
22827 set bfd.h i_bfd
22828 eval $inhdr
22829
22830 : see if this is an execinfo.h system
22831 set execinfo.h i_execinfo
22832 eval $inhdr
22833
22834 : see if this is a fenv.h system
22835 set fenv.h i_fenv
22836 eval $inhdr
22837
22838 : see if this is a fp.h system
22839 set fp.h i_fp
22840 eval $inhdr
22841
22842 : see if this is a fp_class.h system
22843 set fp_class.h i_fp_class
22844 eval $inhdr
22845
22846 : see if gdbm.h is available
22847 set gdbm.h t_gdbm
22848 eval $inhdr
22849 case "$t_gdbm" in
22850 $define)
22851         : see if gdbm_open exists
22852         set gdbm_open d_gdbm_open
22853         eval $inlibc
22854         case "$d_gdbm_open" in
22855         $undef)
22856                 t_gdbm="$undef"
22857                 echo "We won't be including <gdbm.h>"
22858                 ;;
22859         esac
22860         ;;
22861 esac
22862 val="$t_gdbm"
22863 set i_gdbm
22864 eval $setvar
22865
22866 : see if this is a ieeefp.h system
22867 case "$i_ieeefp" in
22868 '' ) set ieeefp.h i_ieeefp
22869      eval $inhdr
22870      ;;
22871 esac
22872
22873 : see if this is a libutil.h system
22874 set libutil.h i_libutil
22875 eval $inhdr
22876
22877 : see if mach cthreads are available
22878 if test "X$usethreads" = "X$define"; then
22879         set mach/cthreads.h i_machcthr
22880         eval $inhdr
22881 else
22882         i_machcthr="$undef"
22883 fi
22884
22885 : see if net/errno.h is available
22886 val=''
22887 set net/errno.h val
22888 eval $inhdr
22889
22890 : Unfortunately, it causes problems on some systems.  Arrgh.
22891 case "$val" in
22892 $define)
22893         cat > try.c <<'EOM'
22894 #include <stdio.h>
22895 #include <errno.h>
22896 #include <net/errno.h>
22897 int func()
22898 {
22899         return ENOTSOCK;
22900 }
22901 EOM
22902         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22903                 echo "We'll be including <net/errno.h>." >&4
22904         else
22905                 echo "We won't be including <net/errno.h>." >&4
22906                 val="$undef"
22907         fi
22908         $rm_try
22909         ;;
22910 esac
22911 set i_neterrno
22912 eval $setvar
22913
22914 : see if netinet/tcp.h is available
22915 set netinet/tcp.h i_netinettcp
22916 eval $inhdr
22917
22918 : see if this is a poll.h system
22919 set poll.h i_poll
22920 eval $inhdr
22921
22922 : see if this is a prot.h system
22923 set prot.h i_prot
22924 eval $inhdr
22925
22926 : Preprocessor symbols
22927 echo " "
22928 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22929 $cat <<'EOSH' > Cppsym.know
22930 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22931 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22932 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22933 arch_pwr ardent ARM ARM32 atarist att386 att3b
22934 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22935 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22936 byteorder byte_order
22937 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22938 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22939 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22940 ELF encore EPI EXTENSIONS
22941 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22942 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22943 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22944 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22945 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
22946 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22947 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22948 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22949 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22950 ksr1
22951 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22952 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22953 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22954 luna88k Lynx
22955 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22956 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22957 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22958 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22959 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22960 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22961 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22962 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22963 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22964 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22965 ns32000 ns32016 ns32332 ns32k nsc32000
22966 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22967 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
22968 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22969 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
22970 QK_USER QNX
22971 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
22972 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
22973 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
22974 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
22975 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
22976 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
22977 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
22978 SYSV4 SYSV5 sysV68 sysV88
22979 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
22980 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
22981 tower32_800 tower32_850 tss
22982 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
22983 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
22984 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
22985 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
22986 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
22987 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
22988 uxpm uxps
22989 vax venix VMESA vms
22990 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
22991 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22992 z8000 zarch
22993 EOSH
22994 # Maybe put other stuff here too.
22995 ./tr '-' '_' <<EOSH >>Cppsym.know
22996 $osname
22997 EOSH
22998 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22999 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23000 $cat Cppsym.know > Cppsym.c
23001 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23002 $rm -f Cppsym.a Cppsym.b Cppsym.c
23003 cat <<EOSH > Cppsym
23004 $startsh
23005 if $test \$# -gt 0; then
23006     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23007     if $test -s Cppsym.got; then
23008         $rm -f Cppsym.got
23009         exit 0
23010     fi
23011     $rm -f Cppsym.got
23012     exit 1
23013 else
23014     $tr " " "$trnl" | ./Cppsym.try
23015     exit 0
23016 fi
23017 EOSH
23018 chmod +x Cppsym
23019 $eunicefix Cppsym
23020 cat <<EOSH > Cppsym.try
23021 $startsh
23022 cat <<'EOCP' > try.c
23023 #include <stdio.h>
23024 #if cpp_stuff == 1
23025 #define STRINGIFY(a)    "a"
23026 #endif
23027 #if cpp_stuff == 42
23028 #define StGiFy(a)  #a
23029 #define STRINGIFY(a)    StGiFy(a)
23030 #endif
23031 #if $cpp_stuff != 1 && $cpp_stuff != 42
23032 #   include "Bletch: How does this C preprocessor stringify macros?"
23033 #endif
23034 int main() {
23035 EOCP
23036 $awk \\
23037 EOSH
23038 cat <<'EOSH' >> Cppsym.try
23039 'length($1) > 0 {
23040     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23041     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23042     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23043     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23044 }'       >> try.c
23045 echo 'return 0;}' >> try.c
23046 EOSH
23047 cat <<EOSH >> Cppsym.try
23048 ccflags="$ccflags"
23049 case "$osname-$gccversion" in
23050 irix-) ccflags="\$ccflags -woff 1178" ;;
23051 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23052 esac
23053 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
23054 EOSH
23055 chmod +x Cppsym.try
23056 $eunicefix Cppsym.try
23057 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23058 : Add in any Linux cpp "predefined macros":
23059 case "$osname::$gccversion" in
23060   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23061     tHdrH=_tmpHdr
23062     rm -f $tHdrH'.h' $tHdrH
23063     touch $tHdrH'.h'
23064     # Filter out macro arguments, such as Linux's __INT8_C(c)
23065     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23066        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23067        if [ -s $tHdrH'_cppsym.real' ]; then
23068           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23069        fi
23070     fi
23071     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23072   ;;
23073 esac
23074 : now check the C compiler for additional symbols
23075 postprocess_cc_v=''
23076 case "$osname" in
23077 aix) postprocess_cc_v="|$tr , ' '" ;;
23078 esac
23079 $cat >ccsym <<EOS
23080 $startsh
23081 $cat >tmp.c <<EOF
23082 extern int foo;
23083 EOF
23084 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23085 do
23086         case "\$i" in
23087         -D*) echo "\$i" | $sed 's/^-D//';;
23088         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23089         esac
23090 done
23091 $rm_try
23092 EOS
23093 postprocess_cc_v=''
23094 chmod +x ccsym
23095 $eunicefix ccsym
23096 ./ccsym > ccsym1.raw
23097 if $test -s ccsym1.raw; then
23098     $sort ccsym1.raw | $uniq >ccsym.raw
23099 else
23100     mv ccsym1.raw ccsym.raw
23101 fi
23102
23103 $awk '/\=/ { print $0; next }
23104         { print $0"=1" }' ccsym.raw >ccsym.list
23105 $comm -13 Cppsym.true ccsym.list >ccsym.own
23106 $comm -12 Cppsym.true ccsym.list >ccsym.com
23107 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23108 also=''
23109 if $test -z ccsym.raw; then
23110         echo "Your C compiler doesn't seem to define any symbols!" >&4
23111         echo " "
23112         echo "However, your C preprocessor defines the following symbols:"
23113         $cat Cppsym.true
23114         ccsymbols=''
23115         cppsymbols=`$cat Cppsym.true`
23116         cppsymbols=`echo $cppsymbols`
23117         cppccsymbols="$cppsymbols"
23118 else
23119         if $test -s ccsym.com; then
23120                 echo "Your C compiler and pre-processor define these symbols:"
23121                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23122                 also='also '
23123                 symbols='ones'
23124                 cppccsymbols=`$cat ccsym.com`
23125                 cppccsymbols=`echo $cppccsymbols`
23126                 $test "$silent" || sleep 1
23127         fi
23128         if $test -s ccsym.cpp; then
23129                 $test "$also" && echo " "
23130                 echo "Your C pre-processor ${also}defines the following symbols:"
23131                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23132                 also='further '
23133                 cppsymbols=`$cat ccsym.cpp`
23134                 cppsymbols=`echo $cppsymbols`
23135                 $test "$silent" || sleep 1
23136         fi
23137         if $test -s ccsym.own; then
23138                 $test "$also" && echo " "
23139                 echo "Your C compiler ${also}defines the following cpp symbols:"
23140                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23141                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23142                 ccsymbols=`$cat ccsym.own`
23143                 ccsymbols=`echo $ccsymbols`
23144                 $test "$silent" || sleep 1
23145         fi
23146 fi
23147
23148 : add -D_FORTIFY_SOURCE if feasible and not already there
23149 case "$gccversion" in
23150 4.*)    case "$optimize$ccflags" in
23151         *-O*)   case "$ccflags$cppsymbols" in
23152                 *_FORTIFY_SOURCE=*) # Don't add it again.
23153                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23154                         ;;
23155                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23156                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23157                         ;;
23158                 esac
23159                 ;;
23160         *)      echo "You have gcc 4.* but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23161                 ;;
23162         esac
23163         ;;
23164 *)      echo "You seem not to have gcc 4.*, not adding -D_FORTIFY_SOURCE." >&4
23165         ;;
23166 esac
23167
23168 : see if this is a termio system
23169 val="$undef"
23170 val2="$undef"
23171 val3="$undef"
23172 if $test `./findhdr termios.h`; then
23173     set tcsetattr i_termios
23174     eval $inlibc
23175     val3="$i_termios"
23176 fi
23177 echo " "
23178 case "$val3" in
23179     "$define") echo "You have POSIX termios.h... good!" >&4;;
23180     *)  if ./Cppsym pyr; then
23181             case "`$run /bin/universe`" in
23182                 ucb) if $test `./findhdr sgtty.h`; then
23183                         val2="$define"
23184                         echo "<sgtty.h> found." >&4
23185                     else
23186                         echo "System is pyramid with BSD universe."
23187                         ./warn "<sgtty.h> not found--you could have problems."
23188                     fi;;
23189                 *)  if $test `./findhdr termio.h`; then
23190                         val="$define"
23191                         echo "<termio.h> found." >&4
23192                     else
23193                         echo "System is pyramid with USG universe."
23194                         ./warn "<termio.h> not found--you could have problems."
23195                     fi;;
23196             esac
23197         elif ./usg; then
23198             if $test `./findhdr termio.h`; then
23199                 echo "<termio.h> found." >&4
23200                 val="$define"
23201             elif $test `./findhdr sgtty.h`; then
23202                 echo "<sgtty.h> found." >&4
23203                 val2="$define"
23204             else
23205                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23206             fi
23207         else
23208             if $test `./findhdr sgtty.h`; then
23209                 echo "<sgtty.h> found." >&4
23210                 val2="$define"
23211             elif $test `./findhdr termio.h`; then
23212                 echo "<termio.h> found." >&4
23213                 val="$define"
23214             else
23215                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23216             fi
23217         fi;;
23218 esac
23219 set i_termio; eval $setvar
23220 val=$val2; set i_sgtty; eval $setvar
23221 val=$val3; set i_termios; eval $setvar
23222
23223 : see if stdbool is available
23224 : we want a real compile instead of Inhdr because some Solaris systems
23225 : have stdbool.h, but it can only be used if the compiler indicates it
23226 : is sufficiently c99-compliant.
23227 echo " "
23228 $cat >try.c <<EOCP
23229 #include <stdio.h>
23230 #include <stdbool.h>
23231 int func(bool x)
23232 {
23233     return x ? 1 : 0;
23234 }
23235 int main(int argc, char **argv)
23236 {
23237     return func(0);
23238 }
23239 EOCP
23240 set try
23241 if eval $compile; then
23242         echo "<stdbool.h> found." >&4
23243         val="$define"
23244 else
23245         echo "<stdbool.h> NOT found." >&4
23246         val="$undef"
23247 fi
23248 $rm_try
23249 set i_stdbool
23250 eval $setvar
23251
23252 : see if stddef is available
23253 set stddef.h i_stddef
23254 eval $inhdr
23255
23256 : see if stdint is available
23257 set stdint.h i_stdint
23258 eval $inhdr
23259
23260 : see if sys/access.h is available
23261 set sys/access.h i_sysaccess
23262 eval $inhdr
23263
23264 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23265 set sys/filio.h i_sysfilio
23266 eval $inhdr
23267 echo " "
23268 if $test `./findhdr sys/ioctl.h`; then
23269         val="$define"
23270         echo '<sys/ioctl.h> found.' >&4
23271 else
23272         val="$undef"
23273         if $test $i_sysfilio = "$define"; then
23274             echo '<sys/ioctl.h> NOT found.' >&4
23275         else
23276                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23277                 $test $i_termio = "$define" && xxx="termio.h"
23278                 $test $i_termios = "$define" && xxx="termios.h"
23279 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23280         fi
23281 fi
23282 set i_sysioctl
23283 eval $setvar
23284
23285 : see if socket ioctl defs are in sys/sockio.h
23286 echo " "
23287 xxx=`./findhdr sys/sockio.h`
23288 if $test "$xxx"; then
23289         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23290                 val="$define"
23291                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23292         else
23293                 val="$undef"
23294                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23295         fi
23296 else
23297         val="$undef"
23298         $cat <<EOM
23299 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23300 EOM
23301 fi
23302 set i_syssockio
23303 eval $setvar
23304
23305 : see if this is a syslog.h system
23306 set syslog.h i_syslog
23307 eval $inhdr
23308
23309 : see if this is a sys/mode.h system
23310 set sys/mode.h i_sysmode
23311 eval $inhdr
23312
23313 : see if there is a sys/poll.h file
23314 set sys/poll.h i_syspoll
23315 eval $inhdr
23316
23317 : see if sys/resource.h has to be included
23318 set sys/resource.h i_sysresrc
23319 eval $inhdr
23320
23321 : see if sys/security.h is available
23322 set sys/security.h i_syssecrt
23323 eval $inhdr
23324
23325 : see if this is a sys/un.h system
23326 set sys/un.h i_sysun
23327 eval $inhdr
23328
23329 : see if this is a sys/utsname.h system
23330 set sys/utsname.h i_sysutsname
23331 eval $inhdr
23332
23333 : see if this is a syswait system
23334 set sys/wait.h i_syswait
23335 eval $inhdr
23336
23337 : see if this is an utime system
23338 set utime.h i_utime
23339 eval $inhdr
23340
23341 : see if this is a vfork system
23342 case "$d_vfork" in
23343 "$define")
23344         set vfork.h i_vfork
23345         eval $inhdr
23346         ;;
23347 *)
23348         i_vfork="$undef"
23349         ;;
23350 esac
23351
23352 : Check extensions
23353 echo " "
23354 echo "Looking for extensions..." >&4
23355 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23356 : contain old or inaccurate or duplicate values.
23357 nonxs_extensions=''
23358 xs_extensions=''
23359 : We do not use find because it might not be available.
23360 : We do not just use MANIFEST because the user may have dropped
23361 : some additional extensions into the source tree and expect them
23362 : to be built.
23363
23364 : Function to recursively find available extensions, ignoring DynaLoader
23365 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23366 : In 5.10.1 and later, extensions are stored in directories
23367 : like File-Glob instead of the older File/Glob/.
23368 find_extensions='
23369     for xxx in *; do
23370         case "$xxx" in
23371             DynaLoader|dynaload) ;;
23372             *)
23373             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23374             case "$this_ext" in
23375                 Scalar/List/Utils) this_ext="List/Util" ;;
23376                 PathTools)         this_ext="Cwd"       ;;
23377             esac;
23378             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23379             if $contains " $this_ext " "$tdir/$$.tmp"; then
23380                 echo >&4;
23381                 echo "Duplicate directories detected for extension $xxx" >&4;
23382                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23383                 case "$knowitall" in
23384                 "") dflt=y;;
23385                 *) dflt=n;;
23386                 esac;
23387                 . ../UU/myread;
23388                 case "$ans" in
23389                 n*|N*) ;;
23390                 *) echo >&4;
23391                     echo "Ok.  Stopping Configure." >&4;
23392                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23393                     exit 1;;
23394                 esac;
23395                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23396             fi;
23397             $ls -1 "$xxx" > "$tdir/$$.tmp";
23398             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23399                 xs_extensions="$xs_extensions $this_ext";
23400             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23401                 xs_extensions="$xs_extensions $this_ext";
23402             elif $test -d "$xxx"; then
23403                 nonxs_extensions="$nonxs_extensions $this_ext";
23404             fi;
23405             $rm -f "$tdir/$$.tmp";
23406             ;;
23407         esac;
23408     done'
23409 tdir=`pwd`
23410 cd "$rsrc/cpan"
23411 set X
23412 shift
23413 eval $find_extensions
23414 cd "$rsrc/dist"
23415 set X
23416 shift
23417 eval $find_extensions
23418 cd "$rsrc/ext"
23419 set X
23420 shift
23421 eval $find_extensions
23422 set X $xs_extensions
23423 shift
23424 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23425 set X $nonxs_extensions
23426 shift
23427 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23428 cd "$tdir"
23429 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23430
23431 : Now see which are supported on this system.
23432 avail_ext=''
23433 for xxx in $xs_extensions ; do
23434         case "$xxx" in
23435         Amiga*)
23436                 case "$osname" in
23437                 amigaos) avail_ext="$avail_ext $xxx" ;;
23438                 esac
23439                 ;;
23440         DB_File|db_file)
23441                 case "$i_db" in
23442                 $define) avail_ext="$avail_ext $xxx" ;;
23443                 esac
23444                 ;;
23445         GDBM_File|gdbm_fil)
23446                 case "$i_gdbm" in
23447                 $define) avail_ext="$avail_ext $xxx" ;;
23448                 esac
23449                 ;;
23450         I18N/Langinfo|i18n_lan)
23451                 case "$i_langinfo$d_nl_langinfo" in
23452                 $define$define) avail_ext="$avail_ext $xxx" ;;
23453                 esac
23454                 ;;
23455         IPC/SysV|ipc/sysv)
23456                 : XXX Do we need a useipcsysv variable here
23457                 case "${d_msg}${d_sem}${d_shm}" in
23458                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23459                 esac
23460                 ;;
23461         NDBM_File|ndbm_fil)
23462                 case "$d_ndbm" in
23463                 $define)
23464                     case "$osname-$use64bitint" in
23465                     hpux-define)
23466                         case "$libs" in
23467                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23468                         esac
23469                         ;;
23470                     *) avail_ext="$avail_ext $xxx" ;;
23471                     esac
23472                     ;;
23473                 esac
23474                 ;;
23475         ODBM_File|odbm_fil)
23476                 case "${i_dbm}${i_rpcsvcdbm}" in
23477                 *"${define}"*)
23478                     case "$d_cplusplus" in
23479                     define) ;; # delete as a function name will not work
23480                     *)  case "$osname-$use64bitint" in
23481                         hpux-define)
23482                             case "$libs" in
23483                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23484                             esac
23485                             ;;
23486                         *) avail_ext="$avail_ext $xxx" ;;
23487                         esac
23488                         ;;
23489                     esac
23490                     ;;
23491                 esac
23492                 ;;
23493         Opcode|opcode)
23494                 case "$useopcode" in
23495                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23496                 esac
23497                 ;;
23498         POSIX|posix)
23499                 case "$useposix" in
23500                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23501                 esac
23502                 ;;
23503         Socket|socket)
23504                 case "$d_socket" in
23505                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23506                 esac
23507                 ;;
23508         Sys/Syslog|sys/syslog)
23509                 case $osname in
23510                         amigaos) ;; # not really very useful on AmigaOS
23511                         *)
23512                         : XXX syslog requires socket
23513                         case "$d_socket" in
23514                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23515                         esac
23516                         ;;
23517                 esac
23518                 ;;
23519         Thread|thread)
23520                 case "$usethreads" in
23521                 true|$define|y)
23522                         case "$use5005threads" in
23523                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23524                         esac
23525                 esac
23526                 ;;
23527         threads|threads/shared)
23528                 # threads and threads::shared are special cases.
23529                 # To stop people from asking "Perl 5.8.0 was supposed
23530                 # to have this new fancy threads implementation but my
23531                 # perl doesn't have it" and from people trying to
23532                 # (re)install the threads module using CPAN.pm and
23533                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23534                 # the threads.pm and threads/shared.pm will always be
23535                 # there, croaking informatively ("you need to rebuild
23536                 # all of Perl with threads, sorry") when threads haven't
23537                 # been compiled in.
23538                 # --jhi
23539                 avail_ext="$avail_ext $xxx"
23540                 ;;
23541         VMS*)
23542                 ;;
23543         Win32*)
23544                 case "$osname" in
23545                 cygwin) avail_ext="$avail_ext $xxx" ;;
23546                 esac
23547                 ;;
23548         XS/APItest|xs/apitest)
23549                 # This is just for testing.  Skip it unless we have dynamic loading.
23550
23551                 case "$usedl" in
23552                 $define) avail_ext="$avail_ext $xxx" ;;
23553                 esac
23554                 ;;
23555         XS/Typemap|xs/typemap)
23556                 # This is just for testing.  Skip it unless we have dynamic loading.
23557                 case "$usedl" in
23558                 $define) avail_ext="$avail_ext $xxx" ;;
23559                 esac
23560                 ;;
23561         *)      avail_ext="$avail_ext $xxx"
23562                 ;;
23563         esac
23564 done
23565
23566 set X $avail_ext
23567 shift
23568 avail_ext="$*"
23569
23570 case "$onlyextensions" in
23571 '') ;;
23572 *)  keepextensions=''
23573     echo "You have requested that only certain extensions be included..." >&4
23574     for i in $onlyextensions; do
23575         case " $avail_ext " in
23576         *" $i "*)
23577             echo "Keeping extension $i."
23578             keepextensions="$keepextensions $i"
23579             ;;
23580         *) echo "Ignoring extension $i." ;;
23581         esac
23582     done
23583     avail_ext="$keepextensions"
23584     ;;
23585 esac
23586
23587 case "$noextensions" in
23588 '') ;;
23589 *)  keepextensions=''
23590     echo "You have requested that certain extensions be ignored..." >&4
23591     for i in $avail_ext; do
23592         case " $noextensions " in
23593         *" $i "*) echo "Ignoring extension $i." ;;
23594         *) echo "Keeping extension $i.";
23595            keepextensions="$keepextensions $i"
23596            ;;
23597         esac
23598     done
23599     avail_ext="$keepextensions"
23600     ;;
23601 esac
23602
23603 : Now see which nonxs extensions are supported on this system.
23604 : For now assume all are.
23605 nonxs_ext=''
23606 for xxx in $nonxs_extensions ; do
23607         case "$xxx" in
23608         VMS*)
23609                 ;;
23610         *)      nonxs_ext="$nonxs_ext $xxx"
23611                 ;;
23612         esac
23613 done
23614
23615 set X $nonxs_ext
23616 shift
23617 nonxs_ext="$*"
23618
23619 case $usedl in
23620 $define)
23621         $cat <<EOM
23622 A number of extensions are supplied with $package.  You may choose to
23623 compile these extensions for dynamic loading (the default), compile
23624 them into the $package executable (static loading), or not include
23625 them at all.  Answer "none" to include no extensions.
23626 Note that DynaLoader is always built and need not be mentioned here.
23627
23628 EOM
23629         case "$dynamic_ext" in
23630         '')
23631                 : Exclude those listed in static_ext
23632                 dflt=''
23633                 for xxx in $avail_ext; do
23634                         case " $static_ext " in
23635                         *" $xxx "*) ;;
23636                         *) dflt="$dflt $xxx" ;;
23637                         esac
23638                 done
23639                 set X $dflt
23640                 shift
23641                 dflt="$*"
23642                 ;;
23643         *)      dflt="$dynamic_ext"
23644                 # Perhaps we are reusing an old out-of-date config.sh.
23645                 case "$hint" in
23646                 previous)
23647                         if test X"$dynamic_ext" != X"$avail_ext"; then
23648                                 $cat <<EOM
23649 NOTICE:  Your previous config.sh list may be incorrect.
23650 The extensions now available to you are
23651         ${avail_ext}
23652 but the default list from your previous config.sh is
23653         ${dynamic_ext}
23654
23655 EOM
23656                         fi
23657                         ;;
23658                 esac
23659                 ;;
23660         esac
23661         case "$dflt" in
23662         '')     dflt=none;;
23663         esac
23664         rp="What extensions do you wish to load dynamically?"
23665         . ./myread
23666         case "$ans" in
23667         none) dynamic_ext=' ' ;;
23668         *) dynamic_ext="$ans" ;;
23669         esac
23670
23671         case "$static_ext" in
23672         '')
23673                 : Exclude those already listed in dynamic linking
23674                 dflt=''
23675                 for xxx in $avail_ext; do
23676                         case " $dynamic_ext " in
23677                         *" $xxx "*) ;;
23678                         *) dflt="$dflt $xxx" ;;
23679                         esac
23680                 done
23681                 set X $dflt
23682                 shift
23683                 dflt="$*"
23684                 ;;
23685         *)  dflt="$static_ext"
23686                 ;;
23687         esac
23688
23689         case "$dflt" in
23690         '')     dflt=none;;
23691         esac
23692         rp="What extensions do you wish to load statically?"
23693         . ./myread
23694         case "$ans" in
23695         none) static_ext=' ' ;;
23696         *) static_ext="$ans" ;;
23697         esac
23698         ;;
23699 *)
23700         $cat <<EOM
23701 A number of extensions are supplied with $package.  Answer "none"
23702 to include no extensions.
23703 Note that DynaLoader is always built and need not be mentioned here.
23704
23705 EOM
23706         case "$static_ext" in
23707         '') dflt="$avail_ext" ;;
23708         *)      dflt="$static_ext"
23709                 # Perhaps we are reusing an old out-of-date config.sh.
23710                 case "$hint" in
23711                 previous)
23712                         if test X"$static_ext" != X"$avail_ext"; then
23713                                 $cat <<EOM
23714 NOTICE:  Your previous config.sh list may be incorrect.
23715 The extensions now available to you are
23716         ${avail_ext}
23717 but the default list from your previous config.sh is
23718         ${static_ext}
23719
23720 EOM
23721                         fi
23722                         ;;
23723                 esac
23724                 ;;
23725         esac
23726         : Exclude those that are not xs extensions
23727         case "$dflt" in
23728         '')     dflt=none;;
23729         esac
23730         rp="What extensions do you wish to include?"
23731         . ./myread
23732         case "$ans" in
23733         none) static_ext=' ' ;;
23734         *) static_ext="$ans" ;;
23735         esac
23736         ;;
23737 esac
23738 #
23739 # Encode is a special case.  If we are building Encode as a static
23740 # extension, we need to explicitly list its subextensions as well.
23741 # For other nested extensions, this is handled automatically by
23742 # the appropriate Makefile.PL.
23743 case " $static_ext " in
23744         *" Encode "*) # Add the subextensions of Encode
23745         cd "$rsrc/cpan"
23746         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23747                 static_ext="$static_ext Encode/$xxx"
23748                 known_extensions="$known_extensions Encode/$xxx"
23749         done
23750         cd "$tdir"
23751         ;;
23752 esac
23753
23754 set X $dynamic_ext $static_ext $nonxs_ext
23755 shift
23756 extensions="$*"
23757
23758 # Sanity check:  We require an extension suitable for use with
23759 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23760 # should show up as failures in the test suite, but it's helpful to
23761 # catch them now.) The 'extensions' list is normally sorted
23762 # alphabetically, so we need to accept either
23763 #    DB_File ... Fcntl ... IO  ....
23764 # or something like
23765 #    Fcntl ... NDBM_File ... IO  ....
23766 case " $extensions"  in
23767 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23768 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23769 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23770 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23771    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23772    ;;
23773 esac
23774
23775 : Remove libraries needed only for extensions
23776 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23777 : The exception is SunOS 4.x, which needs them.
23778 case "${osname}X${osvers}" in
23779 sunos*X4*)
23780     perllibs="$libs"
23781     ;;
23782 *) case "$usedl" in
23783     $define|true|[yY]*)
23784             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23785             shift
23786             perllibs="$*"
23787             ;;
23788     *)  perllibs="$libs"
23789             ;;
23790     esac
23791     ;;
23792 esac
23793
23794 : Remove build directory name from cppstdin so it can be used from
23795 : either the present location or the final installed location.
23796 echo " "
23797 : Get out of the UU directory to get correct path name.
23798 cd ..
23799 case "$cppstdin" in
23800 `pwd`/cppstdin)
23801         echo "Stripping down cppstdin path name"
23802         cppstdin=cppstdin
23803         ;;
23804 esac
23805 cd UU
23806
23807 : end of configuration questions
23808 echo " "
23809 echo "End of configuration questions."
23810 echo " "
23811
23812 : back to where it started
23813 if test -d ../UU; then
23814         cd ..
23815 fi
23816
23817 : configuration may be unconditionally patched via a 'config.arch' file
23818 if $test -f config.arch; then
23819         echo "I see a config.arch file, loading it." >&4
23820         . ./config.arch
23821 fi
23822
23823 : configuration may be patched via a 'config.over' file
23824 if $test -f config.over; then
23825         echo " "
23826         dflt=y
23827         rp='I see a config.over file.  Do you wish to load it?'
23828         . UU/myread
23829         case "$ans" in
23830         n*) echo "OK, I'll ignore it.";;
23831         *)      . ./config.over
23832                 echo "Configuration override changes have been loaded."
23833                 ;;
23834         esac
23835 fi
23836
23837 : in case they want portability, strip down executable paths
23838 case "$d_portable" in
23839 "$define")
23840         echo " "
23841         echo "Stripping down executable paths..." >&4
23842         for file in $loclist $trylist; do
23843                 eval temp=\$$file
23844                 eval $file=`basename $temp`
23845         done
23846         ;;
23847 esac
23848
23849 : create config.sh file
23850 echo " "
23851 echo "Creating config.sh..." >&4
23852 $spitshell <<EOT >config.sh
23853 $startsh
23854 #
23855 # This file was produced by running the Configure script. It holds all the
23856 # definitions figured out by Configure. Should you modify one of these values,
23857 # do not forget to propagate your changes by running "Configure -der". You may
23858 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23859 #
23860
23861 # Package name      : $package
23862 # Source directory  : $src
23863 # Configuration time: $cf_time
23864 # Configured by     : $cf_by
23865 # Target system     : $myuname
23866
23867 EOT
23868 : Add in command line options if available
23869 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23870
23871 $spitshell <<EOT >>config.sh
23872
23873 Author='$Author'
23874 Date='$Date'
23875 Header='$Header'
23876 Id='$Id'
23877 Locker='$Locker'
23878 Log='$Log'
23879 RCSfile='$RCSfile'
23880 Revision='$Revision'
23881 Source='$Source'
23882 State='$State'
23883 _a='$_a'
23884 _exe='$_exe'
23885 _o='$_o'
23886 afs='$afs'
23887 afsroot='$afsroot'
23888 alignbytes='$alignbytes'
23889 ansi2knr='$ansi2knr'
23890 aphostname='$aphostname'
23891 api_revision='$api_revision'
23892 api_subversion='$api_subversion'
23893 api_version='$api_version'
23894 api_versionstring='$api_versionstring'
23895 ar='$ar'
23896 archlib='$archlib'
23897 archlibexp='$archlibexp'
23898 archname64='$archname64'
23899 archname='$archname'
23900 archobjs='$archobjs'
23901 asctime_r_proto='$asctime_r_proto'
23902 awk='$awk'
23903 baserev='$baserev'
23904 bash='$bash'
23905 bin='$bin'
23906 bin_ELF='$bin_ELF'
23907 binexp='$binexp'
23908 bison='$bison'
23909 byacc='$byacc'
23910 byteorder='$byteorder'
23911 c='$c'
23912 castflags='$castflags'
23913 cat='$cat'
23914 cc='$cc'
23915 cccdlflags='$cccdlflags'
23916 ccdlflags='$ccdlflags'
23917 ccflags='$ccflags'
23918 ccflags_uselargefiles='$ccflags_uselargefiles'
23919 ccname='$ccname'
23920 ccsymbols='$ccsymbols'
23921 ccversion='$ccversion'
23922 cf_by='$cf_by'
23923 cf_email='$cf_email'
23924 cf_time='$cf_time'
23925 charbits='$charbits'
23926 charsize='$charsize'
23927 chgrp='$chgrp'
23928 chmod='$chmod'
23929 chown='$chown'
23930 clocktype='$clocktype'
23931 comm='$comm'
23932 compress='$compress'
23933 contains='$contains'
23934 cp='$cp'
23935 cpio='$cpio'
23936 cpp='$cpp'
23937 cpp_stuff='$cpp_stuff'
23938 cppccsymbols='$cppccsymbols'
23939 cppflags='$cppflags'
23940 cpplast='$cpplast'
23941 cppminus='$cppminus'
23942 cpprun='$cpprun'
23943 cppstdin='$cppstdin'
23944 cppsymbols='$cppsymbols'
23945 crypt_r_proto='$crypt_r_proto'
23946 cryptlib='$cryptlib'
23947 csh='$csh'
23948 ctermid_r_proto='$ctermid_r_proto'
23949 ctime_r_proto='$ctime_r_proto'
23950 d_Gconvert='$d_Gconvert'
23951 d_PRIEUldbl='$d_PRIEUldbl'
23952 d_PRIFUldbl='$d_PRIFUldbl'
23953 d_PRIGUldbl='$d_PRIGUldbl'
23954 d_PRIXU64='$d_PRIXU64'
23955 d_PRId64='$d_PRId64'
23956 d_PRIeldbl='$d_PRIeldbl'
23957 d_PRIfldbl='$d_PRIfldbl'
23958 d_PRIgldbl='$d_PRIgldbl'
23959 d_PRIi64='$d_PRIi64'
23960 d_PRIo64='$d_PRIo64'
23961 d_PRIu64='$d_PRIu64'
23962 d_PRIx64='$d_PRIx64'
23963 d_SCNfldbl='$d_SCNfldbl'
23964 d__fwalk='$d__fwalk'
23965 d_access='$d_access'
23966 d_accessx='$d_accessx'
23967 d_acosh='$d_acosh'
23968 d_aintl='$d_aintl'
23969 d_alarm='$d_alarm'
23970 d_archlib='$d_archlib'
23971 d_asctime64='$d_asctime64'
23972 d_asctime_r='$d_asctime_r'
23973 d_asinh='$d_asinh'
23974 d_atanh='$d_atanh'
23975 d_atolf='$d_atolf'
23976 d_atoll='$d_atoll'
23977 d_attribute_deprecated='$d_attribute_deprecated'
23978 d_attribute_format='$d_attribute_format'
23979 d_attribute_malloc='$d_attribute_malloc'
23980 d_attribute_nonnull='$d_attribute_nonnull'
23981 d_attribute_noreturn='$d_attribute_noreturn'
23982 d_attribute_pure='$d_attribute_pure'
23983 d_attribute_unused='$d_attribute_unused'
23984 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23985 d_backtrace='$d_backtrace'
23986 d_bcmp='$d_bcmp'
23987 d_bcopy='$d_bcopy'
23988 d_bsd='$d_bsd'
23989 d_bsdgetpgrp='$d_bsdgetpgrp'
23990 d_bsdsetpgrp='$d_bsdsetpgrp'
23991 d_builtin_choose_expr='$d_builtin_choose_expr'
23992 d_builtin_expect='$d_builtin_expect'
23993 d_bzero='$d_bzero'
23994 d_c99_variadic_macros='$d_c99_variadic_macros'
23995 d_casti32='$d_casti32'
23996 d_castneg='$d_castneg'
23997 d_cbrt='$d_cbrt'
23998 d_charvspr='$d_charvspr'
23999 d_chown='$d_chown'
24000 d_chroot='$d_chroot'
24001 d_chsize='$d_chsize'
24002 d_class='$d_class'
24003 d_clearenv='$d_clearenv'
24004 d_closedir='$d_closedir'
24005 d_cmsghdr_s='$d_cmsghdr_s'
24006 d_const='$d_const'
24007 d_copysign='$d_copysign'
24008 d_copysignl='$d_copysignl'
24009 d_cplusplus='$d_cplusplus'
24010 d_crypt='$d_crypt'
24011 d_crypt_r='$d_crypt_r'
24012 d_csh='$d_csh'
24013 d_ctermid='$d_ctermid'
24014 d_ctermid_r='$d_ctermid_r'
24015 d_ctime64='$d_ctime64'
24016 d_ctime_r='$d_ctime_r'
24017 d_cuserid='$d_cuserid'
24018 d_dbl_dig='$d_dbl_dig'
24019 d_dbminitproto='$d_dbminitproto'
24020 d_difftime64='$d_difftime64'
24021 d_difftime='$d_difftime'
24022 d_dir_dd_fd='$d_dir_dd_fd'
24023 d_dirfd='$d_dirfd'
24024 d_dirnamlen='$d_dirnamlen'
24025 d_dladdr='$d_dladdr'
24026 d_dlerror='$d_dlerror'
24027 d_dlopen='$d_dlopen'
24028 d_dlsymun='$d_dlsymun'
24029 d_dosuid='$d_dosuid'
24030 d_drand48_r='$d_drand48_r'
24031 d_drand48proto='$d_drand48proto'
24032 d_dup2='$d_dup2'
24033 d_eaccess='$d_eaccess'
24034 d_endgrent='$d_endgrent'
24035 d_endgrent_r='$d_endgrent_r'
24036 d_endhent='$d_endhent'
24037 d_endhostent_r='$d_endhostent_r'
24038 d_endnent='$d_endnent'
24039 d_endnetent_r='$d_endnetent_r'
24040 d_endpent='$d_endpent'
24041 d_endprotoent_r='$d_endprotoent_r'
24042 d_endpwent='$d_endpwent'
24043 d_endpwent_r='$d_endpwent_r'
24044 d_endsent='$d_endsent'
24045 d_endservent_r='$d_endservent_r'
24046 d_eofnblk='$d_eofnblk'
24047 d_erf='$d_erf'
24048 d_erfc='$d_erfc'
24049 d_eunice='$d_eunice'
24050 d_exp2='$d_exp2'
24051 d_expm1='$d_expm1'
24052 d_faststdio='$d_faststdio'
24053 d_fchdir='$d_fchdir'
24054 d_fchmod='$d_fchmod'
24055 d_fchown='$d_fchown'
24056 d_fcntl='$d_fcntl'
24057 d_fcntl_can_lock='$d_fcntl_can_lock'
24058 d_fd_macros='$d_fd_macros'
24059 d_fd_set='$d_fd_set'
24060 d_fdim='$d_fdim'
24061 d_fds_bits='$d_fds_bits'
24062 d_fegetround='$d_fegetround'
24063 d_fgetpos='$d_fgetpos'
24064 d_finite='$d_finite'
24065 d_finitel='$d_finitel'
24066 d_flexfnam='$d_flexfnam'
24067 d_flock='$d_flock'
24068 d_flockproto='$d_flockproto'
24069 d_fma='$d_fma'
24070 d_fmax='$d_fmax'
24071 d_fmin='$d_fmin'
24072 d_fork='$d_fork'
24073 d_fp_class='$d_fp_class'
24074 d_fp_classify='$d_fp_classify'
24075 d_fp_classl='$d_fp_classl'
24076 d_fpathconf='$d_fpathconf'
24077 d_fpclass='$d_fpclass'
24078 d_fpclassify='$d_fpclassify'
24079 d_fpclassl='$d_fpclassl'
24080 d_fpgetround='$d_fpgetround'
24081 d_fpos64_t='$d_fpos64_t'
24082 d_frexpl='$d_frexpl'
24083 d_fs_data_s='$d_fs_data_s'
24084 d_fseeko='$d_fseeko'
24085 d_fsetpos='$d_fsetpos'
24086 d_fsync='$d_fsync'
24087 d_ftello='$d_ftello'
24088 d_ftime='$d_ftime'
24089 d_futimes='$d_futimes'
24090 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24091 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24092 d_getaddrinfo='$d_getaddrinfo'
24093 d_getcwd='$d_getcwd'
24094 d_getespwnam='$d_getespwnam'
24095 d_getgrent='$d_getgrent'
24096 d_getgrent_r='$d_getgrent_r'
24097 d_getgrgid_r='$d_getgrgid_r'
24098 d_getgrnam_r='$d_getgrnam_r'
24099 d_getgrps='$d_getgrps'
24100 d_gethbyaddr='$d_gethbyaddr'
24101 d_gethbyname='$d_gethbyname'
24102 d_gethent='$d_gethent'
24103 d_gethname='$d_gethname'
24104 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24105 d_gethostbyname_r='$d_gethostbyname_r'
24106 d_gethostent_r='$d_gethostent_r'
24107 d_gethostprotos='$d_gethostprotos'
24108 d_getitimer='$d_getitimer'
24109 d_getlogin='$d_getlogin'
24110 d_getlogin_r='$d_getlogin_r'
24111 d_getnameinfo='$d_getnameinfo'
24112 d_getnbyaddr='$d_getnbyaddr'
24113 d_getnbyname='$d_getnbyname'
24114 d_getnent='$d_getnent'
24115 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24116 d_getnetbyname_r='$d_getnetbyname_r'
24117 d_getnetent_r='$d_getnetent_r'
24118 d_getnetprotos='$d_getnetprotos'
24119 d_getpagsz='$d_getpagsz'
24120 d_getpbyname='$d_getpbyname'
24121 d_getpbynumber='$d_getpbynumber'
24122 d_getpent='$d_getpent'
24123 d_getpgid='$d_getpgid'
24124 d_getpgrp2='$d_getpgrp2'
24125 d_getpgrp='$d_getpgrp'
24126 d_getppid='$d_getppid'
24127 d_getprior='$d_getprior'
24128 d_getprotobyname_r='$d_getprotobyname_r'
24129 d_getprotobynumber_r='$d_getprotobynumber_r'
24130 d_getprotoent_r='$d_getprotoent_r'
24131 d_getprotoprotos='$d_getprotoprotos'
24132 d_getprpwnam='$d_getprpwnam'
24133 d_getpwent='$d_getpwent'
24134 d_getpwent_r='$d_getpwent_r'
24135 d_getpwnam_r='$d_getpwnam_r'
24136 d_getpwuid_r='$d_getpwuid_r'
24137 d_getsbyname='$d_getsbyname'
24138 d_getsbyport='$d_getsbyport'
24139 d_getsent='$d_getsent'
24140 d_getservbyname_r='$d_getservbyname_r'
24141 d_getservbyport_r='$d_getservbyport_r'
24142 d_getservent_r='$d_getservent_r'
24143 d_getservprotos='$d_getservprotos'
24144 d_getspnam='$d_getspnam'
24145 d_getspnam_r='$d_getspnam_r'
24146 d_gettimeod='$d_gettimeod'
24147 d_gmtime64='$d_gmtime64'
24148 d_gmtime_r='$d_gmtime_r'
24149 d_gnulibc='$d_gnulibc'
24150 d_grpasswd='$d_grpasswd'
24151 d_htonl='$d_htonl'
24152 d_hypot='$d_hypot'
24153 d_ilogb='$d_ilogb'
24154 d_ilogbl='$d_ilogbl'
24155 d_inc_version_list='$d_inc_version_list'
24156 d_index='$d_index'
24157 d_inetaton='$d_inetaton'
24158 d_inetntop='$d_inetntop'
24159 d_inetpton='$d_inetpton'
24160 d_int64_t='$d_int64_t'
24161 d_ip_mreq='$d_ip_mreq'
24162 d_ip_mreq_source='$d_ip_mreq_source'
24163 d_ipv6_mreq='$d_ipv6_mreq'
24164 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24165 d_isascii='$d_isascii'
24166 d_isblank='$d_isblank'
24167 d_isfinite='$d_isfinite'
24168 d_isfinitel='$d_isfinitel'
24169 d_isinf='$d_isinf'
24170 d_isinfl='$d_isinfl'
24171 d_isless='$d_isless'
24172 d_isnan='$d_isnan'
24173 d_isnanl='$d_isnanl'
24174 d_isnormal='$d_isnormal'
24175 d_j0='$d_j0'
24176 d_j0l='$d_j0l'
24177 d_killpg='$d_killpg'
24178 d_lc_monetary_2008='$d_lc_monetary_2008'
24179 d_lchown='$d_lchown'
24180 d_ldbl_dig='$d_ldbl_dig'
24181 d_ldexpl='$d_ldexpl'
24182 d_lgamma='$d_lgamma'
24183 d_lgamma_r='$d_lgamma_r'
24184 d_libm_lib_version='$d_libm_lib_version'
24185 d_libname_unique='$d_libname_unique'
24186 d_link='$d_link'
24187 d_llrint='$d_llrint'
24188 d_llrintl='$d_llrintl'
24189 d_llround='$d_llround'
24190 d_llroundl='$d_llroundl'
24191 d_localtime64='$d_localtime64'
24192 d_localtime_r='$d_localtime_r'
24193 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24194 d_locconv='$d_locconv'
24195 d_lockf='$d_lockf'
24196 d_log1p='$d_log1p'
24197 d_log2='$d_log2'
24198 d_logb='$d_logb'
24199 d_longdbl='$d_longdbl'
24200 d_longlong='$d_longlong'
24201 d_lrint='$d_lrint'
24202 d_lrintl='$d_lrintl'
24203 d_lround='$d_lround'
24204 d_lroundl='$d_lroundl'
24205 d_lseekproto='$d_lseekproto'
24206 d_lstat='$d_lstat'
24207 d_madvise='$d_madvise'
24208 d_malloc_good_size='$d_malloc_good_size'
24209 d_malloc_size='$d_malloc_size'
24210 d_mblen='$d_mblen'
24211 d_mbstowcs='$d_mbstowcs'
24212 d_mbtowc='$d_mbtowc'
24213 d_memchr='$d_memchr'
24214 d_memcmp='$d_memcmp'
24215 d_memcpy='$d_memcpy'
24216 d_memmove='$d_memmove'
24217 d_memset='$d_memset'
24218 d_mkdir='$d_mkdir'
24219 d_mkdtemp='$d_mkdtemp'
24220 d_mkfifo='$d_mkfifo'
24221 d_mkstemp='$d_mkstemp'
24222 d_mkstemps='$d_mkstemps'
24223 d_mktime64='$d_mktime64'
24224 d_mktime='$d_mktime'
24225 d_mmap='$d_mmap'
24226 d_modfl='$d_modfl'
24227 d_modfl_pow32_bug='$d_modfl_pow32_bug'
24228 d_modflproto='$d_modflproto'
24229 d_mprotect='$d_mprotect'
24230 d_msg='$d_msg'
24231 d_msg_ctrunc='$d_msg_ctrunc'
24232 d_msg_dontroute='$d_msg_dontroute'
24233 d_msg_oob='$d_msg_oob'
24234 d_msg_peek='$d_msg_peek'
24235 d_msg_proxy='$d_msg_proxy'
24236 d_msgctl='$d_msgctl'
24237 d_msgget='$d_msgget'
24238 d_msghdr_s='$d_msghdr_s'
24239 d_msgrcv='$d_msgrcv'
24240 d_msgsnd='$d_msgsnd'
24241 d_msync='$d_msync'
24242 d_munmap='$d_munmap'
24243 d_mymalloc='$d_mymalloc'
24244 d_nan='$d_nan'
24245 d_ndbm='$d_ndbm'
24246 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24247 d_nearbyint='$d_nearbyint'
24248 d_nextafter='$d_nextafter'
24249 d_nexttoward='$d_nexttoward'
24250 d_nice='$d_nice'
24251 d_nl_langinfo='$d_nl_langinfo'
24252 d_nv_preserves_uv='$d_nv_preserves_uv'
24253 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24254 d_off64_t='$d_off64_t'
24255 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24256 d_oldpthreads='$d_oldpthreads'
24257 d_oldsock='$d_oldsock'
24258 d_open3='$d_open3'
24259 d_pathconf='$d_pathconf'
24260 d_pause='$d_pause'
24261 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24262 d_phostname='$d_phostname'
24263 d_pipe='$d_pipe'
24264 d_poll='$d_poll'
24265 d_portable='$d_portable'
24266 d_prctl='$d_prctl'
24267 d_prctl_set_name='$d_prctl_set_name'
24268 d_printf_format_null='$d_printf_format_null'
24269 d_procselfexe='$d_procselfexe'
24270 d_pseudofork='$d_pseudofork'
24271 d_pthread_atfork='$d_pthread_atfork'
24272 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24273 d_pthread_yield='$d_pthread_yield'
24274 d_ptrdiff_t='$d_ptrdiff_t'
24275 d_pwage='$d_pwage'
24276 d_pwchange='$d_pwchange'
24277 d_pwclass='$d_pwclass'
24278 d_pwcomment='$d_pwcomment'
24279 d_pwexpire='$d_pwexpire'
24280 d_pwgecos='$d_pwgecos'
24281 d_pwpasswd='$d_pwpasswd'
24282 d_pwquota='$d_pwquota'
24283 d_qgcvt='$d_qgcvt'
24284 d_quad='$d_quad'
24285 d_random_r='$d_random_r'
24286 d_re_comp='$d_re_comp'
24287 d_readdir64_r='$d_readdir64_r'
24288 d_readdir='$d_readdir'
24289 d_readdir_r='$d_readdir_r'
24290 d_readlink='$d_readlink'
24291 d_readv='$d_readv'
24292 d_recvmsg='$d_recvmsg'
24293 d_regcmp='$d_regcmp'
24294 d_regcomp='$d_regcomp'
24295 d_remainder='$d_remainder'
24296 d_remquo='$d_remquo'
24297 d_rename='$d_rename'
24298 d_rewinddir='$d_rewinddir'
24299 d_rint='$d_rint'
24300 d_rmdir='$d_rmdir'
24301 d_round='$d_round'
24302 d_safebcpy='$d_safebcpy'
24303 d_safemcpy='$d_safemcpy'
24304 d_sanemcmp='$d_sanemcmp'
24305 d_sbrkproto='$d_sbrkproto'
24306 d_scalbn='$d_scalbn'
24307 d_scalbnl='$d_scalbnl'
24308 d_sched_yield='$d_sched_yield'
24309 d_scm_rights='$d_scm_rights'
24310 d_seekdir='$d_seekdir'
24311 d_select='$d_select'
24312 d_sem='$d_sem'
24313 d_semctl='$d_semctl'
24314 d_semctl_semid_ds='$d_semctl_semid_ds'
24315 d_semctl_semun='$d_semctl_semun'
24316 d_semget='$d_semget'
24317 d_semop='$d_semop'
24318 d_sendmsg='$d_sendmsg'
24319 d_setegid='$d_setegid'
24320 d_seteuid='$d_seteuid'
24321 d_setgrent='$d_setgrent'
24322 d_setgrent_r='$d_setgrent_r'
24323 d_setgrps='$d_setgrps'
24324 d_sethent='$d_sethent'
24325 d_sethostent_r='$d_sethostent_r'
24326 d_setitimer='$d_setitimer'
24327 d_setlinebuf='$d_setlinebuf'
24328 d_setlocale='$d_setlocale'
24329 d_setlocale_r='$d_setlocale_r'
24330 d_setnent='$d_setnent'
24331 d_setnetent_r='$d_setnetent_r'
24332 d_setpent='$d_setpent'
24333 d_setpgid='$d_setpgid'
24334 d_setpgrp2='$d_setpgrp2'
24335 d_setpgrp='$d_setpgrp'
24336 d_setprior='$d_setprior'
24337 d_setproctitle='$d_setproctitle'
24338 d_setprotoent_r='$d_setprotoent_r'
24339 d_setpwent='$d_setpwent'
24340 d_setpwent_r='$d_setpwent_r'
24341 d_setregid='$d_setregid'
24342 d_setresgid='$d_setresgid'
24343 d_setresuid='$d_setresuid'
24344 d_setreuid='$d_setreuid'
24345 d_setrgid='$d_setrgid'
24346 d_setruid='$d_setruid'
24347 d_setsent='$d_setsent'
24348 d_setservent_r='$d_setservent_r'
24349 d_setsid='$d_setsid'
24350 d_setvbuf='$d_setvbuf'
24351 d_shm='$d_shm'
24352 d_shmat='$d_shmat'
24353 d_shmatprototype='$d_shmatprototype'
24354 d_shmctl='$d_shmctl'
24355 d_shmdt='$d_shmdt'
24356 d_shmget='$d_shmget'
24357 d_sigaction='$d_sigaction'
24358 d_signbit='$d_signbit'
24359 d_sigprocmask='$d_sigprocmask'
24360 d_sigsetjmp='$d_sigsetjmp'
24361 d_sin6_scope_id='$d_sin6_scope_id'
24362 d_sitearch='$d_sitearch'
24363 d_snprintf='$d_snprintf'
24364 d_sockaddr_in6='$d_sockaddr_in6'
24365 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24366 d_sockatmark='$d_sockatmark'
24367 d_sockatmarkproto='$d_sockatmarkproto'
24368 d_socket='$d_socket'
24369 d_socklen_t='$d_socklen_t'
24370 d_sockpair='$d_sockpair'
24371 d_socks5_init='$d_socks5_init'
24372 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24373 d_sqrtl='$d_sqrtl'
24374 d_srand48_r='$d_srand48_r'
24375 d_srandom_r='$d_srandom_r'
24376 d_sresgproto='$d_sresgproto'
24377 d_sresuproto='$d_sresuproto'
24378 d_stat='$d_stat'
24379 d_statblks='$d_statblks'
24380 d_static_inline='$d_static_inline'
24381 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24382 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24383 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24384 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24385 d_stdio_stream_array='$d_stdio_stream_array'
24386 d_stdiobase='$d_stdiobase'
24387 d_stdstdio='$d_stdstdio'
24388 d_strchr='$d_strchr'
24389 d_strcoll='$d_strcoll'
24390 d_strctcpy='$d_strctcpy'
24391 d_strerrm='$d_strerrm'
24392 d_strerror='$d_strerror'
24393 d_strerror_r='$d_strerror_r'
24394 d_strftime='$d_strftime'
24395 d_strlcat='$d_strlcat'
24396 d_strlcpy='$d_strlcpy'
24397 d_strtod='$d_strtod'
24398 d_strtol='$d_strtol'
24399 d_strtold='$d_strtold'
24400 d_strtoll='$d_strtoll'
24401 d_strtoq='$d_strtoq'
24402 d_strtoul='$d_strtoul'
24403 d_strtoull='$d_strtoull'
24404 d_strtouq='$d_strtouq'
24405 d_strxfrm='$d_strxfrm'
24406 d_suidsafe='$d_suidsafe'
24407 d_symlink='$d_symlink'
24408 d_syscall='$d_syscall'
24409 d_syscallproto='$d_syscallproto'
24410 d_sysconf='$d_sysconf'
24411 d_sysernlst='$d_sysernlst'
24412 d_syserrlst='$d_syserrlst'
24413 d_system='$d_system'
24414 d_tcgetpgrp='$d_tcgetpgrp'
24415 d_tcsetpgrp='$d_tcsetpgrp'
24416 d_telldir='$d_telldir'
24417 d_telldirproto='$d_telldirproto'
24418 d_tgamma='$d_tgamma'
24419 d_time='$d_time'
24420 d_timegm='$d_timegm'
24421 d_times='$d_times'
24422 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24423 d_tm_tm_zone='$d_tm_tm_zone'
24424 d_tmpnam_r='$d_tmpnam_r'
24425 d_trunc='$d_trunc'
24426 d_truncate='$d_truncate'
24427 d_truncl='$d_truncl'
24428 d_ttyname_r='$d_ttyname_r'
24429 d_tzname='$d_tzname'
24430 d_u32align='$d_u32align'
24431 d_ualarm='$d_ualarm'
24432 d_umask='$d_umask'
24433 d_uname='$d_uname'
24434 d_union_semun='$d_union_semun'
24435 d_unordered='$d_unordered'
24436 d_unsetenv='$d_unsetenv'
24437 d_usleep='$d_usleep'
24438 d_usleepproto='$d_usleepproto'
24439 d_vendorarch='$d_vendorarch'
24440 d_vendorbin='$d_vendorbin'
24441 d_vendorlib='$d_vendorlib'
24442 d_vendorscript='$d_vendorscript'
24443 d_vfork='$d_vfork'
24444 d_void_closedir='$d_void_closedir'
24445 d_voidsig='$d_voidsig'
24446 d_voidtty='$d_voidtty'
24447 d_volatile='$d_volatile'
24448 d_vprintf='$d_vprintf'
24449 d_vsnprintf='$d_vsnprintf'
24450 d_wait4='$d_wait4'
24451 d_waitpid='$d_waitpid'
24452 d_wcscmp='$d_wcscmp'
24453 d_wcstombs='$d_wcstombs'
24454 d_wcsxfrm='$d_wcsxfrm'
24455 d_wctomb='$d_wctomb'
24456 d_writev='$d_writev'
24457 d_xenix='$d_xenix'
24458 date='$date'
24459 db_hashtype='$db_hashtype'
24460 db_prefixtype='$db_prefixtype'
24461 db_version_major='$db_version_major'
24462 db_version_minor='$db_version_minor'
24463 db_version_patch='$db_version_patch'
24464 direntrytype='$direntrytype'
24465 dlext='$dlext'
24466 dlsrc='$dlsrc'
24467 doubleinfbytes='$doubleinfbytes'
24468 doublekind='$doublekind'
24469 doublemantbits='$doublemantbits'
24470 doublenanbytes='$doublenanbytes'
24471 doublesize='$doublesize'
24472 drand01='$drand01'
24473 drand48_r_proto='$drand48_r_proto'
24474 dtrace='$dtrace'
24475 dynamic_ext='$dynamic_ext'
24476 eagain='$eagain'
24477 ebcdic='$ebcdic'
24478 echo='$echo'
24479 egrep='$egrep'
24480 emacs='$emacs'
24481 endgrent_r_proto='$endgrent_r_proto'
24482 endhostent_r_proto='$endhostent_r_proto'
24483 endnetent_r_proto='$endnetent_r_proto'
24484 endprotoent_r_proto='$endprotoent_r_proto'
24485 endpwent_r_proto='$endpwent_r_proto'
24486 endservent_r_proto='$endservent_r_proto'
24487 eunicefix='$eunicefix'
24488 exe_ext='$exe_ext'
24489 expr='$expr'
24490 extensions='$extensions'
24491 extern_C='$extern_C'
24492 extras='$extras'
24493 fflushNULL='$fflushNULL'
24494 fflushall='$fflushall'
24495 find='$find'
24496 firstmakefile='$firstmakefile'
24497 flex='$flex'
24498 fpossize='$fpossize'
24499 fpostype='$fpostype'
24500 freetype='$freetype'
24501 from='$from'
24502 full_ar='$full_ar'
24503 full_csh='$full_csh'
24504 full_sed='$full_sed'
24505 gccansipedantic='$gccansipedantic'
24506 gccosandvers='$gccosandvers'
24507 gccversion='$gccversion'
24508 getgrent_r_proto='$getgrent_r_proto'
24509 getgrgid_r_proto='$getgrgid_r_proto'
24510 getgrnam_r_proto='$getgrnam_r_proto'
24511 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24512 gethostbyname_r_proto='$gethostbyname_r_proto'
24513 gethostent_r_proto='$gethostent_r_proto'
24514 getlogin_r_proto='$getlogin_r_proto'
24515 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24516 getnetbyname_r_proto='$getnetbyname_r_proto'
24517 getnetent_r_proto='$getnetent_r_proto'
24518 getprotobyname_r_proto='$getprotobyname_r_proto'
24519 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24520 getprotoent_r_proto='$getprotoent_r_proto'
24521 getpwent_r_proto='$getpwent_r_proto'
24522 getpwnam_r_proto='$getpwnam_r_proto'
24523 getpwuid_r_proto='$getpwuid_r_proto'
24524 getservbyname_r_proto='$getservbyname_r_proto'
24525 getservbyport_r_proto='$getservbyport_r_proto'
24526 getservent_r_proto='$getservent_r_proto'
24527 getspnam_r_proto='$getspnam_r_proto'
24528 gidformat='$gidformat'
24529 gidsign='$gidsign'
24530 gidsize='$gidsize'
24531 gidtype='$gidtype'
24532 glibpth='$glibpth'
24533 gmake='$gmake'
24534 gmtime_r_proto='$gmtime_r_proto'
24535 gnulibc_version='$gnulibc_version'
24536 grep='$grep'
24537 groupcat='$groupcat'
24538 groupstype='$groupstype'
24539 gzip='$gzip'
24540 h_fcntl='$h_fcntl'
24541 h_sysfile='$h_sysfile'
24542 hint='$hint'
24543 hostcat='$hostcat'
24544 hostgenerate='$hostgenerate'
24545 hostosname='$hostosname'
24546 hostperl='$hostperl'
24547 html1dir='$html1dir'
24548 html1direxp='$html1direxp'
24549 html3dir='$html3dir'
24550 html3direxp='$html3direxp'
24551 i16size='$i16size'
24552 i16type='$i16type'
24553 i32size='$i32size'
24554 i32type='$i32type'
24555 i64size='$i64size'
24556 i64type='$i64type'
24557 i8size='$i8size'
24558 i8type='$i8type'
24559 i_arpainet='$i_arpainet'
24560 i_assert='$i_assert'
24561 i_bfd='$i_bfd'
24562 i_bsdioctl='$i_bsdioctl'
24563 i_crypt='$i_crypt'
24564 i_db='$i_db'
24565 i_dbm='$i_dbm'
24566 i_dirent='$i_dirent'
24567 i_dlfcn='$i_dlfcn'
24568 i_execinfo='$i_execinfo'
24569 i_fcntl='$i_fcntl'
24570 i_fenv='$i_fenv'
24571 i_float='$i_float'
24572 i_fp='$i_fp'
24573 i_fp_class='$i_fp_class'
24574 i_gdbm='$i_gdbm'
24575 i_gdbm_ndbm='$i_gdbm_ndbm'
24576 i_gdbmndbm='$i_gdbmndbm'
24577 i_grp='$i_grp'
24578 i_ieeefp='$i_ieeefp'
24579 i_inttypes='$i_inttypes'
24580 i_langinfo='$i_langinfo'
24581 i_libutil='$i_libutil'
24582 i_limits='$i_limits'
24583 i_locale='$i_locale'
24584 i_machcthr='$i_machcthr'
24585 i_malloc='$i_malloc'
24586 i_mallocmalloc='$i_mallocmalloc'
24587 i_math='$i_math'
24588 i_memory='$i_memory'
24589 i_ndbm='$i_ndbm'
24590 i_netdb='$i_netdb'
24591 i_neterrno='$i_neterrno'
24592 i_netinettcp='$i_netinettcp'
24593 i_niin='$i_niin'
24594 i_poll='$i_poll'
24595 i_prot='$i_prot'
24596 i_pthread='$i_pthread'
24597 i_pwd='$i_pwd'
24598 i_quadmath='$i_quadmath'
24599 i_rpcsvcdbm='$i_rpcsvcdbm'
24600 i_sgtty='$i_sgtty'
24601 i_shadow='$i_shadow'
24602 i_socks='$i_socks'
24603 i_stdarg='$i_stdarg'
24604 i_stdbool='$i_stdbool'
24605 i_stddef='$i_stddef'
24606 i_stdint='$i_stdint'
24607 i_stdlib='$i_stdlib'
24608 i_string='$i_string'
24609 i_sunmath='$i_sunmath'
24610 i_sysaccess='$i_sysaccess'
24611 i_sysdir='$i_sysdir'
24612 i_sysfile='$i_sysfile'
24613 i_sysfilio='$i_sysfilio'
24614 i_sysin='$i_sysin'
24615 i_sysioctl='$i_sysioctl'
24616 i_syslog='$i_syslog'
24617 i_sysmman='$i_sysmman'
24618 i_sysmode='$i_sysmode'
24619 i_sysndir='$i_sysndir'
24620 i_sysparam='$i_sysparam'
24621 i_syspoll='$i_syspoll'
24622 i_sysresrc='$i_sysresrc'
24623 i_syssecrt='$i_syssecrt'
24624 i_sysselct='$i_sysselct'
24625 i_syssockio='$i_syssockio'
24626 i_sysstat='$i_sysstat'
24627 i_systime='$i_systime'
24628 i_systimek='$i_systimek'
24629 i_systimes='$i_systimes'
24630 i_systypes='$i_systypes'
24631 i_sysuio='$i_sysuio'
24632 i_sysun='$i_sysun'
24633 i_sysutsname='$i_sysutsname'
24634 i_syswait='$i_syswait'
24635 i_termio='$i_termio'
24636 i_termios='$i_termios'
24637 i_time='$i_time'
24638 i_unistd='$i_unistd'
24639 i_utime='$i_utime'
24640 i_values='$i_values'
24641 i_varargs='$i_varargs'
24642 i_varhdr='$i_varhdr'
24643 i_vfork='$i_vfork'
24644 ignore_versioned_solibs='$ignore_versioned_solibs'
24645 inc_version_list='$inc_version_list'
24646 inc_version_list_init='$inc_version_list_init'
24647 incpath='$incpath'
24648 incpth='$incpth'
24649 inews='$inews'
24650 initialinstalllocation='$initialinstalllocation'
24651 installarchlib='$installarchlib'
24652 installbin='$installbin'
24653 installhtml1dir='$installhtml1dir'
24654 installhtml3dir='$installhtml3dir'
24655 installman1dir='$installman1dir'
24656 installman3dir='$installman3dir'
24657 installprefix='$installprefix'
24658 installprefixexp='$installprefixexp'
24659 installprivlib='$installprivlib'
24660 installscript='$installscript'
24661 installsitearch='$installsitearch'
24662 installsitebin='$installsitebin'
24663 installsitehtml1dir='$installsitehtml1dir'
24664 installsitehtml3dir='$installsitehtml3dir'
24665 installsitelib='$installsitelib'
24666 installsiteman1dir='$installsiteman1dir'
24667 installsiteman3dir='$installsiteman3dir'
24668 installsitescript='$installsitescript'
24669 installstyle='$installstyle'
24670 installusrbinperl='$installusrbinperl'
24671 installvendorarch='$installvendorarch'
24672 installvendorbin='$installvendorbin'
24673 installvendorhtml1dir='$installvendorhtml1dir'
24674 installvendorhtml3dir='$installvendorhtml3dir'
24675 installvendorlib='$installvendorlib'
24676 installvendorman1dir='$installvendorman1dir'
24677 installvendorman3dir='$installvendorman3dir'
24678 installvendorscript='$installvendorscript'
24679 intsize='$intsize'
24680 issymlink='$issymlink'
24681 ivdformat='$ivdformat'
24682 ivsize='$ivsize'
24683 ivtype='$ivtype'
24684 known_extensions='$known_extensions'
24685 ksh='$ksh'
24686 ld='$ld'
24687 ld_can_script='$ld_can_script'
24688 lddlflags='$lddlflags'
24689 ldflags='$ldflags'
24690 ldflags_uselargefiles='$ldflags_uselargefiles'
24691 ldlibpthname='$ldlibpthname'
24692 less='$less'
24693 lib_ext='$lib_ext'
24694 libc='$libc'
24695 libperl='$libperl'
24696 libpth='$libpth'
24697 libs='$libs'
24698 libsdirs='$libsdirs'
24699 libsfiles='$libsfiles'
24700 libsfound='$libsfound'
24701 libspath='$libspath'
24702 libswanted='$libswanted'
24703 libswanted_uselargefiles='$libswanted_uselargefiles'
24704 line='$line'
24705 lint='$lint'
24706 lkflags='$lkflags'
24707 ln='$ln'
24708 lns='$lns'
24709 localtime_r_proto='$localtime_r_proto'
24710 locincpth='$locincpth'
24711 loclibpth='$loclibpth'
24712 longdblinfbytes='$longdblinfbytes'
24713 longdblkind='$longdblkind'
24714 longdblmantbits='$longdblmantbits'
24715 longdblnanbytes='$longdblnanbytes'
24716 longdblsize='$longdblsize'
24717 longlongsize='$longlongsize'
24718 longsize='$longsize'
24719 lp='$lp'
24720 lpr='$lpr'
24721 ls='$ls'
24722 lseeksize='$lseeksize'
24723 lseektype='$lseektype'
24724 mail='$mail'
24725 mailx='$mailx'
24726 make='$make'
24727 make_set_make='$make_set_make'
24728 mallocobj='$mallocobj'
24729 mallocsrc='$mallocsrc'
24730 malloctype='$malloctype'
24731 man1dir='$man1dir'
24732 man1direxp='$man1direxp'
24733 man1ext='$man1ext'
24734 man3dir='$man3dir'
24735 man3direxp='$man3direxp'
24736 man3ext='$man3ext'
24737 mips_type='$mips_type'
24738 mistrustnm='$mistrustnm'
24739 mkdir='$mkdir'
24740 mmaptype='$mmaptype'
24741 modetype='$modetype'
24742 more='$more'
24743 multiarch='$multiarch'
24744 mv='$mv'
24745 myarchname='$myarchname'
24746 mydomain='$mydomain'
24747 myhostname='$myhostname'
24748 myuname='$myuname'
24749 n='$n'
24750 need_va_copy='$need_va_copy'
24751 netdb_hlen_type='$netdb_hlen_type'
24752 netdb_host_type='$netdb_host_type'
24753 netdb_name_type='$netdb_name_type'
24754 netdb_net_type='$netdb_net_type'
24755 nm='$nm'
24756 nm_opt='$nm_opt'
24757 nm_so_opt='$nm_so_opt'
24758 nonxs_ext='$nonxs_ext'
24759 nroff='$nroff'
24760 nvEUformat='$nvEUformat'
24761 nvFUformat='$nvFUformat'
24762 nvGUformat='$nvGUformat'
24763 nv_overflows_integers_at='$nv_overflows_integers_at'
24764 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24765 nveformat='$nveformat'
24766 nvfformat='$nvfformat'
24767 nvgformat='$nvgformat'
24768 nvmantbits='$nvmantbits'
24769 nvsize='$nvsize'
24770 nvtype='$nvtype'
24771 o_nonblock='$o_nonblock'
24772 obj_ext='$obj_ext'
24773 old_pthread_create_joinable='$old_pthread_create_joinable'
24774 optimize='$optimize'
24775 orderlib='$orderlib'
24776 osname='$osname'
24777 osvers='$osvers'
24778 otherlibdirs='$otherlibdirs'
24779 package='$package'
24780 pager='$pager'
24781 passcat='$passcat'
24782 patchlevel='$patchlevel'
24783 path_sep='$path_sep'
24784 perl5='$perl5'
24785 perl='$perl'
24786 perl_patchlevel='$perl_patchlevel'
24787 perl_static_inline='$perl_static_inline'
24788 perladmin='$perladmin'
24789 perllibs='$perllibs'
24790 perlpath='$perlpath'
24791 pg='$pg'
24792 phostname='$phostname'
24793 pidtype='$pidtype'
24794 plibpth='$plibpth'
24795 pmake='$pmake'
24796 pr='$pr'
24797 prefix='$prefix'
24798 prefixexp='$prefixexp'
24799 privlib='$privlib'
24800 privlibexp='$privlibexp'
24801 procselfexe='$procselfexe'
24802 prototype='$prototype'
24803 ptrsize='$ptrsize'
24804 quadkind='$quadkind'
24805 quadtype='$quadtype'
24806 randbits='$randbits'
24807 randfunc='$randfunc'
24808 random_r_proto='$random_r_proto'
24809 randseedtype='$randseedtype'
24810 ranlib='$ranlib'
24811 rd_nodata='$rd_nodata'
24812 readdir64_r_proto='$readdir64_r_proto'
24813 readdir_r_proto='$readdir_r_proto'
24814 revision='$revision'
24815 rm='$rm'
24816 rm_try='$rm_try'
24817 rmail='$rmail'
24818 run='$run'
24819 runnm='$runnm'
24820 sGMTIME_max='$sGMTIME_max'
24821 sGMTIME_min='$sGMTIME_min'
24822 sLOCALTIME_max='$sLOCALTIME_max'
24823 sLOCALTIME_min='$sLOCALTIME_min'
24824 sPRIEUldbl='$sPRIEUldbl'
24825 sPRIFUldbl='$sPRIFUldbl'
24826 sPRIGUldbl='$sPRIGUldbl'
24827 sPRIXU64='$sPRIXU64'
24828 sPRId64='$sPRId64'
24829 sPRIeldbl='$sPRIeldbl'
24830 sPRIfldbl='$sPRIfldbl'
24831 sPRIgldbl='$sPRIgldbl'
24832 sPRIi64='$sPRIi64'
24833 sPRIo64='$sPRIo64'
24834 sPRIu64='$sPRIu64'
24835 sPRIx64='$sPRIx64'
24836 sSCNfldbl='$sSCNfldbl'
24837 sched_yield='$sched_yield'
24838 scriptdir='$scriptdir'
24839 scriptdirexp='$scriptdirexp'
24840 sed='$sed'
24841 seedfunc='$seedfunc'
24842 selectminbits='$selectminbits'
24843 selecttype='$selecttype'
24844 sendmail='$sendmail'
24845 setgrent_r_proto='$setgrent_r_proto'
24846 sethostent_r_proto='$sethostent_r_proto'
24847 setlocale_r_proto='$setlocale_r_proto'
24848 setnetent_r_proto='$setnetent_r_proto'
24849 setprotoent_r_proto='$setprotoent_r_proto'
24850 setpwent_r_proto='$setpwent_r_proto'
24851 setservent_r_proto='$setservent_r_proto'
24852 sh='$sh'
24853 shar='$shar'
24854 sharpbang='$sharpbang'
24855 shmattype='$shmattype'
24856 shortsize='$shortsize'
24857 shrpenv='$shrpenv'
24858 shsharp='$shsharp'
24859 sig_count='$sig_count'
24860 sig_name='$sig_name'
24861 sig_name_init='$sig_name_init'
24862 sig_num='$sig_num'
24863 sig_num_init='$sig_num_init'
24864 sig_size='$sig_size'
24865 signal_t='$signal_t'
24866 sitearch='$sitearch'
24867 sitearchexp='$sitearchexp'
24868 sitebin='$sitebin'
24869 sitebinexp='$sitebinexp'
24870 sitehtml1dir='$sitehtml1dir'
24871 sitehtml1direxp='$sitehtml1direxp'
24872 sitehtml3dir='$sitehtml3dir'
24873 sitehtml3direxp='$sitehtml3direxp'
24874 sitelib='$sitelib'
24875 sitelib_stem='$sitelib_stem'
24876 sitelibexp='$sitelibexp'
24877 siteman1dir='$siteman1dir'
24878 siteman1direxp='$siteman1direxp'
24879 siteman3dir='$siteman3dir'
24880 siteman3direxp='$siteman3direxp'
24881 siteprefix='$siteprefix'
24882 siteprefixexp='$siteprefixexp'
24883 sitescript='$sitescript'
24884 sitescriptexp='$sitescriptexp'
24885 sizesize='$sizesize'
24886 sizetype='$sizetype'
24887 sleep='$sleep'
24888 smail='$smail'
24889 so='$so'
24890 sockethdr='$sockethdr'
24891 socketlib='$socketlib'
24892 socksizetype='$socksizetype'
24893 sort='$sort'
24894 spackage='$spackage'
24895 spitshell='$spitshell'
24896 srand48_r_proto='$srand48_r_proto'
24897 srandom_r_proto='$srandom_r_proto'
24898 src='$src'
24899 ssizetype='$ssizetype'
24900 st_ino_sign='$st_ino_sign'
24901 st_ino_size='$st_ino_size'
24902 startperl='$startperl'
24903 startsh='$startsh'
24904 static_ext='$static_ext'
24905 stdchar='$stdchar'
24906 stdio_base='$stdio_base'
24907 stdio_bufsiz='$stdio_bufsiz'
24908 stdio_cnt='$stdio_cnt'
24909 stdio_filbuf='$stdio_filbuf'
24910 stdio_ptr='$stdio_ptr'
24911 stdio_stream_array='$stdio_stream_array'
24912 strerror_r_proto='$strerror_r_proto'
24913 strings='$strings'
24914 submit='$submit'
24915 subversion='$subversion'
24916 sysman='$sysman'
24917 sysroot='$sysroot'
24918 tail='$tail'
24919 tar='$tar'
24920 targetarch='$targetarch'
24921 targetdir='$targetdir'
24922 targetenv='$targetenv'
24923 targethost='$targethost'
24924 targetmkdir='$targetmkdir'
24925 targetport='$targetport'
24926 targetsh='$targetsh'
24927 tbl='$tbl'
24928 tee='$tee'
24929 test='$test'
24930 timeincl='$timeincl'
24931 timetype='$timetype'
24932 tmpnam_r_proto='$tmpnam_r_proto'
24933 to='$to'
24934 touch='$touch'
24935 tr='$tr'
24936 trnl='$trnl'
24937 troff='$troff'
24938 ttyname_r_proto='$ttyname_r_proto'
24939 u16size='$u16size'
24940 u16type='$u16type'
24941 u32size='$u32size'
24942 u32type='$u32type'
24943 u64size='$u64size'
24944 u64type='$u64type'
24945 u8size='$u8size'
24946 u8type='$u8type'
24947 uidformat='$uidformat'
24948 uidsign='$uidsign'
24949 uidsize='$uidsize'
24950 uidtype='$uidtype'
24951 uname='$uname'
24952 uniq='$uniq'
24953 uquadtype='$uquadtype'
24954 use5005threads='$use5005threads'
24955 use64bitall='$use64bitall'
24956 use64bitint='$use64bitint'
24957 usecbacktrace='$usecbacktrace'
24958 usecrosscompile='$usecrosscompile'
24959 usedevel='$usedevel'
24960 usedl='$usedl'
24961 usedtrace='$usedtrace'
24962 usefaststdio='$usefaststdio'
24963 useithreads='$useithreads'
24964 usekernprocpathname='$usekernprocpathname'
24965 uselargefiles='$uselargefiles'
24966 uselongdouble='$uselongdouble'
24967 usemallocwrap='$usemallocwrap'
24968 usemorebits='$usemorebits'
24969 usemultiplicity='$usemultiplicity'
24970 usemymalloc='$usemymalloc'
24971 usenm='$usenm'
24972 usensgetexecutablepath='$usensgetexecutablepath'
24973 useopcode='$useopcode'
24974 useperlio='$useperlio'
24975 useposix='$useposix'
24976 usequadmath='$usequadmath'
24977 usereentrant='$usereentrant'
24978 userelocatableinc='$userelocatableinc'
24979 useshrplib='$useshrplib'
24980 usesitecustomize='$usesitecustomize'
24981 usesocks='$usesocks'
24982 usethreads='$usethreads'
24983 usevendorprefix='$usevendorprefix'
24984 useversionedarchname='$useversionedarchname'
24985 usevfork='$usevfork'
24986 usrinc='$usrinc'
24987 uuname='$uuname'
24988 uvXUformat='$uvXUformat'
24989 uvoformat='$uvoformat'
24990 uvsize='$uvsize'
24991 uvtype='$uvtype'
24992 uvuformat='$uvuformat'
24993 uvxformat='$uvxformat'
24994 vaproto='$vaproto'
24995 vendorarch='$vendorarch'
24996 vendorarchexp='$vendorarchexp'
24997 vendorbin='$vendorbin'
24998 vendorbinexp='$vendorbinexp'
24999 vendorhtml1dir='$vendorhtml1dir'
25000 vendorhtml1direxp='$vendorhtml1direxp'
25001 vendorhtml3dir='$vendorhtml3dir'
25002 vendorhtml3direxp='$vendorhtml3direxp'
25003 vendorlib='$vendorlib'
25004 vendorlib_stem='$vendorlib_stem'
25005 vendorlibexp='$vendorlibexp'
25006 vendorman1dir='$vendorman1dir'
25007 vendorman1direxp='$vendorman1direxp'
25008 vendorman3dir='$vendorman3dir'
25009 vendorman3direxp='$vendorman3direxp'
25010 vendorprefix='$vendorprefix'
25011 vendorprefixexp='$vendorprefixexp'
25012 vendorscript='$vendorscript'
25013 vendorscriptexp='$vendorscriptexp'
25014 version='$version'
25015 version_patchlevel_string='$version_patchlevel_string'
25016 versiononly='$versiononly'
25017 vi='$vi'
25018 xlibpth='$xlibpth'
25019 yacc='$yacc'
25020 yaccflags='$yaccflags'
25021 zcat='$zcat'
25022 zip='$zip'
25023 EOT
25024
25025 : add special variables
25026 $test -f $src/patchlevel.h && \
25027 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25028 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25029 echo "PERL_CONFIG_SH=true" >>config.sh
25030
25031 : propagate old symbols
25032 if $test -f UU/config.sh; then
25033         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25034         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25035                 config.sh config.sh UU/oldconfig.sh |\
25036                 $sort | $uniq -u >UU/oldsyms
25037         set X `$cat UU/oldsyms`
25038         shift
25039         case $# in
25040         0) ;;
25041         *)
25042                 $cat <<EOM
25043 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25044 EOM
25045                 echo ": Variables propagated from previous config.sh file." >>config.sh
25046                 for sym in `$cat UU/oldsyms`; do
25047                         echo "    Propagating $hint variable "'$'"$sym..."
25048                         eval 'tmp="$'"${sym}"'"'
25049                         echo "$tmp" | \
25050                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25051                 done
25052                 ;;
25053         esac
25054 fi
25055
25056 : preserve RCS keywords in files with variable substitution, grrr
25057 Id='$Id'
25058
25059 : Finish up by extracting the .SH files
25060 case "$alldone" in
25061 exit)
25062         $rm -rf UU
25063         echo "Extraction done."
25064         exit 0
25065         ;;
25066 cont)
25067         ;;
25068 '')
25069         dflt=''
25070         nostick=true
25071         $cat <<EOM
25072
25073 If you'd like to make any changes to the config.sh file before I begin
25074 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25075
25076 EOM
25077         rp="Press return or use a shell escape to edit config.sh:"
25078         . UU/myread
25079         nostick=''
25080         case "$ans" in
25081         '') ;;
25082         *) : in case they cannot read
25083                 sh 1>&4 -c "$ans";;
25084         esac
25085         ;;
25086 esac
25087
25088 : if this fails, just run all the .SH files by hand
25089 . ./config.sh
25090
25091 echo " "
25092 exec 1>&4
25093 pwd=`pwd`
25094 . ./UU/extract
25095 cd "$pwd"
25096
25097 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25098         dflt=y
25099         case "$silent" in
25100         true) ;;
25101         *)
25102                 $cat <<EOM
25103
25104 Now you need to generate make dependencies by running "$make depend".
25105 You might prefer to run it in background: "$make depend > makedepend.out &"
25106 It can take a while, so you might not want to run it right now.
25107
25108 EOM
25109                 ;;
25110         esac
25111         rp="Run $make depend now?"
25112         . UU/myread
25113         case "$ans" in
25114         y*)
25115                 $make depend && echo "Now you must run '$make'."
25116                 ;;
25117         *)
25118                 echo "You must run '$make depend' then '$make'."
25119                 ;;
25120         esac
25121 elif test -f [Mm]akefile; then
25122         echo " "
25123         echo "Now you must run a $make."
25124 else
25125         echo "Configure done."
25126 fi
25127
25128 if $test -f Policy.sh; then
25129     $cat <<EOM
25130
25131 If you compile $package on a different machine or from a different object
25132 directory, copy the Policy.sh file from this object directory to the
25133 new one before you run Configure -- this will help you with most of
25134 the policy defaults.
25135
25136 EOM
25137 fi
25138 if $test -f config.msg; then
25139     echo "Hmm.  I also noted the following information while running:"
25140     echo " "
25141     $cat config.msg >&4
25142     $rm -f config.msg
25143 fi
25144 $rm -f kit*isdone ark*isdone
25145 $rm -rf UU
25146
25147 : End of Configure
25148