This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
07dfb7c0eb277f505bcb457d8b79e213457a4dfd
[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_fdclose=''
479 d_fdim=''
480 d_fegetround=''
481 d_fgetpos=''
482 d_finite=''
483 d_finitel=''
484 d_flexfnam=''
485 d_flock=''
486 d_flockproto=''
487 d_fma=''
488 d_fmax=''
489 d_fmin=''
490 d_fork=''
491 d_fp_class=''
492 d_fp_classl=''
493 d_fpclass=''
494 d_fp_classify=''
495 d_fpclassify=''
496 d_fpclassl=''
497 d_fpgetround=''
498 d_fpos64_t=''
499 d_frexpl=''
500 d_fs_data_s=''
501 d_fseeko=''
502 d_fsetpos=''
503 d_fstatfs=''
504 d_fsync=''
505 d_ftello=''
506 d_ftime=''
507 d_gettimeod=''
508 d_futimes=''
509 d_gai_strerror=''
510 d_Gconvert=''
511 d_getaddrinfo=''
512 d_getcwd=''
513 d_getespwnam=''
514 d_getfsstat=''
515 d_getgrent=''
516 d_getgrent_r=''
517 getgrent_r_proto=''
518 d_getgrgid_r=''
519 getgrgid_r_proto=''
520 d_getgrnam_r=''
521 getgrnam_r_proto=''
522 d_getgrps=''
523 d_gethbyaddr=''
524 d_gethbyname=''
525 d_gethent=''
526 aphostname=''
527 d_gethname=''
528 d_phostname=''
529 d_uname=''
530 d_gethostbyaddr_r=''
531 gethostbyaddr_r_proto=''
532 d_gethostbyname_r=''
533 gethostbyname_r_proto=''
534 d_gethostent_r=''
535 gethostent_r_proto=''
536 d_gethostprotos=''
537 d_getitimer=''
538 d_getlogin=''
539 d_getlogin_r=''
540 getlogin_r_proto=''
541 d_getmnt=''
542 d_getmntent=''
543 d_getnameinfo=''
544 d_getnbyaddr=''
545 d_getnbyname=''
546 d_getnent=''
547 d_getnetbyaddr_r=''
548 getnetbyaddr_r_proto=''
549 d_getnetbyname_r=''
550 getnetbyname_r_proto=''
551 d_getnetent_r=''
552 getnetent_r_proto=''
553 d_getnetprotos=''
554 d_getpagsz=''
555 d_getpent=''
556 d_getpgid=''
557 d_getpgrp2=''
558 d_bsdgetpgrp=''
559 d_getpgrp=''
560 d_getppid=''
561 d_getprior=''
562 d_getpbyname=''
563 d_getpbynumber=''
564 d_getprotobyname_r=''
565 getprotobyname_r_proto=''
566 d_getprotobynumber_r=''
567 getprotobynumber_r_proto=''
568 d_getprotoent_r=''
569 getprotoent_r_proto=''
570 d_getprotoprotos=''
571 d_getprpwnam=''
572 d_getpwent=''
573 d_getpwent_r=''
574 getpwent_r_proto=''
575 d_getpwnam_r=''
576 getpwnam_r_proto=''
577 d_getpwuid_r=''
578 getpwuid_r_proto=''
579 d_getsent=''
580 d_getservbyname_r=''
581 getservbyname_r_proto=''
582 d_getservbyport_r=''
583 getservbyport_r_proto=''
584 d_getservent_r=''
585 getservent_r_proto=''
586 d_getservprotos=''
587 d_getspnam=''
588 d_getspnam_r=''
589 getspnam_r_proto=''
590 d_getsbyname=''
591 d_getsbyport=''
592 d_gmtime_r=''
593 gmtime_r_proto=''
594 d_gnulibc=''
595 gnulibc_version=''
596 d_hasmntopt=''
597 d_htonl=''
598 d_hypot=''
599 d_ilogb=''
600 d_ilogbl=''
601 d_inetaton=''
602 d_inetntop=''
603 d_inetpton=''
604 d_int64_t=''
605 d_isascii=''
606 d_isblank=''
607 d_isfinite=''
608 d_isfinitel=''
609 d_isinf=''
610 d_isinfl=''
611 d_isless=''
612 d_isnan=''
613 d_isnanl=''
614 d_isnormal=''
615 d_j0=''
616 d_j0l=''
617 d_killpg=''
618 d_lc_monetary_2008=''
619 d_lchown=''
620 d_ldbl_dig=''
621 d_lgamma=''
622 d_lgamma_r=''
623 d_libm_lib_version=''
624 d_link=''
625 d_llrint=''
626 d_llrintl=''
627 d_llround=''
628 d_llroundl=''
629 d_localtime_r=''
630 d_localtime_r_needs_tzset=''
631 localtime_r_proto=''
632 d_locconv=''
633 d_lockf=''
634 d_log1p=''
635 d_log2=''
636 d_logb=''
637 d_ldexpl=''
638 d_long_double_style_ieee=''
639 d_long_double_style_ieee_doubledouble=''
640 d_long_double_style_ieee_extended=''
641 d_long_double_style_ieee_std=''
642 d_long_double_style_vax=''
643 d_longdbl=''
644 longdblkind=''
645 longdblsize=''
646 d_longlong=''
647 longlongsize=''
648 d_lrint=''
649 d_lrintl=''
650 d_lround=''
651 d_lroundl=''
652 d_lseekproto=''
653 d_lstat=''
654 d_madvise=''
655 d_malloc_good_size=''
656 d_malloc_size=''
657 d_mblen=''
658 d_mbstowcs=''
659 d_mbtowc=''
660 d_memchr=''
661 d_memcmp=''
662 d_memcpy=''
663 d_memmem=''
664 d_memmove=''
665 d_memset=''
666 d_mkdir=''
667 d_mkdtemp=''
668 d_mkfifo=''
669 d_mkstemp=''
670 d_mkstemps=''
671 d_mktime=''
672 d_mmap=''
673 mmaptype=''
674 d_modfl=''
675 d_modflproto=''
676 d_mprotect=''
677 d_msg=''
678 d_msgctl=''
679 d_msgget=''
680 d_msghdr_s=''
681 d_msgrcv=''
682 d_msgsnd=''
683 d_msync=''
684 d_munmap=''
685 d_nan=''
686 d_nearbyint=''
687 d_duplocale=''
688 d_freelocale=''
689 d_newlocale=''
690 d_querylocale=''
691 d_uselocale=''
692 i_xlocale=''
693 d_nextafter=''
694 d_nexttoward=''
695 d_nice=''
696 d_nl_langinfo=''
697 d_off64_t=''
698 d_open3=''
699 d_fpathconf=''
700 d_pathconf=''
701 d_pause=''
702 d_pipe=''
703 d_poll=''
704 d_portable=''
705 d_prctl=''
706 d_prctl_set_name=''
707 d_procselfexe=''
708 procselfexe=''
709 d_old_pthread_create_joinable=''
710 old_pthread_create_joinable=''
711 d_pthread_atfork=''
712 d_pthread_attr_setscope=''
713 d_pthread_yield=''
714 d_sched_yield=''
715 sched_yield=''
716 d_ptrdiff_t=''
717 d_qgcvt=''
718 d_random_r=''
719 random_r_proto=''
720 d_readdir64_r=''
721 readdir64_r_proto=''
722 d_readdir=''
723 d_rewinddir=''
724 d_seekdir=''
725 d_telldir=''
726 d_readdir_r=''
727 readdir_r_proto=''
728 d_readlink=''
729 d_readv=''
730 d_recvmsg=''
731 d_re_comp=''
732 d_regcmp=''
733 d_regcomp=''
734 d_remainder=''
735 d_remquo=''
736 d_rename=''
737 d_rint=''
738 d_rmdir=''
739 d_round=''
740 d_safebcpy=''
741 d_safemcpy=''
742 d_sanemcmp=''
743 d_sbrkproto=''
744 d_scalbn=''
745 d_scalbnl=''
746 d_select=''
747 d_sem=''
748 d_semctl=''
749 d_semget=''
750 d_semop=''
751 d_sendmsg=''
752 d_setegid=''
753 d_seteuid=''
754 d_setgrent=''
755 d_setgrent_r=''
756 setgrent_r_proto=''
757 d_setgrps=''
758 d_sethent=''
759 d_sethostent_r=''
760 sethostent_r_proto=''
761 d_setitimer=''
762 d_setlinebuf=''
763 d_setlocale=''
764 d_setlocale_r=''
765 setlocale_r_proto=''
766 d_setnent=''
767 d_setnetent_r=''
768 setnetent_r_proto=''
769 d_setpent=''
770 d_setpgid=''
771 d_setpgrp2=''
772 d_bsdsetpgrp=''
773 d_setpgrp=''
774 d_setprior=''
775 d_setproctitle=''
776 d_setprotoent_r=''
777 setprotoent_r_proto=''
778 d_setpwent=''
779 d_setpwent_r=''
780 setpwent_r_proto=''
781 d_setregid=''
782 d_setresgid=''
783 d_setresuid=''
784 d_setreuid=''
785 d_setrgid=''
786 d_setruid=''
787 d_setsent=''
788 d_setservent_r=''
789 setservent_r_proto=''
790 d_setsid=''
791 d_setvbuf=''
792 d_shm=''
793 d_shmat=''
794 d_shmatprototype=''
795 shmattype=''
796 d_shmctl=''
797 d_shmdt=''
798 d_shmget=''
799 d_sigaction=''
800 d_siginfo_si_addr=''
801 d_siginfo_si_band=''
802 d_siginfo_si_errno=''
803 d_siginfo_si_fd=''
804 d_siginfo_si_pid=''
805 d_siginfo_si_status=''
806 d_siginfo_si_uid=''
807 d_siginfo_si_value=''
808 d_signbit=''
809 d_sigprocmask=''
810 d_sigsetjmp=''
811 usesitecustomize=''
812 d_snprintf=''
813 d_vsnprintf=''
814 d_sockatmark=''
815 d_sockatmarkproto=''
816 d_ip_mreq=''
817 d_ip_mreq_source=''
818 d_ipv6_mreq=''
819 d_ipv6_mreq_source=''
820 d_msg_ctrunc=''
821 d_msg_dontroute=''
822 d_msg_oob=''
823 d_msg_peek=''
824 d_msg_proxy=''
825 d_oldsock=''
826 d_scm_rights=''
827 d_sin6_scope_id=''
828 d_sockaddr_in6=''
829 d_sockaddr_sa_len=''
830 d_socket=''
831 d_sockpair=''
832 sockethdr=''
833 socketlib=''
834 d_socklen_t=''
835 d_socks5_init=''
836 d_sprintf_returns_strlen=''
837 d_sqrtl=''
838 d_srand48_r=''
839 srand48_r_proto=''
840 d_srandom_r=''
841 srandom_r_proto=''
842 d_sresgproto=''
843 d_sresuproto=''
844 d_stat=''
845 d_statblks=''
846 d_statfs_f_flags=''
847 d_statfs_s=''
848 d_static_inline=''
849 perl_static_inline=''
850 d_fstatvfs=''
851 d_statvfs=''
852 d_stdio_cnt_lval=''
853 d_stdio_ptr_lval=''
854 d_stdio_ptr_lval_nochange_cnt=''
855 d_stdio_ptr_lval_sets_cnt=''
856 d_stdiobase=''
857 d_stdstdio=''
858 stdio_base=''
859 stdio_bufsiz=''
860 stdio_cnt=''
861 stdio_filbuf=''
862 stdio_ptr=''
863 d_index=''
864 d_strchr=''
865 d_strcoll=''
866 d_strctcpy=''
867 d_strerrm=''
868 d_strerror=''
869 d_sysernlst=''
870 d_syserrlst=''
871 d_strerror_l=''
872 d_strerror_r=''
873 strerror_r_proto=''
874 d_strftime=''
875 d_strlcat=''
876 d_strlcpy=''
877 d_strtod=''
878 d_strtol=''
879 d_strtold=''
880 d_strtoll=''
881 d_strtoq=''
882 d_strtoul=''
883 d_strtoull=''
884 d_strtouq=''
885 d_strxfrm=''
886 d_symlink=''
887 d_syscall=''
888 d_syscallproto=''
889 d_sysconf=''
890 d_system=''
891 d_tcgetpgrp=''
892 d_tcsetpgrp=''
893 d_telldirproto=''
894 d_tgamma=''
895 d_time=''
896 timetype=''
897 d_asctime64=''
898 d_ctime64=''
899 d_difftime64=''
900 d_gmtime64=''
901 d_localtime64=''
902 d_mktime64=''
903 d_timegm=''
904 clocktype=''
905 d_times=''
906 d_tmpnam_r=''
907 tmpnam_r_proto=''
908 d_trunc=''
909 d_truncate=''
910 d_truncl=''
911 d_ttyname_r=''
912 ttyname_r_proto=''
913 d_tzname=''
914 d_u32align=''
915 d_ualarm=''
916 d_umask=''
917 d_semctl_semid_ds=''
918 d_semctl_semun=''
919 d_union_semun=''
920 d_unordered=''
921 d_unsetenv=''
922 d_usleep=''
923 d_usleepproto=''
924 d_ustat=''
925 d_pseudofork=''
926 d_vfork=''
927 usevfork=''
928 d_voidsig=''
929 signal_t=''
930 d_volatile=''
931 d_charvspr=''
932 d_vprintf=''
933 d_wait4=''
934 d_waitpid=''
935 d_wcscmp=''
936 d_wcstombs=''
937 d_wcsxfrm=''
938 d_wctomb=''
939 d_writev=''
940 default_inc_excludes_dot='undef'
941 dlext=''
942 bin_ELF=''
943 cccdlflags=''
944 ccdlflags=''
945 dlsrc=''
946 ld=''
947 ld_can_script=''
948 lddlflags=''
949 usedl=''
950 doublesize=''
951 dtraceobject=''
952 dtracexnolibs=''
953 ebcdic=''
954 fflushNULL=''
955 fflushall=''
956 fpossize=''
957 fpostype=''
958 gccansipedantic=''
959 gccosandvers=''
960 gccversion=''
961 gidformat=''
962 gidsign=''
963 gidsize=''
964 gidtype=''
965 groupstype=''
966 h_fcntl=''
967 h_sysfile=''
968 html1dir=''
969 html1direxp=''
970 installhtml1dir=''
971 html3dir=''
972 html3direxp=''
973 installhtml3dir=''
974 i_arpainet=''
975 i_assert=''
976 i_bfd=''
977 i_crypt=''
978 db_hashtype=''
979 db_prefixtype=''
980 db_version_major=''
981 db_version_minor=''
982 db_version_patch=''
983 i_db=''
984 i_dbm=''
985 i_rpcsvcdbm=''
986 d_dirnamlen=''
987 direntrytype=''
988 i_dirent=''
989 i_dlfcn=''
990 i_execinfo=''
991 i_fcntl=''
992 i_fenv=''
993 i_float=''
994 i_fp=''
995 i_fp_class=''
996 i_gdbm=''
997 d_grpasswd=''
998 i_grp=''
999 i_ieeefp=''
1000 i_inttypes=''
1001 i_langinfo=''
1002 i_libutil=''
1003 i_limits=''
1004 i_locale=''
1005 i_machcthr=''
1006 i_malloc=''
1007 i_mallocmalloc=''
1008 i_math=''
1009 i_memory=''
1010 i_mntent=''
1011 d_gdbm_ndbm_h_uses_prototypes=''
1012 d_gdbmndbm_h_uses_prototypes=''
1013 d_ndbm=''
1014 d_ndbm_h_uses_prototypes=''
1015 i_gdbm_ndbm=''
1016 i_gdbmndbm=''
1017 i_ndbm=''
1018 i_netdb=''
1019 i_neterrno=''
1020 i_netinettcp=''
1021 i_niin=''
1022 i_sysin=''
1023 i_poll=''
1024 i_prot=''
1025 i_pthread=''
1026 d_pwage=''
1027 d_pwchange=''
1028 d_pwclass=''
1029 d_pwcomment=''
1030 d_pwexpire=''
1031 d_pwgecos=''
1032 d_pwpasswd=''
1033 d_pwquota=''
1034 i_pwd=''
1035 i_quadmath=''
1036 i_shadow=''
1037 i_socks=''
1038 i_stdbool=''
1039 i_stddef=''
1040 i_stdint=''
1041 i_stdlib=''
1042 i_string=''
1043 strings=''
1044 i_sunmath=''
1045 i_sysaccess=''
1046 i_sysdir=''
1047 i_sysfile=''
1048 d_voidtty=''
1049 i_bsdioctl=''
1050 i_sysfilio=''
1051 i_sysioctl=''
1052 i_syssockio=''
1053 i_syslog=''
1054 i_sysmman=''
1055 i_sysmode=''
1056 i_sysmount=''
1057 i_sysndir=''
1058 i_sysparam=''
1059 i_syspoll=''
1060 i_sysresrc=''
1061 i_syssecrt=''
1062 i_sysselct=''
1063 i_sysstat=''
1064 i_sysstatfs=''
1065 i_sysstatvfs=''
1066 i_systimes=''
1067 i_systypes=''
1068 i_sysuio=''
1069 i_sysun=''
1070 i_sysutsname=''
1071 i_sysvfs=''
1072 i_syswait=''
1073 i_sgtty=''
1074 i_termio=''
1075 i_termios=''
1076 d_tm_tm_gmtoff=''
1077 d_tm_tm_zone=''
1078 i_systime=''
1079 i_systimek=''
1080 i_time=''
1081 timeincl=''
1082 i_unistd=''
1083 i_ustat=''
1084 i_utime=''
1085 i_values=''
1086 i_stdarg=''
1087 i_varargs=''
1088 i_varhdr=''
1089 i_vfork=''
1090 d_inc_version_list=''
1091 inc_version_list=''
1092 inc_version_list_init=''
1093 doubleinfbytes=''
1094 doublenanbytes=''
1095 longdblinfbytes=''
1096 longdblnanbytes=''
1097 installprefix=''
1098 installprefixexp=''
1099 installstyle=''
1100 installusrbinperl=''
1101 intsize=''
1102 longsize=''
1103 shortsize=''
1104 issymlink=''
1105 libc=''
1106 ldlibpthname=''
1107 libperl=''
1108 shrpenv=''
1109 useshrplib=''
1110 glibpth=''
1111 incpth=''
1112 libpth=''
1113 loclibpth=''
1114 plibpth=''
1115 xlibpth=''
1116 ignore_versioned_solibs=''
1117 libs=''
1118 libsdirs=''
1119 libsfiles=''
1120 libsfound=''
1121 libspath=''
1122 lns=''
1123 d_PRIEUldbl=''
1124 d_PRIFUldbl=''
1125 d_PRIGUldbl=''
1126 d_PRIeldbl=''
1127 d_PRIfldbl=''
1128 d_PRIgldbl=''
1129 d_SCNfldbl=''
1130 d_double_has_inf=''
1131 d_double_has_nan=''
1132 d_double_has_negative_zero=''
1133 d_double_has_subnormals=''
1134 d_double_style_cray=''
1135 d_double_style_ibm=''
1136 d_double_style_ieee=''
1137 d_double_style_vax=''
1138 doublekind=''
1139 sPRIEUldbl=''
1140 sPRIFUldbl=''
1141 sPRIGUldbl=''
1142 sPRIeldbl=''
1143 sPRIfldbl=''
1144 sPRIgldbl=''
1145 sSCNfldbl=''
1146 lseeksize=''
1147 lseektype=''
1148 make_set_make=''
1149 d_mymalloc=''
1150 freetype=''
1151 mallocobj=''
1152 mallocsrc=''
1153 malloctype=''
1154 usemallocwrap=''
1155 usemymalloc=''
1156 installman1dir=''
1157 man1dir=''
1158 man1direxp=''
1159 man1ext=''
1160 installman3dir=''
1161 man3dir=''
1162 man3direxp=''
1163 man3ext=''
1164 doublemantbits=''
1165 longdblmantbits=''
1166 nvmantbits=''
1167 modetype=''
1168 multiarch=''
1169 mydomain=''
1170 myhostname=''
1171 phostname=''
1172 c=''
1173 n=''
1174 d_eofnblk=''
1175 eagain=''
1176 o_nonblock=''
1177 rd_nodata=''
1178 need_va_copy=''
1179 netdb_hlen_type=''
1180 netdb_host_type=''
1181 netdb_name_type=''
1182 netdb_net_type=''
1183 groupcat=''
1184 hostcat=''
1185 passcat=''
1186 orderlib=''
1187 ranlib=''
1188 d_perl_otherlibdirs=''
1189 otherlibdirs=''
1190 package=''
1191 spackage=''
1192 pager=''
1193 api_revision=''
1194 api_subversion=''
1195 api_version=''
1196 api_versionstring=''
1197 patchlevel=''
1198 perl_patchlevel=''
1199 revision=''
1200 subversion=''
1201 version=''
1202 version_patchlevel_string=''
1203 perl5=''
1204 perladmin=''
1205 perlpath=''
1206 d_nv_preserves_uv=''
1207 d_nv_zero_is_allbits_zero=''
1208 i16size=''
1209 i16type=''
1210 i32size=''
1211 i32type=''
1212 i64size=''
1213 i64type=''
1214 i8size=''
1215 i8type=''
1216 ivsize=''
1217 ivtype=''
1218 nv_overflows_integers_at=''
1219 nv_preserves_uv_bits=''
1220 nvsize=''
1221 nvtype=''
1222 u16size=''
1223 u16type=''
1224 u32size=''
1225 u32type=''
1226 u64size=''
1227 u64type=''
1228 u8size=''
1229 u8type=''
1230 uvsize=''
1231 uvtype=''
1232 ivdformat=''
1233 nvEUformat=''
1234 nvFUformat=''
1235 nvGUformat=''
1236 nveformat=''
1237 nvfformat=''
1238 nvgformat=''
1239 uvXUformat=''
1240 uvoformat=''
1241 uvuformat=''
1242 uvxformat=''
1243 pidtype=''
1244 prefix=''
1245 prefixexp=''
1246 installprivlib=''
1247 privlib=''
1248 privlibexp=''
1249 prototype=''
1250 ptrsize=''
1251 d_PRIXU64=''
1252 d_PRId64=''
1253 d_PRIi64=''
1254 d_PRIo64=''
1255 d_PRIu64=''
1256 d_PRIx64=''
1257 sPRIXU64=''
1258 sPRId64=''
1259 sPRIi64=''
1260 sPRIo64=''
1261 sPRIu64=''
1262 sPRIx64=''
1263 d_quad=''
1264 quadkind=''
1265 quadtype=''
1266 uquadtype=''
1267 drand01=''
1268 randbits=''
1269 randfunc=''
1270 randseedtype=''
1271 seedfunc=''
1272 installscript=''
1273 scriptdir=''
1274 scriptdirexp=''
1275 selectminbits=''
1276 selecttype=''
1277 sh=''
1278 targetsh=''
1279 sig_count=''
1280 sig_name=''
1281 sig_name_init=''
1282 sig_num=''
1283 sig_num_init=''
1284 sig_size=''
1285 d_sitearch=''
1286 installsitearch=''
1287 sitearch=''
1288 sitearchexp=''
1289 installsitebin=''
1290 sitebin=''
1291 sitebinexp=''
1292 installsitehtml1dir=''
1293 sitehtml1dir=''
1294 sitehtml1direxp=''
1295 installsitehtml3dir=''
1296 sitehtml3dir=''
1297 sitehtml3direxp=''
1298 installsitelib=''
1299 sitelib=''
1300 sitelib_stem=''
1301 sitelibexp=''
1302 installsiteman1dir=''
1303 siteman1dir=''
1304 siteman1direxp=''
1305 installsiteman3dir=''
1306 siteman3dir=''
1307 siteman3direxp=''
1308 siteprefix=''
1309 siteprefixexp=''
1310 installsitescript=''
1311 sitescript=''
1312 sitescriptexp=''
1313 sizesize=''
1314 sizetype=''
1315 d_libname_unique=''
1316 so=''
1317 socksizetype=''
1318 sharpbang=''
1319 shsharp=''
1320 spitshell=''
1321 src=''
1322 ssizetype=''
1323 st_ino_sign=''
1324 st_ino_size=''
1325 startperl=''
1326 startsh=''
1327 stdchar=''
1328 d_stdio_stream_array=''
1329 stdio_stream_array=''
1330 sysman=''
1331 sGMTIME_max=''
1332 sGMTIME_min=''
1333 sLOCALTIME_max=''
1334 sLOCALTIME_min=''
1335 trnl=''
1336 uidformat=''
1337 uidsign=''
1338 uidsize=''
1339 uidtype=''
1340 archname64=''
1341 use64bitall=''
1342 use64bitint=''
1343 usecbacktrace=''
1344 dtrace=''
1345 usedtrace=''
1346 usefaststdio=''
1347 usekernprocpathname=''
1348 ccflags_uselargefiles=''
1349 ldflags_uselargefiles=''
1350 libswanted_uselargefiles=''
1351 uselargefiles=''
1352 uselongdouble=''
1353 usemorebits=''
1354 usemultiplicity=''
1355 nm_opt=''
1356 nm_so_opt=''
1357 runnm=''
1358 usenm=''
1359 usensgetexecutablepath=''
1360 useperlio=''
1361 usequadmath=''
1362 usesocks=''
1363 d_oldpthreads=''
1364 use5005threads=''
1365 useithreads=''
1366 usereentrant=''
1367 usethreads=''
1368 incpath=''
1369 mips_type=''
1370 usrinc=''
1371 vaproto=''
1372 d_vendorarch=''
1373 installvendorarch=''
1374 vendorarch=''
1375 vendorarchexp=''
1376 d_vendorbin=''
1377 installvendorbin=''
1378 vendorbin=''
1379 vendorbinexp=''
1380 installvendorhtml1dir=''
1381 vendorhtml1dir=''
1382 vendorhtml1direxp=''
1383 installvendorhtml3dir=''
1384 vendorhtml3dir=''
1385 vendorhtml3direxp=''
1386 d_vendorlib=''
1387 installvendorlib=''
1388 vendorlib=''
1389 vendorlib_stem=''
1390 vendorlibexp=''
1391 installvendorman1dir=''
1392 vendorman1dir=''
1393 vendorman1direxp=''
1394 installvendorman3dir=''
1395 vendorman3dir=''
1396 vendorman3direxp=''
1397 usevendorprefix=''
1398 vendorprefix=''
1399 vendorprefixexp=''
1400 d_vendorscript=''
1401 installvendorscript=''
1402 vendorscript=''
1403 vendorscriptexp=''
1404 versiononly=''
1405 yacc=''
1406 yaccflags=''
1407 CONFIG=''
1408
1409 : Detect odd OSs
1410 define='define'
1411 undef='undef'
1412 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1413 rmlist=''
1414
1415 : We must find out about Eunice early
1416 eunicefix=':'
1417 if test -f /etc/unixtovms; then
1418         eunicefix=/etc/unixtovms
1419 fi
1420 if test -f /etc/unixtovms.exe; then
1421         eunicefix=/etc/unixtovms.exe
1422 fi
1423
1424 : Set executable suffix now -- needed before hints available
1425 if test -f "/libs/version.library"; then
1426 : Amiga OS
1427     _exe=""
1428 elif test -f "/system/gnu_library/bin/ar.pm"; then
1429 : Stratus VOS
1430     _exe=".pm"
1431 elif test -n "$DJGPP"; then
1432 : DOS DJGPP
1433     _exe=".exe"
1434 elif test -f /kern/cookiejar; then
1435 : MiNT
1436     _exe=""
1437 elif test -d c:/. -o -n "$is_os2" ; then
1438 : OS/2 or cygwin
1439     _exe=".exe"
1440 fi
1441
1442 groupstype=''
1443 i_whoami=''
1444 : Possible local include directories to search.
1445 : Set locincpth to "" in a hint file to defeat local include searches.
1446 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1447 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1448 :
1449 : no include file wanted by default
1450 inclwanted=''
1451
1452 : Enable -DEBUGGING and -DDEBUGGING from the command line
1453 EBUGGING=''
1454 DEBUGGING=''
1455
1456 : Trailing extension.  Override this in a hint file, if needed.
1457 : Extra object files, if any, needed on this platform.
1458 archobjs=''
1459 libnames=''
1460 : change the next line if compiling for Xenix/286 on Xenix/386
1461 xlibpth='/usr/lib/386 /lib/386'
1462 : Possible local library directories to search.
1463 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1464 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1465
1466 : general looking path for locating libraries
1467 glibpth="/lib /usr/lib $xlibpth"
1468 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1469 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1470 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1471 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1472
1473 : Private path used by Configure to find libraries.  Its value
1474 : is prepended to libpth. This variable takes care of special
1475 : machines, like the mips.  Usually, it should be empty.
1476 plibpth=''
1477
1478 : default library list
1479 libswanted=''
1480 : some systems want to use only the non-versioned libso:s
1481 ignore_versioned_solibs=''
1482 ccname=''
1483 ccversion=''
1484 perllibs=''
1485 : set useposix=false in your hint file to disable the POSIX extension.
1486 useposix=true
1487 : set useopcode=false in your hint file to disable the Opcode extension.
1488 useopcode=true
1489 archname64=''
1490 ccflags_uselargefiles=''
1491 ldflags_uselargefiles=''
1492 libswanted_uselargefiles=''
1493 : set usemultiplicity on the Configure command line to enable multiplicity.
1494 : set usesocks on the Configure command line to enable socks.
1495 archname=''
1496 : set usethreads on the Configure command line to enable threads.
1497 usereentrant='undef'
1498 : List of libraries we want.
1499 : If anyone needs extra -lxxx, put those in a hint file.
1500 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1501 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1502 : We probably want to search /usr/shlib before most other libraries.
1503 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1504 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1505 glibpth="/usr/shlib $glibpth"
1506 : Do not use vfork unless overridden by a hint file.
1507 usevfork=false
1508
1509 : Find the basic shell for Bourne shell scripts
1510 case "$sh" in
1511 '')
1512         case "$SYSTYPE" in
1513         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1514         *) xxx='/bin/sh';;
1515         esac
1516         if test -f "$xxx"; then
1517                 sh="$xxx"
1518         else
1519                 : Build up a list and do a single loop so we can 'break' out.
1520                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1521                 for xxx in sh bash ksh pdksh ash; do
1522                         for p in $pth; do
1523                                 try="$try ${p}/${xxx}"
1524                         done
1525                 done
1526                 for xxx in $try; do
1527                         if test -f "$xxx"; then
1528                                 sh="$xxx";
1529                                 break
1530                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1531                                 sh="$xxx";
1532                                 break
1533                         elif test -f "$xxx.exe"; then
1534                                 sh="$xxx";
1535                                 break
1536                         fi
1537                 done
1538         fi
1539         ;;
1540 esac
1541
1542 case "$sh" in
1543 '')     cat >&2 <<EOM
1544 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1545
1546 Usually it's in /bin/sh.  How did you even get this far?
1547 Please contact me (Perl Maintainers) at perlbug@perl.org and
1548 we'll try to straighten this all out.
1549 EOM
1550         exit 1
1551         ;;
1552 esac
1553
1554 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1555 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1556 targetsh=$sh
1557
1558 : see if sh knows # comments
1559 if `$sh -c '#' >/dev/null 2>&1`; then
1560         shsharp=true
1561         spitshell=cat
1562         xcat=/bin/cat
1563         test -f $xcat$_exe || xcat=/usr/bin/cat
1564         if test ! -f $xcat$_exe; then
1565                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1566                         if test -f $p/cat$_exe; then
1567                                 xcat=$p/cat
1568                                 break
1569                         fi
1570                 done
1571                 if test ! -f $xcat$_exe; then
1572                         echo "Can't find cat anywhere!"
1573                         exit 1
1574                 fi
1575         fi
1576         echo "#!$xcat" >sharp
1577         $eunicefix sharp
1578         chmod +x sharp
1579         ./sharp > today 2>/dev/null
1580         if test -s today; then
1581                 sharpbang='#!'
1582         else
1583                 echo "#! $xcat" > sharp
1584                 $eunicefix sharp
1585                 chmod +x sharp
1586                 ./sharp > today 2>/dev/null
1587                 if test -s today; then
1588                         sharpbang='#! '
1589                 else
1590                         sharpbang=': use '
1591                 fi
1592         fi
1593 else
1594         echo " "
1595         echo "Your $sh doesn't grok # comments--I will strip them later on."
1596         shsharp=false
1597         cd ..
1598         echo "exec grep -v '^[  ]*#'" >spitshell
1599         chmod +x spitshell
1600         $eunicefix spitshell
1601         spitshell=`pwd`/spitshell
1602         cd UU
1603         echo "I presume that if # doesn't work, #! won't work either!"
1604         sharpbang=': use '
1605 fi
1606 rm -f sharp today
1607
1608 : figure out how to guarantee sh startup
1609 case "$startsh" in
1610 '') startsh=${sharpbang}${sh} ;;
1611 *)
1612 esac
1613 cat >sharp <<EOSS
1614 $startsh
1615 set abc
1616 test "$?abc" != 1
1617 EOSS
1618
1619 chmod +x sharp
1620 $eunicefix sharp
1621 if ./sharp; then
1622         : echo "Yup, it does."
1623 else
1624         echo "Hmm... '$startsh' does not guarantee sh startup..."
1625         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1626 fi
1627 rm -f sharp
1628
1629 : Save command line options in file UU/cmdline.opt for later use in
1630 : generating config.sh.
1631 cat > cmdline.opt <<EOSH
1632 : Configure command line arguments.
1633 config_arg0='$0'
1634 config_args='$*'
1635 config_argc=$#
1636 EOSH
1637 argn=1
1638 args_exp=''
1639 args_sep=''
1640 for arg in "$@"; do
1641         cat >>cmdline.opt <<EOSH
1642 config_arg$argn='$arg'
1643 EOSH
1644         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1645 $arg
1646 EOC
1647         arg_exp=`cat cmdl.opt`
1648         args_exp="$args_exp$args_sep'$arg_exp'"
1649         argn=`expr $argn + 1`
1650         args_sep=' '
1651 done
1652 rm -f cmdl.opt
1653
1654 : produce awk script to parse command line options
1655 cat >options.awk <<'EOF'
1656 BEGIN {
1657         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1658
1659         len = length(optstr);
1660         for (i = 1; i <= len; i++) {
1661                 c = substr(optstr, i, 1);
1662                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1663                 if (a == ":") {
1664                         arg[c] = 1;
1665                         i++;
1666                 }
1667                 opt[c] = 1;
1668         }
1669 }
1670 {
1671         expect = 0;
1672         str = $0;
1673         if (substr(str, 1, 1) != "-") {
1674                 printf("'%s'\n", str);
1675                 next;
1676         }
1677         len = length($0);
1678         for (i = 2; i <= len; i++) {
1679                 c = substr(str, i, 1);
1680                 if (!opt[c]) {
1681                         printf("-%s\n", substr(str, i));
1682                         next;
1683                 }
1684                 printf("-%s\n", c);
1685                 if (arg[c]) {
1686                         if (i < len)
1687                                 printf("'%s'\n", substr(str, i + 1));
1688                         else
1689                                 expect = 1;
1690                         next;
1691                 }
1692         }
1693 }
1694 END {
1695         if (expect)
1696                 print "?";
1697 }
1698 EOF
1699
1700 : process the command line options
1701 set X `for arg in "$@"; do echo "X$arg"; done |
1702         sed -e s/X// | awk -f options.awk`
1703 eval "set $*"
1704 shift
1705 rm -f options.awk
1706
1707 : set up default values
1708 fastread=''
1709 reuseval=false
1710 config_sh=''
1711 alldone=''
1712 error=''
1713 silent=''
1714 extractsh=''
1715 knowitall=''
1716 rm -f optdef.sh posthint.sh
1717 cat >optdef.sh <<EOS
1718 $startsh
1719 EOS
1720
1721
1722 : option parsing
1723 while test $# -gt 0; do
1724         case "$1" in
1725         -d) shift; fastread=yes;;
1726         -e) shift; alldone=cont;;
1727         -f)
1728                 shift
1729                 cd ..
1730                 if test -r "$1"; then
1731                         config_sh="$1"
1732                 else
1733                         echo "$me: cannot read config file $1." >&2
1734                         error=true
1735                 fi
1736                 cd UU
1737                 shift;;
1738         --help|\
1739         -h) shift; error=true;;
1740         -r) shift; reuseval=true;;
1741         -s) shift; silent=true; realsilent=true;;
1742         -E) shift; alldone=exit;;
1743         -K) shift; knowitall=true;;
1744         -O) shift;;
1745         -S) shift; silent=true; extractsh=true;;
1746         -D)
1747                 shift
1748                 case "$1" in
1749                 *=)
1750                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1751                         echo "$me: ignoring -D $1" >&2
1752                         ;;
1753                 *=*) echo "$1" | \
1754                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1755                 *) echo "$1='define'" >> optdef.sh;;
1756                 esac
1757                 shift
1758                 ;;
1759         -U)
1760                 shift
1761                 case "$1" in
1762                 *=) echo "$1" >> optdef.sh;;
1763                 *=*)
1764                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1765                         echo "$me: ignoring -U $1" >&2
1766                         ;;
1767                 *) echo "$1='undef'" >> optdef.sh;;
1768                 esac
1769                 shift
1770                 ;;
1771         -A)
1772             shift
1773             xxx=''
1774             yyy="$1"
1775             zzz=''
1776             uuu=undef
1777             case "$yyy" in
1778             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1779                  case "$zzz" in
1780                  *:*) zzz='' ;;
1781                  *)   xxx=append
1782                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1783                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1784                  esac
1785                  ;;
1786             esac
1787             case "$xxx" in
1788             '')  case "$yyy" in
1789                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1790                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1791                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1792                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1793                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1794                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1795                  esac
1796                  ;;
1797             esac
1798             case "$xxx" in
1799             append)
1800                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1801             clear)
1802                 echo "$yyy=''"                  >> posthint.sh ;;
1803             define)
1804                 case "$zzz" in
1805                 '') zzz=define ;;
1806                 esac
1807                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1808             eval)
1809                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1810             prepend)
1811                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1812             undef)
1813                 case "$zzz" in
1814                 '') zzz="$uuu" ;;
1815                 esac
1816                 echo "$yyy=$zzz"                >> posthint.sh ;;
1817             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1818             esac
1819             shift
1820             ;;
1821         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1822             exit 0;;
1823         --) break;;
1824         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1825         *) break;;
1826         esac
1827 done
1828
1829 case "$error" in
1830 true)
1831         cat >&2 <<EOM
1832 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1833                  [-U symbol] [-U symbol=] [-A command:symbol...]
1834   -d : use defaults for all answers.
1835   -e : go on without questioning past the production of config.sh.
1836   -f : specify an alternate default configuration file.
1837   -h : print this help message and exit (with an error status).
1838   -r : reuse C symbols value if possible (skips costly nm extraction).
1839   -s : silent mode, only echoes questions and essential information.
1840   -D : define symbol to have some value:
1841          -D symbol         symbol gets the value 'define'
1842          -D symbol=value   symbol gets the value 'value'
1843        common used examples (see INSTALL for more info):
1844          -Duse64bitint            use 64bit integers
1845          -Duse64bitall            use 64bit integers and pointers
1846          -Dusethreads             use thread support
1847          -Dinc_version_list=none  do not include older perl trees in @INC
1848          -DEBUGGING=none          DEBUGGING options
1849          -Dcc=gcc                 choose your compiler
1850          -Dprefix=/opt/perl5      choose your destination
1851   -E : stop at the end of questions, after having produced config.sh.
1852   -K : do not use unless you know what you are doing.
1853   -O : ignored for backward compatibility
1854   -S : perform variable substitutions on all .SH files (can mix with -f)
1855   -U : undefine symbol:
1856          -U symbol    symbol gets the value 'undef'
1857          -U symbol=   symbol gets completely empty
1858        e.g.:  -Uversiononly
1859   -A : manipulate symbol after the platform specific hints have been applied:
1860          -A append:symbol=value   append value to symbol
1861          -A symbol=value          like append:, but with a separating space
1862          -A define:symbol=value   define symbol to have value
1863          -A clear:symbol          define symbol to be ''
1864          -A define:symbol         define symbol to be 'define'
1865          -A eval:symbol=value     define symbol to be eval of value
1866          -A prepend:symbol=value  prepend value to symbol
1867          -A undef:symbol          define symbol to be 'undef'
1868          -A undef:symbol=         define symbol to be ''
1869        e.g.:  -A prepend:libswanted='cl pthread '
1870               -A ccflags=-DSOME_MACRO
1871   -V : print version number and exit (with a zero status).
1872 EOM
1873         exit 1
1874         ;;
1875 esac
1876
1877 : Sanity checks
1878 case "$fastread$alldone" in
1879 yescont|yesexit) ;;
1880 *)
1881         case "$extractsh" in
1882         true) ;;
1883         *)
1884                 if test ! -t 0; then
1885                         echo "Say 'sh Configure', not 'sh <Configure'"
1886                         exit 1
1887                 fi
1888                 ;;
1889         esac
1890         ;;
1891 esac
1892
1893 exec 4>&1
1894 case "$silent" in
1895 true) exec 1>/dev/null;;
1896 esac
1897
1898 : run the defines and the undefines, if any, but leave the file out there...
1899 touch optdef.sh
1900 grep '\\' optdef.sh >/dev/null 2>&1
1901 if test $? = 0; then
1902     echo "Configure does not support \\ in -D arguments"
1903     exit 1
1904 fi
1905 . ./optdef.sh
1906 : create the posthint manipulation script and leave the file out there...
1907 touch posthint.sh
1908
1909 : set package name
1910 package='perl5'
1911 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1912 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1913 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1914 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1915 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1916 esac
1917
1918 : Some greps do not return status, grrr.
1919 echo "grimblepritz" >grimble
1920 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1921         contains=contains
1922 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1923         contains=grep
1924 else
1925         contains=contains
1926 fi
1927 rm -f grimble
1928 : the following should work in any shell
1929 case "$contains" in
1930 contains*)
1931         echo " "
1932         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1933         cat >contains <<'EOSS'
1934 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1935 EOSS
1936 chmod +x contains
1937 esac
1938
1939 : Find the path to the source tree
1940 case "$src" in
1941 '') case "$0" in
1942     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1943          case "$src" in
1944          /*)    ;;
1945          .)     ;;
1946          *)     src=`cd ../$src && pwd` ;;
1947          esac
1948          ;;
1949     *)   src='.';;
1950     esac;;
1951 esac
1952 case "$src" in
1953 '')     src=/
1954         rsrc=/
1955         ;;
1956 /*)     rsrc="$src";;
1957 *)      rsrc="../$src";;
1958 esac
1959 if test -f $rsrc/Configure && \
1960         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1961 then
1962    : found it, so we are ok.
1963 else
1964         rsrc=''
1965         for src in . .. ../.. ../../.. ../../../..; do
1966                 if test -f ../$src/Configure && \
1967                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1968                 then
1969                         rsrc=../$src
1970                         break
1971                 fi
1972         done
1973 fi
1974 case "$rsrc" in
1975 '')
1976         cat <<EOM >&4
1977
1978 Sorry, I can't seem to locate the source dir for $package.  Please start
1979 Configure with an explicit path -- i.e. /some/path/Configure.
1980
1981 EOM
1982         exit 1
1983         ;;
1984 ../.)   rsrc='..';;
1985 *)
1986         echo " "
1987         echo "Sources for $package found in \"$src\"." >&4
1988         ;;
1989 esac
1990
1991 : script used to extract .SH files with variable substitutions
1992 cat >extract <<'EOS'
1993 PERL_CONFIG_SH=true
1994 echo "Doing variable substitutions on .SH files..."
1995 if test -f MANIFEST; then
1996         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1997 else
1998         echo "(Looking for .SH files under the source directory.)"
1999         set x `(cd "$src"; find . -name "*.SH" -print)`
2000 fi
2001 shift
2002 case $# in
2003 0) set x `(cd "$src"; echo *.SH)`; shift;;
2004 esac
2005 if test ! -f "$src/$1"; then
2006         shift
2007 fi
2008 mkdir_p='
2009 name=$1;
2010 create="";
2011 while test $name; do
2012         if test ! -d "$name"; then
2013                 create="$name $create";
2014                 name=`echo $name | sed -e "s|^[^/]*$||"`;
2015                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2016         else
2017                 name="";
2018         fi;
2019 done;
2020 for file in $create; do
2021         mkdir $file;
2022 done
2023 '
2024 for file in $*; do
2025         case "$src" in
2026         ".")
2027                 case "$file" in
2028                 */*)
2029                         dir=`expr X$file : 'X\(.*\)/'`
2030                         file=`expr X$file : 'X.*/\(.*\)'`
2031                         (cd "$dir" && . ./$file)
2032                         ;;
2033                 *)
2034                         . ./$file
2035                         ;;
2036                 esac
2037                 ;;
2038         *)
2039                 case "$file" in
2040                 */*)
2041                         dir=`expr X$file : 'X\(.*\)/'`
2042                         file=`expr X$file : 'X.*/\(.*\)'`
2043                         (set x $dir; shift; eval $mkdir_p)
2044                         sh <"$src/$dir/$file"
2045                         ;;
2046                 *)
2047                         sh <"$src/$file"
2048                         ;;
2049                 esac
2050                 ;;
2051         esac
2052 done
2053 if test -f "$src/config_h.SH"; then
2054         if test ! -f config.h; then
2055         : oops, they left it out of MANIFEST, probably, so do it anyway.
2056         . "$src/config_h.SH"
2057         fi
2058 fi
2059 EOS
2060
2061 : extract files and exit if asked to do so
2062 case "$extractsh" in
2063 true)
2064         case "$realsilent" in
2065         true) ;;
2066         *) exec 1>&4;;
2067         esac
2068         case "$config_sh" in
2069         '') config_sh='config.sh';;
2070         esac
2071         echo " "
2072         echo "Fetching answers from $config_sh..."
2073         cd ..
2074         . $config_sh
2075         . UU/optdef.sh
2076         echo " "
2077         . UU/extract
2078         rm -rf UU
2079         echo "Extraction done."
2080         exit 0
2081         ;;
2082 esac
2083
2084 : Eunice requires " " instead of "", can you believe it
2085 echo " "
2086 : Here we go...
2087 echo "Beginning of configuration questions for $package."
2088
2089 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2090
2091 : first determine how to suppress newline on echo command
2092 echo " "
2093 echo "Checking echo to see how to suppress newlines..."
2094 (echo "hi there\c" ; echo " ") >.echotmp
2095 if $contains c .echotmp >/dev/null 2>&1 ; then
2096         echo "...using -n."
2097         n='-n'
2098         c=''
2099 else
2100         cat <<'EOM'
2101 ...using \c
2102 EOM
2103         n=''
2104         c='\c'
2105 fi
2106 echo $n "The star should be here-->$c"
2107 echo '*'
2108 rm -f .echotmp
2109
2110 : Now test for existence of everything in MANIFEST
2111 echo " "
2112 if test -f "$rsrc/MANIFEST"; then
2113         echo "First let's make sure your kit is complete.  Checking..." >&4
2114         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2115                 (split -l 50 2>/dev/null || split -50)
2116         rm -f missing
2117         tmppwd=`pwd`
2118         for filelist in x??; do
2119                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2120                         >/dev/null 2>>"$tmppwd/missing")
2121         done
2122         if test -s missing; then
2123                 cat missing >&4
2124                 cat >&4 <<'EOM'
2125
2126 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2127
2128 You have the option of continuing the configuration process, despite the
2129 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2130 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2131 and contact the author (perlbug@perl.org).
2132
2133 EOM
2134                 echo $n "Continue? [n] $c" >&4
2135                 read ans
2136                 case "$ans" in
2137                 y*)
2138                         echo "Continuing..." >&4
2139                         rm -f missing
2140                         ;;
2141                 *)
2142                         echo "ABORTING..." >&4
2143                         kill $$
2144                         ;;
2145                 esac
2146         else
2147                 echo "Looks good..."
2148         fi
2149 else
2150         echo "There is no MANIFEST file.  I hope your kit is complete !"
2151 fi
2152 rm -f missing x??
2153
2154 : Find the appropriate value for a newline for tr
2155 if test -n "$DJGPP"; then
2156        trnl='\012'
2157 fi
2158 if test X"$trnl" = X; then
2159         case "`echo foo | tr '\n' x 2>/dev/null`" in
2160         foox) trnl='\n' ;;
2161         esac
2162 fi
2163 if test X"$trnl" = X; then
2164         case "`echo foo | tr '\012' x 2>/dev/null`" in
2165         foox) trnl='\012' ;;
2166         esac
2167 fi
2168 if test X"$trnl" = X; then
2169        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2170        fooxy) trnl='\n\r' ;;
2171        esac
2172 fi
2173 if test X"$trnl" = X; then
2174         cat <<EOM >&2
2175
2176 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2177
2178 EOM
2179         exit 1
2180 fi
2181
2182 : compute the number of columns on the terminal for proper question formatting
2183 case "$COLUMNS" in
2184 '') COLUMNS='80';;
2185 esac
2186
2187 : set up the echo used in my read
2188 myecho="case \"\$xxxm\" in
2189 '') echo $n \"\$rp $c\" >&4;;
2190 *) case \"\$rp\" in
2191         '') echo $n \"[\$xxxm] $c\";;
2192         *)
2193                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2194                         echo \"\$rp\" >&4
2195                         echo $n \"[\$xxxm] $c\" >&4
2196                 else
2197                         echo $n \"\$rp [\$xxxm] $c\" >&4
2198                 fi
2199                 ;;
2200         esac;;
2201 esac"
2202
2203 : now set up to do reads with possible shell escape and default assignment
2204 cat <<EOSC >myread
2205 $startsh
2206 xxxm=\$dflt
2207 $myecho
2208 ans='!'
2209 case "\$fastread" in
2210 yes) case "\$dflt" in
2211         '') ;;
2212         *) ans='';
2213                 case "\$silent-\$rp" in
2214                 true-) ;;
2215                 *) echo " " >&4;;
2216                 esac;;
2217         esac;;
2218 *) case "\$silent" in
2219         true) case "\$rp" in
2220                 '') ans='';;
2221                 esac;;
2222         esac;;
2223 esac
2224 while expr "X\$ans" : "X!" >/dev/null; do
2225         read answ
2226         set x \$xxxm
2227         shift
2228         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2229         case  "\$answ" in
2230         "!")
2231                 sh 1>&4
2232                 echo " "
2233                 $myecho
2234                 ;;
2235         !*)
2236                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2237                 shift
2238                 sh 1>&4 -c "\$*"
2239                 echo " "
2240                 $myecho
2241                 ;;
2242         "\$ans")
2243                 case "\$ans" in
2244                 \\&*)
2245                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2246                         shift
2247                         case "\$1" in
2248                         -d)
2249                                 fastread=yes
2250                                 echo "(OK, I'll run with -d after this question.)" >&4
2251                                 ;;
2252                         -*)
2253                                 echo "*** Sorry, \$1 not supported yet." >&4
2254                                 ;;
2255                         esac
2256                         $myecho
2257                         ans=!
2258                         ;;
2259                 esac;;
2260         *)
2261                 case "\$aok" in
2262                 y)
2263                         echo "*** Substitution done -- please confirm."
2264                         xxxm="\$ans"
2265                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2266                         xxxm="\$ans"
2267                         ans=!
2268                         ;;
2269                 *)
2270                         echo "*** Error -- try again."
2271                         ans=!
2272                         ;;
2273                 esac
2274                 $myecho
2275                 ;;
2276         esac
2277         case "\$ans\$xxxm\$nostick" in
2278         '')
2279                 ans=!
2280                 $myecho
2281                 ;;
2282         esac
2283 done
2284 case "\$ans" in
2285 '') ans="\$xxxm";;
2286 esac
2287 EOSC
2288
2289 : create .config dir to save info across Configure sessions
2290 test -d ../.config || mkdir ../.config
2291 cat >../.config/README <<EOF
2292 This directory created by Configure to save information that should
2293 persist across sessions for $package.
2294
2295 You may safely delete it if you wish.
2296 EOF
2297
2298 : See if we are using a devel version and want that
2299 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2300 case "$usedevel" in
2301 $define|true|[yY]*)
2302     usedevel="$define" ;;
2303 *) case "$xversion" in
2304    *[13579])
2305         cat >&4 <<EOH
2306 *** WHOA THERE!!! ***
2307
2308     This is an UNSTABLE DEVELOPMENT release.
2309     The version of this $package distribution is $xversion, that is, odd,
2310     (as opposed to even) and that signifies a development release.
2311     If you want a maintenance release, you want an even-numbered version.
2312
2313     Do ***NOT*** install this into production use.
2314     Data corruption and crashes are possible.
2315
2316     It is most seriously suggested that you do not continue any further
2317     unless you want to help in developing and debugging Perl.
2318
2319     If you *still* want to build perl, you can answer 'y' now,
2320     or pass -Dusedevel to Configure.
2321
2322 EOH
2323         rp='Do you really want to continue?'
2324         dflt='n'
2325         . ./myread
2326         case "$ans" in
2327         [yY]) echo >&4 "Okay, continuing."
2328               usedevel="$define" ;;
2329         *) echo >&4 "Okay, bye."
2330            exit 1
2331            ;;
2332         esac
2333         ;;
2334     esac
2335     usedevel="$undef"
2336     ;;
2337 esac
2338 case "$usedevel" in
2339 $define|true|[yY]*)
2340         case "$versiononly" in
2341         '') versiononly="$define" ;;
2342         esac
2343         case "$installusrbinperl" in
2344         '') installusrbinperl="$undef" ;;
2345         esac
2346         ;;
2347 esac
2348
2349 : general instructions
2350 needman=true
2351 firsttime=true
2352 user=`(logname) 2>/dev/null`
2353 case "$user" in
2354 '') user=`whoami 2>&1`;;
2355 esac
2356 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2357         firsttime=false
2358         echo " "
2359         rp='Would you like to see the instructions?'
2360         dflt=n
2361         . ./myread
2362         case "$ans" in
2363         [yY]*) ;;
2364         *) needman=false;;
2365         esac
2366 fi
2367 if $needman; then
2368         cat <<EOH
2369
2370 This installation shell script will examine your system and ask you questions
2371 to determine how the perl5 package should be installed. If you get
2372 stuck on a question, you may use a ! shell escape to start a subshell or
2373 execute a command.  Many of the questions will have default answers in square
2374 brackets; typing carriage return will give you the default.
2375
2376 On some of the questions which ask for file or directory names you are allowed
2377 to use the ~name construct to specify the login directory belonging to "name",
2378 even if you don't have a shell which knows about that.  Questions where this is
2379 allowed will be marked "(~name ok)".
2380
2381 EOH
2382         rp=''
2383         dflt='Type carriage return to continue'
2384         . ./myread
2385         cat <<'EOH'
2386
2387 The prompter used in this script allows you to use shell variables and
2388 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2389 in the default answer, as if the default line was a set of arguments given to a
2390 script shell.  This means you may also use $* to repeat the whole default line,
2391 so you do not have to re-type everything to add something to the default.
2392
2393 Every time there is a substitution, you will have to confirm.  If there is an
2394 error (e.g. an unmatched backtick), the default answer will remain unchanged
2395 and you will be prompted again.
2396
2397 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2398 the questions and use the computed defaults (or the previous answers if there
2399 was already a config.sh file). Type 'Configure -h' for a list of options.
2400 You may also start interactively and then answer '& -d' at any prompt to turn
2401 on the non-interactive behaviour for the remainder of the execution.
2402
2403 EOH
2404         . ./myread
2405         cat <<EOH
2406
2407 Much effort has been expended to ensure that this shell script will run on any
2408 Unix system.  If despite that it blows up on yours, your best bet is to edit
2409 Configure and run it again.  If you can't run Configure for some reason,
2410 you'll have to generate a config.sh file by hand.  Whatever problems you
2411 have, let me (perlbug@perl.org) know how I blew it.
2412
2413 This installation script affects things in two ways:
2414
2415 1) it may do direct variable substitutions on some of the files included
2416    in this kit.
2417 2) it builds a config.h file for inclusion in C programs.  You may edit
2418    any of these files as the need arises after running this script.
2419
2420 If you make a mistake on a question, there is no easy way to back up to it
2421 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2422 files.  Configure will offer to let you do this before it runs the SH files.
2423
2424 EOH
2425         dflt='Type carriage return to continue'
2426         . ./myread
2427         case "$firsttime" in
2428         true) echo $user >>../.config/instruct;;
2429         esac
2430 fi
2431
2432 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2433 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2434 if test "X$sysroot" = X; then
2435     sysroot=""
2436 else
2437     case "$cc" in
2438         *gcc*|*g++*)
2439             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2440             # _sysroot is used in places where we need --sysroot=foo
2441             # but using the rest of the flags could cause issues.
2442             _sysroot="--sysroot=$sysroot";
2443             case "$ccflags" in
2444                 *sysroot*) ;;
2445                 'undef'|*)
2446                 ccflags="$ccflags $_sysroot"
2447             esac
2448             case "$ldflags" in
2449                 *sysroot*) ;;
2450                 'undef'|*)
2451                 ldflags="$ldflags $_sysroot"
2452             esac
2453             case "$cppflags" in
2454                 *sysroot*) ;;
2455                 'undef'|*)
2456                 cppflags="$cppflags $_sysroot"
2457             esac
2458             # lddlflags updated below in lddlflags section;
2459             # same with cccdlflags
2460             ;;
2461     esac
2462
2463     # Adjust some defaults to also use $sysroot
2464     for var in xlibpth loclibpth locincpth glibpth; do
2465         eval xxx=\$$var
2466         eval $var=''
2467         for path in $xxx; do
2468             eval $var=\"\$$var $sysroot$path\"
2469         done
2470     done
2471
2472 fi
2473
2474 : find out where common programs are
2475 echo " "
2476 echo "Locating common programs..." >&4
2477 cat <<EOSC >loc
2478 $startsh
2479 case \$# in
2480 0) exit 1;;
2481 esac
2482 thing=\$1
2483 shift
2484 dflt=\$1
2485 shift
2486 for dir in \$*; do
2487         case "\$thing" in
2488         .)
2489         if test -d \$dir/\$thing; then
2490                 echo \$dir
2491                 exit 0
2492         fi
2493         ;;
2494         *)
2495         for thisthing in \$dir/\$thing; do
2496                 : just loop through to pick last item
2497         done
2498         if test -f \$thisthing; then
2499                 echo \$thisthing
2500                 exit 0
2501         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2502                 echo \$thisthing
2503                 exit 0
2504         elif test -f \$dir/\$thing.exe; then
2505                 if test -n "$DJGPP"; then
2506                         echo \$dir/\$thing.exe
2507                 elif test "$eunicefix" != ":"; then
2508                         : on Eunice apparently
2509                         echo \$dir/\$thing
2510                 fi
2511                 exit 0
2512         fi
2513         ;;
2514         esac
2515 done
2516 echo \$dflt
2517 exit 1
2518 EOSC
2519 chmod +x loc
2520 $eunicefix loc
2521 loclist="
2522 awk
2523 cat
2524 chmod
2525 comm
2526 cp
2527 echo
2528 expr
2529 grep
2530 ls
2531 mkdir
2532 rm
2533 sed
2534 sort
2535 touch
2536 tr
2537 uniq
2538 "
2539 trylist="
2540 ar
2541 bison
2542 byacc
2543 cpp
2544 csh
2545 date
2546 egrep
2547 gmake
2548 gzip
2549 less
2550 ln
2551 make
2552 more
2553 nm
2554 nroff
2555 perl
2556 pg
2557 test
2558 uname
2559 zip
2560 "
2561 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2562 pth="$pth $sysroot/lib $sysroot/usr/lib"
2563 for file in $loclist; do
2564         eval xxx=\$$file
2565         case "$xxx" in
2566         /*|?:[\\/]*)
2567                 if test -f "$xxx"; then
2568                         : ok
2569                 else
2570                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2571                         xxx=`./loc $file $file $pth`
2572                 fi
2573                 ;;
2574         '') xxx=`./loc $file $file $pth`;;
2575         *) xxx=`./loc $xxx $xxx $pth`;;
2576         esac
2577         eval $file=$xxx$_exe
2578         eval _$file=$xxx
2579         case "$xxx" in
2580         /*)
2581                 echo $file is in $xxx.
2582                 ;;
2583         ?:[\\/]*)
2584                 echo $file is in $xxx.
2585                 ;;
2586         *)
2587                 echo "I don't know where '$file' is, and my life depends on it." >&4
2588                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2589                 exit 1
2590                 ;;
2591         esac
2592 done
2593 echo " "
2594 echo "Don't worry if any of the following aren't found..."
2595 say=offhand
2596 for file in $trylist; do
2597         eval xxx=\$$file
2598         case "$xxx" in
2599         /*|?:[\\/]*)
2600                 if test -f "$xxx"; then
2601                         : ok
2602                 else
2603                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2604                         xxx=`./loc $file $file $pth`
2605                 fi
2606                 ;;
2607         '') xxx=`./loc $file $file $pth`;;
2608         *) xxx=`./loc $xxx $xxx $pth`;;
2609         esac
2610         eval $file=$xxx$_exe
2611         eval _$file=$xxx
2612         case "$xxx" in
2613         /*)
2614                 echo $file is in $xxx.
2615                 ;;
2616         ?:[\\/]*)
2617                 echo $file is in $xxx.
2618                 ;;
2619         *)
2620                 echo "I don't see $file out there, $say."
2621                 say=either
2622                 ;;
2623         esac
2624 done
2625 case "$egrep" in
2626 egrep)
2627         echo "Substituting grep for egrep."
2628         egrep=$grep
2629         _egrep=$grep
2630         ;;
2631 esac
2632 case "$less" in
2633 '')     ;;
2634 *)      if $less -R </dev/null >/dev/null 2>&1; then
2635                echo "Substituting less -R for less."
2636                less="$less -R"
2637                _less=$less
2638         fi
2639         ;;
2640 esac
2641 case "$ln" in
2642 ln)
2643         echo "Substituting cp for ln."
2644         ln=$cp
2645         _ln=$cp
2646         ;;
2647 esac
2648 case "$make" in
2649 make)
2650         case "$gmake" in
2651         gmake)
2652         echo "I can't find make or gmake, and my life depends on it." >&4
2653         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2654         exit 1
2655         ;;
2656         esac
2657         ;;
2658 esac
2659 case "$gmake" in
2660 gmake)  ;;
2661 *)      # We can't have osname yet.
2662         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2663                 # Assume that gmake, if found, is definitely GNU make
2664                 # and prefer it over the system make.
2665                 echo "Substituting gmake for make."
2666                 make=$gmake
2667                 _make=$gmake
2668         fi
2669         ;;
2670 esac
2671 case "$test" in
2672 test)
2673         echo "Hopefully test is built into your sh."
2674         ;;
2675 *)
2676         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2677                 echo "Using the test built into your sh."
2678                 test=test
2679                 _test=test
2680         fi
2681         ;;
2682 esac
2683 case "$echo" in
2684 echo)
2685         echo "Hopefully echo is built into your sh."
2686         ;;
2687 '') ;;
2688 *)
2689         echo " "
2690 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2691         $echo $n "hi there$c" >foo1
2692         echo $n "hi there$c" >foo2
2693         if cmp foo1 foo2 >/dev/null 2>&1; then
2694                 echo "They are compatible.  In fact, they may be identical."
2695         else
2696                 case "$n" in
2697                 '-n') n='' c='\c';;
2698                 *) n='-n' c='';;
2699                 esac
2700                 cat <<FOO
2701 They are not compatible!  You are probably running ksh on a non-USG system.
2702 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2703 have echo built in and we may have to run some Bourne shell scripts.  That
2704 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2705
2706 FOO
2707                 $echo $n "The star should be here-->$c"
2708                 $echo "*"
2709         fi
2710         $rm -f foo1 foo2
2711         ;;
2712 esac
2713
2714 # This question was auctioned at YAPC::Europe-2007 in Vienna
2715 # I never promised you could answer it. I only auctioned the question.
2716 cat <<FOO
2717 The following message is sponsored by
2718
2719   Dresden.pm<--The stars should be here.
2720
2721 Dear Perl user, system administrator or package
2722 maintainer, the Perl community sends greetings to
2723 you. Do you (emblematical) greet back [Y/n]? n
2724
2725 FOO
2726
2727 : Check what type of C compiler we use
2728 cat <<EOS >trygcc
2729 $startsh
2730 EOS
2731 cat <<'EOSC' >>trygcc
2732 case "$cc" in
2733 '') ;;
2734 *)  $rm -f try try.*
2735     $cat >try.c <<EOM
2736 int main(int argc, char *argv[]) {
2737   return 0;
2738 }
2739 EOM
2740     if $cc -o try $ccflags $ldflags try.c; then
2741        :
2742     else
2743         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2744         despair=yes
2745         trygcc=yes
2746         case "$cc" in
2747         *gcc*) trygcc=no ;;
2748         esac
2749         # Skip this test because it gives a false match on output like:
2750         #    ./trygcc: line 23: cc: command not found
2751         # case "`$cc -v -c try.c 2>&1`" in
2752         # *gcc*) trygcc=no ;;
2753         # esac
2754         if $test X"$trygcc" = Xyes; then
2755             if gcc -o try -c try.c; then
2756                 echo " "
2757                 echo "You seem to have a working gcc, though." >&4
2758                 # Switching compilers may undo the work of hints files.
2759                 # The most common problem is -D_REENTRANT for threads.
2760                 # This heuristic catches that case, but gets false positives
2761                 # if -Dusethreads was not actually specified.  Better to
2762                 # bail out here with a useful message than fail
2763                 # mysteriously later. Should we perhaps just try to
2764                 # re-invoke Configure -Dcc=gcc config_args ?
2765                 if $test -f usethreads.cbu; then
2766                         $cat >&4 <<EOM
2767
2768 *** However, any setting of the C compiler flags (e.g. for thread support)
2769 *** will be lost.  It may be necessary for you to restart Configure and
2770 *** add -Dcc=gcc to your Configure command line.
2771
2772 EOM
2773                         rp="Would you like to go ahead and try gcc anyway?"
2774                         dflt=n
2775                 else
2776                         rp="Would you like to use it?"
2777                         dflt=y
2778                 fi
2779                 if $test -f myread; then
2780                     . ./myread
2781                 else
2782                     if $test -f UU/myread; then
2783                         . ./UU/myread
2784                     else
2785                         echo "Cannot find myread, sorry.  Aborting." >&2
2786                         exit 1
2787                     fi
2788                 fi
2789                 case "$ans" in
2790                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2791                 esac
2792             fi
2793         fi
2794     fi
2795     $rm -f try try.*
2796     ;;
2797 esac
2798 EOSC
2799
2800 cat <<EOS >checkcc
2801 $startsh
2802 EOS
2803 cat <<'EOSC' >>checkcc
2804 case "$cc" in
2805 '') ;;
2806 *)  $rm -f try try.*
2807     $cat >try.c <<EOM
2808 int main(int argc, char *argv[]) {
2809   return 0;
2810 }
2811 EOM
2812     if $cc -o try $ccflags $ldflags try.c; then
2813        :
2814     else
2815         if $test X"$despair" = Xyes; then
2816            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2817         fi
2818         $cat >&4 <<EOM
2819 You need to find a working C compiler.
2820 Either (purchase and) install the C compiler supplied by your OS vendor,
2821 or for a free C compiler try http://gcc.gnu.org/
2822 I cannot continue any further, aborting.
2823 EOM
2824         exit 1
2825     fi
2826     $rm -f try try.*
2827     ;;
2828 esac
2829 EOSC
2830
2831 : determine whether symbolic links are supported
2832 echo " "
2833 $touch blurfl
2834 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2835         echo "Symbolic links are supported." >&4
2836         lns="$ln -s"
2837 else
2838         echo "Symbolic links are NOT supported." >&4
2839         lns="$ln"
2840 fi
2841 $rm -f blurfl sym
2842
2843 : determine whether symbolic links are supported
2844 echo " "
2845 case "$lns" in
2846 *"ln"*" -s")
2847         echo "Checking how to test for symbolic links..." >&4
2848         $lns blurfl sym
2849         if $test "X$issymlink" = X; then
2850                 case "$newsh" in
2851                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2852                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2853                 esac
2854                 if test $? = 0; then
2855                         issymlink="test -h"
2856                 else
2857                         echo "Your builtin 'test -h' may be broken." >&4
2858                         case "$test" in
2859                         /*)     ;;
2860                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2861                                 for p in $pth
2862                                 do
2863                                         if test -f "$p/$test"; then
2864                                                 test="$p/$test"
2865                                                 break
2866                                         fi
2867                                 done
2868                                 ;;
2869                         esac
2870                         case "$test" in
2871                         /*)
2872                                 echo "Trying external '$test -h'." >&4
2873                                 issymlink="$test -h"
2874                                 if $test ! -h sym >/dev/null 2>&1; then
2875                                         echo "External '$test -h' is broken, too." >&4
2876                                         issymlink=''
2877                                 fi
2878                                 ;;
2879                         *)      issymlink='' ;;
2880                         esac
2881                 fi
2882         fi
2883         if $test "X$issymlink" = X; then
2884                 if $test -L sym 2>/dev/null; then
2885                         issymlink="$test -L"
2886                         echo "The builtin '$test -L' worked." >&4
2887                 fi
2888         fi
2889         if $test "X$issymlink" != X; then
2890                 echo "You can test for symbolic links with '$issymlink'." >&4
2891         else
2892                 echo "I do not know how you can test for symbolic links." >&4
2893         fi
2894         $rm -f blurfl sym
2895         ;;
2896 *)      echo "No symbolic links, so not testing for their testing..." >&4
2897         ;;
2898 esac
2899 echo " "
2900
2901 : Make symlinks util
2902 case "$mksymlinks" in
2903 $define|true|[yY]*)
2904         case "$src" in
2905         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2906                 exit 1
2907                 ;;
2908         *)      case "$lns:$issymlink" in
2909                 *"ln"*" -s:"*"test -"?)
2910                         echo "Creating the symbolic links..." >&4
2911                         cd ..
2912                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2913                         awk 'NF == 1 {
2914                                 dir=".";
2915                                 file=$1 "";
2916                              }
2917                              NF == 2 {
2918                                 dir=$1 "";
2919                                 file=$2 "";
2920                              }
2921                              {
2922                                  print "# dir = ", dir, "file = ", file
2923                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2924                              } END {
2925                                  for (d in mf) {
2926                                      if (d != ".") { print("mkdir -p "d) }
2927                                      print("ln -sf "mf[d]" "d);
2928                                  }
2929                              }' source="$src" > UU/mksymlinks.$$
2930                         sh UU/mksymlinks.$$
2931                         rm UU/mksymlinks.$$
2932                         # Sanity check 1.
2933                         if test ! -d t/base; then
2934                                 echo "Failed to create the subdirectories.  Aborting." >&4
2935                                 exit 1
2936                         fi
2937                         # Sanity check 2.
2938                         if test ! -f t/base/lex.t; then
2939                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2940                                 exit 1
2941                         fi
2942                         if test ! -f win32/win32.c; then
2943                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2944                                 exit 1
2945                         fi
2946                         cd UU
2947                         ;;
2948                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2949                         ;;
2950                 esac
2951                 ;;
2952         esac
2953         ;;
2954 esac
2955
2956 : Check for Cross-Compilation
2957 if $test "X$targethost" = "X"; then
2958     targethost=""
2959 fi
2960 if $test "X$targetenv" = "X"; then
2961     targetenv=""
2962 fi
2963 case "$usecrosscompile" in
2964 $define|true|[yY]*)
2965         $echo "Cross-compiling..."
2966         croak=''
2967         case "$cc" in
2968         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2969             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2970             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2971             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2972             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2973             # leave out ld, choosing it is more complex
2974             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2975             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2976             # We are in a weird spot. Just before us, some values
2977             # were 'saved', to be restored after the hints are
2978             # run.  This means that the changes we made to ar,
2979             # nm and ranlib will get reverted.
2980             # To avoid that, we hijack the saving mechanism and
2981             # have it save our new values.
2982             for file in ar nm ranlib; do
2983                 eval xxx=\$$file
2984                 eval $file=$xxx$_exe
2985                 eval _$file=$xxx
2986             done
2987         ;;
2988         esac
2989         case "$targetarch" in
2990         '') echo "Targetarch not defined." >&4; croak=y ;;
2991         *)  echo "Using targetarch $targetarch." >&4 ;;
2992         esac
2993         case "$targethost" in
2994         '') echo "Targethost not defined." >&4; croak=n ;;
2995         *)  echo "Using targethost $targethost." >&4
2996         esac
2997         locincpth=' '
2998         loclibpth=' '
2999         case "$croak" in
3000         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
3001         esac
3002     : compile a host miniperl and generate_uudmap, unless we got passed them
3003     if $test "X$hostperl" = X; then
3004       echo "Building host miniperl and generate_uudmap binaries" >&4
3005       before_host=`pwd`
3006       cd ..
3007       cd $src
3008       src=`pwd`
3009       rm -rf $src/host
3010       mkdir $src/host
3011       cd $src/host
3012       $src/Configure -des -Dusedevel -Dmksymlinks
3013       $make miniperl
3014       case "$hostgenerate" in
3015       '') $make generate_uudmap
3016           hostgenerate=$src/host/generate_uudmap
3017           ;;
3018        "$undef") hostgenerate=''
3019           ;;
3020       esac
3021       hostperl=$src/host/miniperl
3022       cd $before_host
3023     fi
3024     hostosname=`$hostperl -le 'print $^O'`
3025     ;;
3026 *)
3027     usecrosscompile="$undef"
3028     ;;
3029 esac
3030
3031 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3032 case "$targethost" in
3033     '') echo "Checking for cross-compile" >&4
3034     case "$usecrosscompile$multiarch" in
3035        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3036          if [ -f Makefile ]; then
3037            echo " "
3038            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3039          else
3040            echo "Configure done."
3041          fi
3042        exit 0
3043        ;;
3044      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3045         run=''
3046         to=:
3047         from=:
3048         ;;
3049     esac
3050     ;;
3051     *) echo "Using targethost $targethost." >&4
3052         case "$src" in
3053         /*) run=$src/Cross/run
3054             targetmkdir=$src/Cross/mkdir
3055             to=$src/Cross/to
3056             from=$src/Cross/from
3057             ;;
3058         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3059             run=$pwd/Cross/run
3060             targetmkdir=$pwd/Cross/mkdir
3061             to=$pwd/Cross/to
3062             from=$pwd/Cross/from
3063             ;;
3064         esac
3065         case "$targetrun" in
3066         '') targetrun=ssh ;;
3067         esac
3068         case "$targetto" in
3069         '') targetto=scp ;;
3070         esac
3071         case "$targetfrom" in
3072         '') targetfrom=scp ;;
3073         esac
3074         run=$run-$targetrun
3075         to=$to-$targetto
3076         from=$from-$targetfrom
3077         case "$targetdir" in
3078         '')  targetdir=/tmp
3079              echo "Guessing targetdir $targetdir." >&4
3080              ;;
3081         esac
3082         case "$targetuser" in
3083         '')  targetuser=root
3084              echo "Guessing targetuser $targetuser." >&4
3085              ;;
3086         esac
3087         case "$targetport" in
3088         '')  targetport=22
3089              echo "Guessing targetport $targetport." >&4
3090              ;;
3091         esac
3092         case "$targetfrom" in
3093         scp)    q=-q ;;
3094         *)      q='' ;;
3095         esac
3096         case "$targetrun" in
3097         ssh|rsh)
3098             cat >$run <<EOF
3099 #!/bin/sh
3100 env=''
3101 case "\$1" in
3102 -cwd)
3103   shift
3104   cwd=\$1
3105   shift
3106   ;;
3107 esac
3108 case "\$1" in
3109 -env)
3110   shift
3111   env=\$1
3112   shift
3113   ;;
3114 esac
3115 case "\$cwd" in
3116 '') cwd=$targetdir ;;
3117 esac
3118 exe=\$1
3119 shift
3120 $to \$exe
3121 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3122 EOF
3123             ;;
3124         adb)
3125             $touch $run
3126             ;;
3127         *)  echo "Unknown targetrun '$targetrun'" >&4
3128             exit 1
3129             ;;
3130         esac
3131         case "$targetmkdir" in
3132         */Cross/mkdir)
3133             cat >$targetmkdir <<EOF
3134 #!/bin/sh
3135 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3136 EOF
3137             $chmod a+rx $targetmkdir
3138             ;;
3139         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3140             exit 1
3141             ;;
3142         esac
3143         case "$targetto" in
3144         scp|rcp)
3145             cat >$to <<EOF
3146 #!/bin/sh
3147 for f in \$@
3148 do
3149   case "\$f" in
3150   /*)
3151     $targetmkdir \`dirname \$f\`
3152     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3153     ;;
3154   *)
3155     $targetmkdir $targetdir/\`dirname \$f\`
3156     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3157     ;;
3158   esac
3159 done
3160 exit 0
3161 EOF
3162             ;;
3163         cp) cat >$to <<EOF
3164 #!/bin/sh
3165 for f in \$@
3166 do
3167   case "\$f" in
3168   /*)
3169     $mkdir -p $targetdir/\`dirname \$f\`
3170     $cp \$f $targetdir/\$f || exit 1
3171     ;;
3172   *)
3173     $targetmkdir $targetdir/\`dirname \$f\`
3174     $cp \$f $targetdir/\$f || exit 1
3175     ;;
3176   esac
3177 done
3178 exit 0
3179 EOF
3180             ;;
3181         *)  echo "Unknown targetto '$targetto'" >&4
3182             exit 1
3183             ;;
3184         esac
3185         case "$targetfrom" in
3186         scp|rcp)
3187           cat >$from <<EOF
3188 #!/bin/sh
3189 for f in \$@
3190 do
3191   $rm -f \$f
3192   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3193 done
3194 exit 0
3195 EOF
3196             ;;
3197         cp) cat >$from <<EOF
3198 #!/bin/sh
3199 for f in \$@
3200 do
3201   $rm -f \$f
3202   cp $targetdir/\$f . || exit 1
3203 done
3204 exit 0
3205 EOF
3206             ;;
3207         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3208             exit 1
3209             ;;
3210         esac
3211         if $test ! -f $run; then
3212             echo "Target 'run' script '$run' not found." >&4
3213         else
3214             $chmod a+rx $run
3215         fi
3216         if $test ! -f $to; then
3217             echo "Target 'to' script '$to' not found." >&4
3218         else
3219             $chmod a+rx $to
3220         fi
3221         if $test ! -f $from; then
3222             echo "Target 'from' script '$from' not found." >&4
3223         else
3224             $chmod a+rx $from
3225         fi
3226         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3227             exit 1
3228         fi
3229         cat >&4 <<EOF
3230 Using '$run' for remote execution,
3231 and '$from' and '$to'
3232 for remote file transfer.
3233 EOF
3234         ;;
3235 *)      run=''
3236         to=:
3237         from=:
3238         usecrosscompile="$undef"
3239         targetarch=''
3240         ;;
3241 esac
3242
3243 : see whether [:lower:] and [:upper:] are supported character classes
3244 echo " "
3245 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3246 ABYZ-abyz)
3247         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3248         up='[:upper:]'
3249         low='[:lower:]'
3250         ;;
3251 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3252         # (0xd9 and 0xe2), therefore that is a nice testing point.
3253         if test "X$up" = X -o "X$low" = X; then
3254             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3255             rs) up='[A-Z]'
3256                 low='[a-z]'
3257                 ;;
3258             esac
3259         fi
3260         if test "X$up" = X -o "X$low" = X; then
3261             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3262             rs) up='A-Z'
3263                 low='a-z'
3264                 ;;
3265             esac
3266         fi
3267         if test "X$up" = X -o "X$low" = X; then
3268             case "`echo RS | od -x 2>/dev/null`" in
3269             *D9E2*|*d9e2*)
3270                 echo "Hey, this might be EBCDIC." >&4
3271                 if test "X$up" = X -o "X$low" = X; then
3272                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3273                     rs) up='[A-IJ-RS-Z]'
3274                         low='[a-ij-rs-z]'
3275                         ;;
3276                     esac
3277                 fi
3278                 if test "X$up" = X -o "X$low" = X; then
3279                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3280                     rs) up='A-IJ-RS-Z'
3281                         low='a-ij-rs-z'
3282                         ;;
3283                     esac
3284                 fi
3285                 ;;
3286             esac
3287         fi
3288 esac
3289 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3290 rs)
3291     echo "Using $up and $low to convert case." >&4
3292     ;;
3293 *)
3294     echo "I don't know how to translate letters from upper to lower case." >&4
3295     echo "Your tr is not acting any way I know of." >&4
3296     exit 1
3297     ;;
3298 esac
3299 : set up the translation script tr, must be called with ./tr of course
3300 cat >tr <<EOSC
3301 $startsh
3302 case "\$1\$2" in
3303 '[A-Z][a-z]') exec $tr '$up' '$low';;
3304 '[a-z][A-Z]') exec $tr '$low' '$up';;
3305 esac
3306 exec $tr "\$@"
3307 EOSC
3308 chmod +x tr
3309 $eunicefix tr
3310
3311 : Try to determine whether config.sh was made on this system
3312 case "$config_sh" in
3313 '')
3314 myuname=`$uname -a 2>/dev/null`
3315 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3316 # Downcase everything to avoid ambiguity.
3317 # Remove slashes and single quotes so we can use parts of this in
3318 # directory and file names.
3319 # Remove newlines so myuname is sane to use elsewhere.
3320 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3321 # because the A-Z/a-z are not consecutive.
3322 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3323         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3324 newmyuname="$myuname"
3325 dflt=n
3326 case "$knowitall" in
3327 '')
3328         if test -f ../config.sh; then
3329                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3330                         eval "`grep myuname= ../config.sh`"
3331                 fi
3332                 if test "X$myuname" = "X$newmyuname"; then
3333                         dflt=y
3334                 fi
3335         fi
3336         ;;
3337 *) dflt=y;;
3338 esac
3339
3340 : Get old answers from old config file if Configure was run on the
3341 : same system, otherwise use the hints.
3342 hint=default
3343 cd ..
3344 if test -f config.sh; then
3345         echo " "
3346         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3347         . UU/myread
3348         case "$ans" in
3349         n*|N*) echo "OK, I'll ignore it."
3350                 mv config.sh config.sh.old
3351                 myuname="$newmyuname"
3352                 ;;
3353         *)  echo "Fetching default answers from your old config.sh file..." >&4
3354                 tmp_n="$n"
3355                 tmp_c="$c"
3356                 tmp_sh="$sh"
3357                 . ./config.sh
3358                 cp config.sh UU
3359                 n="$tmp_n"
3360                 c="$tmp_c"
3361                 : Older versions did not always set $sh.  Catch re-use of such
3362                 : an old config.sh.
3363                 case "$sh" in
3364                 '') sh="$tmp_sh" ;;
3365                 esac
3366                 hint=previous
3367                 ;;
3368         esac
3369 fi
3370 . ./UU/checkcc
3371 if test ! -f config.sh; then
3372         $cat <<EOM
3373
3374 First time through, eh?  I have some defaults handy for some systems
3375 that need some extra help getting the Configure answers right:
3376
3377 EOM
3378         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3379         dflt=''
3380         : Half the following guesses are probably wrong... If you have better
3381         : tests or hints, please send them to perlbug@perl.org
3382         : The metaconfig authors would also appreciate a copy...
3383         $test -f /irix && osname=irix
3384         $test -f /xenix && osname=sco_xenix
3385         $test -f /dynix && osname=dynix
3386         $test -f /dnix && osname=dnix
3387         $test -f /lynx.os && osname=lynxos
3388         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3389         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3390         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3391         $test -f /bin/mips && /bin/mips && osname=mips
3392         $test -d /usr/apollo/bin && osname=apollo
3393         $test -f /etc/saf/_sactab && osname=svr4
3394         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3395         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3396         $test -f /sys/utilities/MultiView && osname=amigaos
3397         if $test -d /MachTen -o -d /MachTen_Folder; then
3398                 osname=machten
3399                 if $test -x /sbin/version; then
3400                         osvers=`/sbin/version | $awk '{print $2}' |
3401                         $sed -e 's/[A-Za-z]$//'`
3402                 elif $test -x /usr/etc/version; then
3403                         osvers=`/usr/etc/version | $awk '{print $2}' |
3404                         $sed -e 's/[A-Za-z]$//'`
3405                 else
3406                         osvers="$2.$3"
3407                 fi
3408         fi
3409
3410         $test -f /sys/posix.dll &&
3411                 $test -f /usr/bin/what &&
3412                 set X `/usr/bin/what /sys/posix.dll` &&
3413                 $test "$3" = UWIN &&
3414                 osname=uwin &&
3415                 osvers="$5"
3416
3417         if $test -f $uname; then
3418                 set X $myuname
3419                 shift
3420
3421                 case "$5" in
3422                 fps*) osname=fps ;;
3423                 mips*)
3424                         case "$4" in
3425                         umips) osname=umips ;;
3426                         *) osname=mips ;;
3427                         esac;;
3428                 [23]100) osname=mips ;;
3429                 i386*)
3430                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3431                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3432                                 osname='sco'
3433                                 osvers=$tmp
3434                         elif $test -f /etc/kconfig; then
3435                                 osname=isc
3436                                 if test "$lns" = "$ln -s"; then
3437                                         osvers=4
3438                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3439                                         osvers=3
3440                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3441                                         osvers=2
3442                                 fi
3443                         fi
3444                         tmp=''
3445                         ;;
3446                 pc*)
3447                         if test -n "$DJGPP"; then
3448                                 osname=dos
3449                                 osvers=djgpp
3450                         fi
3451                         ;;
3452                 esac
3453
3454                 case "$1" in
3455                 aix) osname=aix
3456                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3457                         case "$tmp" in
3458                         # oslevel can fail with:
3459                         # oslevel: Unable to acquire lock.
3460                         *not\ found) osvers="$4"."$3" ;;
3461                         '<3240'|'<>3240') osvers=3.2.0 ;;
3462                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3463                         '=3250'|'>3250') osvers=3.2.5 ;;
3464                         *) osvers=$tmp;;
3465                         esac
3466                         ;;
3467                 bitrig) osname=bitrig
3468                         osvers="$3"
3469                         ;;
3470                 bsd386) osname=bsd386
3471                         osvers=`$uname -r`
3472                         ;;
3473                 cygwin*) osname=cygwin
3474                         osvers="$3"
3475                         ;;
3476                 *dc.osx) osname=dcosx
3477                         osvers="$3"
3478                         ;;
3479                 dnix) osname=dnix
3480                         osvers="$3"
3481                         ;;
3482                 domainos) osname=apollo
3483                         osvers="$3"
3484                         ;;
3485                 dgux)   osname=dgux
3486                         osvers="$3"
3487                         ;;
3488                 dragonfly) osname=dragonfly
3489                         osvers="$3"
3490                         ;;
3491                 dynixptx*) osname=dynixptx
3492                         osvers=`echo "$4"|sed 's/^v//'`
3493                         ;;
3494                 freebsd) osname=freebsd
3495                         osvers="$3" ;;
3496                 genix)  osname=genix ;;
3497                 gnu)    osname=gnu
3498                         osvers="$3" ;;
3499                 hp*)    osname=hpux
3500                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3501                         ;;
3502                 irix*)  osname=irix
3503                         case "$3" in
3504                         4*) osvers=4 ;;
3505                         5*) osvers=5 ;;
3506                         *)      osvers="$3" ;;
3507                         esac
3508                         ;;
3509                 linux)  osname=linux
3510                         case "$3" in
3511                         *)      osvers="$3" ;;
3512                         esac
3513                         $test -f /system/lib/libandroid.so && osname=linux-android
3514                         ;;
3515                 MiNT)   osname=mint
3516                         ;;
3517                 netbsd*) osname=netbsd
3518                         osvers="$3"
3519                         ;;
3520                 news-os) osvers="$3"
3521                         case "$3" in
3522                         4*) osname=newsos4 ;;
3523                         *) osname=newsos ;;
3524                         esac
3525                         ;;
3526                 nonstop-ux) osname=nonstopux ;;
3527                 openbsd) osname=openbsd
3528                         osvers="$3"
3529                         ;;
3530                 os2)    osname=os2
3531                         osvers="$4"
3532                         ;;
3533                 POSIX-BC | posix-bc ) osname=posix-bc
3534                         osvers="$3"
3535                         ;;
3536                 powerux | power_ux | powermax_os | powermaxos | \
3537                 powerunix | power_unix) osname=powerux
3538                         osvers="$3"
3539                         ;;
3540                 qnx) osname=qnx
3541                         osvers="$4"
3542                         ;;
3543                 solaris) osname=solaris
3544                         case "$3" in
3545                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3546                         *)      osvers="$3" ;;
3547                         esac
3548                         ;;
3549                 sunos) osname=sunos
3550                         case "$3" in
3551                         5*) osname=solaris
3552                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3553                         *)      osvers="$3" ;;
3554                         esac
3555                         ;;
3556                 titanos) osname=titanos
3557                         case "$3" in
3558                         1*) osvers=1 ;;
3559                         2*) osvers=2 ;;
3560                         3*) osvers=3 ;;
3561                         4*) osvers=4 ;;
3562                         *)      osvers="$3" ;;
3563                         esac
3564                         ;;
3565                 ultrix) osname=ultrix
3566                         osvers="$3"
3567                         ;;
3568                 osf1|mls+)      case "$5" in
3569                                 alpha)
3570                                         osname=dec_osf
3571                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3572                                         case "$osvers" in
3573                                         [1-9].[0-9]*) ;;
3574                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3575                                         esac
3576                                         ;;
3577                         hp*)    osname=hp_osf1  ;;
3578                         mips)   osname=mips_osf1 ;;
3579                         esac
3580                         ;;
3581                 # UnixWare 7.1.2 is known as Open UNIX 8
3582                 openunix|unixware) osname=svr5
3583                         osvers="$4"
3584                         ;;
3585                 uts)    osname=uts
3586                         osvers="$3"
3587                         ;;
3588                 vos) osvers="$3"
3589                         ;;
3590                 $2) case "$osname" in
3591                         *isc*) ;;
3592                         *freebsd*) ;;
3593                         svr*)
3594                                 : svr4.x or possibly later
3595                                 case "svr$3" in
3596                                 ${osname}*)
3597                                         osname=svr$3
3598                                         osvers=$4
3599                                         ;;
3600                                 esac
3601                                 case "$osname" in
3602                                 svr4.0)
3603                                         : Check for ESIX
3604                                         if test -f /stand/boot ; then
3605                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3606                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3607                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3608                                                         if test -n "$isesix"; then
3609                                                                 osname=esix4
3610                                                         fi
3611                                                 fi
3612                                         fi
3613                                         ;;
3614                                 esac
3615                                 ;;
3616                         *)      if test -f /etc/systemid; then
3617                                         osname=sco
3618                                         set `echo $3 | $sed 's/\./ /g'` $4
3619                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3620                                                 osvers=$1.$2.$3
3621                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3622                                                 osvers=$1.$2
3623                                         elif $test -f $src/hints/sco_$1.sh; then
3624                                                 osvers=$1
3625                                         fi
3626                                 else
3627                                         case "$osname" in
3628                                         '') : Still unknown.  Probably a generic Sys V.
3629                                                 osname="sysv"
3630                                                 osvers="$3"
3631                                                 ;;
3632                                         esac
3633                                 fi
3634                                 ;;
3635                         esac
3636                         ;;
3637                 *)      case "$osname" in
3638                         '') : Still unknown.  Probably a generic BSD.
3639                                 osname="$1"
3640                                 osvers="$3"
3641                                 ;;
3642                         esac
3643                         ;;
3644                 esac
3645         else
3646                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3647                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3648                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3649                                 osname=news_os
3650                         fi
3651                         $rm -f UU/kernel.what
3652                 elif test -d c:/. -o -n "$is_os2" ; then
3653                         set X $myuname
3654                         osname=os2
3655                         osvers="$5"
3656                 fi
3657         fi
3658
3659         case "$targetarch" in
3660         '') ;;
3661         *)  hostarch=$osname
3662             case "$targetarch" in
3663                 nto*|*-nto-*)
3664                     # Will load qnx.sh, which should change osname to nto
3665                     osname=qnx
3666                     osvers=''
3667                     ;;
3668                 *linux-android*)
3669                     # Catch arm-linux-androideabi, mipsel-linux-android,
3670                     # and i686-linux-android
3671                     osname=linux-android
3672                     osvers=''
3673                     ;;
3674                 *linux*)
3675                     # Something like arm-linux-gnueabihf is really just
3676                     # plain linux.
3677                     osname=linux
3678                     osvers=''
3679                     ;;
3680                 *solaris*|*sunos*)
3681                     osname=solaris
3682                     # XXX perhaps we should just assume
3683                     # osvers to be 2, or maybe take the value
3684                     # from targetarch. Using $run before the
3685                     # hints are run is somewhat icky.
3686                     set X `$run $uname -a 2>/dev/null`
3687                     shift
3688                     case "$3" in
3689                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3690                         *)  osvers="$3" ;;
3691                     esac
3692                     ;;
3693                 *)
3694                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3695                     osvers=''
3696                 ;;
3697             esac
3698             ;;
3699         esac
3700
3701         : Now look for a hint file osname_osvers, unless one has been
3702         : specified already.
3703         case "$hintfile" in
3704         ''|' ')
3705                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3706                 : Also try without trailing minor version numbers.
3707                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3708                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3709                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3710                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3711                 case "$file" in
3712                 '') dflt=none ;;
3713                 *)  case "$osvers" in
3714                         '') dflt=$file
3715                                 ;;
3716                         *)  if $test -f $src/hints/$file.sh ; then
3717                                         dflt=$file
3718                                 elif $test -f $src/hints/$xfile.sh ; then
3719                                         dflt=$xfile
3720                                 elif $test -f $src/hints/$xxfile.sh ; then
3721                                         dflt=$xxfile
3722                                 elif $test -f $src/hints/$xxxfile.sh ; then
3723                                         dflt=$xxxfile
3724                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3725                                         dflt=$xxxxfile
3726                                 elif $test -f "$src/hints/${osname}.sh" ; then
3727                                         dflt="${osname}"
3728                                 else
3729                                         dflt=none
3730                                 fi
3731                                 ;;
3732                         esac
3733                         ;;
3734                 esac
3735                 if $test -f Policy.sh ; then
3736                         case "$dflt" in
3737                         *Policy*) ;;
3738                         none) dflt="Policy" ;;
3739                         *) dflt="Policy $dflt" ;;
3740                         esac
3741                 fi
3742                 ;;
3743         *)
3744                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3745                 ;;
3746         esac
3747
3748         if $test -f Policy.sh ; then
3749                 $cat <<EOM
3750
3751 There's also a Policy hint file available, which should make the
3752 site-specific (policy) questions easier to answer.
3753 EOM
3754
3755         fi
3756
3757         $cat <<EOM
3758
3759 You may give one or more space-separated answers, or "none" if appropriate.
3760 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3761 previous run of Configure, you may specify it as well as or instead of
3762 OS-specific hints.  If hints are provided for your OS, you should use them:
3763 although Perl can probably be built without hints on many platforms, using
3764 hints often improve performance and may enable features that Configure can't
3765 set up on its own. If there are no hints that match your OS, specify "none";
3766 DO NOT give a wrong version or a wrong OS.
3767
3768 EOM
3769
3770         rp="Which of these apply, if any?"
3771         . UU/myread
3772         tans=$ans
3773         for file in $tans; do
3774                 if $test X$file = XPolicy -a -f Policy.sh; then
3775                         . Policy.sh
3776                         $cat Policy.sh >> UU/config.sh
3777                 elif $test -f $src/hints/$file.sh; then
3778                         . $src/hints/$file.sh
3779                         $cat $src/hints/$file.sh >> UU/config.sh
3780                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3781                         : nothing
3782                 else
3783                         : Give one chance to correct a possible typo.
3784                         echo "$file.sh does not exist"
3785                         dflt=$file
3786                         rp="hint to use instead?"
3787                         . UU/myread
3788                         for file in $ans; do
3789                                 if $test -f "$src/hints/$file.sh"; then
3790                                         . $src/hints/$file.sh
3791                                         $cat $src/hints/$file.sh >> UU/config.sh
3792                                 elif $test X$ans = X -o X$ans = Xnone ; then
3793                                         : nothing
3794                                 else
3795                                         echo "$file.sh does not exist -- ignored."
3796                                 fi
3797                         done
3798                 fi
3799         done
3800
3801         hint=recommended
3802         : Remember our hint file for later.
3803         if $test -f "$src/hints/$file.sh" ; then
3804                 hintfile="$file"
3805         else
3806                 hintfile=''
3807         fi
3808 fi
3809 cd UU
3810 ;;
3811 *)
3812         echo " "
3813         echo "Fetching default answers from $config_sh..." >&4
3814         tmp_n="$n"
3815         tmp_c="$c"
3816         cd ..
3817         cp $config_sh config.sh 2>/dev/null
3818         chmod +w config.sh
3819         . ./config.sh
3820         cd UU
3821         cp ../config.sh .
3822         n="$tmp_n"
3823         c="$tmp_c"
3824         hint=previous
3825         ;;
3826 esac
3827 . ./optdef.sh
3828
3829 : Restore computed paths
3830 for file in $loclist $trylist; do
3831         eval $file="\$_$file"
3832 done
3833
3834 cat << EOM
3835
3836 Configure uses the operating system name and version to set some defaults.
3837 The default value is probably right if the name rings a bell. Otherwise,
3838 since spelling matters for me, either accept the default or answer "none"
3839 to leave it blank.
3840
3841 EOM
3842 case "$osname" in
3843         ''|' ')
3844                 case "$hintfile" in
3845                 ''|' '|none) dflt=none ;;
3846                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3847                 esac
3848                 ;;
3849         *) dflt="$osname" ;;
3850 esac
3851 rp="Operating system name?"
3852 . ./myread
3853 case "$ans" in
3854 none)  osname='' ;;
3855 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3856 esac
3857 echo " "
3858 case "$osvers" in
3859         ''|' ')
3860                 case "$hintfile" in
3861                 ''|' '|none) dflt=none ;;
3862                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3863                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3864                         case "$dflt" in
3865                         ''|' ') dflt=none ;;
3866                         esac
3867                         ;;
3868                 esac
3869                 ;;
3870         *) dflt="$osvers" ;;
3871 esac
3872 rp="Operating system version?"
3873 . ./myread
3874 case "$ans" in
3875 none)  osvers='' ;;
3876 *) osvers="$ans" ;;
3877 esac
3878
3879
3880 . ./posthint.sh
3881
3882 : who configured the system
3883 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3884 case "$cf_by" in
3885 "")
3886         cf_by=`(logname) 2>/dev/null`
3887         case "$cf_by" in
3888         "")
3889                 cf_by=`(whoami) 2>/dev/null`
3890                 case "$cf_by" in
3891                 "") cf_by=unknown ;;
3892                 esac ;;
3893         esac ;;
3894 esac
3895
3896 : decide how portable to be.  Allow command line overrides.
3897 case "$d_portable" in
3898 "$undef") ;;
3899 *)      d_portable="$define" ;;
3900 esac
3901
3902 : set up shell script to do ~ expansion
3903 cat >filexp <<EOSS
3904 $startsh
3905 : expand filename
3906 case "\$1" in
3907  \~/*|\~)
3908         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3909         ;;
3910  \~*)
3911         if $test -f /bin/csh; then
3912                 /bin/csh -f -c "glob \$1"
3913                 failed=\$?
3914                 echo ""
3915                 exit \$failed
3916         else
3917                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3918                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3919                 if $test ! -d "\$dir"; then
3920                         me=\`basename \$0\`
3921                         echo "\$me: can't locate home directory for: \$name" >&2
3922                         exit 1
3923                 fi
3924                 case "\$1" in
3925                 */*)
3926                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3927                         ;;
3928                 *)
3929                         echo \$dir
3930                         ;;
3931                 esac
3932         fi
3933         ;;
3934 *)
3935         echo \$1
3936         ;;
3937 esac
3938 EOSS
3939 chmod +x filexp
3940 $eunicefix filexp
3941
3942 : now set up to get a file name
3943 cat <<EOS >getfile
3944 $startsh
3945 EOS
3946 cat <<'EOSC' >>getfile
3947 tilde=''
3948 fullpath=''
3949 already=''
3950 skip=''
3951 none_ok=''
3952 exp_file=''
3953 nopath_ok=''
3954 orig_rp="$rp"
3955 orig_dflt="$dflt"
3956 case "$gfpth" in
3957 '') gfpth='.' ;;
3958 esac
3959
3960 case "$fn" in
3961 *\(*)
3962         : getfile will accept an answer from the comma-separated list
3963         : enclosed in parentheses even if it does not meet other criteria.
3964         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3965         fn=`echo $fn | sed 's/(.*)//'`
3966         ;;
3967 esac
3968
3969 case "$fn" in
3970 *:*)
3971         loc_file=`expr $fn : '.*:\(.*\)'`
3972         fn=`expr $fn : '\(.*\):.*'`
3973         ;;
3974 esac
3975
3976 case "$fn" in
3977 *~*) tilde=true;;
3978 esac
3979 case "$fn" in
3980 */*) fullpath=true;;
3981 esac
3982 case "$fn" in
3983 *+*) skip=true;;
3984 esac
3985 case "$fn" in
3986 *n*) none_ok=true;;
3987 esac
3988 case "$fn" in
3989 *e*) exp_file=true;;
3990 esac
3991 case "$fn" in
3992 *p*) nopath_ok=true;;
3993 esac
3994
3995 case "$fn" in
3996 *f*) type='File';;
3997 *d*) type='Directory';;
3998 *l*) type='Locate';;
3999 esac
4000
4001 what="$type"
4002 case "$what" in
4003 Locate) what='File';;
4004 esac
4005
4006 case "$exp_file" in
4007 '')
4008         case "$d_portable" in
4009         "$define") ;;
4010         *) exp_file=true;;
4011         esac
4012         ;;
4013 esac
4014
4015 cd ..
4016 while test "$type"; do
4017         redo=''
4018         rp="$orig_rp"
4019         dflt="$orig_dflt"
4020         case "$tilde" in
4021         true) rp="$rp (~name ok)";;
4022         esac
4023         . UU/myread
4024         if test -f UU/getfile.ok && \
4025                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4026         then
4027                 value="$ans"
4028                 ansexp="$ans"
4029                 break
4030         fi
4031         case "$ans" in
4032         none)
4033                 value=''
4034                 ansexp=''
4035                 case "$none_ok" in
4036                 true) type='';;
4037                 esac
4038                 ;;
4039         *)
4040                 case "$tilde" in
4041                 '') value="$ans"
4042                         ansexp="$ans";;
4043                 *)
4044                         value=`UU/filexp $ans`
4045                         case $? in
4046                         0)
4047                                 if test "$ans" != "$value"; then
4048                                         echo "(That expands to $value on this system.)"
4049                                 fi
4050                                 ;;
4051                         *) value="$ans";;
4052                         esac
4053                         ansexp="$value"
4054                         case "$exp_file" in
4055                         '') value="$ans";;
4056                         esac
4057                         ;;
4058                 esac
4059                 case "$fullpath" in
4060                 true)
4061                         case "$ansexp" in
4062                         /*) value="$ansexp" ;;
4063                         [a-zA-Z]:/*) value="$ansexp" ;;
4064                         *)
4065                                 redo=true
4066                                 case "$already" in
4067                                 true)
4068                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4069                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4070                                         ;;
4071                                 *)
4072                                 echo "Please give a full path name, starting with slash." >&4
4073                                         case "$tilde" in
4074                                         true)
4075                                 echo "Note that using ~name is ok provided it expands well." >&4
4076                                                 already=true
4077                                                 ;;
4078                                         esac
4079                                 esac
4080                                 ;;
4081                         esac
4082                         ;;
4083                 esac
4084                 case "$redo" in
4085                 '')
4086                         case "$type" in
4087                         File)
4088                                 for fp in $gfpth; do
4089                                         if test "X$fp" = X.; then
4090                                             pf="$ansexp"
4091                                         else    
4092                                             pf="$fp/$ansexp"
4093                                         fi
4094                                         if test -f "$pf"; then
4095                                                 type=''
4096                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4097                                         then
4098                                                 echo "($value is not a plain file, but that's ok.)"
4099                                                 type=''
4100                                         fi
4101                                         if test X"$type" = X; then
4102                                             value="$pf"
4103                                             break
4104                                         fi
4105                                 done
4106                                 ;;
4107                         Directory)
4108                                 for fp in $gfpth; do
4109                                         if test "X$fp" = X.; then
4110                                             dir="$ans"
4111                                             direxp="$ansexp"
4112                                         else    
4113                                             dir="$fp/$ansexp"
4114                                             direxp="$fp/$ansexp"
4115                                         fi
4116                                         if test -d "$direxp"; then
4117                                                 type=''
4118                                                 value="$dir"
4119                                                 break
4120                                         fi
4121                                 done
4122                                 ;;
4123                         Locate)
4124                                 if test -d "$ansexp"; then
4125                                         echo "(Looking for $loc_file in directory $value.)"
4126                                         value="$value/$loc_file"
4127                                         ansexp="$ansexp/$loc_file"
4128                                 fi
4129                                 if test -f "$ansexp"; then
4130                                         type=''
4131                                 fi
4132                                 case "$nopath_ok" in
4133                                 true)   case "$value" in
4134                                         */*) ;;
4135                                         *)      echo "Assuming $value will be in people's path."
4136                                                 type=''
4137                                                 ;;
4138                                         esac
4139                                         ;;
4140                                 esac
4141                                 ;;
4142                         esac
4143
4144                         case "$skip" in
4145                         true) type='';
4146                         esac
4147
4148                         case "$type" in
4149                         '') ;;
4150                         *)
4151                                 if test "$fastread" = yes; then
4152                                         dflt=y
4153                                 else
4154                                         dflt=n
4155                                 fi
4156                                 rp="$what $value doesn't exist.  Use that name anyway?"
4157                                 . UU/myread
4158                                 dflt=''
4159                                 case "$ans" in
4160                                 y*) type='';;
4161                                 *) echo " ";;
4162                                 esac
4163                                 ;;
4164                         esac
4165                         ;;
4166                 esac
4167                 ;;
4168         esac
4169 done
4170 cd UU
4171 ans="$value"
4172 rp="$orig_rp"
4173 dflt="$orig_dflt"
4174 rm -f getfile.ok
4175 test "X$gfpthkeep" != Xy && gfpth=""
4176 EOSC
4177
4178 : determine root of directory hierarchy where package will be installed.
4179 case "$prefix" in
4180 '')
4181         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4182         ;;
4183 *?/)
4184         dflt=`echo "$prefix" | sed 's/.$//'`
4185         ;;
4186 *)
4187         dflt="$prefix"
4188         ;;
4189 esac
4190 $cat <<EOM
4191
4192 By default, $package will be installed in $dflt/bin, manual pages
4193 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4194 installation directories. Typically this is something like /usr/local.
4195 If you wish to have binaries under /usr/bin but other parts of the
4196 installation under /usr/local, that's ok: you will be prompted
4197 separately for each of the installation directories, the prefix being
4198 only used to set the defaults.
4199
4200 EOM
4201 fn=d~
4202 rp='Installation prefix to use?'
4203 . ./getfile
4204 oldprefix=''
4205 case "$prefix" in
4206 '') ;;
4207 *)
4208         case "$ans" in
4209         "$prefix") ;;
4210         *) oldprefix="$prefix";;
4211         esac
4212         ;;
4213 esac
4214 prefix="$ans"
4215 prefixexp="$ansexp"
4216
4217 : allow them to override the AFS root
4218 case "$afsroot" in
4219 '')     afsroot=/afs ;;
4220 *)      afsroot=$afsroot ;;
4221 esac
4222
4223 : is AFS running?
4224 echo " "
4225 case "$afs" in
4226 $define|true)   afs=true ;;
4227 $undef|false)   afs=false ;;
4228 *)      if $test -d $afsroot; then
4229                 afs=true
4230         else
4231                 afs=false
4232         fi
4233         ;;
4234 esac
4235 if $afs; then
4236         echo "AFS may be running... I'll be extra cautious then..." >&4
4237 else
4238         echo "AFS does not seem to be running..." >&4
4239 fi
4240
4241 : determine installation prefix for where package is to be installed.
4242 if $afs; then
4243 $cat <<EOM
4244
4245 Since you are running AFS, I need to distinguish the directory in which
4246 files will reside from the directory in which they are installed (and from
4247 which they are presumably copied to the former directory by occult means).
4248
4249 EOM
4250         case "$installprefix" in
4251         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4252         *) dflt="$installprefix";;
4253         esac
4254 else
4255 $cat <<EOM
4256
4257 In some special cases, particularly when building $package for distribution,
4258 it is convenient to distinguish the directory in which files should be
4259 installed from the directory ($prefix) in which they will
4260 eventually reside.  For most users, these two directories are the same.
4261
4262 EOM
4263         case "$installprefix" in
4264         '') dflt=$prefix ;;
4265         *) dflt=$installprefix;;
4266         esac
4267 fi
4268 fn=d~
4269 rp='What installation prefix should I use for installing files?'
4270 . ./getfile
4271 installprefix="$ans"
4272 installprefixexp="$ansexp"
4273
4274 : Perform the prefixexp/installprefixexp correction if necessary
4275 cat <<EOS >installprefix
4276 $startsh
4277 EOS
4278 cat <<'EOSC' >>installprefix
4279 : Change installation prefix, if necessary.
4280 if $test X"$prefix" != X"$installprefix"; then
4281     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4282 else
4283     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4284 fi
4285 EOSC
4286 chmod +x installprefix
4287 $eunicefix installprefix
4288
4289 : Set variables such as privlib and privlibexp from the output of ./getfile
4290 : performing the prefixexp/installprefixexp correction if necessary.
4291 cat <<EOS >setprefixvar
4292 $startsh
4293 EOS
4294 cat <<'EOSC' >>setprefixvar
4295 eval "${prefixvar}=\"\$ans\""
4296 eval "${prefixvar}exp=\"\$ansexp\""
4297 . ./installprefix
4298 EOSC
4299 chmod +x setprefixvar
4300 $eunicefix setprefixvar
4301
4302 : set up the script used to warn in case of inconsistency
4303 cat <<EOS >whoa
4304 $startsh
4305 EOS
4306 cat <<'EOSC' >>whoa
4307 dflt=y
4308 case "$hint" in
4309     recommended)
4310         case "$hintfile" in
4311         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4312                 ;;
4313         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4314                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4315                 ;;
4316         esac
4317         ;;
4318     *)  echo " "
4319         echo "*** WHOA THERE!!! ***" >&4
4320         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4321         ;;
4322 esac
4323 rp="    Keep the $hint value?"
4324 . ./myread
4325 case "$ans" in
4326 y) td=$was; tu=$was;;
4327 esac
4328 EOSC
4329
4330 : function used to set '$1' to '$val'
4331 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4332 case "$val$was" in
4333 $define$undef) . ./whoa; eval "$var=\$td";;
4334 $undef$define) . ./whoa; eval "$var=\$tu";;
4335 *) eval "$var=$val";;
4336 esac'
4337
4338 : get the patchlevel
4339 echo " "
4340 echo "Getting the current patchlevel..." >&4
4341 if $test -r $rsrc/patchlevel.h;then
4342         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4343         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4344         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4345         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4346         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4347         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4348         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4349 else
4350         revision=0
4351         patchlevel=0
4352         subversion=0
4353         api_revision=0
4354         api_version=0
4355         api_subversion=0
4356         perl_patchlevel=0
4357         $echo "(You do not have patchlevel.h.  Eek.)"
4358 fi
4359 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4360 version_patchlevel_string="version $patchlevel subversion $subversion"
4361 case "$perl_patchlevel" in
4362 0|'') ;;
4363 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4364     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4365     ;;
4366 esac
4367
4368 $echo "(You have $package $version_patchlevel_string.)"
4369
4370 case "$osname" in
4371 dos|vms)
4372         : XXX Should be a Configure test for double-dots in filenames.
4373         version=`echo $revision $patchlevel $subversion | \
4374                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4375         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4376                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4377         ;;
4378 *)
4379         version=`echo $revision $patchlevel $subversion | \
4380                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4381         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4382                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4383         ;;
4384 esac
4385 : Special case the 5.005_xx maintenance series, which used 5.005
4386 : without any subversion label as a subdirectory in $sitelib
4387 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4388         api_versionstring='5.005'
4389 fi
4390
4391 : Do we want threads support and if so, what type
4392 case "$usethreads" in
4393 $define|true|[yY]*)     dflt='y';;
4394 *)     # Catch case where user specified ithreads or 5005threads but
4395        # forgot -Dusethreads (A.D. 4/2002)
4396        case "$useithreads$use5005threads" in
4397        *$define*)       dflt='y';;
4398        *)               dflt='n';;
4399        esac
4400        ;;
4401 esac
4402 cat <<EOM
4403
4404 Perl can be built to offer a form of threading support on some systems
4405 To do so, Configure can be run with -Dusethreads.
4406
4407 Note that Perl built with threading support runs slightly slower
4408 and uses slightly more memory than plain Perl.
4409
4410 If this doesn't make any sense to you, just accept the default '$dflt'.
4411 EOM
4412 rp='Build a threading Perl?'
4413 . ./myread
4414 case "$ans" in
4415 y|Y)    val="$define" ;;
4416 *)      val="$undef" ;;
4417 esac
4418 set usethreads
4419 eval $setvar
4420
4421 if $test $patchlevel -lt 9; then
4422     case "$usethreads" in
4423     $define)
4424         : Default to ithreads unless overridden on command line or with
4425         : old config.sh
4426         dflt='y'
4427         case "$use5005threads" in
4428                 $define|true|[yY]*)
4429                         echo "5.005 threads are no longer supported"
4430                         exit 1
4431                 ;;
4432         esac
4433         case "$useithreads" in
4434                 $undef|false|[nN]*) dflt='n';;
4435         esac
4436         rp='Use the newer interpreter-based ithreads?'
4437         . ./myread
4438         case "$ans" in
4439         y|Y)    val="$define" ;;
4440         *)      val="$undef" ;;
4441         esac
4442         set useithreads
4443         eval $setvar
4444         : Now set use5005threads to the opposite value.
4445         case "$useithreads" in
4446         $define) val="$undef" ;;
4447         *) val="$define" ;;
4448         esac
4449         set use5005threads
4450         eval $setvar
4451         ;;
4452     *)
4453         useithreads="$undef"
4454         use5005threads="$undef"
4455         ;;
4456     esac
4457
4458     case "$useithreads$use5005threads" in
4459     "$define$define")
4460         $cat >&4 <<EOM
4461
4462 You cannot have both the ithreads and the 5.005 threads enabled
4463 at the same time.  Disabling the 5.005 threads since they are
4464 much less stable than the ithreads.
4465
4466 EOM
4467         use5005threads="$undef"
4468         ;;
4469     esac
4470
4471 else
4472 : perl-5.9.x and later
4473
4474     if test X"$usethreads" = "X$define"; then
4475         case "$use5005threads" in
4476             $define|true|[yY]*)
4477                 $cat >&4 <<EOM
4478
4479 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4480
4481 EOM
4482             ;;
4483         esac
4484     fi
4485
4486     use5005threads="$undef"
4487     useithreads="$usethreads"
4488 fi
4489
4490 case "$d_oldpthreads" in
4491 '')     : Configure tests would be welcome here.  For now, assume undef.
4492         val="$undef" ;;
4493 *)      val="$d_oldpthreads" ;;
4494 esac
4495 set d_oldpthreads
4496 eval $setvar
4497
4498
4499 : Look for a hint-file generated 'call-back-unit'.  If the
4500 : user has specified that a threading perl is to be built,
4501 : we may need to set or change some other defaults.
4502 if $test -f usethreads.cbu; then
4503     echo "Your platform has some specific hints regarding threaded builds, using them..."
4504     . ./usethreads.cbu
4505 else
4506     case "$usethreads" in
4507         "$define"|true|[yY]*)
4508                 $cat <<EOM
4509 (Your platform does not have any specific hints for threaded builds.
4510  Assuming POSIX threads, then.)
4511 EOM
4512         ;;
4513     esac
4514 fi
4515
4516 : Check if multiplicity is required
4517 cat <<EOM
4518
4519 Perl can be built so that multiple Perl interpreters can coexist
4520 within the same Perl executable.
4521 EOM
4522
4523 case "$useithreads" in
4524 $define)
4525         cat <<EOM
4526 This multiple interpreter support is required for interpreter-based threads.
4527 EOM
4528         val="$define"
4529         ;;
4530 *)      case "$usemultiplicity" in
4531         $define|true|[yY]*)     dflt='y';;
4532         *) dflt='n';;
4533         esac
4534         echo " "
4535         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4536         rp='Build Perl for multiplicity?'
4537         . ./myread
4538         case "$ans" in
4539         y|Y)    val="$define" ;;
4540         *)      val="$undef" ;;
4541         esac
4542         ;;
4543 esac
4544 set usemultiplicity
4545 eval $setvar
4546
4547 : Check if morebits is requested
4548 case "$usemorebits" in
4549 "$define"|true|[yY]*)
4550         use64bitint="$define"
4551         uselongdouble="$define"
4552         usemorebits="$define"
4553         ;;
4554 *)      usemorebits="$undef"
4555         ;;
4556 esac
4557
4558 : Determine the C compiler to be used
4559 echo " "
4560 case "$cc" in
4561 '') dflt=cc;;
4562 *) dflt="$cc";;
4563 esac
4564 rp="Use which C compiler?"
4565 . ./myread
4566 cc="$ans"
4567
4568 : See whether they have no cc but they do have gcc
4569 . ./trygcc
4570 if $test -f cc.cbu; then
4571     . ./cc.cbu
4572 fi
4573 . ./checkcc
4574
4575 : make some quick guesses about what we are up against
4576 echo " "
4577 $echo $n "Hmm...  $c"
4578 echo exit 1 >bsd
4579 echo exit 1 >usg
4580 echo exit 1 >v7
4581 echo exit 1 >osf1
4582 echo exit 1 >eunice
4583 echo exit 1 >xenix
4584 echo exit 1 >venix
4585 echo exit 1 >os2
4586 d_bsd="$undef"
4587 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4588 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4589 then
4590         echo "Looks kind of like an OSF/1 system, but we'll see..."
4591         echo exit 0 >osf1
4592 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4593         xxx=`./loc addbib blurfl $pth`
4594         if $test -f $xxx; then
4595         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4596                 echo exit 0 >bsd
4597                 echo exit 0 >usg
4598         else
4599                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4600                         echo "Looks kind of like an extended USG system, but we'll see..."
4601                 else
4602                         echo "Looks kind of like a USG system, but we'll see..."
4603                 fi
4604                 echo exit 0 >usg
4605         fi
4606 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4607         echo "Looks kind of like a BSD system, but we'll see..."
4608         d_bsd="$define"
4609         echo exit 0 >bsd
4610 else
4611         echo "Looks kind of like a Version 7 system, but we'll see..."
4612         echo exit 0 >v7
4613 fi
4614 case "$eunicefix" in
4615 *unixtovms*)
4616         $cat <<'EOI'
4617 There is, however, a strange, musty smell in the air that reminds me of
4618 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4619 EOI
4620         echo exit 0 >eunice
4621         d_eunice="$define"
4622 : it so happens the Eunice I know will not run shell scripts in Unix format
4623         ;;
4624 *)
4625         echo " "
4626         echo "Congratulations.  You aren't running Eunice."
4627         d_eunice="$undef"
4628         ;;
4629 esac
4630 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4631 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4632 : semicolon as a patch separator
4633 case "$p_" in
4634 :) ;;
4635 *)
4636         $cat <<'EOI'
4637 I have the feeling something is not exactly right, however...don't tell me...
4638 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4639 (Or you may be running DOS with DJGPP.)
4640 EOI
4641         echo exit 0 >os2
4642         ;;
4643 esac
4644 if test -f /xenix; then
4645         echo "Actually, this looks more like a XENIX system..."
4646         echo exit 0 >xenix
4647         d_xenix="$define"
4648 else
4649         echo " "
4650         echo "It's not Xenix..."
4651         d_xenix="$undef"
4652 fi
4653 chmod +x xenix
4654 $eunicefix xenix
4655 if test -f /venix; then
4656         echo "Actually, this looks more like a VENIX system..."
4657         echo exit 0 >venix
4658 else
4659         echo " "
4660         if ./xenix; then
4661                 : null
4662         else
4663                 echo "Nor is it Venix..."
4664         fi
4665 fi
4666 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4667 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4668 $rm -f foo
4669
4670 : Check if we are using GNU gcc and what its version is
4671 echo " "
4672 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4673 $cat >try.c <<EOM
4674 #include <stdio.h>
4675 int main() {
4676 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4677 #ifdef __VERSION__
4678         printf("%s\n", __VERSION__);
4679 #else
4680         printf("%s\n", "1");
4681 #endif
4682 #endif
4683         return(0);
4684 }
4685 EOM
4686 if $cc -o try $ccflags $ldflags try.c; then
4687         gccversion=`$run ./try`
4688         case "$gccversion" in
4689         '') echo "You are not using GNU cc." ;;
4690         *)  echo "You are using GNU cc $gccversion."
4691             ccname=gcc
4692             ;;
4693         esac
4694 else
4695         echo " "
4696         echo "*** WHOA THERE!!! ***" >&4
4697         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4698         case "$knowitall" in
4699         '')
4700         echo "    You'd better start hunting for one and let me know about it." >&4
4701                 exit 1
4702                 ;;
4703         esac
4704 fi
4705 $rm -f try try.*
4706 case "$gccversion" in
4707 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4708 esac
4709 case "$gccversion" in
4710 '') gccosandvers='' ;;
4711 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4712    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4713    gccshortvers=''
4714    case "$gccosandvers" in
4715    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4716    $osname$osvers) ;; # looking good
4717    $osname*) cat <<EOM >&4
4718
4719 *** WHOA THERE!!! ***
4720
4721     Your gcc has not been compiled for the exact release of
4722     your operating system ($gccosandvers versus $osname$osvers).
4723
4724     In general it is a good idea to keep gcc synchronized with
4725     the operating system because otherwise serious problems
4726     may ensue when trying to compile software, like Perl.
4727
4728     I'm trying to be optimistic here, though, and will continue.
4729     If later during the configuration and build icky compilation
4730     problems appear (headerfile conflicts being the most common
4731     manifestation), I suggest reinstalling the gcc to match
4732     your operating system release.
4733
4734 EOM
4735       ;;
4736    *) gccosandvers='' ;; # failed to parse, better be silent
4737    esac
4738    ;;
4739 esac
4740 case "$ccname" in
4741 '') ccname="$cc" ;;
4742 esac
4743
4744 # gcc 3.* complain about adding -Idirectories that they already know about,
4745 # so we will take those off from locincpth.
4746 case "$gccversion" in
4747 3*)
4748     echo "main(){}">try.c
4749     for incdir in $locincpth; do
4750        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4751              grep '^c[cp]p*[01]: warning: changing search order '`
4752        if test "X$warn" != X; then
4753            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4754        fi
4755     done
4756     $rm -f try try.*
4757 esac
4758
4759 # gcc 4.9 by default does some optimizations that break perl.
4760 # see ticket 121505.
4761 #
4762 # The -fwrapv disables those optimizations (and probably others,) so
4763 # for gcc 4.9 (and later, since the optimizations probably won't go
4764 # away), add -fwrapv unless the user requests -fno-wrapv, which
4765 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4766 # which turns the overflows -fwrapv ignores into runtime errors.
4767 case "$gccversion" in
4768 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4769     case "$ccflags" in
4770     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4771     *) ccflags="$ccflags -fwrapv" ;;
4772     esac
4773 esac
4774
4775 : What should the include directory be ?
4776 : Use sysroot if set, so findhdr looks in the right place.
4777 echo " "
4778 $echo $n "Hmm...  $c"
4779 dflt="$sysroot/usr/include"
4780 incpath=''
4781 mips_type=''
4782 if $test -f /bin/mips && /bin/mips; then
4783         echo "Looks like a MIPS system..."
4784         $cat >usr.c <<'EOCP'
4785 #ifdef SYSTYPE_BSD43
4786 /bsd43
4787 #endif
4788 EOCP
4789         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4790                 dflt='/bsd43/usr/include'
4791                 incpath='/bsd43'
4792                 mips_type='BSD 4.3'
4793         else
4794                 mips_type='System V'
4795         fi
4796         $rm -f usr.c usr.out
4797         echo "and you're compiling with the $mips_type compiler and libraries."
4798         xxx_prompt=y
4799         echo "exit 0" >mips
4800 else
4801         echo "Doesn't look like a MIPS system."
4802         xxx_prompt=n
4803         echo "exit 1" >mips
4804 fi
4805 chmod +x mips
4806 $eunicefix mips
4807 case "$usrinc" in
4808 '') ;;
4809 *) dflt="$usrinc";;
4810 esac
4811 case "$xxx_prompt" in
4812 y)      fn=d/
4813         echo " "
4814         rp='Where are the include files you want to use?'
4815         . ./getfile
4816         usrinc="$ans"
4817         ;;
4818 *)      usrinc="$dflt"
4819         ;;
4820 esac
4821
4822 : see how we invoke the C preprocessor
4823 echo " "
4824 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4825 cat <<'EOT' >testcpp.c
4826 #define ABC abc
4827 #define XYZ xyz
4828 ABC.XYZ
4829 EOT
4830 cd ..
4831 if test ! -f cppstdin; then
4832         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4833                 # AIX cc -E doesn't show the absolute headerfile
4834                 # locations but we'll cheat by using the -M flag.
4835                 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
4836         else
4837                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4838         fi
4839 else
4840         echo "Keeping your $hint cppstdin wrapper."
4841 fi
4842 chmod 755 cppstdin
4843 wrapper=`pwd`/cppstdin
4844 ok='false'
4845 cd UU
4846
4847 if $test "X$cppstdin" != "X" && \
4848         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4849         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4850 then
4851         echo "You used to use $cppstdin $cppminus so we'll use that again."
4852         case "$cpprun" in
4853         '') echo "But let's see if we can live without a wrapper..." ;;
4854         *)
4855                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4856                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4857                 then
4858                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4859                         ok='true'
4860                 else
4861                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4862                 fi
4863                 ;;
4864         esac
4865 else
4866         case "$cppstdin" in
4867         '') ;;
4868         *)
4869                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4870                 ;;
4871         esac
4872 fi
4873
4874 if $ok; then
4875         : nothing
4876 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4877         $cc -E <testcpp.c >testcpp.out 2>&1; \
4878         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4879         echo "Yup, it does."
4880         x_cpp="$cc $cppflags -E"
4881         x_minus='';
4882 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4883         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4884         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4885         echo "Yup, it does."
4886         x_cpp="$cc $cppflags -E"
4887         x_minus='-';
4888 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4889         $cc -P <testcpp.c >testcpp.out 2>&1; \
4890         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4891         echo "Yipee, that works!"
4892         x_cpp="$cc $cppflags -P"
4893         x_minus='';
4894 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4895         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4896         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4897         echo "At long last!"
4898         x_cpp="$cc $cppflags -P"
4899         x_minus='-';
4900 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4901         $cpp <testcpp.c >testcpp.out 2>&1; \
4902         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4903         echo "It works!"
4904         x_cpp="$cpp $cppflags"
4905         x_minus='';
4906 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4907         $cpp - <testcpp.c >testcpp.out 2>&1; \
4908         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4909         echo "Hooray, it works!  I was beginning to wonder."
4910         x_cpp="$cpp $cppflags"
4911         x_minus='-';
4912 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4913         $wrapper <testcpp.c >testcpp.out 2>&1; \
4914         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4915         x_cpp="$wrapper"
4916         x_minus=''
4917         echo "Eureka!"
4918 else
4919         dflt=''
4920         rp="No dice.  I can't find a C preprocessor.  Name one:"
4921         . ./myread
4922         x_cpp="$ans"
4923         x_minus=''
4924         $x_cpp <testcpp.c >testcpp.out 2>&1
4925         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4926                 echo "OK, that will do." >&4
4927         else
4928 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4929                 exit 1
4930         fi
4931 fi
4932
4933 case "$ok" in
4934 false)
4935         cppstdin="$x_cpp"
4936         cppminus="$x_minus"
4937         cpprun="$x_cpp"
4938         cpplast="$x_minus"
4939         set X $x_cpp
4940         shift
4941         case "$1" in
4942         "$cpp")
4943                 echo "Perhaps can we force $cc -E using a wrapper..."
4944                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4945                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4946                 then
4947                         echo "Yup, we can."
4948                         cppstdin="$wrapper"
4949                         cppminus='';
4950                 else
4951                         echo "Nope, we'll have to live without it..."
4952                 fi
4953                 ;;
4954         esac
4955         case "$cpprun" in
4956         "$wrapper")
4957                 cpprun=''
4958                 cpplast=''
4959                 ;;
4960         esac
4961         ;;
4962 esac
4963
4964 case "$cppstdin" in
4965 "$wrapper"|'cppstdin') ;;
4966 *) $rm -f $wrapper;;
4967 esac
4968 $rm -f testcpp.c testcpp.out
4969
4970 : Adjust cppfilter for path component separator
4971 case "$osname" in
4972 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4973 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4974 *)   cppfilter='' ;;
4975 esac
4976
4977 : Use gcc to determine libpth and incpth
4978 # If using gcc or clang, we can get better values for libpth, incpth
4979 # and usrinc directly from the compiler.
4980 # Note that ccname for clang is also gcc.
4981 case "$ccname" in
4982     gcc)
4983         $echo 'extern int foo;' > try.c
4984         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4985         shift
4986         if $test $# -gt 0; then
4987             incpth="$incpth $*"
4988             incpth="`$echo $incpth|$sed 's/^ //'`"
4989             for i in $*; do
4990                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4991                 if $test -d $j; then
4992                     libpth="$libpth $j"
4993                 fi
4994             done
4995             libpth="`$echo $libpth|$sed 's/^ //'`"
4996             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4997                 if $test -d $xxx; then
4998                     case " $libpth " in
4999                     *" $xxx "*) ;;
5000                     *) libpth="$libpth $xxx";;
5001                     esac
5002                 fi
5003             done
5004         fi
5005         $rm -f try.c
5006         case "$usrinc" in
5007         '') for i in $incpth; do
5008                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
5009                     usrinc="$i"
5010                     break
5011                 fi
5012             done
5013             ;;
5014         esac
5015
5016         case "$usecrosscompile" in
5017         $define|true|[yY]*)
5018             case "$incpth" in
5019                 '') echo "Incpth not defined." >&4; croak=y ;;
5020                 *)  echo "Using incpth '$incpth'." >&4 ;;
5021             esac
5022             case "$libpth" in
5023                 '') echo "Libpth not defined." >&4; croak=y ;;
5024                 *)  echo "Using libpth '$libpth'." >&4 ;;
5025             esac
5026             case "$usrinc" in
5027                 '') echo "Usrinc not defined." >&4; croak=y ;;
5028                 *)  echo "Using usrinc $usrinc." >&4 ;;
5029             esac
5030             case "$croak" in
5031                 y)
5032                 if test "X$sysroot" = X; then
5033                     echo "Cannot continue, aborting." >&4; exit 1
5034                 else
5035                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5036                 fi
5037                 ;;
5038             esac
5039             ;;
5040         esac
5041     ;;
5042 esac
5043
5044 : Default value for incpth is just usrinc
5045 case "$incpth" in
5046 '') incpth="$usrinc";;
5047 esac
5048
5049 : Set private lib path
5050 case "$plibpth" in
5051 '') if ./mips; then
5052         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5053     fi;;
5054 esac
5055 case "$libpth" in
5056 ' ') dlist='';;
5057 '') dlist="$loclibpth $plibpth $glibpth";;
5058 *) dlist="$libpth";;
5059 esac
5060
5061 : Now check and see which directories actually exist, avoiding duplicates
5062 for xxx in $dlist
5063 do
5064     if $test -d $xxx; then
5065                 case " $libpth " in
5066                 *" $xxx "*) ;;
5067                 *) libpth="$libpth $xxx";;
5068                 esac
5069     fi
5070 done
5071 $cat <<'EOM'
5072
5073 Some systems have incompatible or broken versions of libraries.  Among
5074 the directories listed in the question below, please remove any you
5075 know not to be holding relevant libraries, and add any that are needed.
5076 Say "none" for none.
5077
5078 EOM
5079
5080 if test "X$sysroot" != X; then
5081     $cat <<EOM
5082 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5083
5084 EOM
5085 fi
5086
5087 case "$libpth" in
5088 '') dflt='none';;
5089 *)
5090         set X $libpth
5091         shift
5092         dflt=${1+"$@"}
5093         ;;
5094 esac
5095 rp="Directories to use for library searches?"
5096 . ./myread
5097 case "$ans" in
5098 none) libpth=' ';;
5099 *) libpth="$ans";;
5100 esac
5101
5102 : compute shared library extension
5103 case "$so" in
5104 '')
5105         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5106                 dflt='sl'
5107         else
5108                 dflt='so'
5109         fi
5110         ;;
5111 *) dflt="$so";;
5112 esac
5113 $cat <<EOM
5114
5115 On some systems, shared libraries may be available.  Answer 'none' if
5116 you want to suppress searching of shared libraries for the remainder
5117 of this configuration.
5118
5119 EOM
5120 rp='What is the file extension used for shared libraries?'
5121 . ./myread
5122 so="$ans"
5123
5124 : Does target system insist that shared library basenames are unique
5125 $cat << EOM
5126
5127 Some dynamic loaders assume that the *basename* of shared library filenames
5128 are globally unique.  We'll default this to undef as we assume your system
5129 is not this weird. Set to defined if you're on one of them.
5130
5131 EOM
5132
5133 dflt='n'
5134 rp='Make shared library basenames unique?'
5135 . ./myread
5136 case "$ans" in
5137 y|Y) val="$define" ;;
5138 *)   val="$undef"  ;;
5139 esac
5140 set d_libname_unique
5141 eval $setvar
5142
5143 : Define several unixisms.
5144 : Hints files or command line option can be used to override them.
5145 : The convoluted testing is in case hints files set either the old
5146 : or the new name.
5147 case "$_exe" in
5148 '')     case "$exe_ext" in
5149         '')     ;;
5150         *)      _exe="$exe_ext" ;;
5151         esac
5152         ;;
5153 esac
5154 case "$_a" in
5155 '')     case "$lib_ext" in
5156     '') _a='.a';;
5157         *)      _a="$lib_ext" ;;
5158         esac
5159         ;;
5160 esac
5161 case "$_o" in
5162 '') case "$obj_ext" in
5163         '')     _o='.o';;
5164         *)      _o="$obj_ext";;
5165         esac
5166         ;;
5167 esac
5168 case "$p_" in
5169 '') case "$path_sep" in
5170         '')     p_=':';;
5171         *)      p_="$path_sep";;
5172         esac
5173         ;;
5174 esac
5175 exe_ext=$_exe
5176 lib_ext=$_a
5177 obj_ext=$_o
5178 path_sep=$p_
5179
5180 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5181
5182 : Which makefile gets called first.  This is used by make depend.
5183 case "$firstmakefile" in
5184 '') firstmakefile='makefile';;
5185 esac
5186
5187 : Check is we will use socks
5188 case "$usesocks" in
5189 $define|true|[yY]*)     dflt='y';;
5190 *) dflt='n';;
5191 esac
5192 cat <<EOM
5193
5194 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5195 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5196 to use the PerlIO abstraction layer, this will be implicitly selected.
5197
5198 If this doesn't make any sense to you, just accept the default '$dflt'.
5199 EOM
5200 rp='Build Perl for SOCKS?'
5201 . ./myread
5202 case "$ans" in
5203 y|Y)    val="$define" ;;
5204 *)      val="$undef" ;;
5205 esac
5206 set usesocks
5207 eval $setvar
5208
5209 : Check for uselongdouble support
5210 case "$ccflags" in
5211 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5212 esac
5213
5214 case "$uselongdouble" in
5215 $define|true|[yY]*)     dflt='y';;
5216 *) dflt='n';;
5217 esac
5218 cat <<EOM
5219
5220 Perl can be built to take advantage of long doubles which
5221 (if available) may give more accuracy and range for floating point numbers.
5222
5223 If this doesn't make any sense to you, just accept the default '$dflt'.
5224 EOM
5225 rp='Try to use long doubles if available?'
5226 . ./myread
5227 case "$ans" in
5228 y|Y)    val="$define"   ;;
5229 *)      val="$undef"    ;;
5230 esac
5231 set uselongdouble
5232 eval $setvar
5233
5234 case "$uselongdouble" in
5235 true|[yY]*) uselongdouble="$define" ;;
5236 esac
5237
5238 : Look for a hint-file generated 'call-back-unit'.  If the
5239 : user has specified that long doubles should be used,
5240 : we may need to set or change some other defaults.
5241 if $test -f uselongdouble.cbu; then
5242     echo "Your platform has some specific hints regarding long doubles, using them..."
5243     . ./uselongdouble.cbu
5244 else
5245     case "$uselongdouble" in
5246         $define)
5247                 $cat <<EOM
5248 (Your platform does not have any specific hints for long doubles.)
5249 EOM
5250         ;;
5251     esac
5252 fi
5253
5254 : Check if quadmath is requested
5255 case "$usequadmath" in
5256 "$define"|true|[yY]*) usequadmath="$define" ;;
5257 *)                    usequadmath="$undef"  ;;
5258 esac
5259
5260 : Fail if both uselongdouble and usequadmath are requested
5261 case "$usequadmath:$uselongdouble" in
5262 define:define)
5263         $cat <<EOM >&4
5264
5265 *** You requested the use of the quadmath library and use
5266 *** of long doubles.
5267 ***
5268 *** Please select one or the other.
5269 EOM
5270         exit 1
5271         ;;
5272 esac
5273
5274 : Looking for optional libraries
5275 echo " "
5276 echo "Checking for optional libraries..." >&4
5277 case "$libs" in
5278 ' '|'') dflt='';;
5279 *) dflt="$libs";;
5280 esac
5281 case "$libswanted" in
5282 '') libswanted='c_s';;
5283 esac
5284 case "$usesocks" in
5285 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5286 esac
5287 case "$usecbacktrace" in
5288 "$define") libswanted="$libswanted bfd" ;;
5289 esac
5290 case "$usequadmath" in
5291 "$define") libswanted="$libswanted quadmath" ;;
5292 esac
5293 libsfound=''
5294 libsfiles=''
5295 libsdirs=''
5296 libspath=''
5297 for thisdir in $libpth $xlibpth; do
5298   test -d $thisdir && libspath="$libspath $thisdir"
5299 done
5300 for thislib in $libswanted; do
5301         for thisdir in $libspath; do
5302             xxx=''
5303             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5304                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5305                 $test -f "$xxx" && eval $libscheck
5306                 $test -f "$xxx" && libstyle=shared
5307                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5308                 $test -f "$xxx" && eval $libscheck
5309                 $test -f "$xxx" && libstyle=shared
5310             fi
5311             if test ! -f "$xxx"; then
5312                 xxx=$thisdir/lib$thislib.$so
5313                 $test -f "$xxx" && eval $libscheck
5314                 $test -f "$xxx" && libstyle=shared
5315             fi
5316             if test ! -f "$xxx"; then
5317                 xxx=$thisdir/lib$thislib$_a
5318                 $test -f "$xxx" && eval $libscheck
5319                 $test -f "$xxx" && libstyle=static
5320             fi
5321             if test ! -f "$xxx"; then
5322                 xxx=$thisdir/$thislib$_a
5323                 $test -f "$xxx" && eval $libscheck
5324                 $test -f "$xxx" && libstyle=static
5325             fi
5326             if test ! -f "$xxx"; then
5327                 xxx=$thisdir/lib${thislib}_s$_a
5328                 $test -f "$xxx" && eval $libscheck
5329                 $test -f "$xxx" && libstyle=static
5330                 $test -f "$xxx" && thislib=${thislib}_s
5331             fi
5332             if test ! -f "$xxx"; then
5333                 xxx=$thisdir/Slib$thislib$_a
5334                 $test -f "$xxx" && eval $libscheck
5335                 $test -f "$xxx" && libstyle=static
5336             fi
5337             if $test -f "$xxx"; then
5338                 case "$libstyle" in
5339                 shared) echo "Found -l$thislib (shared)." ;;
5340                 static) echo "Found -l$thislib." ;;
5341                 *)      echo "Found -l$thislib ($libstyle)." ;;
5342                 esac
5343                 case " $dflt " in
5344                 *"-l$thislib "*);;
5345                 *) dflt="$dflt -l$thislib"
5346                    libsfound="$libsfound $xxx"
5347                    yyy=`basename $xxx`
5348                    libsfiles="$libsfiles $yyy"
5349                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5350                    case " $libsdirs " in
5351                    *" $yyy "*) ;;
5352                    *) libsdirs="$libsdirs $yyy" ;;
5353                    esac
5354                    ;;
5355                 esac
5356                 break
5357             fi
5358         done
5359         if $test ! -f "$xxx"; then
5360             echo "No -l$thislib."
5361         fi
5362 done
5363 set X $dflt
5364 shift
5365 dflt="$*"
5366 case "$libs" in
5367 '') dflt="$dflt";;
5368 *) dflt="$libs";;
5369 esac
5370 case "$dflt" in
5371 ' '|'') dflt='none';;
5372 esac
5373
5374 $cat <<EOM
5375
5376 In order to compile $package on your machine, a number of libraries
5377 are usually needed.  Include any other special libraries here as well.
5378 Say "none" for none.  The default list is almost always right.
5379 EOM
5380
5381 echo " "
5382 rp="What libraries to use?"
5383 . ./myread
5384 case "$ans" in
5385 none) libs=' ';;
5386 *) libs="$ans";;
5387 esac
5388
5389 : determine optimization, if desired, or use for debug flag also
5390 case "$optimize" in
5391 ' '|$undef) dflt='none';;
5392 '') dflt='-O';;
5393 *) dflt="$optimize";;
5394 esac
5395 $cat <<EOH
5396
5397 By default, $package compiles with the -O flag to use the optimizer.
5398 Alternately, you might want to use the symbolic debugger, which uses
5399 the -g flag (on traditional Unix systems).  Either flag can be
5400 specified here.  To use neither flag, specify the word "none".
5401
5402 EOH
5403 rp="What optimizer/debugger flag should be used?"
5404 . ./myread
5405 optimize="$ans"
5406 case "$optimize" in
5407 'none') optimize=" ";;
5408 esac
5409
5410 : Check what DEBUGGING is required from the command line
5411 : -DEBUGGING      or -DDEBUGGING or
5412 : -DEBUGGING=both                       = -g + -DDEBUGGING
5413 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5414 : -DEBUGGING=none or -UDEBUGGING        =
5415 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5416 case "$EBUGGING" in
5417 '')     ;;
5418 *)      DEBUGGING=$EBUGGING ;;
5419 esac
5420
5421 case "$DEBUGGING" in
5422 -g|both|$define)
5423     case "$optimize" in
5424         *-g*) ;;
5425         *)    optimize="$optimize -g" ;;
5426     esac ;;
5427 none|$undef)
5428     case "$optimize" in
5429         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5430                 shift
5431                 optimize="$*"
5432                 ;;
5433     esac ;;
5434 esac
5435
5436 dflt=''
5437 case "$DEBUGGING" in
5438 both|$define) dflt='-DDEBUGGING'
5439 esac
5440
5441 : argument order is deliberate, as the flag will start with - which set could
5442 : think is an option
5443 checkccflag='check=$1; flag=$2; callback=$3;
5444 echo " ";
5445 echo "Checking if your compiler accepts $flag" 2>&1;
5446 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5447 echo "int main(void) { return 0; }" > gcctest.c;
5448 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5449     echo "Yes, it does." 2>&1;
5450     if $test -s gcctest.out ; then
5451         echo "But your platform does not like it:";
5452         cat gcctest.out;
5453     else
5454         case "$ccflags" in
5455         *$check*)
5456             echo "Leaving current flags $ccflags alone." 2>&1
5457             ;;
5458         *) dflt="$dflt $flag";
5459             eval $callback
5460             ;;
5461         esac
5462     fi
5463 else
5464     echo "Nope, it does not, but that is ok." 2>&1;
5465 fi
5466 '
5467
5468 : We will not override a previous value, but we might want to
5469 : augment a hint file
5470 case "$hint" in
5471 default|recommended)
5472         case "$gccversion" in
5473         1*) dflt="$dflt -fpcc-struct-return" ;;
5474         esac
5475         case "$optimize:$DEBUGGING" in
5476         *-g*:old) dflt="$dflt -DDEBUGGING";;
5477         esac
5478         case "$gccversion" in
5479         2*) if $test -d /etc/conf/kconfig.d &&
5480                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5481                 then
5482                         # Interactive Systems (ISC) POSIX mode.
5483                         dflt="$dflt -posix"
5484                 fi
5485                 ;;
5486         esac
5487         case "$gccversion" in
5488         1*) ;;
5489         2.[0-8]*) ;;
5490         ?*)     set strict-aliasing -fno-strict-aliasing
5491                 eval $checkccflag
5492                 ;;
5493         esac
5494         # For gcc, adding -pipe speeds up compilations for some, but apparently
5495         # some assemblers can't read from stdin.  (It also slows down compilations
5496         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5497         case "$gccversion" in
5498         ?*)     set pipe -pipe
5499                 eval $checkccflag
5500                 ;;
5501         esac
5502
5503         # on x86_64 (at least) we require an extra library (libssp) in the
5504         # link command line. This library is not named, so I infer that it is
5505         # an implementation detail that may change. Hence the safest approach
5506         # is to add the flag to the flags passed to the compiler at link time,
5507         # as that way the compiler can do the right implementation dependant
5508         # thing. (NWC)
5509         case "$osname" in
5510         amigaos) ;; # -fstack-protector builds but doesn't work
5511         *)      case "$gccversion" in
5512                 ?*)     set stack-protector-strong -fstack-protector-strong
5513                         eval $checkccflag
5514                         case "$dflt" in
5515                         *-fstack-protector-strong*) ;; # It got added.
5516                         *) # Try the plain/older -fstack-protector.
5517                            set stack-protector -fstack-protector
5518                            eval $checkccflag
5519                            ;;
5520                         esac
5521                         ;;
5522                 esac
5523                 ;;
5524         esac
5525         ;;
5526 esac
5527
5528 case "$mips_type" in
5529 *BSD*|'') inclwanted="$locincpth $usrinc";;
5530 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5531 esac
5532 for thisincl in $inclwanted; do
5533         if $test -d $thisincl; then
5534                 if $test x$thisincl != x$usrinc; then
5535                         case "$dflt" in
5536                         *" -I$thisincl "*);;
5537                         *) dflt="$dflt -I$thisincl ";;
5538                         esac
5539                 fi
5540         fi
5541 done
5542
5543 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5544         xxx=true;
5545 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5546         xxx=true;
5547 else
5548         xxx=false;
5549 fi;
5550 if $xxx; then
5551         case "$dflt" in
5552         *$2*);;
5553         *) dflt="$dflt -D$2";;
5554         esac;
5555 fi'
5556
5557 set signal.h LANGUAGE_C; eval $inctest
5558
5559 case "$usesocks" in
5560 $define)
5561         ccflags="$ccflags -DSOCKS"
5562         ;;
5563 esac
5564
5565 case "$hint" in
5566 default|recommended) dflt="$ccflags $dflt" ;;
5567 *) dflt="$ccflags";;
5568 esac
5569
5570 case "$dflt" in
5571 ''|' ') dflt=none;;
5572 esac
5573
5574 $cat <<EOH
5575
5576 Your C compiler may want other flags.  For this question you should include
5577 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5578 but you should NOT include libraries or ld flags like -lwhatever.  If you
5579 want $package to honor its debug switch, you should include -DDEBUGGING here.
5580 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5581
5582 To use no flags, specify the word "none".
5583
5584 EOH
5585 set X $dflt
5586 shift
5587 dflt=${1+"$@"}
5588 rp="Any additional cc flags?"
5589 . ./myread
5590 case "$ans" in
5591 none) ccflags='';;
5592 *) ccflags="$ans";;
5593 esac
5594
5595 : the following weeds options from ccflags that are of no interest to cpp
5596 case "$cppflags" in
5597 '') cppflags="$ccflags" ;;
5598 *)  set X $ccflags; shift
5599     case " $cppflags " in
5600     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5601     *) cppflags="$cppflags $ccflags" ;;
5602     esac
5603     ;;
5604 esac
5605 case "$gccversion" in
5606 1*) cppflags="$cppflags -D__GNUC__"
5607 esac
5608 case "$mips_type" in
5609 '');;
5610 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5611 esac
5612 case "$cppflags" in
5613 '');;
5614 *)
5615         echo " "
5616         echo "Let me guess what the preprocessor flags are..." >&4
5617         set X $cppflags
5618         shift
5619         cppflags=''
5620         $cat >cpp.c <<'EOM'
5621 #define BLURFL foo
5622
5623 BLURFL xx LFRULB
5624 EOM
5625         previous=''
5626         for flag in $*
5627         do
5628                 case "$flag" in
5629                 -*) ftry="$flag";;
5630                 *) ftry="$previous $flag";;
5631                 esac
5632                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5633                         >cpp1.out 2>/dev/null && \
5634                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5635                         >cpp2.out 2>/dev/null && \
5636                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5637                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5638                 then
5639                         cppflags="$cppflags $ftry"
5640                         previous=''
5641                 else
5642                         previous="$flag"
5643                 fi
5644         done
5645         set X $cppflags
5646         shift
5647         cppflags=${1+"$@"}
5648         case "$cppflags" in
5649         *-*)  echo "They appear to be: $cppflags";;
5650         esac
5651         $rm -f cpp.c cpp?.out
5652         ;;
5653 esac
5654
5655 : flags used in final linking phase
5656 case "$ldflags" in
5657 '') if ./venix; then
5658                 dflt='-i -z'
5659         else
5660                 dflt=''
5661         fi
5662         case "$ccflags" in
5663         *-posix*) dflt="$dflt -posix" ;;
5664         esac
5665         ;;
5666 *) dflt="$ldflags";;
5667 esac
5668 # See note above about -fstack-protector
5669 case "$ccflags" in
5670 *-fstack-protector-strong*)
5671         case "$dflt" in
5672         *-fstack-protector-strong*) ;; # Don't add it again
5673         *) dflt="$dflt -fstack-protector-strong" ;;
5674         esac
5675         ;;
5676 *-fstack-protector*)
5677         case "$dflt" in
5678         *-fstack-protector*) ;; # Don't add it again
5679         *) dflt="$dflt -fstack-protector" ;;
5680         esac
5681         ;;
5682 esac
5683
5684 : Try to guess additional flags to pick up local libraries.
5685 for thislibdir in $libpth; do
5686         case " $loclibpth " in
5687         *" $thislibdir "*)
5688                 case "$dflt " in
5689                 *"-L$thislibdir "*) ;;
5690                 *)  dflt="$dflt -L$thislibdir" ;;
5691                 esac
5692                 ;;
5693         esac
5694 done
5695
5696 case "$dflt" in
5697 '') dflt='none' ;;
5698 esac
5699
5700 $cat <<EOH
5701
5702 Your C linker may need flags.  For this question you should
5703 include -L/whatever and any other flags used by the C linker, but you
5704 should NOT include libraries like -lwhatever.
5705
5706 Make sure you include the appropriate -L/path flags if your C linker
5707 does not normally search all of the directories you specified above,
5708 namely
5709         $libpth
5710 To use no flags, specify the word "none".
5711
5712 EOH
5713
5714 rp="Any additional ld flags (NOT including libraries)?"
5715 . ./myread
5716 case "$ans" in
5717 none) ldflags='';;
5718 *) ldflags="$ans";;
5719 esac
5720 rmlist="$rmlist pdp11"
5721
5722 : coherency check
5723 echo " "
5724 echo "Checking your choice of C compiler and flags for coherency..." >&4
5725 $cat > try.c <<'EOF'
5726 #include <stdio.h>
5727 int main() { printf("Ok\n"); return(0); }
5728 EOF
5729 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5730 shift
5731 $cat >try.msg <<'EOM'
5732 I've tried to compile and run the following simple program:
5733
5734 EOM
5735 $cat try.c >> try.msg
5736
5737 $cat >> try.msg <<EOM
5738
5739 I used the command:
5740
5741         $*
5742         $run ./try
5743
5744 and I got the following output:
5745
5746 EOM
5747 dflt=y
5748 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5749         if $sh -c "$run ./try " >>try.msg 2>&1; then
5750                 xxx=`$run ./try`
5751                 case "$xxx" in
5752                 "Ok") dflt=n ;;
5753                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5754                 esac
5755         else
5756                 echo "The program compiled OK, but exited with status $?." >>try.msg
5757                 rp="You have a problem.  Shall I abort Configure"
5758                 dflt=y
5759         fi
5760 else
5761         echo "I can't compile the test program." >>try.msg
5762         rp="You have a BIG problem.  Shall I abort Configure"
5763         dflt=y
5764 fi
5765 case "$dflt" in
5766 y)
5767         $cat try.msg >&4
5768         case "$knowitall" in
5769         '')
5770                 echo "(The supplied flags or libraries might be incorrect.)"
5771                 ;;
5772         *) dflt=n;;
5773         esac
5774         echo " "
5775         . ./myread
5776         case "$ans" in
5777         n*|N*) ;;
5778         *)      echo "Ok.  Stopping Configure." >&4
5779                 exit 1
5780                 ;;
5781         esac
5782         ;;
5783 n) echo "OK, that should do.";;
5784 esac
5785 $rm_try gcctest gcctest.out
5786
5787 : define a shorthand compile call
5788 compile='
5789 mc_file=$1;
5790 shift;
5791 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5792 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5793 exit 1;
5794 fi;
5795 esac;
5796 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5797 : define a shorthand compile call for compilations that should be ok.
5798 compile_ok='
5799 mc_file=$1;
5800 shift;
5801 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5802
5803 : determine filename position in cpp output
5804 echo " "
5805 echo "Computing filename position in cpp output for #include directives..." >&4
5806 case "$osname" in
5807 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5808 esac
5809 case "$fieldn" in
5810 '')
5811 case "$osname" in
5812 vos) testaccess=-e ;;
5813 *)   testaccess=-r ;;
5814 esac
5815 echo '#include <stdio.h>' > foo.c
5816 $cat >fieldn <<EOF
5817 $startsh
5818 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5819 $grep '^[       ]*#.*stdio\.h' | \
5820 while read cline; do
5821         pos=1
5822         set \$cline
5823         while $test \$# -gt 0; do
5824                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5825                         echo "\$pos"
5826                         exit 0
5827                 fi
5828                 shift
5829                 pos=\`expr \$pos + 1\`
5830         done
5831 done
5832 EOF
5833 chmod +x fieldn
5834 fieldn=`./fieldn`
5835 $rm -f foo.c fieldn
5836 ;;
5837 esac
5838 case $fieldn in
5839 '') pos='???';;
5840 1) pos=first;;
5841 2) pos=second;;
5842 3) pos=third;;
5843 *) pos="${fieldn}th";;
5844 esac
5845 echo "Your cpp writes the filename in the $pos field of the line."
5846
5847 : locate header file
5848 $cat >findhdr <<EOF
5849 $startsh
5850 wanted=\$1
5851 name=''
5852 for usrincdir in $incpth
5853 do
5854         if test -f \$usrincdir/\$wanted; then
5855                 echo "\$usrincdir/\$wanted"
5856                 exit 0
5857         fi
5858 done
5859 awkprg='{ print \$$fieldn }'
5860 echo "#include <\$wanted>" > foo\$\$.c
5861 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5862 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5863 while read cline; do
5864         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5865         case "\$name" in
5866         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5867         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5868         *) exit 2;;
5869         esac;
5870 done;
5871 #
5872 # status = 0: grep returned 0 lines, case statement not executed
5873 # status = 1: headerfile found
5874 # status = 2: while loop executed, no headerfile found
5875 #
5876 status=\$?
5877 $rm -f foo\$\$.c;
5878 if test \$status -eq 1; then
5879         exit 0;
5880 fi
5881 exit 1
5882 EOF
5883 chmod +x findhdr
5884
5885 : define an alternate in-header-list? function
5886 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5887 cont=true; xxf="echo \"<\$1> found.\" >&4";
5888 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5889 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5890 esac;
5891 case $# in 4) instead=instead;; *) instead="at last";; esac;
5892 while $test "$cont"; do
5893         xxx=`./findhdr $1`
5894         var=$2; eval "was=\$$2";
5895         if $test "$xxx" && $test -r "$xxx";
5896         then eval $xxf;
5897         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5898                 cont="";
5899         else eval $xxnf;
5900         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5901         set $yyy; shift; shift; yyy=$@;
5902         case $# in 0) cont="";;
5903         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5904                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5905         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5906                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5907         esac;
5908 done;
5909 while $test "$yyy";
5910 do set $yyy; var=$2; eval "was=\$$2";
5911         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5912         set $yyy; shift; shift; yyy=$@;
5913 done'
5914
5915 : see if stdlib is available
5916 set stdlib.h i_stdlib
5917 eval $inhdr
5918
5919 : check for lengths of integral types
5920 echo " "
5921 case "$intsize" in
5922 '')
5923         echo "Checking to see how big your integers are..." >&4
5924         $cat >try.c <<EOCP
5925 #include <stdio.h>
5926 #$i_stdlib I_STDLIB
5927 #ifdef I_STDLIB
5928 #include <stdlib.h>
5929 #endif
5930 int main()
5931 {
5932         printf("intsize=%d;\n", (int)sizeof(int));
5933         printf("longsize=%d;\n", (int)sizeof(long));
5934         printf("shortsize=%d;\n", (int)sizeof(short));
5935         exit(0);
5936 }
5937 EOCP
5938         set try
5939         if eval $compile_ok && $run ./try > /dev/null; then
5940                 eval `$run ./try`
5941                 echo "Your integers are $intsize bytes long."
5942                 echo "Your long integers are $longsize bytes long."
5943                 echo "Your short integers are $shortsize bytes long."
5944         else
5945                 $cat >&4 <<EOM
5946 !
5947 Help! I can't compile and run the intsize test program: please enlighten me!
5948 (This is probably a misconfiguration in your system or libraries, and
5949 you really ought to fix it.  Still, I'll try anyway.)
5950 !
5951 EOM
5952                 dflt=4
5953                 rp="What is the size of an integer (in bytes)?"
5954                 . ./myread
5955                 intsize="$ans"
5956                 dflt=$intsize
5957                 rp="What is the size of a long integer (in bytes)?"
5958                 . ./myread
5959                 longsize="$ans"
5960                 dflt=2
5961                 rp="What is the size of a short integer (in bytes)?"
5962                 . ./myread
5963                 shortsize="$ans"
5964         fi
5965         ;;
5966 esac
5967 $rm_try
5968
5969 : check for long long
5970 echo " "
5971 echo "Checking to see if you have long long..." >&4
5972 echo 'int main() { long long x = 7; return 0; }' > try.c
5973 set try
5974 if eval $compile; then
5975         val="$define"
5976         echo "You have long long."
5977 else
5978         val="$undef"
5979         echo "You do not have long long."
5980 fi
5981 $rm_try
5982 set d_longlong
5983 eval $setvar
5984
5985 : check for length of long long
5986 case "${d_longlong}${longlongsize}" in
5987 $define)
5988         echo " "
5989         echo "Checking to see how big your long longs are..." >&4
5990         $cat >try.c <<'EOCP'
5991 #include <stdio.h>
5992 int main()
5993 {
5994     printf("%d\n", (int)sizeof(long long));
5995     return(0);
5996 }
5997 EOCP
5998         set try
5999         if eval $compile_ok; then
6000                 longlongsize=`$run ./try`
6001                 echo "Your long longs are $longlongsize bytes long."
6002         else
6003                 dflt='8'
6004                 echo " "
6005                 echo "(I can't seem to compile the test program.  Guessing...)"
6006                 rp="What is the size of a long long (in bytes)?"
6007                 . ./myread
6008                 longlongsize="$ans"
6009         fi
6010         if $test "X$longsize" = "X$longlongsize"; then
6011                 echo "(That isn't any different from an ordinary long.)"
6012         fi
6013         ;;
6014 esac
6015 $rm_try
6016
6017 : see if inttypes.h is available
6018 : we want a real compile instead of Inhdr because some systems
6019 : have an inttypes.h which includes non-existent headers
6020 echo " "
6021 $cat >try.c <<EOCP
6022 #include <inttypes.h>
6023 int main() {
6024         static int32_t foo32 = 0x12345678;
6025 }
6026 EOCP
6027 set try
6028 if eval $compile; then
6029         echo "<inttypes.h> found." >&4
6030         val="$define"
6031 else
6032         echo "<inttypes.h> NOT found." >&4
6033         val="$undef"
6034 fi
6035 $rm_try
6036 set i_inttypes
6037 eval $setvar
6038
6039 : check for int64_t
6040 echo " "
6041 echo "Checking to see if you have int64_t..." >&4
6042 $cat >try.c <<EOCP
6043 #include <sys/types.h>
6044 #$i_inttypes I_INTTYPES
6045 #ifdef I_INTTYPES
6046 #include <inttypes.h>
6047 #endif
6048 int main() { int64_t x = 7; }
6049 EOCP
6050 set try
6051 if eval $compile; then
6052         val="$define"
6053         echo "You have int64_t."
6054 else
6055         val="$undef"
6056         echo "You do not have int64_t."
6057 fi
6058 $rm_try
6059 set d_int64_t
6060 eval $setvar
6061
6062 : Check if 64bit ints have a quad type
6063 echo " "
6064 echo "Checking which 64-bit integer type we could use..." >&4
6065
6066 case "$intsize" in
6067 8) val=int
6068    set quadtype
6069    eval $setvar
6070    val='"unsigned int"'
6071    set uquadtype
6072    eval $setvar
6073    quadkind=1
6074    ;;
6075 *) case "$longsize" in
6076    8) val=long
6077       set quadtype
6078       eval $setvar
6079       val='"unsigned long"'
6080       set uquadtype
6081       eval $setvar
6082       quadkind=2
6083       ;;
6084    *) case "$d_longlong:$longlongsize" in
6085       define:8)
6086         val='"long long"'
6087         set quadtype
6088         eval $setvar
6089         val='"unsigned long long"'
6090         set uquadtype
6091         eval $setvar
6092         quadkind=3
6093         ;;
6094       *) case "$d_int64_t" in
6095          define)
6096            val=int64_t
6097            set quadtype
6098            eval $setvar
6099            val=uint64_t
6100            set uquadtype
6101            eval $setvar
6102            quadkind=4
6103            ;;
6104          esac
6105          ;;
6106       esac
6107       ;;
6108    esac
6109    ;;
6110 esac
6111
6112 case "$quadtype" in
6113 '')     echo "Alas, no 64-bit integer types in sight." >&4
6114         d_quad="$undef"
6115         ;;
6116 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6117         d_quad="$define"
6118         ;;
6119 esac
6120
6121 : Do we want 64bit support
6122 case "$uselonglong" in
6123 "$define"|true|[yY]*)
6124         cat <<EOM >&4
6125
6126 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6127 EOM
6128         use64bitint="$define"
6129         ;;
6130 esac
6131 case "$use64bits" in
6132 "$define"|true|[yY]*)
6133         cat <<EOM >&4
6134
6135 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6136 EOM
6137         use64bitint="$define"
6138         ;;
6139 esac
6140 case "$use64bitints" in
6141 "$define"|true|[yY]*)
6142         cat <<EOM >&4
6143
6144 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6145 EOM
6146         use64bitint="$define"
6147         ;;
6148 esac
6149 case "$use64bitsint" in
6150 "$define"|true|[yY]*)
6151         cat <<EOM >&4
6152
6153 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6154 EOM
6155         use64bitint="$define"
6156         ;;
6157 esac
6158 case "$uselonglongs" in
6159 "$define"|true|[yY]*)
6160         cat <<EOM >&4
6161
6162 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6163 EOM
6164         use64bitint="$define"
6165         ;;
6166 esac
6167 case "$use64bitsall" in
6168 "$define"|true|[yY]*)
6169         cat <<EOM >&4
6170
6171 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6172 EOM
6173         use64bitall="$define"
6174         ;;
6175 esac
6176
6177 case "$ccflags" in
6178 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6179 esac
6180 case "$use64bitall" in
6181 "$define"|true|[yY]*) use64bitint="$define" ;;
6182 esac
6183
6184 case "$longsize" in
6185 8) cat <<EOM
6186
6187 You have natively 64-bit long integers.
6188 EOM
6189    val="$define"
6190    ;;
6191 *) case "$use64bitint" in
6192    "$define"|true|[yY]*) dflt='y';;
6193    *) dflt='n';;
6194    esac
6195    case "$d_quad" in
6196    "$define") ;;
6197    *) dflt='n' ;;
6198    esac
6199    cat <<EOM
6200
6201 Perl can be built to take advantage of 64-bit integer types
6202 on some systems.  To do so, Configure can be run with -Duse64bitint.
6203 Choosing this option will most probably introduce binary incompatibilities.
6204
6205 If this doesn't make any sense to you, just accept the default '$dflt'.
6206 (The default has been chosen based on your configuration.)
6207 EOM
6208    rp='Try to use 64-bit integers, if available?'
6209    . ./myread
6210    case "$ans" in
6211    [yY]*) val="$define" ;;
6212    *)     val="$undef"  ;;
6213    esac
6214    ;;
6215 esac
6216 set use64bitint
6217 eval $setvar
6218
6219 case "$use64bitall" in
6220 "$define"|true|[yY]*) dflt='y' ;;
6221 *) case "$longsize" in
6222    8) dflt='y' ;;
6223    *) dflt='n' ;;
6224    esac
6225    ;;
6226 esac
6227 cat <<EOM
6228
6229 You may also choose to try maximal 64-bitness.  It means using as much
6230 64-bitness as possible on the platform.  This in turn means even more
6231 binary incompatibilities.  On the other hand, your platform may not
6232 have any more 64-bitness available than what you already have chosen.
6233
6234 If this doesn't make any sense to you, just accept the default '$dflt'.
6235 (The default has been chosen based on your configuration.)
6236 EOM
6237 rp='Try to use maximal 64-bit support, if available?'
6238 . ./myread
6239 case "$ans" in
6240 [yY]*) val="$define" ;;
6241 *)     val="$undef"  ;;
6242 esac
6243 set use64bitall
6244 eval $setvar
6245 case "$use64bitall" in
6246 "$define")
6247         case "$use64bitint" in
6248         "$undef")
6249                 cat <<EOM
6250
6251 Since you have chosen a maximally 64-bit build, I'm also turning on
6252 the use of 64-bit integers.
6253 EOM
6254                 use64bitint="$define" ;;
6255         esac
6256         ;;
6257 esac
6258
6259 : Look for a hint-file generated 'call-back-unit'.  If the
6260 : user has specified that a 64-bit perl is to be built,
6261 : we may need to set or change some other defaults.
6262 if $test -f use64bitint.cbu; then
6263         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6264         . ./use64bitint.cbu
6265 fi
6266 case "$use64bitint" in
6267 "$define"|true|[yY]*)
6268         : This test was common to all the OpenBSD forks, and seems harmless for
6269         : other platforms:
6270         echo " "
6271         echo "Checking if your C library has broken 64-bit functions..." >&4
6272         cat >try.c <<EOCP
6273 #include <stdio.h>
6274 typedef $uquadtype myULL;
6275 int main (void)
6276 {
6277     struct {
6278         double d;
6279         myULL  u;
6280     } *p, test[] = {
6281         {4294967303.15, 4294967303ULL},
6282         {4294967294.2,  4294967294ULL},
6283         {4294967295.7,  4294967295ULL},
6284         {0.0, 0ULL}
6285     };
6286     for (p = test; p->u; p++) {
6287         myULL x = (myULL)p->d;
6288         if (x != p->u) {
6289             printf("buggy\n");
6290             return 0;
6291         }
6292     }
6293     printf("ok\n");
6294     return 0;
6295 }
6296 EOCP
6297         set try
6298         if eval $compile_ok; then
6299             libcquad=`$run ./try`
6300             echo "Your C library's 64-bit functions are $libcquad."
6301         else
6302             echo "(I can't seem to compile the test program.)"
6303             echo "Assuming that your C library's 64-bit functions are ok."
6304             libcquad="ok"
6305         fi
6306         $rm_try
6307
6308         case "$libcquad" in
6309             buggy*)
6310                 cat >&4 <<EOM
6311
6312 *** You have a C library with broken 64-bit functions.
6313 *** 64-bit support does not work reliably in this configuration.
6314 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6315 *** Cannot continue, aborting.
6316
6317 EOM
6318                 exit 1
6319                 ;;
6320         esac
6321         case "$longsize" in
6322         4) case "$archname64" in
6323            '') archname64=64int ;;
6324            esac
6325            ;;
6326         esac
6327         ;;
6328 esac
6329
6330 : Look for a hint-file generated 'call-back-unit'.  If the
6331 : user has specified that a maximally 64-bit perl is to be built,
6332 : we may need to set or change some other defaults.
6333 if $test -f use64bitall.cbu; then
6334         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6335         . ./use64bitall.cbu
6336 fi
6337 case "$use64bitall" in
6338 "$define"|true|[yY]*)
6339         case "$longsize" in
6340         4) case "$archname64" in
6341            ''|64int) archname64=64all ;;
6342            esac
6343            ;;
6344         esac
6345         ;;
6346 esac
6347
6348 case "$d_quad:$use64bitint" in
6349 $undef:$define)
6350         cat >&4 <<EOF
6351
6352 *** You have chosen to use 64-bit integers,
6353 *** but none can be found.
6354 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6355 *** Cannot continue, aborting.
6356
6357 EOF
6358         exit 1
6359         ;;
6360 esac
6361
6362 : Check if we are using the GNU C library
6363 echo " "
6364 echo "Checking for GNU C Library..." >&4
6365 cat >try.c <<'EOCP'
6366 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6367    alone are insufficient to distinguish different versions, such as
6368    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6369    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6370 */
6371 #include <stdio.h>
6372 int main(void)
6373 {
6374 #ifdef __GLIBC__
6375 #   ifdef __GLIBC_MINOR__
6376 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6377 #           include <gnu/libc-version.h>
6378             printf("%s\n",  gnu_get_libc_version());
6379 #       else
6380             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6381 #       endif
6382 #   else
6383         printf("%d\n",  __GLIBC__);
6384 #   endif
6385     return 0;
6386 #else
6387     return 1;
6388 #endif
6389 }
6390 EOCP
6391 set try
6392 if eval $compile_ok && $run ./try > glibc.ver; then
6393         val="$define"
6394         gnulibc_version=`$cat glibc.ver`
6395         echo "You are using the GNU C Library version $gnulibc_version"
6396 else
6397         val="$undef"
6398         gnulibc_version=''
6399         echo "You are not using the GNU C Library"
6400 fi
6401 $rm_try glibc.ver
6402 set d_gnulibc
6403 eval $setvar
6404
6405 : see if nm is to be used to determine whether a symbol is defined or not
6406 case "$usenm" in
6407 '')
6408         dflt=''
6409         case "$d_gnulibc" in
6410         "$define")
6411                 echo " "
6412                 echo "nm probably won't work on the GNU C Library." >&4
6413                 dflt=n
6414                 ;;
6415         esac
6416         case "$dflt" in
6417         '')
6418                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6419                         echo " "
6420                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6421                         echo "'nm' won't be sufficient on this system." >&4
6422                         dflt=n
6423                 fi
6424                 ;;
6425         esac
6426         case "$dflt" in
6427         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6428                 if $test $dflt -gt 20; then
6429                         dflt=y
6430                 else
6431                         dflt=n
6432                 fi
6433                 ;;
6434         esac
6435         ;;
6436 *)
6437         case "$usenm" in
6438         true|$define) dflt=y;;
6439         *) dflt=n;;
6440         esac
6441         ;;
6442 esac
6443 $cat <<EOM
6444
6445 I can use $nm to extract the symbols from your C libraries. This
6446 is a time consuming task which may generate huge output on the disk (up
6447 to 3 megabytes) but that should make the symbols extraction faster. The
6448 alternative is to skip the 'nm' extraction part and to compile a small
6449 test program instead to determine whether each symbol is present. If
6450 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6451 this may be the best solution.
6452
6453 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6454
6455 EOM
6456 rp="Shall I use $nm to extract C symbols from the libraries?"
6457 . ./myread
6458 case "$ans" in
6459 [Nn]*) usenm=false;;
6460 *) usenm=true;;
6461 esac
6462
6463 runnm=$usenm
6464 case "$reuseval" in
6465 true) runnm=false;;
6466 esac
6467
6468 : nm options which may be necessary
6469 case "$nm_opt" in
6470 '') if $test -f /mach_boot; then
6471                 nm_opt=''       # Mach
6472         elif $test -d /usr/ccs/lib; then
6473                 nm_opt='-p'     # Solaris (and SunOS?)
6474         elif $test -f /dgux; then
6475                 nm_opt='-p'     # DG-UX
6476         elif $test -f /lib64/rld; then
6477                 nm_opt='-p'     # 64-bit Irix
6478         else
6479                 nm_opt=''
6480         fi;;
6481 esac
6482
6483 : nm options which may be necessary for shared libraries but illegal
6484 : for archive libraries.  Thank you, Linux.
6485 case "$nm_so_opt" in
6486 '')     case "$myuname" in
6487         *linux*|gnu*)
6488                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6489                         nm_so_opt='--dynamic'
6490                 fi
6491                 ;;
6492         esac
6493         ;;
6494 esac
6495
6496 : Figure out where the libc is located
6497 case "$runnm" in
6498 true)
6499 : get list of predefined functions in a handy place
6500 echo " "
6501 case "$libc" in
6502 '') libc=unknown
6503         case "$libs" in
6504         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6505         esac
6506         ;;
6507 esac
6508 case "$libs" in
6509 '') ;;
6510 *)  for thislib in $libs; do
6511         case "$thislib" in
6512         -lc|-lc_s)
6513                 : Handle C library specially below.
6514                 ;;
6515         -l*)
6516                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6517                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6518                         :
6519                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6520                         :
6521                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6522                         :
6523                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6524                         :
6525                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6526                         :
6527                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6528                         :
6529                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6530                         :
6531                 else
6532                         try=''
6533                 fi
6534                 libnames="$libnames $try"
6535                 ;;
6536         *) libnames="$libnames $thislib" ;;
6537         esac
6538         done
6539         ;;
6540 esac
6541 xxx=normal
6542 case "$libc" in
6543 unknown)
6544         set /lib/libc.$so
6545         for xxx in $libpth; do
6546                 $test -r $1 || set $xxx/libc.$so
6547                 : The messy sed command sorts on library version numbers.
6548                 $test -r $1 || \
6549                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6550                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6551                                 h
6552                                 s/[0-9][0-9]*/0000&/g
6553                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6554                                 G
6555                                 s/\n/ /' | \
6556                          $sort | $sed -e 's/^.* //'`
6557                 eval set \$$#
6558         done
6559         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6560         $test -r $1 || set $sysroot/lib/libsys_s$_a
6561         ;;
6562 *)
6563         set blurfl
6564         ;;
6565 esac
6566 if $test -r "$1"; then
6567         echo "Your (shared) C library seems to be in $1."
6568         libc="$1"
6569 elif $test -r /lib/libc && $test -r /lib/clib; then
6570         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6571         xxx=apollo
6572         libc='/lib/clib /lib/libc'
6573         if $test -r /lib/syslib; then
6574                 echo "(Your math library is in /lib/syslib.)"
6575                 libc="$libc /lib/syslib"
6576         fi
6577 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6578         echo "Your C library seems to be in $libc, as you said before."
6579 elif $test -r $incpath/usr/lib/libc$_a; then
6580         libc=$incpath/usr/lib/libc$_a;
6581         echo "Your C library seems to be in $libc.  That's fine."
6582 elif $test -r /lib/libc$_a; then
6583         libc=/lib/libc$_a;
6584         echo "Your C library seems to be in $libc.  You're normal."
6585 else
6586         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6587                 :
6588         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6589                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6590         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6591                 :
6592         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6593                 :
6594         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6595                 :
6596         else
6597                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6598         fi
6599         if $test -r "$tans"; then
6600                 echo "Your C library seems to be in $tans, of all places."
6601                 libc=$tans
6602         else
6603                 libc='blurfl'
6604         fi
6605 fi
6606 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6607         dflt="$libc"
6608         cat <<EOM
6609
6610 If the guess above is wrong (which it might be if you're using a strange
6611 compiler, or your machine supports multiple models), you can override it here.
6612
6613 EOM
6614 else
6615         dflt=''
6616         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6617         cat >&4 <<EOM
6618 I can't seem to find your C library.  I've looked in the following places:
6619
6620 EOM
6621         $sed 's/^/      /' libpath
6622         cat <<EOM
6623
6624 None of these seems to contain your C library. I need to get its name...
6625
6626 EOM
6627 fi
6628 fn=f
6629 rp='Where is your C library?'
6630 . ./getfile
6631 libc="$ans"
6632
6633 echo " "
6634 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6635 set X `cat libnames`
6636 shift
6637 xxx=files
6638 case $# in 1) xxx=file; esac
6639 echo "Extracting names from the following $xxx for later perusal:" >&4
6640 echo " "
6641 $sed 's/^/      /' libnames >&4
6642 echo " "
6643 $echo $n "This may take a while...$c" >&4
6644
6645 for file in $*; do
6646         case $file in
6647         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6648         *) $nm $nm_opt $file 2>/dev/null;;
6649         esac
6650 done >libc.tmp
6651
6652 $echo $n ".$c"
6653 $grep fprintf libc.tmp > libc.ptf
6654 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6655 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6656 xxx='[ADTSIWi]'
6657 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6658         eval $xscan;\
6659         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6660                 eval $xrun
6661 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6662         eval $xscan;\
6663         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6664                 eval $xrun
6665 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6666         eval $xscan;\
6667         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6668                 eval $xrun
6669 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6670         eval $xscan;\
6671         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6672                 eval $xrun
6673 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6674         eval $xscan;\
6675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6676                 eval $xrun
6677 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6678         eval $xscan;\
6679         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6680                 eval $xrun
6681 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6682                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6683         eval $xscan;\
6684         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6685                 eval $xrun
6686 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6687         eval $xscan;\
6688         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6689                 eval $xrun
6690 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6691         eval $xscan;\
6692         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6693                 eval $xrun
6694 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6695         eval $xscan;\
6696         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6697                 eval $xrun
6698 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6699         eval $xscan;\
6700         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6701                 eval $xrun
6702 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6703         eval $xscan;\
6704         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6705                 eval $xrun
6706 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6707         eval $xscan;\
6708         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6709                 eval $xrun
6710 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6711         eval $xscan;\
6712         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6713                 eval $xrun
6714 else
6715         $nm -p $* 2>/dev/null >libc.tmp
6716         $grep fprintf libc.tmp > libc.ptf
6717         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6718                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6719         then
6720                 nm_opt='-p'
6721                 eval $xrun
6722         else
6723                 echo " "
6724                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6725                 com=''
6726                 if $ar t $libc > libc.tmp && \
6727                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6728                 then
6729                         for thisname in $libnames $libc; do
6730                                 $ar t $thisname >>libc.tmp
6731                         done
6732                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6733                         echo "Ok." >&4
6734                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6735                         for thisname in $libnames $libc; do
6736                                 $ar tv $thisname >>libc.tmp
6737                                 emximp -o tmp.imp $thisname \
6738                                     2>/dev/null && \
6739                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6740                                     < tmp.imp >>libc.tmp
6741                                 $rm -f tmp.imp
6742                         done
6743                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6744                         echo "Ok." >&4
6745                 else
6746                         echo "$ar didn't seem to work right." >&4
6747                         echo "Maybe this is a Cray...trying bld instead..." >&4
6748                         if  bld t $libc | \
6749                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6750                                 $test -s libc.list
6751                         then
6752                                 for thisname in $libnames; do
6753                                         bld t $libnames | \
6754                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6755                                         $ar t $thisname >>libc.tmp
6756                                 done
6757                                 echo "Ok." >&4
6758                         else
6759                                 echo "That didn't work either.  Giving up." >&4
6760                                 exit 1
6761                         fi
6762                 fi
6763         fi
6764 fi
6765 nm_extract="$com"
6766 case "$PASE" in
6767 define)
6768     echo " "
6769     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6770     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6771     ;;
6772 *)  if $test -f /lib/syscalls.exp; then
6773         echo " "
6774         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6775         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6776                 /lib/syscalls.exp >>libc.list
6777     fi
6778     ;;
6779 esac
6780 ;;
6781 esac
6782 $rm -f libnames libpath
6783
6784 : Check if we are using C++
6785 echo " "
6786 echo "Checking for C++..." >&4
6787 $cat >try.c <<'EOCP'
6788 #include <stdio.h>
6789 int main(void)
6790 {
6791 #ifdef __cplusplus
6792     return 0;
6793 #else
6794     return 1;
6795 #endif
6796 }
6797 EOCP
6798 set try
6799 if eval $compile_ok && $run ./try; then
6800         val="$define"
6801         echo "You are using a C++ compiler."
6802 else
6803         val="$undef"
6804         echo "You are not using a C++ compiler."
6805 fi
6806 $rm_try cplusplus$$
6807 set d_cplusplus
6808 eval $setvar
6809
6810 : is a C symbol defined?
6811 csym='tlook=$1;
6812 case "$3" in
6813 -v) tf=libc.tmp; tdc="";;
6814 -a) tf=libc.tmp; tdc="[]";;
6815 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6816 esac;
6817 case "$d_cplusplus" in
6818     $define)    extern_C="extern \"C\"" ;;
6819     *)          extern_C="extern"       ;;
6820 esac;
6821 tx=yes;
6822 case "$reuseval-$4" in
6823 true-) ;;
6824 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6825 esac;
6826 case "$tx" in
6827 yes)
6828         tval=false;
6829         if $test "$runnm" = true; then
6830                 if $contains $tlook $tf >/dev/null 2>&1; then
6831                         tval=true;
6832                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6833                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main(int argc, char **argv) { if(p() && p() != (void *)argv[0]) return(0); else return(1); }"> try.c;
6834                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6835                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6836                         $rm_try;
6837                 fi;
6838         else
6839                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main(int argc, char **argv) { if(p() && p() != (void *)argv[0]) return(0); else return(1); }"> try.c;
6840                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6841                 $rm_try;
6842         fi;
6843         ;;
6844 *)
6845         case "$tval" in
6846         $define) tval=true;;
6847         *) tval=false;;
6848         esac;
6849         ;;
6850 esac;
6851 eval "$2=$tval"'
6852
6853 : define an is-in-libc? function
6854 inlibc='echo " "; td=$define; tu=$undef;
6855 sym=$1; var=$2; eval "was=\$$2";
6856 tx=yes;
6857 case "$reuseval$was" in
6858 true) ;;
6859 true*) tx=no;;
6860 esac;
6861 case "$tx" in
6862 yes)
6863         set $sym tres -f;
6864         eval $csym;
6865         case "$tres" in
6866         true)
6867                 echo "$sym() found." >&4;
6868                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6869         *)
6870                 echo "$sym() NOT found." >&4;
6871                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6872         esac;;
6873 *)
6874         case "$was" in
6875         $define) echo "$sym() found." >&4;;
6876         *) echo "$sym() NOT found." >&4;;
6877         esac;;
6878 esac'
6879
6880 : check for length of double
6881 echo " "
6882 case "$doublesize" in
6883 '')
6884         echo "Checking to see how big your double precision numbers are..." >&4
6885         $cat >try.c <<EOCP
6886 #include <stdio.h>
6887 #$i_stdlib I_STDLIB
6888 #ifdef I_STDLIB
6889 #include <stdlib.h>
6890 #endif
6891 int main()
6892 {
6893     printf("%d\n", (int)sizeof(double));
6894     exit(0);
6895 }
6896 EOCP
6897         set try
6898         if eval $compile_ok; then
6899                 doublesize=`$run ./try`
6900                 echo "Your double is $doublesize bytes long."
6901         else
6902                 dflt='8'
6903                 echo "(I can't seem to compile the test program.  Guessing...)"
6904                 rp="What is the size of a double precision number (in bytes)?"
6905                 . ./myread
6906                 doublesize="$ans"
6907         fi
6908         ;;
6909 esac
6910 $rm_try
6911
6912 : see if this is a float.h system
6913 set float.h i_float
6914 eval $inhdr
6915
6916 : check for long doubles
6917 echo " "
6918 echo "Checking to see if you have long double..." >&4
6919 echo 'int main() { long double x = 7.0; }' > try.c
6920 set try
6921 if eval $compile; then
6922         val="$define"
6923         echo "You have long double."
6924 else
6925         val="$undef"
6926         echo "You do not have long double."
6927 fi
6928 $rm_try
6929 set d_longdbl
6930 eval $setvar
6931
6932 : see if ldexpl exists
6933 set ldexpl d_ldexpl
6934 eval $inlibc
6935
6936 : check for length of long double
6937 case "${d_longdbl}${longdblsize}" in
6938 $define)
6939         echo " "
6940         echo "Checking to see how big your long doubles are..." >&4
6941         $cat >try.c <<'EOCP'
6942 #include <stdio.h>
6943 int main()
6944 {
6945         printf("%d\n", sizeof(long double));
6946 }
6947 EOCP
6948         set try
6949         set try
6950         if eval $compile; then
6951                 longdblsize=`$run ./try`
6952                 echo "Your long doubles are $longdblsize bytes long."
6953         else
6954                 dflt='8'
6955                 echo " "
6956                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6957                 rp="What is the size of a long double (in bytes)?"
6958                 . ./myread
6959                 longdblsize="$ans"
6960         fi
6961         if $test "X$doublesize" = "X$longdblsize"; then
6962                 echo "That isn't any different from an ordinary double."
6963                 echo "I'll keep your setting anyway, but you may see some"
6964                 echo "harmless compilation warnings."
6965         fi
6966         ;;
6967 esac
6968 $rm_try
6969
6970 $echo "Checking the kind of long doubles you have..." >&4
6971 case "$d_longdbl" in
6972 define)
6973 $cat <<EOP >try.c
6974 #$i_float I_FLOAT
6975 #$i_stdlib I_STDLIB
6976 #define LONGDBLSIZE $longdblsize
6977 #define DOUBLESIZE $doublesize
6978 #ifdef I_FLOAT
6979 #include <float.h>
6980 #endif
6981 #ifdef I_STDLIB
6982 #include <stdlib.h>
6983 #endif
6984 #include <stdio.h>
6985 static const long double d = -0.1L;
6986 int main() {
6987   unsigned const char* b = (unsigned const char*)(&d);
6988 #if DOUBLESIZE == LONGDBLSIZE
6989   printf("0\n"); /* if it floats like double */
6990   exit(0);
6991 #endif
6992 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6993   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6994     /* IEEE 754 128-bit little-endian */
6995     printf("1\n");
6996     exit(0);
6997   }
6998   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6999     /* IEEE 128-bit big-endian, e.g. solaris sparc */
7000     printf("2\n");
7001     exit(0);
7002   }
7003 #endif
7004 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
7005  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
7006  * cannot be trusted. */
7007 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
7008   if (b[0] == 0xCD && b[9] == 0xBF) {
7009     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
7010      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
7011      * Also known as "extended precision". */
7012     printf("3\n");
7013     exit(0);
7014   }
7015   if (b[0] == 0xBF && b[9] == 0xCD) {
7016     /* Is there ever big-endian 80-bit, really?
7017      *
7018      * The Motorola 68881 had another "extended precision" format:
7019      * sign:1 exp:15 zero:16 integer:1 mantissa:63
7020      * for total of 96 bits of bytes.  The zero bits were unused.
7021      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
7022      * If it ever becomes relevant, this format should be allocated
7023      * a new doublekind code since it's quite different from the Intel x87.
7024      */
7025     printf("4\n");
7026     exit(0);
7027   }
7028 #endif
7029 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7030   /* software "double double", the 106 is 53+53.
7031    * but irix thinks it is 107. */
7032   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7033     /* double double 128-bit fully little-endian,
7034      * little-endian doubles in little-endian order,
7035      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7036     printf("5\n");
7037     exit(0);
7038   }
7039   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7040     /* double double 128-bit fully big-endian,
7041      * big-endian doubles in big-endian order,
7042      * e.g. PPC/Power and MIPS:
7043      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7044     printf("6\n");
7045     exit(0);
7046   }
7047   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7048     /* double double 128-bit mixed endian.
7049      * little-endian doubles in big-endian order,
7050      * e.g. ppc64el,
7051      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7052     printf("7\n");
7053     exit(0);
7054   }
7055   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7056     /* double double 128-bit mixed endian,
7057      * big-endian doubles in little-endian order,
7058      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7059     printf("8\n");
7060     exit(0);
7061   }
7062 #endif
7063 /* We are largely making this up because it may well be
7064  * that the VAX format H was never made available to C,
7065  * only to Fortran. */
7066 #if LONGDBLSIZE == 16 && defined(__vax__)
7067   if (b[0] == 0xFD && b[15] == 0x99) {
7068     /* VAX format H, PDP-11 mixed endian. */
7069     printf("9\n");
7070     exit(0);
7071   }
7072 #endif
7073   printf("-1\n"); /* unknown */
7074   exit(0);
7075 }
7076 EOP
7077 set try
7078 if eval $compile; then
7079     longdblkind=`$run ./try`
7080 else
7081     longdblkind=-1
7082 fi
7083 ;;
7084 *) longdblkind=0 ;;
7085 esac
7086 case "$longdblkind" in
7087 0) echo "Your long doubles are doubles." >&4 ;;
7088 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7089 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7090 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7091 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7092 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7093 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7094 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7095 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7096 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >& 4 ;;
7097 *) echo "Cannot figure out your long double." >&4 ;;
7098 esac
7099 d_long_double_style_ieee=$undef
7100 d_long_double_style_ieee_std=$undef
7101 d_long_double_style_ieee_extended=$undef
7102 d_long_double_style_ieee_doubledouble=$undef
7103 d_long_double_style_vax=$undef
7104 case "$longdblkind" in
7105 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7106 esac
7107 case "$longdblkind" in
7108 1|2) d_long_double_style_ieee_std=$define ;;
7109 esac
7110 case "$longdblkind" in
7111 3|4) d_long_double_style_ieee_extended=$define ;;
7112 esac
7113 case "$longdblkind" in
7114 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7115 esac
7116 case "$longdblkind" in
7117 9) d_long_double_style_vax=$define ;;
7118 esac
7119 $rm_try
7120
7121 : determine the architecture name
7122 echo " "
7123 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7124         tarch=`arch`"-$osname"
7125 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7126         if uname -m > tmparch 2>&1 ; then
7127                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7128                         -e 's/$/'"-$osname/" tmparch`
7129         else
7130                 tarch="$osname"
7131         fi
7132         $rm -f tmparch
7133 else
7134         tarch="$osname"
7135 fi
7136 case "$myarchname" in
7137 ''|"$tarch") ;;
7138 *)
7139         echo "(Your architecture name used to be $myarchname.)"
7140         archname=''
7141         ;;
7142 esac
7143 case "$targetarch" in
7144 '') ;;
7145 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7146 esac
7147 myarchname="$tarch"
7148 case "$archname" in
7149 '') dflt="$tarch";;
7150 *) dflt="$archname";;
7151 esac
7152 rp='What is your architecture name'
7153 . ./myread
7154 archname="$ans"
7155
7156 : optionally add API version to the architecture for versioned archlibs
7157 case "$useversionedarchname" in
7158 $define|true|[yY]*) dflt='y';;
7159 *)                  dflt='n';;
7160 esac
7161 rp='Add the Perl API version to your archname?'
7162 . ./myread
7163 case "$ans" in
7164 y|Y)    useversionedarchname="$define" ;;
7165 *)      useversionedarchname="$undef" ;;
7166 esac
7167 case "$useversionedarchname" in
7168 $define)
7169         case "$archname" in
7170         *-$api_versionstring)
7171                 echo "...and architecture name already has -$api_versionstring" >&4
7172                 ;;
7173         *)
7174                 archname="$archname-$api_versionstring"
7175                 echo "...setting architecture name to $archname." >&4
7176                 ;;
7177         esac
7178         ;;
7179 esac
7180
7181 case "$usethreads" in
7182 $define)
7183         echo "Threads selected." >&4
7184         case "$archname" in
7185         *-thread*) echo "...and architecture name already has -thread." >&4
7186                 ;;
7187         *)      archname="$archname-thread"
7188                 echo "...setting architecture name to $archname." >&4
7189                 ;;
7190         esac
7191         ;;
7192 esac
7193 case "$usemultiplicity" in
7194 $define)
7195         echo "Multiplicity selected." >&4
7196         case "$archname" in
7197         *-multi*) echo "...and architecture name already has -multi." >&4
7198                 ;;
7199         *)      archname="$archname-multi"
7200                 echo "...setting architecture name to $archname." >&4
7201                 ;;
7202         esac
7203         ;;
7204 esac
7205 case "$use64bitint$use64bitall" in
7206 *"$define"*)
7207         case "$archname64" in
7208         '')
7209                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7210                 ;;
7211         *)
7212                 case "$use64bitint" in
7213                 "$define") echo "64 bit integers selected." >&4 ;;
7214                 esac
7215                 case "$use64bitall" in
7216                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7217                 esac
7218                 case "$archname" in
7219                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7220                         ;;
7221                 *)      archname="$archname-$archname64"
7222                         echo "...setting architecture name to $archname." >&4
7223                         ;;
7224                 esac
7225                 ;;
7226         esac
7227 esac
7228 case "$uselongdouble" in
7229 $define)
7230         echo "Long doubles selected." >&4
7231         case "$longdblsize" in
7232         $doublesize)
7233                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7234                 ;;
7235         *)
7236                 case "$archname" in
7237                 *-ld*) echo "...and architecture name already has -ld." >&4
7238                         ;;
7239                 *)      archname="$archname-ld"
7240                         echo "...setting architecture name to $archname." >&4
7241                         ;;
7242                 esac
7243                 ;;
7244         esac
7245         ;;
7246 esac
7247 case "$usequadmath" in
7248 $define)
7249         echo "quadmath selected." >&4
7250         case "$archname" in
7251         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7252                 ;;
7253         *)      archname="$archname-quadmath"
7254                 echo "...setting architecture name to $archname." >&4
7255                 ;;
7256         esac
7257         ;;
7258 esac
7259 if $test -f archname.cbu; then
7260         echo "Your platform has some specific hints for architecture name, using them..."
7261         . ./archname.cbu
7262 fi
7263
7264 : set the prefixit variable, to compute a suitable default value
7265 prefixit='case "$3" in
7266 ""|none)
7267         case "$oldprefix" in
7268         "") eval "$1=\"\$$2\"";;
7269         *)
7270                 case "$3" in
7271                 "") eval "$1=";;
7272                 none)
7273                         eval "tp=\"\$$2\"";
7274                         case "$tp" in
7275                         ""|" ") eval "$1=\"\$$2\"";;
7276                         *) eval "$1=";;
7277                         esac;;
7278                 esac;;
7279         esac;;
7280 *)
7281         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7282         case "$tp" in
7283         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7284         /*-$oldprefix/*|\~*-$oldprefix/*)
7285                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7286         *) eval "$1=\"\$$2\"";;
7287         esac;;
7288 esac'
7289
7290 : determine installation style
7291 : For now, try to deduce it from prefix unless it is already set.
7292 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7293 case "$installstyle" in
7294 '')     case "$prefix" in
7295                 *perl*) dflt='lib';;
7296                 *) dflt='lib/perl5' ;;
7297         esac
7298         ;;
7299 *)      dflt="$installstyle" ;;
7300 esac
7301 : Probably not worth prompting for this since we prompt for all
7302 : the directories individually, and the prompt would be too long and
7303 : confusing anyway.
7304 installstyle=$dflt
7305
7306 : determine where public executables go
7307 echo " "
7308 set dflt bin bin
7309 eval $prefixit
7310 fn=d~
7311 rp='Pathname where the public executables will reside?'
7312 . ./getfile
7313 if $test "X$ansexp" != "X$binexp"; then
7314         installbin=''
7315 fi
7316 prefixvar=bin
7317 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7318 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7319 :     this via initialinstalllocation
7320 . ./setprefixvar
7321
7322 case "$userelocatableinc" in
7323 $define|true|[yY]*)     dflt='y' ;;
7324 *)                      dflt='n' ;;
7325 esac
7326 cat <<EOM
7327
7328 Would you like to build Perl so that the installation is relocatable, so that
7329 library paths in @INC are determined relative to the path of the perl binary?
7330 This is not advised for system Perl installs, or if you need to run setid
7331 scripts or scripts under taint mode.
7332
7333 If this doesn't make any sense to you, just accept the default '$dflt'.
7334 EOM
7335 rp='Use relocatable @INC?'
7336 . ./myread
7337 case "$ans" in
7338 y|Y)    val="$define" ;;
7339 *)      val="$undef"  ;;
7340 esac
7341 set userelocatableinc
7342 eval $setvar
7343
7344 initialinstalllocation="$binexp"
7345 : Default prefix is now "up one level from where the binaries are"
7346 case "$userelocatableinc" in
7347 $define|true|[yY]*)
7348     bin=".../"
7349     binexp=".../"
7350     prefix=".../.."
7351     prefixexp=".../.."
7352     installprefixexp=".../.."
7353     ;;
7354 esac
7355
7356 : determine where private library files go
7357 : Usual default is /usr/local/lib/perl5/$version.
7358 : Also allow things like /opt/perl/lib/$version, since
7359 : /opt/perl/lib/perl5... would be redundant.
7360 : The default "style" setting is made in installstyle.U
7361 case "$installstyle" in
7362 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7363 *)       set dflt privlib lib/$version ;;
7364 esac
7365 eval $prefixit
7366 $cat <<EOM
7367
7368 There are some auxiliary files for $package that need to be put into a
7369 private library directory that is accessible by everyone.
7370
7371 EOM
7372 fn=$binexp
7373 fn=d~+
7374 rp='Pathname where the private library files will reside?'
7375 . ./getfile
7376 prefixvar=privlib
7377 . ./setprefixvar
7378
7379 : set the prefixup variable, to restore leading tilda escape
7380 prefixup='case "$prefixexp" in
7381 "$prefix") ;;
7382 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7383 esac'
7384
7385 : determine where public architecture dependent libraries go
7386 set archlib archlib
7387 eval $prefixit
7388 : privlib default is /usr/local/lib/$package/$version
7389 : archlib default is /usr/local/lib/$package/$version/$archname
7390 : privlib may have an optional trailing /share.
7391 tdflt=`echo $privlib | $sed 's,/share$,,'`
7392 tdflt=$tdflt/$archname
7393 case "$archlib" in
7394 '')     dflt=$tdflt
7395         ;;
7396 *)      dflt="$archlib"
7397     ;;
7398 esac
7399 $cat <<EOM
7400
7401 $spackage contains architecture-dependent library files.  If you are
7402 sharing libraries in a heterogeneous environment, you might store
7403 these files in a separate location.  Otherwise, you can just include
7404 them with the rest of the public library files.
7405
7406 EOM
7407 fn=$binexp
7408 fn=d+~
7409 rp='Where do you want to put the public architecture-dependent libraries?'
7410 . ./getfile
7411 prefixvar=archlib
7412 . ./setprefixvar
7413 if $test X"$archlib" = X"$privlib"; then
7414         d_archlib="$undef"
7415 else
7416         d_archlib="$define"
7417 fi
7418
7419 : see if setuid scripts can be secure
7420 $cat <<EOM
7421
7422 Some kernels have a bug that prevents setuid #! scripts from being
7423 secure.  Some sites have disabled setuid #! scripts because of this.
7424
7425 First let's decide if your kernel supports secure setuid #! scripts.
7426 (If setuid #! scripts would be secure but have been disabled anyway,
7427 don't say that they are secure if asked.)
7428
7429 EOM
7430
7431 val="$undef"
7432 if $test -d /dev/fd; then
7433         echo "#!$ls" >reflect
7434         chmod +x,u+s reflect
7435         ./reflect >flect 2>&1
7436         if $contains "/dev/fd" flect >/dev/null; then
7437                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7438                 val="$define"
7439         else
7440                 $cat <<EOM
7441 If you are not sure if they are secure, I can check but I'll need a
7442 username and password different from the one you are using right now.
7443 If you don't have such a username or don't want me to test, simply
7444 enter 'none'.
7445
7446 EOM
7447                 rp='Other username to test security of setuid scripts with?'
7448                 dflt='none'
7449                 . ./myread
7450                 case "$ans" in
7451                 n|none)
7452                         case "$d_suidsafe" in
7453                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7454                                 dflt=n;;
7455                         "$undef")
7456                                 echo "Well, the $hint value is *not* secure." >&4
7457                                 dflt=n;;
7458                         *)      echo "Well, the $hint value *is* secure." >&4
7459                                 dflt=y;;
7460                         esac
7461                         ;;
7462                 *)
7463                         $rm -f reflect flect
7464                         echo "#!$ls" >reflect
7465                         chmod +x,u+s reflect
7466                         echo >flect
7467                         chmod a+w flect
7468                         echo '"su" will (probably) prompt you for '"$ans's password."
7469                         su $ans -c './reflect >flect'
7470                         if $contains "/dev/fd" flect >/dev/null; then
7471                                 echo "Okay, it looks like setuid scripts are secure." >&4
7472                                 dflt=y
7473                         else
7474                                 echo "I don't think setuid scripts are secure." >&4
7475                                 dflt=n
7476                         fi
7477                         ;;
7478                 esac
7479                 rp='Does your kernel have *secure* setuid scripts?'
7480                 . ./myread
7481                 case "$ans" in
7482                 [yY]*)  val="$define";;
7483                 *)      val="$undef";;
7484                 esac
7485         fi
7486 else
7487         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7488         echo "(That's for file descriptors, not floppy disks.)"
7489         val="$undef"
7490 fi
7491 set d_suidsafe
7492 eval $setvar
7493
7494 $rm -f reflect flect
7495
7496 : now see if they want to do setuid emulation
7497 if $test $patchlevel -lt 11; then
7498 echo " "
7499 val="$undef"
7500 case "$d_suidsafe" in
7501 "$define")
7502         val="$undef"
7503         echo "No need to emulate SUID scripts since they are secure here." >&4
7504         ;;
7505 *)
7506         $cat <<EOM
7507 Some systems have disabled setuid scripts, especially systems where
7508 setuid scripts cannot be secure.  On systems where setuid scripts have
7509 been disabled, the setuid/setgid bits on scripts are currently
7510 useless.  It is possible for $package to detect those bits and emulate
7511 setuid/setgid in a secure fashion.  This emulation will only work if
7512 setuid scripts have been disabled in your kernel.
7513
7514 EOM
7515         case "$d_dosuid" in
7516         "$define") dflt=y ;;
7517         *) dflt=n ;;
7518         esac
7519         rp="Do you want to do setuid/setgid emulation?"
7520         . ./myread
7521         case "$ans" in
7522         [yY]*)  val="$define";;
7523         *)      val="$undef";;
7524         esac
7525         ;;
7526 esac
7527 set d_dosuid
7528 eval $setvar
7529 else
7530     case "$d_dosuid" in
7531         "$define")
7532         cat >&4 <<EOH
7533
7534 SUID emulation has been removed for 5.12
7535 Please re-run Configure without -Dd_dosuid
7536
7537 EOH
7538         exit 1;
7539         ;;
7540     esac
7541     d_dosuid=undef
7542 fi
7543
7544 : Find perl5.005 or later.
7545 echo "Looking for a previously installed perl5.005 or later... "
7546 case "$perl5" in
7547 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7548                 : Check if this perl is recent and can load a simple module
7549                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7550                         perl5=$tdir/perl
7551                         break;
7552                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7553                         perl5=$tdir/perl5
7554                         break;
7555                 fi
7556         done
7557         ;;
7558 *)      perl5="$perl5"
7559         ;;
7560 esac
7561 case "$perl5" in
7562 '')     echo "None found.  That's ok.";;
7563 *)      echo "Using $perl5." ;;
7564 esac
7565
7566 : Set the siteprefix variables
7567 $cat <<EOM
7568
7569 After $package is installed, you may wish to install various
7570 add-on modules and utilities.  Typically, these add-ons will
7571 be installed under $prefix with the rest
7572 of this package.  However, you may wish to install such add-ons
7573 elsewhere under a different prefix.
7574
7575 If you do not wish to put everything under a single prefix, that's
7576 ok.  You will be prompted for the individual locations; this siteprefix
7577 is only used to suggest the defaults.
7578
7579 The default should be fine for most people.
7580
7581 EOM
7582 fn=d~+
7583 rp='Installation prefix to use for add-on modules and utilities?'
7584 : XXX Here might be another good place for an installstyle setting.
7585 case "$siteprefix" in
7586 '') dflt=$prefix ;;
7587 *)  dflt=$siteprefix ;;
7588 esac
7589 . ./getfile
7590 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7591 oldsiteprefix=''
7592 case "$siteprefix" in
7593 '') ;;
7594 *)      case "$ans" in
7595         "$prefix") ;;
7596         *) oldsiteprefix="$prefix";;
7597         esac
7598         ;;
7599 esac
7600 siteprefix="$ans"
7601 siteprefixexp="$ansexp"
7602
7603 : determine where site specific libraries go.
7604 : Usual default is /usr/local/lib/perl5/site_perl/$version
7605 : The default "style" setting is made in installstyle.U
7606 : XXX No longer works with Prefixit stuff.
7607 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7608 case "$sitelib" in
7609 '') case "$installstyle" in
7610         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7611         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7612         esac
7613         ;;
7614 *)      dflt="$sitelib"
7615         ;;
7616 esac
7617 $cat <<EOM
7618
7619 The installation process will create a directory for
7620 site-specific extensions and modules.  Most users find it convenient
7621 to place all site-specific files in this directory rather than in the
7622 main distribution directory.
7623
7624 EOM
7625 fn=d~+
7626 rp='Pathname for the site-specific library files?'
7627 . ./getfile
7628 prefixvar=sitelib
7629 . ./setprefixvar
7630 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7631
7632 : Determine list of previous versions to include in @INC
7633 $cat > getverlist <<EOPL
7634 #!$perl5 -w
7635 use File::Basename;
7636 \$api_versionstring = "$api_versionstring";
7637 \$version = "$version";
7638 \$stem = "$sitelib_stem";
7639 \$archname = "$archname";
7640 EOPL
7641         $cat >> getverlist <<'EOPL'
7642 # The list found is store twice for each entry: the original name, and
7643 # the binary broken down version as pack "sss", so sorting is easy and
7644 # unambiguous. This will work for all versions that have a maximum of
7645 # three digit groups, separate by '.'s or '_'s. Names are extended with
7646 # ".0.0" to ensure at least three elements for the pack.
7647 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7648
7649 # Can't have leading @ because metaconfig interprets it as a command!
7650 ;@inc_version_list=();
7651 # XXX Redo to do opendir/readdir?
7652 if (-d $stem) {
7653     chdir($stem);
7654     ;@candidates = map {
7655         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7656     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7657 }
7658 else {
7659     ;@candidates = ();
7660 }
7661
7662 ($pversion, $aversion, $vsn5005) = map {
7663     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7664 foreach $d (@candidates) {
7665     if ($d->[1] lt $pversion) {
7666         if ($d->[1] ge $aversion) {
7667             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7668         }
7669         elsif ($d->[1] ge $vsn5005) {
7670             unshift(@inc_version_list, grep { -d } $d->[0]);
7671         }
7672     }
7673     else {
7674         # Skip newer version.  I.e. don't look in
7675         # 5.7.0 if we're installing 5.6.1.
7676     }
7677 }
7678
7679 if (@inc_version_list) {
7680     print join(' ', @inc_version_list);
7681 }
7682 else {
7683     # Blank space to preserve value for next Configure run.
7684     print " ";
7685 }
7686 EOPL
7687 chmod +x getverlist
7688 case "$inc_version_list" in
7689 '')     if test -x "$perl5$exe_ext"; then
7690                 dflt=`$perl5 getverlist`
7691         else
7692                 dflt='none'
7693         fi
7694         ;;
7695 $undef) dflt='none' ;;
7696 *)  eval dflt=\"$inc_version_list\" ;;
7697 esac
7698 case "$dflt" in
7699 ''|' ') dflt=none ;;
7700 esac
7701 case "$dflt" in
7702 5.005) dflt=none ;;
7703 esac
7704 $cat <<EOM
7705
7706 In order to ease the process of upgrading, this version of perl
7707 can be configured to use modules built and installed with earlier
7708 versions of perl that were installed under $prefix.  Specify here
7709 the list of earlier versions that this version of perl should check.
7710 If Configure detected no earlier versions of perl installed under
7711 $prefix, then the list will be empty.  Answer 'none' to tell perl
7712 to not search earlier versions.
7713
7714 The default should almost always be sensible, so if you're not sure,
7715 just accept the default.
7716 EOM
7717
7718 rp='List of earlier versions to include in @INC?'
7719 . ./myread
7720 case "$ans" in
7721 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7722 *) inc_version_list="$ans" ;;
7723 esac
7724 case "$inc_version_list" in
7725 ''|' ')
7726         inc_version_list_init='0'
7727         d_inc_version_list="$undef"
7728         ;;
7729 *)      inc_version_list_init=`echo $inc_version_list |
7730                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7731         d_inc_version_list="$define"
7732         ;;
7733 esac
7734 $rm -f getverlist
7735
7736 : see if malloc/malloc.h has to be included
7737 set malloc/malloc.h i_mallocmalloc
7738 eval $inhdr
7739
7740 : see if this is a malloc.h system
7741 : we want a real compile instead of Inhdr because some systems have a
7742 : malloc.h that just gives a compile error saying to use stdlib.h instead
7743 echo " "
7744 $cat >try.c <<EOCP
7745 #include <stdlib.h>
7746 #include <malloc.h>
7747 #$i_mallocmalloc I_MALLOCMALLOC
7748 #ifdef I_MALLOCMALLOC
7749 # include <malloc/malloc.h>
7750 #endif
7751
7752 int main () { return 0; }
7753 EOCP
7754 set try
7755 if eval $compile; then
7756     echo "<malloc.h> found." >&4
7757     val="$define"
7758 else
7759     echo "<malloc.h> NOT found." >&4
7760     val="$undef"
7761 fi
7762 $rm_try
7763 set i_malloc
7764 eval $setvar
7765
7766 : check for length of pointer
7767 echo " "
7768 case "$ptrsize" in
7769 '')
7770         echo "Checking to see how big your pointers are..." >&4
7771         $cat >try.c <<EOCP
7772 #include <stdio.h>
7773 #$i_stdlib I_STDLIB
7774 #ifdef I_STDLIB
7775 #include <stdlib.h>
7776 #endif
7777 int main()
7778 {
7779     printf("%d\n", (int)sizeof(void *));
7780     exit(0);
7781 }
7782 EOCP
7783         set try
7784         if eval $compile_ok; then
7785                 ptrsize=`$run ./try`
7786                 echo "Your pointers are $ptrsize bytes long."
7787         else
7788                 dflt='4'
7789                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7790                 rp="What is the size of a pointer (in bytes)?"
7791                 . ./myread
7792                 ptrsize="$ans"
7793         fi
7794         ;;
7795 esac
7796 $rm_try
7797 case "$use64bitall" in
7798 "$define"|true|[yY]*)
7799         case "$ptrsize" in
7800         4)      cat <<EOM >&4
7801
7802 *** You have chosen a maximally 64-bit build,
7803 *** but your pointers are only 4 bytes wide.
7804 *** Please rerun Configure without -Duse64bitall.
7805 EOM
7806                 case "$d_quad" in
7807                 define)
7808                         cat <<EOM >&4
7809 *** Since you have quads, you could possibly try with -Duse64bitint.
7810 EOM
7811                         ;;
7812                 esac
7813                 cat <<EOM >&4
7814 *** Cannot continue, aborting.
7815
7816 EOM
7817
7818                 exit 1
7819                 ;;
7820         esac
7821         ;;
7822 esac
7823
7824
7825 : determine whether to use malloc wrapping
7826 echo " "
7827 case "$usemallocwrap" in
7828 [yY]*|true|$define)     dflt='y' ;;
7829 [nN]*|false|$undef)     dflt='n' ;;
7830 *)      case "$usedevel" in
7831         [yY]*|true|$define)     dflt='y' ;;
7832         *) dflt='n' ;;
7833         esac
7834         ;;
7835 esac
7836 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7837 . ./myread
7838 usemallocwrap="$ans"
7839 case "$ans" in
7840 y*|true)
7841         usemallocwrap="$define" ;;
7842 *)
7843         usemallocwrap="$undef" ;;
7844 esac
7845
7846 : determine which malloc to compile in
7847 echo " "
7848 case "$usemymalloc" in
7849 [yY]*|true|$define)     dflt='y' ;;
7850 [nN]*|false|$undef)     dflt='n' ;;
7851 *)      case "$ptrsize" in
7852         4) dflt='y' ;;
7853         *) dflt='n' ;;
7854         esac
7855         if test "$useithreads" = "$define"; then dflt='n'; fi
7856         ;;
7857 esac
7858 rp="Do you wish to attempt to use the malloc that comes with $package?"
7859 . ./myread
7860 usemymalloc="$ans"
7861 case "$ans" in
7862 y*|true)
7863         usemymalloc='y'
7864         mallocsrc='malloc.c'
7865         mallocobj="malloc$_o"
7866         d_mymalloc="$define"
7867         case "$libs" in
7868         *-lmalloc*)
7869                 : Remove malloc from list of libraries to use
7870                 echo "Removing unneeded -lmalloc from library list" >&4
7871                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7872                 shift
7873                 libs="$*"
7874                 echo "libs = $libs" >&4
7875                 ;;
7876         esac
7877         ;;
7878 *)
7879         usemymalloc='n'
7880         mallocsrc=''
7881         mallocobj=''
7882         d_mymalloc="$undef"
7883         ;;
7884 esac
7885
7886 : compute the return types of malloc and free
7887 echo " "
7888 $cat >malloc.c <<END
7889 #$i_malloc I_MALLOC
7890 #$i_stdlib I_STDLIB
7891 #include <stdio.h>
7892 #include <sys/types.h>
7893 #ifdef I_MALLOC
7894 #include <malloc.h>
7895 #endif
7896 #ifdef I_STDLIB
7897 #include <stdlib.h>
7898 #endif
7899 #ifdef TRY_MALLOC
7900 void *malloc();
7901 #endif
7902 #ifdef TRY_FREE
7903 void free();
7904 #endif
7905 END
7906 case "$malloctype" in
7907 '')
7908         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7909                 malloctype='void *'
7910         else
7911                 malloctype='char *'
7912         fi
7913         ;;
7914 esac
7915 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7916
7917 case "$freetype" in
7918 '')
7919         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7920                 freetype='void'
7921         else
7922                 freetype='int'
7923         fi
7924         ;;
7925 esac
7926 echo "Your system uses $freetype free(), it would seem." >&4
7927 $rm -f malloc.[co]
7928 : determine where site specific architecture-dependent libraries go.
7929 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7930 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7931 : sitelib may have an optional trailing /share.
7932 case "$sitearch" in
7933 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7934         dflt="$dflt/$archname"
7935         ;;
7936 *)      dflt="$sitearch"
7937         ;;
7938 esac
7939 set sitearch sitearch none
7940 eval $prefixit
7941 $cat <<EOM
7942
7943 The installation process will also create a directory for
7944 architecture-dependent site-specific extensions and modules.
7945
7946 EOM
7947 fn=d~+
7948 rp='Pathname for the site-specific architecture-dependent library files?'
7949 . ./getfile
7950 prefixvar=sitearch
7951 . ./setprefixvar
7952 if $test X"$sitearch" = X"$sitelib"; then
7953         d_sitearch="$undef"
7954 else
7955         d_sitearch="$define"
7956 fi
7957
7958 : Set the vendorprefix variables
7959 $cat <<EOM
7960
7961 The installation process will also create a directory for
7962 vendor-supplied add-ons.  Vendors who supply perl with their system
7963 may find it convenient to place all vendor-supplied files in this
7964 directory rather than in the main distribution directory.  This will
7965 ease upgrades between binary-compatible maintenance versions of perl.
7966
7967 Of course you may also use these directories in whatever way you see
7968 fit.  For example, you might use them to access modules shared over a
7969 company-wide network.
7970
7971 The default answer should be fine for most people.
7972 This causes further questions about vendor add-ons to be skipped
7973 and no vendor-specific directories will be configured for perl.
7974
7975 EOM
7976 rp='Do you want to configure vendor-specific add-on directories?'
7977 case "$usevendorprefix" in
7978 define|true|[yY]*) dflt=y ;;
7979 *)      : User may have set vendorprefix directly on Configure command line.
7980         case "$vendorprefix" in
7981         ''|' ') dflt=n ;;
7982         *)      dflt=y ;;
7983         esac
7984         ;;
7985 esac
7986 . ./myread
7987 case "$ans" in
7988 [yY]*)  fn=d~+
7989         rp='Installation prefix to use for vendor-supplied add-ons?'
7990         case "$vendorprefix" in
7991         '') dflt="$prefix" ;;
7992         *)  dflt=$vendorprefix ;;
7993         esac
7994         . ./getfile
7995         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7996         oldvendorprefix=''
7997         case "$vendorprefix" in
7998         '') ;;
7999         *)      case "$ans" in
8000                 "$prefix") ;;
8001                 *) oldvendorprefix="$prefix";;
8002                 esac
8003                 ;;
8004         esac
8005         usevendorprefix="$define"
8006         vendorprefix="$ans"
8007         vendorprefixexp="$ansexp"
8008         ;;
8009 *)      usevendorprefix="$undef"
8010         vendorprefix=''
8011         vendorprefixexp=''
8012         ;;
8013 esac
8014
8015 : Set the vendorlib variables
8016 case "$vendorprefix" in
8017 '')     d_vendorlib="$undef"
8018         vendorlib=''
8019         vendorlibexp=''
8020         ;;
8021 *)      d_vendorlib="$define"
8022         : determine where vendor-supplied modules go.
8023         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8024         case "$vendorlib" in
8025         '')
8026                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8027                 case "$installstyle" in
8028                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8029                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8030                 esac
8031                 ;;
8032         *)      dflt="$vendorlib"
8033                 ;;
8034         esac
8035         fn=d~+
8036         rp='Pathname for the vendor-supplied library files?'
8037         . ./getfile
8038         vendorlib="$ans"
8039         vendorlibexp="$ansexp"
8040         ;;
8041 esac
8042 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8043 prefixvar=vendorlib
8044 . ./installprefix
8045
8046 : Set the vendorarch variables
8047 case "$vendorprefix" in
8048 '')     d_vendorarch="$undef"
8049         vendorarch=''
8050         vendorarchexp=''
8051         ;;
8052 *)      d_vendorarch="$define"
8053         : determine where vendor-supplied architecture-dependent libraries go.
8054         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8055         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8056         : vendorlib may have an optional trailing /share.
8057         case "$vendorarch" in
8058         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8059                 dflt="$dflt/$archname"
8060                 ;;
8061         *)      dflt="$vendorarch" ;;
8062         esac
8063         fn=d~+
8064         rp='Pathname for vendor-supplied architecture-dependent files?'
8065         . ./getfile
8066         vendorarch="$ans"
8067         vendorarchexp="$ansexp"
8068         ;;
8069 esac
8070 prefixvar=vendorarch
8071 . ./installprefix
8072 if $test X"$vendorarch" = X"$vendorlib"; then
8073         d_vendorarch="$undef"
8074 else
8075         d_vendorarch="$define"
8076 fi
8077
8078 : Final catch-all directories to search
8079 $cat <<EOM
8080
8081 Lastly, you can have perl look in other directories for extensions and
8082 modules in addition to those already specified.
8083 These directories will be searched after
8084         $sitearch
8085         $sitelib
8086 EOM
8087 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8088 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8089 echo ' '
8090 case "$otherlibdirs" in
8091 ''|' ') dflt='none' ;;
8092 *)      dflt="$otherlibdirs" ;;
8093 esac
8094 $cat <<EOM
8095 Enter a colon-separated set of extra paths to include in perl's @INC
8096 search path, or enter 'none' for no extra paths.
8097
8098 EOM
8099
8100 rp='Colon-separated list of additional directories for perl to search?'
8101 . ./myread
8102 case "$ans" in
8103 ' '|''|none)    otherlibdirs=' ' ;;
8104 *)      otherlibdirs="$ans" ;;
8105 esac
8106 case "$otherlibdirs" in
8107 ' ') val=$undef ;;
8108 *)      val=$define ;;
8109 esac
8110 set d_perl_otherlibdirs
8111 eval $setvar
8112
8113 : Cruising for prototypes
8114 echo " "
8115 echo "Checking out function prototypes..." >&4
8116 $cat >prototype.c <<EOCP
8117 #$i_stdlib I_STDLIB
8118 #ifdef I_STDLIB
8119 #include <stdlib.h>
8120 #endif
8121 int main(int argc, char *argv[]) {
8122         exit(0);}
8123 EOCP
8124 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
8125         echo "Your C compiler appears to support function prototypes."
8126         val="$define"
8127 else
8128         echo "Your C compiler doesn't seem to understand function prototypes."
8129         val="$undef"
8130 fi
8131 set prototype
8132 eval $setvar
8133 $rm -f prototype*
8134
8135 : Check if ansi2knr is required
8136 case "$prototype" in
8137 "$define") ;;
8138 *)      ansi2knr='ansi2knr'
8139         echo " "
8140         cat <<EOM >&4
8141
8142 $me:  FATAL ERROR:
8143 This version of $package can only be compiled by a compiler that
8144 understands function prototypes.  Unfortunately, your C compiler
8145         $cc $ccflags
8146 doesn't seem to understand them.  Sorry about that.
8147
8148 If GNU cc is available for your system, perhaps you could try that instead.
8149
8150 Eventually, we hope to support building Perl with pre-ANSI compilers.
8151 If you would like to help in that effort, please contact <perlbug@perl.org>.
8152
8153 Aborting Configure now.
8154 EOM
8155         exit 2
8156         ;;
8157 esac
8158
8159 : DTrace support
8160 dflt_dtrace='/usr/sbin/dtrace'
8161 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8162
8163 cat <<EOM
8164
8165 Perl can be built to support DTrace on platforms that support it.
8166 DTrace is a diagnosis and performance analysis tool from Sun.
8167
8168 If this doesn't make any sense to you, just accept the default.
8169 EOM
8170
8171 while $test 1 ; do
8172         case "$usedtrace" in
8173         $define|true|[yY]*)
8174                 dflt='y'
8175                 ;;
8176         ?*)
8177                 dflt='y'
8178                 dflt_dtrace=$usedtrace
8179                 ;;
8180         *)
8181                 dflt='n'
8182                 ;;
8183         esac
8184
8185         rp='Support DTrace if available?'
8186         . ./myread
8187         case "$ans" in
8188         y|Y)    val="$define" ;;
8189         *)      val="$undef" ;;
8190         esac
8191         set usedtrace
8192         eval $setvar
8193
8194         test "X$usedtrace" != "X$define" && break
8195
8196         echo " "
8197         rp='Where is the dtrace executable?'
8198         dflt=$dflt_dtrace
8199         . ./getfile
8200         val="$ans"
8201         set dtrace
8202         eval $setvar
8203
8204         if $test -f $dtrace
8205         then
8206                 if $dtrace -h -s ../perldtrace.d \
8207                         -o perldtrace.tmp >/dev/null 2>&1 \
8208                         && rm -f perldtrace.tmp
8209                 then
8210                         echo " "
8211                         echo "Good: your $dtrace knows about the -h flag."
8212                 else
8213                         cat >&2 <<EOM
8214
8215 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8216 ***
8217 *** Your installed dtrace doesn't support the -h switch to compile a D
8218 *** program into a C header. Can't continue.
8219
8220 EOM
8221                         exit 1
8222                 fi
8223                 break;
8224         fi
8225
8226         case "$fastread" in
8227         yes)
8228                 cat >&2 <<EOM
8229
8230 *** $me:  Fatal Error:  $dtrace not found.
8231 *** Can't continue.
8232
8233 EOM
8234                 exit 1
8235                 ;;
8236         *)
8237                 echo "*** $dtrace was not found."
8238                 echo " "
8239                 ;;
8240         esac
8241 done
8242
8243 : See if we want extra modules installed
8244 echo " "
8245 case "$extras" in
8246 '') dflt='n';;
8247 *) dflt='y';;
8248 esac
8249 cat <<EOM
8250 Perl can be built with extra modules or bundles of modules which
8251 will be fetched from the CPAN and installed alongside Perl.
8252
8253 Notice that you will need access to the CPAN; either via the Internet,
8254 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8255 be asked later to configure the CPAN.pm module which will in turn do
8256 the installation of the rest of the extra modules or bundles.)
8257
8258 Notice also that if the modules require any external software such as
8259 libraries and headers (the libz library and the zlib.h header for the
8260 Compress::Zlib module, for example) you MUST have any such software
8261 already installed, this configuration process will NOT install such
8262 things for you.
8263
8264 If this doesn't make any sense to you, just accept the default '$dflt'.
8265 EOM
8266 rp='Install any extra modules (y or n)?'
8267 . ./myread
8268 case "$ans" in
8269 y|Y)
8270         cat <<EOM
8271
8272 Please list any extra modules or bundles to be installed from CPAN,
8273 with spaces between the names.  The names can be in any format the
8274 'install' command of CPAN.pm will understand.  (Answer 'none',
8275 without the quotes, to install no extra modules or bundles.)
8276 EOM
8277         rp='Extras?'
8278         dflt="$extras"
8279         . ./myread
8280         extras="$ans"
8281 esac
8282 case "$extras" in
8283 ''|'none')
8284         val=''
8285         $rm -f ../extras.lst
8286         ;;
8287 *)      echo "(Saving the list of extras for later...)"
8288         echo "$extras" > ../extras.lst
8289         val="'$extras'"
8290         ;;
8291 esac
8292 set extras
8293 eval $setvar
8294 echo " "
8295
8296 : determine where html pages for programs go
8297 set html1dir html1dir none
8298 eval $prefixit
8299 $cat <<EOM
8300
8301 If you wish to install html files for programs in $spackage, indicate
8302 the appropriate directory here.  To skip installing html files,
8303 answer "none".
8304 EOM
8305 case "$html1dir" in
8306 ''|none|$undef|' ') dflt=none ;;
8307 *) dflt=$html1dir ;;
8308 esac
8309 fn=dn+~
8310 rp="Directory for the main $spackage html pages?"
8311 . ./getfile
8312 prefixvar=html1dir
8313 . ./setprefixvar
8314 : Use ' ' for none so value is preserved next time through Configure
8315 $test X"$html1dir" = "X" && html1dir=' '
8316
8317 : determine where html pages for libraries and modules go
8318 set html3dir html3dir none
8319 eval $prefixit
8320 $cat <<EOM
8321
8322 If you wish to install html files for modules associated with $spackage,
8323 indicate the appropriate directory here.  To skip installing html files,
8324 answer "none".
8325 EOM
8326 : There is no obvious default.  If they have specified html1dir, then
8327 : try to key off that, possibly changing .../html1 into .../html3.
8328 case "$html3dir" in
8329 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8330 *) dflt=$html3dir ;;
8331 esac
8332 fn=dn+~
8333 rp="Directory for the $spackage module html pages?"
8334 . ./getfile
8335 prefixvar=html3dir
8336 . ./setprefixvar
8337 : Use ' ' for none so value is preserved next time through Configure
8338 $test X"$html3dir" = "X" && html3dir=' '
8339
8340 : determine whether to install perl also as /usr/bin/perl
8341
8342 echo " "
8343 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8344         $cat <<EOM
8345 Many scripts expect perl to be installed as /usr/bin/perl.
8346
8347 If you want to, I can install the perl you are about to compile
8348 as /usr/bin/perl (in addition to $bin/perl).
8349 EOM
8350         if test -f /usr/bin/perl; then
8351             $cat <<EOM
8352
8353 However, please note that because you already have a /usr/bin/perl,
8354 overwriting that with a new Perl would very probably cause problems.
8355 Therefore I'm assuming you don't want to do that (unless you insist).
8356
8357 EOM
8358             case "$installusrbinperl" in
8359             "$define"|[yY]*)    dflt='y';;
8360             *)                  dflt='n';;
8361             esac
8362         else
8363             $cat <<EOM
8364
8365 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8366
8367 EOM
8368             case "$installusrbinperl" in
8369             "$undef"|[nN]*)     dflt='n';;
8370             *)                  dflt='y';;
8371             esac
8372         fi
8373         rp="Do you want to install perl as /usr/bin/perl?"
8374         . ./myread
8375         case "$ans" in
8376         [yY]*)  val="$define";;
8377         *)      val="$undef" ;;
8378         esac
8379 else
8380         val="$undef"
8381 fi
8382 set installusrbinperl
8383 eval $setvar
8384
8385 : see if dlopen exists
8386 xxx_runnm="$runnm"
8387 xxx_ccflags="$ccflags"
8388 runnm=false
8389 : with g++ one needs -shared to get is-in-libc to work for dlopen
8390 case "$gccversion" in
8391 '')     ;;
8392 *Clang*)        ;;
8393 *)      case "$d_cplusplus" in
8394         "$define") ccflags="$ccflags -shared" ;;
8395         esac
8396         ;;
8397 esac
8398 set dlopen d_dlopen
8399 eval $inlibc
8400 runnm="$xxx_runnm"
8401 ccflags="$xxx_ccflags"
8402
8403 : see if this is a unistd.h system
8404 set unistd.h i_unistd
8405 eval $inhdr
8406
8407 : determine which dynamic loading, if any, to compile in
8408 echo " "
8409 dldir="ext/DynaLoader"
8410 case "$usedl" in
8411     $define|y|true)
8412         dflt='y'
8413         usedl="$define"
8414         ;;
8415     $undef|n|false)
8416         dflt='n'
8417         usedl="$undef"
8418         ;;
8419     *)
8420         dflt='n'
8421         case "$d_dlopen" in
8422             $define) dflt='y' ;;
8423         esac
8424         : Does a dl_xxx.xs file exist for this operating system
8425         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8426         ;;
8427 esac
8428 rp="Do you wish to use dynamic loading?"
8429 . ./myread
8430 usedl="$ans"
8431 bin_ELF="$undef"
8432 case "$ans" in
8433     y*) usedl="$define"
8434         case "$dlsrc" in
8435             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8436                     dflt="$dldir/dl_${osname}.xs"
8437                 elif $test "$d_dlopen" = "$define" ; then
8438                     dflt="$dldir/dl_dlopen.xs"
8439                 else
8440                     dflt=''
8441                 fi
8442                 ;;
8443             *)  dflt="$dldir/$dlsrc"
8444                 ;;
8445         esac
8446         echo "The following dynamic loading files are available:"
8447         : Can not go over to $dldir because getfile has path hard-coded in.
8448         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8449         rp="Source file to use for dynamic loading"
8450         fn="fne"
8451         gfpth="$src"
8452         . ./getfile
8453         usedl="$define"
8454         : emulate basename
8455         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8456
8457         $cat << EOM
8458
8459 Some systems may require passing special flags to $cc -c to
8460 compile modules that will be used to create a shared library.
8461 To use no flags, say "none".
8462
8463 EOM
8464         case "$cccdlflags" in
8465             '') case "$gccversion" in
8466                 '') case "$osname" in
8467                         hpux)   dflt='+z' ;;
8468                         irix*)  dflt='-KPIC' ;;
8469                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8470                         sunos)  dflt='-pic' ;;
8471                         *)      dflt='none' ;;
8472                     esac
8473                     ;;
8474                 *)  case "$osname" in
8475                         darwin) dflt='none' ;;
8476                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8477                         *)      dflt='-fpic' ;;
8478                     esac ;;
8479                 esac ;;
8480             ' ') dflt='none' ;;
8481             *)   dflt="$cccdlflags" ;;
8482         esac
8483
8484         case "$dflt" in
8485             none) dflt='' ;;
8486         esac
8487
8488         # If -Dsysroot was specified, now's the time to add it
8489         # to cccdlflags
8490         if test "X$sysroot" != X; then
8491             case "$gccversion" in
8492                 '') ;;
8493                 *)  case "$dflt" in
8494                         *sysroot*) ;;
8495                         'undef'|*)
8496                             dflt="$dflt --sysroot=$sysroot" ;;
8497                     esac
8498                     ;;
8499             esac
8500         fi
8501
8502         case "$dflt" in
8503             '') dflt='none';;
8504         esac
8505
8506         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8507         . ./myread
8508         case "$ans" in
8509             none) cccdlflags=' ' ;;
8510             *)    cccdlflags="$ans" ;;
8511         esac
8512
8513         cat << EOM
8514
8515 Some systems use ld to create libraries that can be dynamically loaded,
8516 while other systems (such as those using ELF) use $cc.
8517
8518 EOM
8519
8520 : Determine if this is ELF
8521         $cat >try.c <<EOM
8522 /* Test for whether ELF binaries are produced */
8523 #include <fcntl.h>
8524 #$i_stdlib I_STDLIB
8525 #ifdef I_STDLIB
8526 #include <stdlib.h>
8527 #endif
8528 #$i_unistd I_UNISTD
8529 #ifdef I_UNISTD
8530 #include <unistd.h>
8531 #endif
8532 int main() {
8533     char b[4];
8534     int i = open("a.out",O_RDONLY);
8535     if(i == -1)
8536         exit(1); /* fail */
8537     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8538         exit(0); /* succeed (yes, it is ELF) */
8539     exit(1); /* fail */
8540 }
8541 EOM
8542         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8543             bin_ELF="$define"
8544         fi
8545         $rm_try
8546
8547         case "$ld" in
8548             '') if $test $bin_ELF = "$define"; then
8549                     cat <<EOM
8550 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8551 EOM
8552                     dflt="$cc"
8553                 else
8554                     echo "I'll use ld to build dynamic libraries."
8555                     dflt='ld'
8556                 fi
8557                 ;;
8558             *)  dflt="$ld"
8559                 ;;
8560         esac
8561
8562         rp="What command should be used to create dynamic libraries?"
8563         . ./myread
8564         ld="$ans"
8565
8566         cat << EOM
8567
8568 Some systems may require passing special flags to $ld to create a
8569 library that can be dynamically loaded.  If your ld flags include
8570 -L/other/path options to locate libraries outside your loader's normal
8571 search path, you may need to specify those -L options here as well.  To
8572 use no flags, say "none".
8573
8574 EOM
8575         case "$lddlflags" in
8576             '') case "$osname" in
8577                     haiku) dflt='-shared' ;;
8578                     hpux) dflt='-b';
8579                           case "$gccversion" in
8580                               '') dflt="$dflt +vnocompatwarnings" ;;
8581                           esac
8582                           ;;
8583                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8584                     solaris) # See [perl #66604].
8585                             # On Solaris 11, gcc -m64 on amd64
8586                             # appears not to understand -G.  gcc versions at
8587                             # least as old as 3.4.3 support -shared, so just
8588                             # use that with Solaris 11 and later, but keep
8589                             # the old behavior for older Solaris versions.
8590                             case "$gccversion" in
8591                                 '') dflt='-G' ;;
8592                                 *)  case "$osvers" in
8593                                         2.?|2.10) dflt='-G' ;;
8594                                         *) dflt='-shared' ;;
8595                                     esac
8596                                     ;;
8597                             esac
8598                             ;;
8599                     sunos) dflt='-assert nodefinitions' ;;
8600                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8601                     *)     dflt='none' ;;
8602                 esac
8603                 ;;
8604             *) dflt="$lddlflags" ;;
8605         esac
8606
8607         : Only do this for gcc, since, for example, qcc has no concept
8608         : of --sysroot.
8609         if $test "X$sysroot" != X; then
8610             case "$gccversion" in
8611                 '') ;;
8612                 *)  dflt="$dflt --sysroot $sysroot" ;;
8613             esac
8614         fi
8615
8616         : Try to guess additional flags to pick up local libraries.
8617         : Be careful not to append to a plain 'none'
8618         case "$dflt" in
8619             none) dflt='' ;;
8620         esac
8621         for thisflag in $ldflags; do
8622             case "$thisflag" in
8623                 -L*|-R*|-Wl,-R*)
8624                     case " $dflt " in
8625                         *" $thisflag "*) ;;
8626                         *) dflt="$dflt $thisflag" ;;
8627                     esac
8628                     ;;
8629             esac
8630         done
8631
8632         case "$dflt" in
8633             ''|' ') dflt='none' ;;
8634         esac
8635
8636         case "$ldflags" in
8637             *-fstack-protector-strong*)
8638                 case "$dflt" in
8639                     *-fstack-protector-strong*) ;; # Don't add it again
8640                     *) dflt="$dflt -fstack-protector-strong" ;;
8641                 esac
8642                 ;;
8643             *-fstack-protector*)
8644                 case "$dflt" in
8645                     *-fstack-protector*) ;; # Don't add it again
8646                     *) dflt="$dflt -fstack-protector" ;;
8647                 esac
8648                 ;;
8649         esac
8650
8651         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8652         . ./myread
8653         case "$ans" in
8654             none) lddlflags=' ' ;;
8655             *) lddlflags="$ans" ;;
8656         esac
8657
8658         cat <<EOM
8659
8660 Some systems may require passing special flags to $cc to indicate that
8661 the resulting executable will use dynamic linking.  To use no flags,
8662 say "none".
8663
8664 EOM
8665         case "$ccdlflags" in
8666             '') case "$osname" in
8667                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8668                     sunos)             dflt='none'   ;;
8669                     *)                 dflt='none'   ;;
8670                 esac ;;
8671             ' ') dflt='none' ;;
8672             *)   dflt="$ccdlflags" ;;
8673         esac
8674         rp="Any special flags to pass to $cc to use dynamic linking?"
8675         . ./myread
8676         case "$ans" in
8677             none) ccdlflags=' ' ;;
8678             *)    ccdlflags="$ans" ;;
8679         esac
8680         ;;
8681
8682     *)  usedl="$undef"
8683         ld='ld'
8684         dlsrc='dl_none.xs'
8685         lddlflags=''
8686         ccdlflags=''
8687         ;;
8688 esac
8689
8690 ld_can_script="$undef"
8691 case "$bin_ELF$usedl" in
8692     $define$define)
8693         # Abuse try.h and a.out names for neat cleanup
8694         $cat >try.c <<EOM
8695 void foo() {}
8696 void bar() {}
8697 EOM
8698         $cat >try.h <<EOM
8699 LIBTEST_42 {
8700  global:
8701   foo;
8702  local: *;
8703  };
8704 EOM
8705         if $cc $cccdlflags $ccdlflags $ccflags \
8706                $ldflags $lddlflags -o a.out try.c \
8707                -Wl,--version-script=try.h >/dev/null 2>&1 \
8708            &&  $test -s a.out ; then
8709             echo "ld supports scripting" >&4
8710             ld_can_script="$define"
8711         else
8712             echo "ld does not support scripting" >&4
8713         fi
8714         $rm_try
8715         ;;
8716 esac
8717
8718 : Do we want a shared libperl?
8719 also=''
8720 case "$usedl" in
8721 $undef)
8722         # No dynamic loading being used, so don't bother even to prompt.
8723         useshrplib='false'
8724         ;;
8725 *)      case "$useshrplib" in
8726         '')     case "$osname" in
8727                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8728                         dflt=y
8729                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8730                         ;;
8731                 *)      dflt=n
8732                         ;;
8733                 esac
8734                 ;;
8735         $define|true|[Yy]*)
8736                 dflt=y
8737                 ;;
8738         *)      dflt=n
8739                 ;;
8740         esac
8741         $cat << EOM
8742
8743 The perl executable is normally obtained by linking perlmain.c with
8744 libperl${_a}, any static extensions (usually just DynaLoader), and
8745 any other libraries needed on this system (such as -lm, etc.).  Since
8746 your system supports dynamic loading, it is probably possible to build
8747 a shared libperl.$so.  If you will have more than one executable linked
8748 to libperl.$so, this will significantly reduce the size of each
8749 executable, but it may have a noticeable effect on performance.  The
8750 default is probably sensible for your system.
8751 $also
8752
8753 EOM
8754         rp="Build a shared libperl.$so (y/n)"
8755         . ./myread
8756         case "$ans" in
8757         true|$define|[Yy]*)
8758                 useshrplib='true'  ;;
8759         *)      useshrplib='false' ;;
8760         esac
8761         ;;
8762 esac
8763
8764 case "$useshrplib" in
8765 true)
8766         case "$userelocatableinc" in
8767         true|define)
8768                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8769                 echo "See INSTALL for an explanation why that won't work." >&4
8770                 exit 4
8771                 ;;
8772         esac
8773         case "$libperl" in
8774         '')
8775                 # Figure out a good name for libperl.so.  Since it gets stored in
8776                 # a version-specific architecture-dependent library, the version
8777                 # number isn't really that important, except for making cc/ld happy.
8778                 #
8779                 # A name such as libperl.so.10.1
8780                 majmin="libperl.$so.$patchlevel.$subversion"
8781                 # A name such as libperl.so.100
8782                 majonly=`echo $patchlevel $subversion |
8783                         $awk '{printf "%d%02d", $1, $2}'`
8784                 majonly=libperl.$so.$majonly
8785                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8786                 # rely on figuring it out from the naming of libc.
8787                 case "${osname}${osvers}" in
8788                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8789                         dflt=libperl.$so
8790                         ;;
8791                 cygwin*) # ld links now against the dll directly
8792                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8793                         majonly=`echo $patchlevel $subversion |
8794                                 $awk '{printf "%03d%03d", $1, $2}'`
8795                         majonly=cygperl5.$majonly.$so
8796                         dflt=$majmin
8797                         ;;
8798                 *)      # Try to guess based on whether libc has major.minor.
8799                         case "$libc" in
8800                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8801                         *libc.$so.[0-9]*) dflt=$majonly ;;
8802                         *)      dflt=libperl.$so ;;
8803                         esac
8804                         ;;
8805                 esac
8806                 ;;
8807         *)      dflt=$libperl
8808                 ;;
8809         esac
8810         cat << EOM
8811
8812 I need to select a good name for the shared libperl.  If your system uses
8813 library names with major and minor numbers, then you might want something
8814 like $majmin.  Alternatively, if your system uses a single version
8815 number for shared libraries, then you might want to use $majonly.
8816 Or, your system might be quite happy with a simple libperl.$so.
8817
8818 Since the shared libperl will get installed into a version-specific
8819 architecture-dependent directory, the version number of the shared perl
8820 library probably isn't important, so the default should be o.k.
8821
8822 EOM
8823         rp='What name do you want to give to the shared libperl?'
8824         . ./myread
8825         libperl=$ans
8826         echo "Ok, I'll use $libperl"
8827         ;;
8828 *)
8829         libperl="libperl${_a}"
8830         ;;
8831 esac
8832
8833 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8834 case "$shrpdir" in
8835 '') ;;
8836 *)      $cat >&4 <<EOM
8837 WARNING:  Use of the shrpdir variable for the installation location of
8838 the shared $libperl is not supported.  It was never documented and
8839 will not work in this version.  Let me (perlbug@perl.org)
8840 know of any problems this may cause.
8841
8842 EOM
8843         case "$shrpdir" in
8844         "$archlibexp/CORE")
8845                 $cat >&4 <<EOM
8846 But your current setting of $shrpdir is
8847 the default anyway, so it's harmless.
8848 EOM
8849                 ;;
8850         *)
8851                 $cat >&4 <<EOM
8852 Further, your current attempted setting of $shrpdir
8853 conflicts with the value of $archlibexp/CORE
8854 that installperl will use.
8855 EOM
8856                 ;;
8857         esac
8858         ;;
8859 esac
8860
8861 # How will the perl executable find the installed shared $libperl?
8862 # Add $xxx to ccdlflags.
8863 # If we can't figure out a command-line option, use $shrpenv to
8864 # set env LD_RUN_PATH.  The main perl makefile uses this.
8865 shrpdir=$archlibexp/CORE
8866 xxx=''
8867 tmp_shrpenv=''
8868 if "$useshrplib"; then
8869     case "$osname" in
8870         aix)
8871                 # We'll set it in Makefile.SH...
8872                 ;;
8873         solaris)
8874                 xxx="-R $shrpdir"
8875                 ;;
8876         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8877                 xxx="-Wl,-R$shrpdir"
8878                 ;;
8879         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8880                 xxx="-Wl,-rpath,$shrpdir"
8881                 ;;
8882         hpux*)
8883                 # hpux doesn't like the default, either.
8884                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8885                 ;;
8886         cygwin)
8887                 # cygwin needs only ldlibpth
8888                 ;;
8889         *)
8890                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8891                 ;;
8892         esac
8893         case "$xxx" in
8894         '') ;;
8895         *)
8896                 # Only add $xxx if it isn't already in ccdlflags.
8897                 case " $ccdlflags " in
8898                 *" $xxx "*)     ;;
8899                 *)      ccdlflags="$ccdlflags $xxx"
8900                         cat <<EOM >&4
8901
8902 Adding $xxx to the flags
8903 passed to $ld so that the perl executable will find the
8904 installed shared $libperl.
8905
8906 EOM
8907                         ;;
8908                 esac
8909                 ;;
8910         esac
8911 fi
8912 # Fix ccdlflags in AIX for building external extensions.
8913 # (For building Perl itself bare -bE:perl.exp is needed,
8914 #  Makefile.SH takes care of this.)
8915 case "$osname" in
8916 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8917 esac
8918 # Respect a hint or command-line value.
8919 case "$shrpenv" in
8920 '') shrpenv="$tmp_shrpenv" ;;
8921 esac
8922 case "$ldlibpthname" in
8923 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8924 none)   ldlibpthname='' ;;
8925 esac
8926
8927 : determine where manual pages are on this system
8928 echo " "
8929 case "$sysman" in
8930 '')
8931         syspath='/usr/share/man/man1 /usr/man/man1'
8932         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8933         syspath="$syspath /usr/man/u_man/man1"
8934         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8935         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8936         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8937         sysman=`./loc . /usr/man/man1 $syspath`
8938         ;;
8939 esac
8940 if $test -d "$sysman"; then
8941         echo "System manual is in $sysman." >&4
8942 else
8943         echo "Could not find manual pages in source form." >&4
8944 fi
8945
8946 : determine where manual pages go
8947 set man1dir man1dir none
8948 eval $prefixit
8949 $cat <<EOM
8950
8951 $spackage has manual pages available in source form.
8952 EOM
8953 case "$nroff" in
8954 nroff)
8955         echo "However, you don't have nroff, so they're probably useless to you."
8956         case "$man1dir" in
8957         '') man1dir="none";;
8958         esac;;
8959 esac
8960 echo "If you don't want the manual sources installed, answer 'none'."
8961 case "$man1dir" in
8962 ' ') dflt=none
8963         ;;
8964 '')
8965         lookpath="$prefixexp/share/man/man1"
8966         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8967         lookpath="$lookpath $prefixexp/man/p_man/man1"
8968         lookpath="$lookpath $prefixexp/man/u_man/man1"
8969         lookpath="$lookpath $prefixexp/man/man.1"
8970         case "$sysman" in
8971         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8972         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8973         esac
8974         set dflt
8975         eval $prefixup
8976         ;;
8977 *)  dflt="$man1dir"
8978         ;;
8979 esac
8980 echo " "
8981 fn=dn+~
8982 rp="Where do the main $spackage manual pages (source) go?"
8983 . ./getfile
8984 if $test "X$man1direxp" != "X$ansexp"; then
8985         installman1dir=''
8986 fi
8987 prefixvar=man1dir
8988 . ./setprefixvar
8989
8990 case "$man1dir" in
8991 '')     man1dir=' '
8992         installman1dir='';;
8993 esac
8994
8995 : What suffix to use on installed man pages
8996
8997 case "$man1dir" in
8998 ' ')
8999         man1ext='0'
9000         ;;
9001 *)
9002         rp="What suffix should be used for the main $spackage man pages?"
9003         case "$man1ext" in
9004         '')     case "$man1dir" in
9005                 *1)  dflt=1 ;;
9006                 *1p) dflt=1p ;;
9007                 *1pm) dflt=1pm ;;
9008                 *l) dflt=l;;
9009                 *n) dflt=n;;
9010                 *o) dflt=o;;
9011                 *p) dflt=p;;
9012                 *C) dflt=C;;
9013                 *L) dflt=L;;
9014                 *L1) dflt=L1;;
9015                 *) dflt=1;;
9016                 esac
9017                 ;;
9018         *)      dflt="$man1ext";;
9019         esac
9020         . ./myread
9021         man1ext="$ans"
9022         ;;
9023 esac
9024
9025 : see if we can have long filenames
9026 echo " "
9027 first=123456789abcdef
9028 $rm -f $first
9029 if (echo hi >$first) 2>/dev/null; then
9030         if $test -f 123456789abcde; then
9031                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
9032                 val="$undef"
9033         else
9034                 echo 'You can have filenames longer than 14 characters.'>&4
9035                 val="$define"
9036         fi
9037 else
9038         $cat <<'EOM'
9039 You can't have filenames longer than 14 chars.
9040 You can't even think about them!
9041 EOM
9042         val="$undef"
9043 fi
9044 set d_flexfnam
9045 eval $setvar
9046 $rm -rf 123456789abcde*
9047
9048 : determine where library module manual pages go
9049 set man3dir man3dir none
9050 eval $prefixit
9051 $cat <<EOM
9052
9053 $spackage has manual pages for many of the library modules.
9054 EOM
9055
9056 case "$nroff" in
9057 nroff)
9058         $cat <<'EOM'
9059 However, you don't have nroff, so they're probably useless to you.
9060 EOM
9061         case "$man3dir" in
9062         '') man3dir="none";;
9063         esac;;
9064 esac
9065
9066 case "$d_flexfnam" in
9067 undef)
9068         $cat <<'EOM'
9069 However, your system can't handle the long file names like File::Basename.3.
9070 EOM
9071         case "$man3dir" in
9072         '') man3dir="none";;
9073         esac;;
9074 esac
9075
9076 echo "If you don't want the manual sources installed, answer 'none'."
9077 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9078 case "$man3dir" in
9079 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9080         if $test -d "$privlib/man/man3"; then
9081                 cat <<EOM >&4
9082
9083 WARNING:  Previous versions of perl installed man3 pages into
9084 $privlib/man/man3.  This version will suggest a
9085 new default of $dflt.
9086 EOM
9087                 tdflt=$dflt
9088                 dflt='n'
9089                 rp='Do you wish to preserve the old behavior?(y/n)'
9090                 . ./myread
9091                 case "$ans" in
9092                 y*) dflt="$privlib/man/man3" ;;
9093                 *)  dflt=$tdflt ;;
9094                 esac
9095     fi
9096         ;;
9097 *)      dflt="$man3dir" ;;
9098 esac
9099 case "$dflt" in
9100 ' ') dflt=none ;;
9101 esac
9102 echo " "
9103 fn=dn+~
9104 rp="Where do the $package library man pages (source) go?"
9105 . ./getfile
9106 prefixvar=man3dir
9107 . ./setprefixvar
9108
9109 case "$man3dir" in
9110 '')     man3dir=' '
9111         installman3dir='';;
9112 esac
9113
9114 : What suffix to use on installed man pages
9115 case "$man3dir" in
9116 ' ')
9117         man3ext='0'
9118         ;;
9119 *)
9120         rp="What suffix should be used for the $package library man pages?"
9121         case "$man3ext" in
9122         '')     case "$man3dir" in
9123                 *3)  dflt=3 ;;
9124                 *3p) dflt=3p ;;
9125                 *3pm) dflt=3pm ;;
9126                 *l) dflt=l;;
9127                 *n) dflt=n;;
9128                 *o) dflt=o;;
9129                 *p) dflt=p;;
9130                 *C) dflt=C;;
9131                 *L) dflt=L;;
9132                 *L3) dflt=L3;;
9133                 *) dflt=3;;
9134                 esac
9135                 ;;
9136         *)      dflt="$man3ext";;
9137         esac
9138         . ./myread
9139         man3ext="$ans"
9140         ;;
9141 esac
9142
9143 : see if we have to deal with yellow pages, now NIS.
9144 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9145         case "$hostcat" in
9146         nidump*) ;;
9147         *)
9148                 case "$hostcat" in
9149                 *ypcat*) dflt=y;;
9150                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9151                                 dflt=y
9152                         else
9153                                 dflt=n
9154                         fi;;
9155                 *) dflt=n;;
9156                 esac
9157                 echo " "
9158                 rp='Are you getting the hosts file via yellow pages?'
9159                 . ./myread
9160                 case "$ans" in
9161                 y*) hostcat='ypcat hosts';;
9162                 *) hostcat='cat /etc/hosts';;
9163                 esac
9164                 ;;
9165         esac
9166 fi
9167 case "$hostcat" in
9168 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9169 esac
9170 case "$groupcat" in
9171 '') test -f /etc/group && groupcat='cat /etc/group';;
9172 esac
9173 case "$passcat" in
9174 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9175 esac
9176
9177 : now get the host name
9178 echo " "
9179 echo "Figuring out host name..." >&4
9180 case "$myhostname" in
9181 '') cont=true
9182         echo 'Maybe "hostname" will work...'
9183         if tans=`sh -c hostname 2>&1` ; then
9184                 myhostname=$tans
9185                 phostname=hostname
9186                 cont=''
9187         fi
9188         ;;
9189 *) cont='';;
9190 esac
9191 if $test "$cont"; then
9192         if ./xenix; then
9193                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9194                 if tans=`cat /etc/systemid 2>&1` ; then
9195                         myhostname=$tans
9196                         phostname='cat /etc/systemid'
9197                         echo "Whadyaknow.  Xenix always was a bit strange..."
9198                         cont=''
9199                 fi
9200         elif $test -r /etc/systemid; then
9201                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9202         fi
9203 fi
9204 if $test "$cont"; then
9205         echo 'No, maybe "uuname -l" will work...'
9206         if tans=`sh -c 'uuname -l' 2>&1` ; then
9207                 myhostname=$tans
9208                 phostname='uuname -l'
9209         else
9210                 echo 'Strange.  Maybe "uname -n" will work...'
9211                 if tans=`sh -c 'uname -n' 2>&1` ; then
9212                         myhostname=$tans
9213                         phostname='uname -n'
9214                 else
9215                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9216                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9217                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9218                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9219                         else
9220                                 case "$myhostname" in
9221                                 '') echo "Does this machine have an identity crisis or something?"
9222                                         phostname='';;
9223                                 *)
9224                                         echo "Well, you said $myhostname before..."
9225                                         phostname='echo $myhostname';;
9226                                 esac
9227                         fi
9228                 fi
9229         fi
9230 fi
9231 case "$myhostname" in
9232 '') myhostname=noname ;;
9233 esac
9234 : you do not want to know about this
9235 set $myhostname
9236 myhostname=$1
9237
9238 : verify guess
9239 if $test "$myhostname" ; then
9240         dflt=y
9241         rp='Your host name appears to be "'$myhostname'".'" Right?"
9242         . ./myread
9243         case "$ans" in
9244         y*) ;;
9245         *) myhostname='';;
9246         esac
9247 fi
9248
9249 : bad guess or no guess
9250 while $test "X$myhostname" = X ; do
9251         dflt=''
9252         rp="Please type the (one word) name of your host:"
9253         . ./myread
9254         myhostname="$ans"
9255 done
9256
9257 : translate upper to lower if necessary
9258 case "$myhostname" in
9259 *[A-Z]*)
9260         echo "(Normalizing case in your host name)"
9261         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9262         ;;
9263 esac
9264
9265 case "$myhostname" in
9266 *.*)
9267         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9268         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9269         echo "(Trimming domain name from host name--host name is now $myhostname)"
9270         ;;
9271 *) case "$mydomain" in
9272         '')
9273                 {
9274                         test "X$hostcat" = "Xypcat hosts" &&
9275                         ypmatch "$myhostname" hosts 2>/dev/null |\
9276                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9277                         $test -s hosts
9278                 } || {
9279                         test "X$hostcat" != "X" &&
9280                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9281                                         /[       ]$myhostname[  . ]/p" > hosts
9282                 }
9283                 tmp_re="[       . ]"
9284                 if $test -f hosts; then
9285                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9286                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9287                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9288                                 hosts | $sort | $uniq | \
9289                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9290                         case `$echo X$dflt` in
9291                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9292                                 dflt=.
9293                                 ;;
9294                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9295                                 ;;
9296                         esac
9297                 else
9298                         echo "(I cannot locate a hosts database anywhere)"
9299                         dflt=.
9300                 fi
9301                 case "$dflt" in
9302                 .)
9303                         tans=`./loc resolv.conf X /etc /usr/etc`
9304                         if $test -f "$tans"; then
9305                                 echo "(Attempting domain name extraction from $tans)"
9306                                 dflt=.`$sed -n -e 's/   / /g' \
9307                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9308                                   -e 1q 2>/dev/null`
9309                                 case "$dflt" in
9310                                 .) dflt=.`$sed -n -e 's/        / /g' \
9311                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9312                                      -e 1q 2>/dev/null`
9313                                         ;;
9314                                 esac
9315                         fi
9316                         ;;
9317                 esac
9318                 case "$dflt" in
9319                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9320                         dflt=.`sh -c domainname 2>/dev/null`
9321                         case "$dflt" in
9322                         '') dflt='.';;
9323                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9324                         esac
9325                         ;;
9326                 esac
9327                 case "$dflt$osname" in
9328                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9329                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9330                         ;;
9331                 esac
9332                 case "$dflt" in
9333                 .) echo "(Lost all hope -- silly guess then)"
9334                         dflt='.nonet'
9335                         ;;
9336                 esac
9337                 $rm -f hosts
9338                 ;;
9339         *) dflt="$mydomain";;
9340         esac;;
9341 esac
9342 echo " "
9343 rp="What is your domain name?"
9344 . ./myread
9345 tans="$ans"
9346 case "$ans" in
9347 '') ;;
9348 .*) ;;
9349 *) tans=".$tans";;
9350 esac
9351 mydomain="$tans"
9352
9353 : translate upper to lower if necessary
9354 case "$mydomain" in
9355 *[A-Z]*)
9356         echo "(Normalizing case in your domain name)"
9357         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9358         ;;
9359 esac
9360
9361 : a little sanity check here
9362 case "$phostname" in
9363 '') ;;
9364 *)
9365         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9366         $myhostname$mydomain|$myhostname) ;;
9367         *)
9368                 case "$phostname" in
9369                 sed*)
9370                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9371                         ;;
9372                 *)
9373                         echo "(That doesn't agree with your $phostname command, by the way.)"
9374                         ;;
9375                 esac
9376         ;;
9377         esac
9378         ;;
9379 esac
9380
9381 : determine the e-mail address of the user who is running us
9382 $cat <<EOM
9383
9384 I need to get your e-mail address in Internet format if possible, i.e.
9385 something like user@host.domain. Please answer accurately since I have
9386 no easy means to double check it. The default value provided below
9387 is most probably close to reality but may not be valid from outside
9388 your organization...
9389
9390 EOM
9391 cont=x
9392 while test "$cont"; do
9393         case "$MAILDOMAIN" in
9394         '')
9395                 if $test -s /etc/mailname; then
9396                         maildomain=`$cat /etc/mailname`
9397                 else
9398                         maildomain="$myhostname$mydomain"
9399                 fi
9400                 ;;
9401         *)  maildomain="$MAILDOMAIN";;
9402         esac
9403         case "$cf_email" in
9404         '') dflt="$cf_by@$maildomain";;
9405         *)  dflt="$cf_email";;
9406         esac
9407         rp='What is your e-mail address?'
9408         . ./myread
9409         cf_email="$ans"
9410         case "$cf_email" in
9411         *@*.*) cont='' ;;
9412         *)
9413                 rp='Address does not look like an Internet one.  Use it anyway?'
9414                 case "$fastread" in
9415                 yes) dflt=y ;;
9416                 *) dflt=n ;;
9417                 esac
9418                 . ./myread
9419                 case "$ans" in
9420                 y*) cont='' ;;
9421                 *) echo " " ;;
9422                 esac
9423                 ;;
9424         esac
9425 done
9426
9427 : Ask e-mail of administrator
9428 $cat <<EOM
9429
9430 If you or somebody else will be maintaining perl at your site, please
9431 fill in the correct e-mail address here so that they may be contacted
9432 if necessary. Currently, the "perlbug" program included with perl
9433 will send mail to this address in addition to perlbug@perl.org. You may
9434 enter "none" for no administrator.
9435
9436 EOM
9437 case "$perladmin" in
9438 '') dflt="$cf_email";;
9439 *) dflt="$perladmin";;
9440 esac
9441 rp='Perl administrator e-mail address'
9442 . ./myread
9443 perladmin="$ans"
9444
9445 : determine whether to use a version number suffix for installed binaries
9446 echo " "
9447 $cat <<EOM
9448 Do you want to use a version number suffix for installed binaries? This
9449 will install 'perl$version' instead of 'perl', and likewise for other
9450 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9451 to be installed side-by-side. Unless you are a developer, you probably
9452 do *not* want to do this.
9453 EOM
9454 case "$versiononly" in
9455 "$define"|[Yy]*|true) dflt='y' ;;
9456 *) dflt='n';
9457 esac
9458 rp="Do you want to use a version number suffix for installed binaries?"
9459 . ./myread
9460 case "$ans" in
9461 [yY]*)  val="$define";;
9462 *)      val="$undef" ;;
9463 esac
9464 set versiononly
9465 eval $setvar
9466
9467 case "$versiononly" in
9468 "$define") inc_version_list=''
9469            inc_version_list_init=0
9470            ;;
9471 esac
9472
9473 : figure out how to guarantee perl startup
9474 : XXX Note that this currently takes advantage of the bug that binexp ignores
9475 :     the Configure -Dinstallprefix setting, which in turn means that under
9476 :     relocatable @INC, initialinstalllocation is what binexp started as.
9477 case "$startperl" in
9478 '')
9479         case "$sharpbang" in
9480         *!)
9481                 $cat <<EOH
9482
9483 I can use the #! construct to start perl on your system. This will
9484 make startup of perl scripts faster, but may cause problems if you
9485 want to share those scripts and perl is not in a standard place
9486 ($initialinstalllocation/perl) on all your platforms. The alternative
9487 is to force a shell by starting the script with a single ':' character.
9488
9489 EOH
9490                 case "$versiononly" in
9491                 "$define")      dflt="$initialinstalllocation/perl$version";;
9492                 *)              dflt="$initialinstalllocation/perl";;
9493                 esac
9494                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9495                 . ./myread
9496                 case "$ans" in
9497                 none)   startperl=": # use perl";;
9498                 *)      startperl="#!$ans"
9499                         if $test 30 -lt `echo "$ans" | wc -c`; then
9500                                 $cat >&4 <<EOM
9501
9502 WARNING:  Some systems limit the #! command to 32 characters.
9503 If you experience difficulty running Perl scripts with #!, try
9504 installing Perl in a directory with a shorter pathname.
9505
9506 EOM
9507                         fi ;;
9508                 esac
9509                 ;;
9510         *) startperl=": # use perl"
9511                 ;;
9512         esac
9513         ;;
9514 esac
9515 echo "I'll use $startperl to start perl scripts."
9516
9517 : figure best path for perl in scripts
9518 case "$perlpath" in
9519 '')
9520         case "$versiononly" in
9521         "$define")      perlpath="$initialinstalllocation/perl$version";;
9522         *)              perlpath="$initialinstalllocation/perl";;
9523         esac
9524         case "$startperl" in
9525         *!*) ;;
9526         *)
9527                 $cat <<EOH
9528
9529 I will use the "eval 'exec'" idiom to start Perl on your system.
9530 I can use the full path of your Perl binary for this purpose, but
9531 doing so may cause problems if you want to share those scripts and
9532 Perl is not always in a standard place ($initialinstalllocation/perl).
9533
9534 EOH
9535                 dflt="$initialinstalllocation/perl"
9536                 rp="What path shall I use in \"eval 'exec'\"?"
9537                 . ./myread
9538                 perlpath="$ans"
9539                 ;;
9540         esac
9541         ;;
9542 esac
9543 case "$startperl" in
9544 *!*)    ;;
9545 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9546 esac
9547
9548 : determine where public executable scripts go
9549 set scriptdir scriptdir
9550 eval $prefixit
9551 case "$scriptdir" in
9552 '')
9553         dflt="$bin"
9554         : guess some guesses
9555         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9556         $test -d /usr/share/bin     && dflt=/usr/share/bin
9557         $test -d /usr/local/script  && dflt=/usr/local/script
9558         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9559         $test -d $prefixexp/script  && dflt=$prefixexp/script
9560         set dflt
9561         eval $prefixup
9562         ;;
9563 *)  dflt="$scriptdir"
9564         ;;
9565 esac
9566 $cat <<EOM
9567
9568 Some installations have a separate directory just for executable scripts so
9569 that they can mount it across multiple architectures but keep the scripts in
9570 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9571 Or you might just lump your scripts in with all your other executables.
9572
9573 EOM
9574 fn=d~
9575 rp='Where do you keep publicly executable scripts?'
9576 . ./getfile
9577 if $test "X$ansexp" != "X$scriptdirexp"; then
9578         installscript=''
9579 fi
9580 installscriptdir=''
9581 prefixvar=scriptdir
9582 . ./setprefixvar
9583 : A little fix up for an irregularly named variable.
9584 installscript="$installscriptdir"
9585
9586 : determine where add-on public executables go
9587 case "$sitebin" in
9588 '')     dflt=$siteprefix/bin ;;
9589 *)      dflt=$sitebin ;;
9590 esac
9591 fn=d~
9592 rp='Pathname where the add-on public executables should be installed?'
9593 . ./getfile
9594 prefixvar=sitebin
9595 . ./setprefixvar
9596
9597 : determine where add-on html pages go
9598 : There is no standard location, so try to copy the previously-selected
9599 : directory structure for the core html pages.
9600 case "$sitehtml1dir" in
9601 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9602 *)     dflt=$sitehtml1dir ;;
9603 esac
9604 case "$dflt" in
9605 ''|' ') dflt=none ;;
9606 esac
9607 fn=dn+~
9608 rp='Pathname where the site-specific html pages should be installed?'
9609 . ./getfile
9610 prefixvar=sitehtml1dir
9611 . ./setprefixvar
9612
9613 : determine where add-on library html pages go
9614 : There is no standard location, so try to copy the previously-selected
9615 : directory structure for the core html pages.
9616 case "$sitehtml3dir" in
9617 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9618 *)     dflt=$sitehtml3dir ;;
9619 esac
9620 case "$dflt" in
9621 ''|' ') dflt=none ;;
9622 esac
9623 fn=dn+~
9624 rp='Pathname where the site-specific library html pages should be installed?'
9625 . ./getfile
9626 prefixvar=sitehtml3dir
9627 . ./setprefixvar
9628
9629 : determine where add-on manual pages go
9630 case "$siteman1dir" in
9631 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9632 *)      dflt=$siteman1dir ;;
9633 esac
9634 case "$dflt" in
9635 ''|' ') dflt=none ;;
9636 esac
9637 fn=dn+~
9638 rp='Pathname where the site-specific manual pages should be installed?'
9639 . ./getfile
9640 prefixvar=siteman1dir
9641 . ./setprefixvar
9642
9643 : determine where add-on library man pages go
9644 case "$siteman3dir" in
9645 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9646 *)      dflt=$siteman3dir ;;
9647 esac
9648 case "$dflt" in
9649 ''|' ') dflt=none ;;
9650 esac
9651 fn=dn+~
9652 rp='Pathname where the site-specific library manual pages should be installed?'
9653 . ./getfile
9654 prefixvar=siteman3dir
9655 . ./setprefixvar
9656
9657 : determine where add-on public executable scripts go
9658 case "$sitescript" in
9659 '')     dflt=$siteprefix/script
9660         $test -d $dflt || dflt=$sitebin ;;
9661 *)  dflt="$sitescript" ;;
9662 esac
9663 fn=d~+
9664 rp='Pathname where add-on public executable scripts should be installed?'
9665 . ./getfile
9666 prefixvar=sitescript
9667 . ./setprefixvar
9668
9669 : see if backtrace exists
9670 set backtrace d_backtrace
9671 eval $inlibc
9672
9673 : add flags if using c backtrace
9674 case "$usecbacktrace" in
9675   "") usecbacktrace=$undef ;;
9676   [yY]*|true|$define)
9677     case "$d_backtrace" in
9678       [yY]*|true|$define)
9679         case " $ccflags " in
9680           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9681           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9682           esac
9683         ;;
9684       *)
9685         echo "This system does not support backtrace" >&4
9686         usecbacktrace=$undef
9687         ;;
9688       esac
9689     ;;
9690   esac
9691
9692 : Check if faststdio is requested and available
9693 case "$usefaststdio" in
9694 $define|true|[yY]*|'')
9695         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9696         case "$xversion" in
9697         [68])   dflt='y' ;;
9698         *)      dflt='n' ;;
9699         esac
9700         ;;
9701 *) dflt='n';;
9702 esac
9703 cat <<EOM
9704
9705 Perl can be built to use 'fast stdio', which means using the stdio
9706 library but also directly manipulating the stdio buffers to enable
9707 faster I/O.  Using stdio is better for backward compatibility (especially
9708 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9709 interface has been preferred instead of stdio.
9710
9711 If this doesn't make any sense to you, just accept the default '$dflt'.
9712 EOM
9713 rp='Use the "fast stdio" if available?'
9714 . ./myread
9715 case "$ans" in
9716 y|Y)    val="$define" ;;
9717 *)      val="$undef" ;;
9718 esac
9719 set usefaststdio
9720 eval $setvar
9721
9722
9723 : define an is-a-typedef? function
9724 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9725 case "$inclist" in
9726 "") inclist="sys/types.h";;
9727 esac;
9728 eval "varval=\$$var";
9729 case "$varval" in
9730 "")
9731         $rm -f temp.c;
9732         for inc in $inclist; do
9733                 echo "#include <$inc>" >>temp.c;
9734         done;
9735         echo "#ifdef $type" >> temp.c;
9736         echo "printf(\"We have $type\");" >> temp.c;
9737         echo "#endif" >> temp.c;
9738         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9739         if $contains $type temp.E >/dev/null 2>&1; then
9740                 eval "$var=\$type";
9741         else
9742                 eval "$var=\$def";
9743         fi;
9744         $rm -f temp.?;;
9745 *) eval "$var=\$varval";;
9746 esac'
9747
9748 : define an is-a-typedef? function that prompts if the type is not available.
9749 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9750 case "$inclist" in
9751 "") inclist="sys/types.h";;
9752 esac;
9753 eval "varval=\$$var";
9754 case "$varval" in
9755 "")
9756         $rm -f temp.c;
9757         for inc in $inclist; do
9758                 echo "#include <$inc>" >>temp.c;
9759         done;
9760         echo "#ifdef $type" >> temp.c;
9761         echo "printf(\"We have $type\");" >> temp.c;
9762         echo "#endif" >> temp.c;
9763         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9764         echo " " ;
9765         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9766         if $contains $type temp.E >/dev/null 2>&1; then
9767                 echo "$type found." >&4;
9768                 eval "$var=\$type";
9769         else
9770                 echo "$type NOT found." >&4;
9771                 dflt="$def";
9772                 . ./myread ;
9773                 eval "$var=\$ans";
9774         fi;
9775         $rm -f temp.?;;
9776 *) eval "$var=\$varval";;
9777 esac'
9778
9779 : see what type lseek is declared as in the kernel
9780 rp="What is the type used for lseek's offset on this system?"
9781 set off_t lseektype long stdio.h sys/types.h
9782 eval $typedef_ask
9783
9784 echo " "
9785 echo "Checking to see how big your file offsets are..." >&4
9786 $cat >try.c <<EOCP
9787 #include <sys/types.h>
9788 #include <stdio.h>
9789 int main()
9790 {
9791     printf("%d\n", (int)sizeof($lseektype));
9792     return(0);
9793 }
9794 EOCP
9795 set try
9796 if eval $compile_ok; then
9797         lseeksize=`$run ./try`
9798         echo "Your file offsets are $lseeksize bytes long."
9799 else
9800         dflt=$longsize
9801         echo " "
9802         echo "(I can't seem to compile the test program.  Guessing...)"
9803         rp="What is the size of your file offsets (in bytes)?"
9804         . ./myread
9805         lseeksize="$ans"
9806 fi
9807 $rm_try
9808
9809 : see what type file positions are declared as in the library
9810 rp="What is the type for file position used by fsetpos()?"
9811 set fpos_t fpostype long stdio.h sys/types.h
9812 eval $typedef_ask
9813
9814 : Check size for Fpos_t
9815 echo " "
9816 case "$fpostype" in
9817 *_t) zzz="$fpostype"    ;;
9818 *)   zzz="fpos_t"       ;;
9819 esac
9820 echo "Checking the size of $zzz..." >&4
9821 cat > try.c <<EOCP
9822 #include <sys/types.h>
9823 #include <stdio.h>
9824 #$i_stdlib I_STDLIB
9825 #ifdef I_STDLIB
9826 #include <stdlib.h>
9827 #endif
9828 int main() {
9829     printf("%d\n", (int)sizeof($fpostype));
9830     exit(0);
9831 }
9832 EOCP
9833 set try
9834 if eval $compile_ok; then
9835         yyy=`$run ./try`
9836         case "$yyy" in
9837         '')     fpossize=4
9838                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9839                 ;;
9840         *)      fpossize=$yyy
9841                 echo "Your $zzz is $fpossize bytes long."
9842                 ;;
9843         esac
9844 else
9845         dflt="$longsize"
9846         echo " " >&4
9847         echo "(I can't compile the test program.  Guessing...)" >&4
9848         rp="What is the size of your file positions (in bytes)?"
9849         . ./myread
9850         fpossize="$ans"
9851 fi
9852
9853 : Check for large file support
9854 # Backward compatibility (uselfs is deprecated).
9855 case "$uselfs" in
9856 "$define"|true|[yY]*)
9857         cat <<EOM >&4
9858
9859 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9860 EOM
9861         uselargefiles="$define"
9862         ;;
9863 esac
9864
9865 case "$lseeksize:$fpossize" in
9866 8:8) cat <<EOM
9867
9868 You can have files larger than 2 gigabytes.
9869 EOM
9870    val="$define" ;;
9871 *)    case "$uselargefiles" in
9872    "$undef"|false|[nN]*) dflt='n' ;;
9873    *)   dflt='y' ;;
9874    esac
9875    cat <<EOM
9876
9877 Perl can be built to understand large files (files larger than 2 gigabytes)
9878 on some systems.  To do so, Configure can be run with -Duselargefiles.
9879
9880 If this doesn't make any sense to you, just accept the default '$dflt'.
9881 EOM
9882    rp='Try to understand large files, if available?'
9883    . ./myread
9884    case "$ans" in
9885    y|Y)         val="$define" ;;
9886    *)           val="$undef"  ;;
9887    esac
9888    ;;
9889 esac
9890 set uselargefiles
9891 eval $setvar
9892 : Look for a hint-file generated 'call-back-unit'.  If the
9893 : user has specified that a large files perl is to be built,
9894 : we may need to set or change some other defaults.
9895 if $test -f uselargefiles.cbu; then
9896         echo "Your platform has some specific hints regarding large file builds, using them..."
9897         . ./uselargefiles.cbu
9898 fi
9899 case "$uselargefiles" in
9900 "$define")
9901         if $test -f uselargefiles.cbu; then
9902                 echo " "
9903                 echo "Rechecking to see how big your file offsets are..." >&4
9904                 $cat >try.c <<EOCP
9905 #include <sys/types.h>
9906 #include <stdio.h>
9907 int main()
9908 {
9909     printf("%d\n", (int)sizeof($lseektype));
9910     return(0);
9911 }
9912 EOCP
9913                 set try
9914                 if eval $compile_ok; then
9915                         lseeksize=`$run ./try`
9916                         $echo "Your file offsets are now $lseeksize bytes long."
9917                 else
9918                         dflt="$lseeksize"
9919                         echo " "
9920                         echo "(I can't seem to compile the test program.  Guessing...)"
9921                         rp="What is the size of your file offsets (in bytes)?"
9922                         . ./myread
9923                         lseeksize="$ans"
9924                 fi
9925                 case "$fpostype" in
9926                 *_t) zzz="$fpostype"    ;;
9927                 *)   zzz="fpos_t"       ;;
9928                 esac
9929                 $echo $n "Rechecking the size of $zzz...$c" >&4
9930                 $cat > try.c <<EOCP
9931 #include <sys/types.h>
9932 #include <stdio.h>
9933 #$i_stdlib I_STDLIB
9934 #ifdef I_STDLIB
9935 #include <stdlib.h>
9936 #endif
9937 int main() {
9938     printf("%d\n", (int)sizeof($fpostype));
9939     return(0);
9940 }
9941 EOCP
9942                 set try
9943                 if eval $compile_ok; then
9944                         yyy=`$run ./try`
9945                         dflt="$lseeksize"
9946                         case "$yyy" in
9947                         '')     echo " "
9948                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9949                                 ;;
9950                         *)      fpossize=$yyy
9951                                 echo " $fpossize bytes." >&4
9952                                 ;;
9953                         esac
9954                 else
9955                         dflt="$fpossize"
9956                         echo " "
9957                         echo "(I can't compile the test program.  Guessing...)" >&4
9958                         rp="What is the size of your file positions (in bytes)?"
9959                         . ./myread
9960                         fpossize="$ans"
9961                 fi
9962                 $rm_try
9963         fi
9964         ;;
9965 esac
9966
9967 : Check if we want perlio
9968 useperlio="$define"
9969
9970 : Set the vendorbin variables
9971 case "$vendorprefix" in
9972 '')     d_vendorbin="$undef"
9973         vendorbin=''
9974         vendorbinexp=''
9975         ;;
9976 *)      d_vendorbin="$define"
9977         : determine where vendor-supplied executables go.
9978         case "$vendorbin" in
9979         '') dflt=$vendorprefix/bin ;;
9980         *)      dflt="$vendorbin" ;;
9981         esac
9982         fn=d~+
9983         rp='Pathname for the vendor-supplied executables directory?'
9984         . ./getfile
9985         vendorbin="$ans"
9986         vendorbinexp="$ansexp"
9987         ;;
9988 esac
9989 prefixvar=vendorbin
9990 . ./installprefix
9991
9992 : Set the vendorhtml1dir variables
9993 case "$vendorprefix" in
9994 '')     vendorhtml1dir=''
9995         vendorhtml1direxp=''
9996         ;;
9997 *)      : determine where vendor-supplied html pages go.
9998         : There is no standard location, so try to copy the previously-selected
9999         : directory structure for the core html pages.
10000         : XXX Better default suggestions would be welcome.
10001         case "$vendorhtml1dir" in
10002         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10003         *)      dflt=$vendorhtml1dir ;;
10004         esac
10005         case "$dflt" in
10006         ''|' ') dflt=none ;;
10007         esac
10008         fn=dn+~
10009         rp='Pathname for the vendor-supplied html pages?'
10010         . ./getfile
10011         vendorhtml1dir="$ans"
10012         vendorhtml1direxp="$ansexp"
10013         ;;
10014 esac
10015 : Use ' ' for none so value is preserved next time through Configure
10016 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
10017 prefixvar=vendorhtml1dir
10018 . ./installprefix
10019
10020 : Set the vendorhtml3dir variables
10021 case "$vendorprefix" in
10022 '')     vendorhtml3dir=''
10023         vendorhtml3direxp=''
10024         ;;
10025 *)      : determine where vendor-supplied module html pages go.
10026         : There is no standard location, so try to copy the previously-selected
10027         : directory structure for the core html pages.
10028         : XXX Better default suggestions would be welcome.
10029         case "$vendorhtml3dir" in
10030         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10031         *)      dflt=$vendorhtml3dir ;;
10032         esac
10033         case "$dflt" in
10034         ''|' ') dflt=none ;;
10035         esac
10036         fn=dn+~
10037         rp='Pathname for the vendor-supplied html pages?'
10038         . ./getfile
10039         vendorhtml3dir="$ans"
10040         vendorhtml3direxp="$ansexp"
10041         ;;
10042 esac
10043 : Use ' ' for none so value is preserved next time through Configure
10044 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
10045 prefixvar=vendorhtml3dir
10046 . ./installprefix
10047
10048 : Set the vendorman1dir variables
10049 case "$vendorprefix" in
10050 '')     vendorman1dir=''
10051         vendorman1direxp=''
10052         ;;
10053 *)      : determine where vendor-supplied manual pages go.
10054         case "$vendorman1dir" in
10055         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10056         *)      dflt=$vendorman1dir ;;
10057         esac
10058         case "$dflt" in
10059         ''|' ') dflt=none ;;
10060         esac
10061         fn=nd~+
10062         rp='Pathname for the vendor-supplied manual section 1 pages?'
10063         . ./getfile
10064         vendorman1dir="$ans"
10065         vendorman1direxp="$ansexp"
10066         ;;
10067 esac
10068 : Use ' ' for none so value is preserved next time through Configure
10069 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10070 prefixvar=vendorman1dir
10071 . ./installprefix
10072
10073 : Set the vendorman3dir variables
10074 case "$vendorprefix" in
10075 '')     vendorman3dir=''
10076         vendorman3direxp=''
10077         ;;
10078 *)      : determine where vendor-supplied module manual pages go.
10079         case "$vendorman3dir" in
10080         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10081         *)      dflt=$vendorman3dir ;;
10082         esac
10083         case "$dflt" in
10084         ''|' ') dflt=none ;;
10085         esac
10086         fn=nd~+
10087         rp='Pathname for the vendor-supplied manual section 3 pages?'
10088         . ./getfile
10089         vendorman3dir="$ans"
10090         vendorman3direxp="$ansexp"
10091         ;;
10092 esac
10093 : Use ' ' for none so value is preserved next time through Configure
10094 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10095 prefixvar=vendorman3dir
10096 . ./installprefix
10097
10098 : Set the vendorscript variables
10099 case "$vendorprefix" in
10100 '')     d_vendorscript="$undef"
10101         vendorscript=''
10102         vendorscriptexp=''
10103         ;;
10104 *)      d_vendorscript="$define"
10105         : determine where vendor-supplied scripts go.
10106         case "$vendorscript" in
10107         '')     dflt=$vendorprefix/script
10108                 $test -d $dflt || dflt=$vendorbin ;;
10109         *)  dflt="$vendorscript" ;;
10110         esac
10111         $cat <<EOM
10112
10113 The installation process will create a directory for
10114 vendor-supplied scripts.
10115
10116 EOM
10117         fn=d~+
10118         rp='Pathname for the vendor-supplied scripts directory?'
10119         . ./getfile
10120         vendorscript="$ans"
10121         vendorscriptexp="$ansexp"
10122         ;;
10123 esac
10124 prefixvar=vendorscript
10125 . ./installprefix
10126
10127 : script used to emit important warnings
10128 cat >warn <<EOS
10129 $startsh
10130 if test \$# -gt 0; then
10131         echo "\$@" >msg
10132 else
10133         cat >msg
10134 fi
10135 echo "*** WARNING:" >&4
10136 sed -e 's/^/*** /' <msg >&4
10137 echo "*** " >&4
10138 cat msg >>config.msg
10139 echo " " >>config.msg
10140 rm -f msg
10141 EOS
10142 chmod +x warn
10143 $eunicefix warn
10144
10145 : see which of string.h or strings.h is needed
10146 echo " "
10147 strings=`./findhdr string.h`
10148 if $test "$strings" && $test -r "$strings"; then
10149         echo "Using <string.h> instead of <strings.h>." >&4
10150         val="$define"
10151 else
10152         val="$undef"
10153         strings=`./findhdr strings.h`
10154         if $test "$strings" && $test -r "$strings"; then
10155                 echo "Using <strings.h> instead of <string.h>." >&4
10156         else
10157                 ./warn "No string header found -- You'll surely have problems."
10158         fi
10159 fi
10160 set i_string
10161 eval $setvar
10162 case "$i_string" in
10163 "$undef") strings=`./findhdr strings.h`;;
10164 *)        strings=`./findhdr string.h`;;
10165 esac
10166
10167 : see if qgcvt exists
10168 set qgcvt d_qgcvt
10169 eval $inlibc
10170
10171 : Check what kind of doubles your system has
10172 $echo "Checking the kind of doubles you have..." >&4
10173 $cat >try.c <<EOP
10174 #$i_stdlib I_STDLIB
10175 #define DOUBLESIZE $doublesize
10176 #ifdef I_STDLIB
10177 #include <stdlib.h>
10178 #endif
10179 #include <stdio.h>
10180 static const double d = -0.1;
10181 int main() {
10182   unsigned const char* b = (unsigned const char*)(&d);
10183 #if DOUBLESIZE == 4
10184   if (b[0] == 0xCD && b[3] == 0xBD) {
10185     /* IEEE 754 32-bit little-endian */
10186     printf("1\n");
10187     exit(0);
10188   }
10189   if (b[0] == 0xBD && b[3] == 0xCD) {
10190     /* IEEE 754 32-bit big-endian */
10191     printf("2\n");
10192     exit(0);
10193   }
10194   if (b[0] == 0xCC && b[3] == 0xCC) {
10195     /* VAX format F, 32-bit PDP-style mixed endian. */
10196     printf("9\n");
10197     exit(0);
10198   }
10199   if (b[0] == 0xC0 && b[3] == 0x9A) {
10200     /* IBM single 32-bit */
10201     printf("12\n");
10202     exit(0);
10203   }
10204 #endif
10205 #if DOUBLESIZE == 8
10206   if (b[0] == 0x9A && b[7] == 0xBF) {
10207     /* IEEE 754 64-bit little-endian */
10208     printf("3\n");
10209     exit(0);
10210   }
10211   if (b[0] == 0xBF && b[7] == 0x9A) {
10212     /* IEEE 754 64-bit big-endian */
10213     printf("4\n");
10214     exit(0);
10215   }
10216   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10217    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10218     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10219     * 99 99 b9 bf 9a 99 99 99 */
10220     printf("7\n");
10221     exit(0);
10222   }
10223   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10224    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10225     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10226     * 99 99 99 9a bf b9 99 99 */
10227     printf("8\n");
10228     exit(0);
10229   }
10230   if (b[0] == 0xCC && b[7] == 0xCC) {
10231    /* VAX format D, 64-bit PDP-style mixed endian. */
10232     printf("10\n");
10233     exit(0);
10234   }
10235   if (b[0] == 0xD9 && b[7] == 0x99) {
10236    /* VAX format G, 64-bit PDP-style mixed endian. */
10237     printf("11\n");
10238     exit(0);
10239   }
10240   if (b[0] == 0xC0 && b[7] == 0x9A) {
10241     /* IBM double 64-bit */
10242     printf("13\n");
10243     exit(0);
10244   }
10245   if (b[0] == 0xBF && b[7] == 0xCD) {
10246     /* CRAY single 64-bit */
10247     printf("14\n");
10248     exit(0);
10249   }
10250 #endif
10251 #if DOUBLESIZE == 16
10252   if (b[0] == 0x9A && b[15] == 0xBF) {
10253     /* IEEE 754 128-bit little-endian */
10254     printf("5\n");
10255     exit(0);
10256   }
10257   if (b[0] == 0xBF && b[15] == 0x9A) {
10258     /* IEEE 754 128-bit big-endian */
10259     printf("6\n");
10260     exit(0);
10261   }
10262 #endif
10263   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10264    * Whether those environments can still build Perl is debatable. */
10265   printf("-1\n"); /* unknown */
10266   exit(0);
10267 }
10268 EOP
10269 set try
10270 if eval $compile; then
10271     doublekind=`$run ./try`
10272 else
10273     doublekind=-1
10274 fi
10275 case "$doublekind" in
10276 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10277 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10278 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10279 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10280 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10281 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10282 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10283 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10284 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10285 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10286 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10287 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10288 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10289 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10290 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10291 esac
10292 d_double_style_ieee=$undef
10293 d_double_style_vax=$undef
10294 d_double_style_ibm=$undef
10295 d_double_style_cray=$undef
10296 case "$doublekind" in
10297 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10298 9|10|11) d_double_style_vax=$define ;;
10299 12|13) d_double_style_ibm=$define ;;
10300 14) d_double_style_cray=$define ;;
10301 esac
10302 case "$d_double_style_ieee" in
10303 $define)
10304     d_double_has_inf=$define
10305     d_double_has_nan=$define
10306     d_double_has_negative_zero=$define
10307     d_double_has_subnormals=$define
10308     ;;
10309 *)
10310     d_double_has_inf=$undef
10311     d_double_has_nan=$undef
10312     d_double_has_negative_zero=$undef
10313     d_double_has_subnormals=$undef
10314     ;;
10315 esac
10316 $rm_try
10317
10318 : Check print/scan long double stuff
10319 echo " "
10320
10321 if $test X"$d_longdbl" = X"$define"; then
10322
10323 echo "Checking how to print long doubles..." >&4
10324
10325 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10326         $cat >try.c <<'EOCP'
10327 #include <sys/types.h>
10328 #include <stdio.h>
10329 int main() {
10330   double d = 123.456;
10331   printf("%.3f\n", d);
10332 }
10333 EOCP
10334         set try
10335         if eval $compile; then
10336                 yyy=`$run ./try`
10337                 case "$yyy" in
10338                 123.456)
10339                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10340                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10341                         echo "We will use %f."
10342                         ;;
10343                 esac
10344         fi
10345 fi
10346
10347 if $test X"$sPRIfldbl" = X; then
10348         $cat >try.c <<'EOCP'
10349 #include <sys/types.h>
10350 #include <stdio.h>
10351 int main() {
10352   long double d = 123.456;
10353   printf("%.3Lf\n", d);
10354 }
10355 EOCP
10356         set try
10357         if eval $compile; then
10358                 yyy=`$run ./try`
10359                 case "$yyy" in
10360                 123.456)
10361                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10362                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10363                         echo "We will use %Lf."
10364                         ;;
10365                 esac
10366         fi
10367 fi
10368
10369 if $test X"$sPRIfldbl" = X; then
10370         $cat >try.c <<'EOCP'
10371 #include <sys/types.h>
10372 #include <stdio.h>
10373 int main() {
10374   long double d = 123.456;
10375   printf("%.3llf\n", d);
10376 }
10377 EOCP
10378         set try
10379         if eval $compile; then
10380                 yyy=`$run ./try`
10381                 case "$yyy" in
10382                 123.456)
10383                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10384                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10385                         echo "We will use %llf."
10386                         ;;
10387                 esac
10388         fi
10389 fi
10390
10391 if $test X"$sPRIfldbl" = X; then
10392         $cat >try.c <<'EOCP'
10393 #include <sys/types.h>
10394 #include <stdio.h>
10395 int main() {
10396   long double d = 123.456;
10397   printf("%.3lf\n", d);
10398 }
10399 EOCP
10400         set try
10401         if eval $compile; then
10402                 yyy=`$run ./try`
10403                 case "$yyy" in
10404                 123.456)
10405                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10406                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10407                         echo "We will use %lf."
10408                         ;;
10409                 esac
10410         fi
10411 fi
10412
10413 if $test X"$sPRIfldbl" = X; then
10414         echo "Cannot figure out how to print long doubles." >&4
10415 else
10416         sSCNfldbl=$sPRIfldbl    # expect consistency
10417 fi
10418
10419 $rm_try
10420
10421 fi # d_longdbl
10422
10423 case "$sPRIfldbl" in
10424 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10425         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10426         d_SCNfldbl="$undef";
10427         ;;
10428 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10429         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10430         d_SCNfldbl="$define";
10431         ;;
10432 esac
10433
10434 : Before committing on uselongdouble, see whether that looks sane.
10435 if $test "$uselongdouble" = "$define"; then
10436     message=""
10437     echo " "
10438     echo "Checking if your long double math functions work right..." >&4
10439     $cat > try.c <<EOF
10440 #include <math.h>
10441 #include <stdio.h>
10442 int main() {
10443   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10444 }
10445 EOF
10446     case "$osname:$gccversion" in
10447     aix:)       saveccflags="$ccflags"
10448                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10449     esac
10450     set try
10451     if eval $compile_ok; then
10452       yyy=`$run ./try`
10453     fi
10454     case "$yyy" in
10455     3) echo "Your long double math functions are working correctly." >&4 ;;
10456     *) echo "Your long double math functions are broken, not using long doubles." >&4
10457        uselongdouble=$undef
10458        ;;
10459     esac
10460     $rm_try
10461     case "$osname:$gccversion" in
10462     aix:)       ccflags="$saveccflags" ;; # restore
10463     esac
10464 fi
10465
10466 : Check how to convert floats to strings.
10467
10468 if test "X$d_Gconvert" = X; then
10469
10470 echo " "
10471 echo "Checking for an efficient way to convert floats to strings."
10472 echo " " > try.c
10473 case "$uselongdouble" in
10474 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10475 esac
10476 case "$d_longdbl" in
10477 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10478 esac
10479 case "$d_PRIgldbl" in
10480 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10481 esac
10482 $cat >>try.c <<EOP
10483 #ifdef TRY_gconvert
10484 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10485 char *myname = "gconvert";
10486 #endif
10487 #ifdef TRY_gcvt
10488 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10489 char *myname = "gcvt";
10490 #endif
10491 #ifdef TRY_qgcvt
10492 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10493 char *myname = "qgcvt";
10494 #define DOUBLETYPE long double
10495 #endif
10496 #ifdef TRY_sprintf
10497 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10498 #ifdef HAS_PRIgldbl
10499 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10500 #else
10501 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10502 #endif
10503 #else
10504 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10505 #endif
10506 char *myname = "sprintf";
10507 #endif
10508
10509 #ifndef DOUBLETYPE
10510 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10511 #define DOUBLETYPE long double
10512 #else
10513 #define DOUBLETYPE double
10514 #endif
10515 #endif
10516
10517 #include <stdio.h>
10518
10519 #$i_stdlib I_STDLIB
10520 #ifdef I_STDLIB
10521 #include <stdlib.h>
10522 #endif
10523 #$i_string I_STRING
10524 #ifdef I_STRING
10525 #  include <string.h>
10526 #else
10527 #  include <strings.h>
10528 #endif
10529
10530 int checkit(char *expect, char *got)
10531 {
10532     if (strcmp(expect, got)) {
10533                 printf("%s oddity:  Expected %s, got %s\n",
10534                         myname, expect, got);
10535                 exit(1);
10536         }
10537 }
10538
10539 int main()
10540 {
10541         char buf[64];
10542         buf[63] = '\0';
10543
10544         /* This must be 1st test on (which?) platform */
10545         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10546         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10547         checkit("0.1", buf);
10548
10549         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10550         checkit("0.01", buf);
10551
10552         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10553         checkit("0.001", buf);
10554
10555         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10556         checkit("0.0001", buf);
10557
10558         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10559         if (strlen(buf) > 5)
10560             checkit("9e-005", buf); /* for Microsoft ?? */
10561         else
10562             checkit("9e-05", buf);
10563
10564         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10565         checkit("1", buf);
10566
10567         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10568         checkit("1.1", buf);
10569
10570         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10571         checkit("1.01", buf);
10572
10573         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10574         checkit("1.001", buf);
10575
10576         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10577         checkit("1.0001", buf);
10578
10579         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10580         checkit("1.00001", buf);
10581
10582         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10583         checkit("1.000001", buf);
10584
10585         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10586         checkit("0", buf);
10587
10588         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10589         checkit("-1", buf);
10590
10591         /* Some Linux gcvt's give 1.e+5 here. */
10592         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10593         checkit("100000", buf);
10594
10595         /* Some Linux gcvt's give -1.e+5 here. */
10596         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10597         checkit("-100000", buf);
10598
10599         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10600         checkit("123.456", buf);
10601
10602         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10603         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10604         /* 34 should be enough to scare even long double
10605          * places into using the e notation. */
10606         if (strlen(buf) > 5)
10607             checkit("1e+034", buf); /* for Microsoft */
10608         else
10609             checkit("1e+34", buf);
10610
10611         /* For Perl, if you add additional tests here, also add them to
10612          * t/base/num.t for benefit of platforms not using Configure or
10613          * overriding d_Gconvert */
10614
10615         exit(0);
10616 }
10617 EOP
10618 : first add preferred functions to our list
10619 xxx_list=""
10620 for xxx_convert in $gconvert_preference; do
10621     case $xxx_convert in
10622     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10623     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10624     esac
10625 done
10626 : then add any others
10627 for xxx_convert in gconvert gcvt sprintf; do
10628     case "$xxx_list" in
10629     *$xxx_convert*) ;;
10630     *) xxx_list="$xxx_list $xxx_convert" ;;
10631     esac
10632 done
10633
10634 case "$d_longdbl$uselongdouble" in
10635 "$define$define")
10636     : again, add preferred functions to our list first
10637     xxx_ld_list=""
10638     for xxx_convert in $gconvert_ld_preference; do
10639         case $xxx_convert in
10640         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10641         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10642         esac
10643     done
10644     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10645     for xxx_convert in qgcvt sprintf $xxx_list; do
10646         case "$xxx_ld_list" in
10647         $xxx_convert*|*" $xxx_convert"*) ;;
10648         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10649         esac
10650     done
10651     : if sprintf cannot do long doubles, move it to the end
10652     if test "$d_PRIgldbl" != "$define"; then
10653         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10654     fi
10655     : if no qgcvt, remove it
10656     if test "$d_qgcvt" != "$define"; then
10657         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10658     fi
10659     : use the ld_list
10660     xxx_list="$xxx_ld_list"
10661     ;;
10662 esac
10663
10664 for xxx_convert in $xxx_list; do
10665         echo "Trying $xxx_convert..."
10666         $rm -f try try$_o core
10667         set try -DTRY_$xxx_convert
10668         if eval $compile; then
10669                 echo "$xxx_convert() found." >&4
10670                 if $run ./try; then
10671                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10672                         break;
10673                 else
10674                         echo "...But $xxx_convert didn't work as I expected."
10675                         xxx_convert=''
10676                 fi
10677         else
10678                 echo "$xxx_convert NOT found." >&4
10679         fi
10680 done
10681
10682 if test X$xxx_convert = X; then
10683     echo "*** WHOA THERE!!! ***" >&4
10684     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10685     xxx_convert=sprintf
10686 fi
10687
10688 case "$xxx_convert" in
10689 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10690 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10691 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10692 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10693    "$define$define$define")
10694       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10695    "$define$define$undef")
10696       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10697    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10698    esac
10699    ;;
10700 esac
10701
10702 fi
10703 $rm_try
10704
10705 : see if _fwalk exists
10706 set fwalk d__fwalk
10707 eval $inlibc
10708
10709 : Initialize h_fcntl
10710 h_fcntl=false
10711
10712 : Initialize h_sysfile
10713 h_sysfile=false
10714
10715 : access call always available on UNIX
10716 set access d_access
10717 eval $inlibc
10718
10719 : locate the flags for 'access()'
10720 case "$d_access" in
10721 "$define")
10722         echo " "
10723         $cat >access.c <<EOCP
10724 #include <sys/types.h>
10725 #ifdef I_FCNTL
10726 #include <fcntl.h>
10727 #endif
10728 #ifdef I_SYS_FILE
10729 #include <sys/file.h>
10730 #endif
10731 #ifdef I_UNISTD
10732 #include <unistd.h>
10733 #endif
10734 #$i_stdlib I_STDLIB
10735 #ifdef I_STDLIB
10736 #include <stdlib.h>
10737 #endif
10738 int main() {
10739         exit(R_OK);
10740 }
10741 EOCP
10742         : check sys/file.h first, no particular reason here
10743         if $test `./findhdr sys/file.h` && \
10744                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10745                 h_sysfile=true;
10746                 echo "<sys/file.h> defines the *_OK access constants." >&4
10747         elif $test `./findhdr fcntl.h` && \
10748                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10749                 h_fcntl=true;
10750                 echo "<fcntl.h> defines the *_OK access constants." >&4
10751         elif $test `./findhdr unistd.h` && \
10752                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10753                 echo "<unistd.h> defines the *_OK access constants." >&4
10754         else
10755                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10756         fi
10757         ;;
10758 esac
10759 $rm -f access*
10760
10761 : see if accessx exists
10762 set accessx d_accessx
10763 eval $inlibc
10764
10765 : see if acosh exists
10766 set acosh d_acosh
10767 eval $inlibc
10768
10769 : see if aintl exists
10770 set aintl d_aintl
10771 eval $inlibc
10772
10773 : see if alarm exists
10774 set alarm d_alarm
10775 eval $inlibc
10776
10777 : see if 64bit time functions exists
10778
10779 set ctime64 d_ctime64
10780 eval $inlibc
10781
10782 set localtime64 d_localtime64
10783 eval $inlibc
10784
10785 set gmtime64 d_gmtime64
10786 eval $inlibc
10787
10788 set mktime64 d_mktime64
10789 eval $inlibc
10790
10791 set difftime64 d_difftime64
10792 eval $inlibc
10793
10794 set asctime64 d_asctime64
10795 eval $inlibc
10796
10797 : see if POSIX threads are available
10798 set pthread.h i_pthread
10799 eval $inhdr
10800
10801 : define a function to check prototypes
10802 $cat > protochk <<EOSH
10803 $startsh
10804 cc="$cc"
10805 optimize="$optimize"
10806 ccflags="$ccflags"
10807 prototype="$prototype"
10808 define="$define"
10809 rm_try="$rm_try"
10810 usethreads=$usethreads
10811 i_pthread=$i_pthread
10812 pthread_h_first=$pthread_h_first
10813 EOSH
10814
10815 $cat >> protochk <<'EOSH'
10816
10817 $rm_try
10818 foo="$1"
10819 shift
10820 while test $# -ge 2; do
10821         case "$1" in
10822                 $define) echo "#include <$2>" >> try.c ;;
10823                 literal) echo "$2" >> try.c ;;
10824         esac
10825     # Extra magic for the benefit of systems that need pthread.h
10826     # to be included early to correctly detect threadsafe functions.
10827     # Such functions must guarantee themselves, though, that the usethreads
10828     # and i_pthread have been defined, before calling protochk.
10829     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10830         echo "#include <pthread.h>" >> try.c
10831         pthread_h_done=yes
10832     fi
10833     shift 2
10834 done
10835 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10836 cat >> try.c <<'EOCP'
10837 #ifdef CAN_PROTOTYPE
10838 #define _(args) args
10839 #else
10840 #define _(args) ()
10841 #endif
10842 EOCP
10843 echo "$foo" >> try.c
10844 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10845 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10846 status=$?
10847 $rm_try
10848 exit $status
10849 EOSH
10850 chmod +x protochk
10851 $eunicefix protochk
10852
10853 : Define hasproto macro for Configure internal use
10854 hasproto='varname=$1; func=$2; shift; shift;
10855 while $test $# -ge 2; do
10856         case "$1" in
10857         $define) echo "#include <$2>";;
10858         esac ;
10859     shift 2;
10860 done > try.c;
10861 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10862 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10863         echo "$func() prototype found.";
10864         val="$define";
10865 else
10866         echo "$func() prototype NOT found.";
10867         val="$undef";
10868 fi;
10869 set $varname;
10870 eval $setvar;
10871 $rm_try tryout.c'
10872
10873 : see if sys/types.h has to be included
10874 set sys/types.h i_systypes
10875 eval $inhdr
10876
10877 : see if sys/select.h has to be included
10878 set sys/select.h i_sysselct
10879 eval $inhdr
10880
10881 : Define hasfield macro for Configure internal use
10882 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10883 while $test $# -ge 2; do
10884         case "$1" in
10885         $define) echo "#include <$2>";;
10886         esac ;
10887     shift 2;
10888 done > try.c;
10889 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10890 set try;
10891 if eval $compile; then
10892         val="$define";
10893 else
10894         val="$undef";
10895 fi;
10896 set $varname;
10897 eval $setvar;
10898 $rm_try'
10899
10900 : see if we should include time.h, sys/time.h, or both
10901 echo " "
10902 if test "X$timeincl" = X; then
10903         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10904         $echo $n "I'm now running the test program...$c"
10905         $cat >try.c <<EOCP
10906 #include <sys/types.h>
10907 #ifdef I_TIME
10908 #include <time.h>
10909 #endif
10910 #ifdef I_SYSTIME
10911 #ifdef SYSTIMEKERNEL
10912 #define KERNEL
10913 #endif
10914 #include <sys/time.h>
10915 #endif
10916 #ifdef I_SYSSELECT
10917 #include <sys/select.h>
10918 #endif
10919 #$i_stdlib I_STDLIB
10920 #ifdef I_STDLIB
10921 #include <stdlib.h>
10922 #endif
10923 int main()
10924 {
10925         struct tm foo;
10926 #ifdef S_TIMEVAL
10927         struct timeval bar;
10928 #endif
10929 #ifdef S_TIMEZONE
10930         struct timezone tzp;
10931 #endif
10932         if (foo.tm_sec == foo.tm_sec)
10933                 exit(0);
10934 #ifdef S_TIMEVAL
10935         if (bar.tv_sec == bar.tv_sec)
10936                 exit(0);
10937 #endif
10938         exit(1);
10939 }
10940 EOCP
10941         flags=''
10942         for s_timezone in '-DS_TIMEZONE' ''; do
10943         sysselect=''
10944         for s_timeval in '-DS_TIMEVAL' ''; do
10945         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10946         for i_time in '' '-DI_TIME'; do
10947         for i_systime in '-DI_SYSTIME' ''; do
10948                 case "$flags" in
10949                 '') $echo $n ".$c"
10950                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10951                         if eval $compile; then
10952                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10953                                 shift
10954                                 flags="$*"
10955                                 echo " "
10956                                 $echo $n "Succeeded with $flags$c"
10957                         fi
10958                         ;;
10959                 esac
10960         done
10961         done
10962         done
10963         done
10964         done
10965         timeincl=''
10966         echo " "
10967         case "$flags" in
10968         *SYSTIMEKERNEL*) i_systimek="$define"
10969                 timeincl=`./findhdr sys/time.h`
10970                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10971         *) i_systimek="$undef";;
10972         esac
10973         case "$flags" in
10974         *I_TIME*) i_time="$define"
10975                 timeincl=`./findhdr time.h`" $timeincl"
10976                 echo "We'll include <time.h>." >&4;;
10977         *) i_time="$undef";;
10978         esac
10979         case "$flags" in
10980         *I_SYSTIME*) i_systime="$define"
10981                 timeincl=`./findhdr sys/time.h`" $timeincl"
10982                 echo "We'll include <sys/time.h>." >&4;;
10983         *) i_systime="$undef";;
10984         esac
10985         $rm_try
10986 fi
10987 : see if struct tm knows about tm_zone
10988 case "$i_systime$i_time" in
10989 *$define*)
10990         echo " "
10991         echo "Checking to see if your struct tm has tm_zone field..." >&4
10992         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10993         eval $hasfield
10994         ;;
10995 *)      val="$undef"
10996         set d_tm_tm_zone
10997         eval $setvar
10998         ;;
10999 esac
11000 case "$d_tm_tm_zone" in
11001 "$define")      echo "Yes, it does."   ;;
11002 *)              echo "No, it doesn't." ;;
11003 esac
11004 : see if struct tm knows about tm_gmtoff
11005 case "$i_systime$i_time" in
11006 *$define*)
11007         echo " "
11008         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
11009         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
11010         eval $hasfield
11011         ;;
11012 *)      val="$undef"
11013         set d_tm_tm_gmtoff
11014         eval $setvar
11015         ;;
11016 esac
11017 case "$d_tm_tm_gmtoff" in
11018 "$define")      echo "Yes, it does."   ;;
11019 *)              echo "No, it doesn't." ;;
11020 esac
11021
11022 : see if asctime_r exists
11023 set asctime_r d_asctime_r
11024 eval $inlibc
11025 case "$d_asctime_r" in
11026 "$define")
11027         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11028         case "$d_asctime_r_proto:$usethreads" in
11029         ":define")      d_asctime_r_proto=define
11030                 set d_asctime_r_proto asctime_r $hdrs
11031                 eval $hasproto ;;
11032         *)      ;;
11033         esac
11034         case "$d_asctime_r_proto" in
11035         define)
11036         case "$asctime_r_proto" in
11037         ''|0) try='char* asctime_r(const struct tm*, char*);'
11038         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
11039         esac
11040         case "$asctime_r_proto" in
11041         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
11042         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
11043         esac
11044         case "$asctime_r_proto" in
11045         ''|0) try='int asctime_r(const struct tm*, char*);'
11046         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
11047         esac
11048         case "$asctime_r_proto" in
11049         ''|0) try='int asctime_r(const struct tm*, char*, int);'
11050         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
11051         esac
11052         case "$asctime_r_proto" in
11053         ''|0)   d_asctime_r=undef
11054                 asctime_r_proto=0
11055                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
11056         * )     case "$asctime_r_proto" in
11057                 REENTRANT_PROTO*) ;;
11058                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
11059                 esac
11060                 echo "Prototype: $try" ;;
11061         esac
11062         ;;
11063         *)      case "$usethreads" in
11064                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
11065                 esac
11066                 d_asctime_r=undef
11067                 asctime_r_proto=0
11068                 ;;
11069         esac
11070         ;;
11071 *)      asctime_r_proto=0
11072         ;;
11073 esac
11074
11075 : see if asinh exists
11076 set asinh d_asinh
11077 eval $inlibc
11078
11079 : see if atanh exists
11080 set atanh d_atanh
11081 eval $inlibc
11082
11083 : see if atolf exists
11084 set atolf d_atolf
11085 eval $inlibc
11086
11087 : see if atoll exists
11088 set atoll d_atoll
11089 eval $inlibc
11090
11091 : Look for GCC-style attribute format
11092 case "$d_attribute_format" in
11093 '')
11094 echo " "
11095 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
11096 $cat >attrib.c <<'EOCP'
11097 #include <stdio.h>
11098 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
11099 EOCP
11100 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11101         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11102                 echo "Your C compiler doesn't support __attribute__((format))."
11103                 val="$undef"
11104         else
11105                 echo "Your C compiler supports __attribute__((format))."
11106                 val="$define"
11107         fi
11108 else
11109         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11110         val="$undef"
11111 fi
11112 ;;
11113 *) val="$d_attribute_format" ;;
11114 esac
11115 set d_attribute_format
11116 eval $setvar
11117 $rm -f attrib*
11118
11119 : Look for GCC-style attribute format with null format allowed
11120 case "$d_printf_format_null" in
11121 '') case "$d_attribute_format" in
11122     $define)
11123         echo " "
11124         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11125 $cat >attrib.c <<EOCP
11126 #include <stdio.h>
11127 #$i_stdlib I_STDLIB
11128 #ifdef I_STDLIB
11129 #include <stdlib.h>
11130 #endif
11131 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11132 int null_printf (char* pat,...) { return (int)pat; }
11133 int main () { exit(null_printf(NULL)); }
11134 EOCP
11135         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11136             : run the executable in case it produces a run-time warning
11137             if $run ./attrib >>attrib.out 2>&1; then
11138                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11139                     echo "Your C compiler doesn't allow __printf__ format to be null."
11140                     val="$undef"
11141                 else
11142                     echo "Your C compiler allows __printf__ format to be null."
11143                     val="$define"
11144                 fi
11145             else
11146             echo "Your C compiler executable failed with __printf__ format null."
11147             val="$undef"
11148         fi
11149     else
11150         echo "Your C compiler fails with __printf__ format null."
11151         val="$undef"
11152     fi
11153     ;;
11154     *)  val="$undef" ;;
11155     esac
11156 ;;
11157 *)  val="$d_printf_format_null" ;;
11158 esac
11159 set d_printf_format_null
11160 eval $setvar
11161 $rm -f attrib*
11162
11163 : Look for GCC-style attribute malloc
11164 case "$d_attribute_malloc" in
11165 '')
11166 echo " "
11167 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11168 $cat >attrib.c <<'EOCP'
11169 #include <stdio.h>
11170 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11171 EOCP
11172 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11173         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11174                 echo "Your C compiler doesn't support __attribute__((malloc))."
11175                 val="$undef"
11176         else
11177                 echo "Your C compiler supports __attribute__((malloc))."
11178                 val="$define"
11179         fi
11180 else
11181         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11182         val="$undef"
11183 fi
11184 ;;
11185 *) val="$d_attribute_malloc" ;;
11186 esac
11187 set d_attribute_malloc
11188 eval $setvar
11189 $rm -f attrib*
11190
11191 : Look for GCC-style attribute nonnull
11192 case "$d_attribute_nonnull" in
11193 '')
11194 echo " "
11195 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11196 $cat >attrib.c <<'EOCP'
11197 #include <stdio.h>
11198 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11199 EOCP
11200 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11201         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11202                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11203                 val="$undef"
11204         else
11205                 echo "Your C compiler supports __attribute__((nonnull))."
11206                 val="$define"
11207         fi
11208 else
11209         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11210         val="$undef"
11211 fi
11212 ;;
11213 *) val="$d_attribute_nonnull" ;;
11214 esac
11215 set d_attribute_nonnull
11216 eval $setvar
11217 $rm -f attrib*
11218
11219 : Look for GCC-style attribute noreturn
11220 case "$d_attribute_noreturn" in
11221 '')
11222 echo " "
11223 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11224 $cat >attrib.c <<'EOCP'
11225 #include <stdio.h>
11226 void fall_over_dead( void ) __attribute__((noreturn));
11227 EOCP
11228 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11229         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11230                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11231                 val="$undef"
11232         else
11233                 echo "Your C compiler supports __attribute__((noreturn))."
11234                 val="$define"
11235         fi
11236 else
11237         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11238         val="$undef"
11239 fi
11240 ;;
11241 *) val="$d_attribute_noreturn" ;;
11242 esac
11243 set d_attribute_noreturn
11244 eval $setvar
11245 $rm -f attrib*
11246
11247 : Look for GCC-style attribute pure
11248 case "$d_attribute_pure" in
11249 '')
11250 echo " "
11251 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11252 $cat >attrib.c <<'EOCP'
11253 #include <stdio.h>
11254 int square( int n ) __attribute__((pure));
11255 EOCP
11256 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11257         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11258                 echo "Your C compiler doesn't support __attribute__((pure))."
11259                 val="$undef"
11260         else
11261                 echo "Your C compiler supports __attribute__((pure))."
11262                 val="$define"
11263         fi
11264 else
11265         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11266         val="$undef"
11267 fi
11268 ;;
11269 *) val="$d_attribute_pure" ;;
11270 esac
11271 set d_attribute_pure
11272 eval $setvar
11273 $rm -f attrib*
11274
11275 : Look for GCC-style attribute unused
11276 case "$d_attribute_unused" in
11277 '')
11278 echo " "
11279 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11280 $cat >attrib.c <<'EOCP'
11281 #include <stdio.h>
11282 int do_something( int dummy __attribute__((unused)), int n );
11283 EOCP
11284 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11285         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11286                 echo "Your C compiler doesn't support __attribute__((unused))."
11287                 val="$undef"
11288         else
11289                 echo "Your C compiler supports __attribute__((unused))."
11290                 val="$define"
11291         fi
11292 else
11293         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11294         val="$undef"
11295 fi
11296 ;;
11297 *) val="$d_attribute_unused" ;;
11298 esac
11299 set d_attribute_unused
11300 eval $setvar
11301 $rm -f attrib*
11302
11303 : Look for GCC-style attribute deprecated
11304 case "$d_attribute_deprecated" in
11305 '')
11306 echo " "
11307 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11308 $cat >attrib.c <<'EOCP'
11309 #include <stdio.h>
11310 int I_am_deprecated(void) __attribute__((deprecated));
11311 EOCP
11312 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11313         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11314                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11315                 val="$undef"
11316         else
11317                 echo "Your C compiler supports __attribute__((deprecated))."
11318                 val="$define"
11319         fi
11320 else
11321         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11322         val="$undef"
11323 fi
11324 ;;
11325 *) val="$d_attribute_deprecated" ;;
11326 esac
11327 set d_attribute_deprecated
11328 eval $setvar
11329 $rm -f attrib*
11330
11331 : Look for GCC-style attribute warn_unused_result
11332 case "$d_attribute_warn_unused_result" in
11333 '')
11334 echo " "
11335 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11336 $cat >attrib.c <<'EOCP'
11337 #include <stdio.h>
11338 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11339 EOCP
11340 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11341         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11342                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11343                 val="$undef"
11344         else
11345                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11346                 val="$define"
11347         fi
11348 else
11349         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11350         val="$undef"
11351 fi
11352 ;;
11353 *) val="$d_attribute_warn_unused_result" ;;
11354 esac
11355 set d_attribute_warn_unused_result
11356 eval $setvar
11357 $rm -f attrib*
11358
11359 : see if bcmp exists
11360 set bcmp d_bcmp
11361 eval $inlibc
11362
11363 : see if bcopy exists
11364 set bcopy d_bcopy
11365 eval $inlibc
11366
11367 : see if getpgrp exists
11368 set getpgrp d_getpgrp
11369 eval $inlibc
11370
11371 case "$d_getpgrp" in
11372 "$define")
11373         echo " "
11374         echo "Checking to see which flavor of getpgrp is in use..."
11375         $cat >try.c <<EOP
11376 #$i_unistd I_UNISTD
11377 #include <sys/types.h>
11378 #ifdef I_UNISTD
11379 #  include <unistd.h>
11380 #endif
11381 #$i_stdlib I_STDLIB
11382 #ifdef I_STDLIB
11383 #include <stdlib.h>
11384 #endif
11385 int main()
11386 {
11387         if (getuid() == 0) {
11388                 printf("(I see you are running Configure as super-user...)\n");
11389                 setuid(1);
11390         }
11391 #ifdef TRY_BSD_PGRP
11392         if (getpgrp(1) == 0)
11393                 exit(0);
11394 #else
11395         if (getpgrp() > 0)
11396                 exit(0);
11397 #endif
11398         exit(1);
11399 }
11400 EOP
11401         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11402                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11403                 val="$define"
11404         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11405                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11406                 val="$undef"
11407         else
11408                 echo "I can't seem to compile and run the test program."
11409                 if ./usg; then
11410                         xxx="a USG one, i.e. you use getpgrp()."
11411                 else
11412                         # SVR4 systems can appear rather BSD-ish.
11413                         case "$i_unistd" in
11414                         $undef)
11415                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11416                                 val="$define"
11417                                 ;;
11418                         $define)
11419                                 xxx="probably a USG one, i.e. you use getpgrp()."
11420                                 val="$undef"
11421                                 ;;
11422                         esac
11423                 fi
11424                 echo "Assuming your getpgrp is $xxx" >&4
11425         fi
11426         ;;
11427 *) val="$undef";;
11428 esac
11429 set d_bsdgetpgrp
11430 eval $setvar
11431 $rm_try
11432
11433 : see if setpgrp exists
11434 set setpgrp d_setpgrp
11435 eval $inlibc
11436
11437 case "$d_setpgrp" in
11438 "$define")
11439         echo " "
11440         echo "Checking to see which flavor of setpgrp is in use..."
11441         $cat >try.c <<EOP
11442 #$i_unistd I_UNISTD
11443 #include <sys/types.h>
11444 #ifdef I_UNISTD
11445 #  include <unistd.h>
11446 #endif
11447 #$i_stdlib I_STDLIB
11448 #ifdef I_STDLIB
11449 #include <stdlib.h>
11450 #endif
11451 int main()
11452 {
11453         if (getuid() == 0) {
11454                 printf("(I see you are running Configure as super-user...)\n");
11455                 setuid(1);
11456         }
11457 #ifdef TRY_BSD_PGRP
11458         if (-1 == setpgrp(1, 1))
11459                 exit(0);
11460 #else
11461         if (setpgrp() != -1)
11462                 exit(0);
11463 #endif
11464         exit(1);
11465 }
11466 EOP
11467         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11468                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11469                 val="$define"
11470         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11471                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11472                 val="$undef"
11473         else
11474                 echo "(I can't seem to compile and run the test program.)"
11475                 if ./usg; then
11476                         xxx="a USG one, i.e. you use setpgrp()."
11477                 else
11478                         # SVR4 systems can appear rather BSD-ish.
11479                         case "$i_unistd" in
11480                         $undef)
11481                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11482                                 val="$define"
11483                                 ;;
11484                         $define)
11485                                 xxx="probably a USG one, i.e. you use setpgrp()."
11486                                 val="$undef"
11487                                 ;;
11488                         esac
11489                 fi
11490                 echo "Assuming your setpgrp is $xxx" >&4
11491         fi
11492         ;;
11493 *) val="$undef";;
11494 esac
11495 set d_bsdsetpgrp
11496 eval $setvar
11497 $rm_try
11498
11499 : Look for GCC-style __builtin_choose_expr
11500 case "$d_builtin_choose_expr" in
11501 '')
11502     echo " "
11503     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11504     $cat >try.c <<'EOCP'
11505 #include <assert.h>
11506 #include <stdlib.h>
11507 #include <stdio.h>
11508
11509 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11510
11511 int main(void) {
11512     assert( SYRINX(1) == 2112 );
11513     assert( SYRINX(1) != 5150 );
11514     assert( SYRINX(0) == 5150 );
11515     assert( SYRINX(0) != 2112 );
11516     puts( "All good!" );
11517     exit(0);
11518 }
11519
11520 EOCP
11521     set try
11522     if eval $compile && $run ./try; then
11523         echo "Your C compiler supports __builtin_choose_expr."
11524         val="$define"
11525     else
11526         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11527         val="$undef"
11528     fi
11529 ;;
11530 *) val="$d_builtin_choose_expr" ;;
11531 esac
11532
11533 set d_builtin_choose_expr
11534 eval $setvar
11535 $rm_try
11536
11537 : Look for GCC-style __builtin_expect
11538 case "$d_builtin_expect" in
11539 '')
11540     echo " "
11541     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11542     $cat >try.c <<'EOCP'
11543 int main(void) {
11544     int n = 50;
11545     if ( __builtin_expect(n, 0) ) n = 1;
11546     /* Remember shell exit code truth is 0, C truth is non-zero */
11547     return !(n == 1);
11548 }
11549 EOCP
11550     set try
11551     if eval $compile && $run ./try; then
11552         echo "Your C compiler supports __builtin_expect."
11553         val="$define"
11554     else
11555         echo "Your C compiler doesn't seem to understand __builtin_expect."
11556         val="$undef"
11557     fi
11558     ;;
11559 *) val="$d_builtin_expect" ;;
11560 esac
11561
11562 set d_builtin_expect
11563 eval $setvar
11564 $rm_try
11565
11566 : see if bzero exists
11567 set bzero d_bzero
11568 eval $inlibc
11569
11570 : see if stdarg is available
11571 echo " "
11572 if $test `./findhdr stdarg.h`; then
11573         echo "<stdarg.h> found." >&4
11574         valstd="$define"
11575 else
11576         echo "<stdarg.h> NOT found." >&4
11577         valstd="$undef"
11578 fi
11579
11580 : see if varargs is available
11581 echo " "
11582 if $test `./findhdr varargs.h`; then
11583         echo "<varargs.h> found." >&4
11584 else
11585         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11586 fi
11587
11588 : set up the varargs testing programs
11589 $cat > varargs.c <<EOP
11590 #ifdef I_STDARG
11591 #include <stdarg.h>
11592 #endif
11593 #ifdef I_VARARGS
11594 #include <varargs.h>
11595 #endif
11596
11597 #ifdef I_STDARG
11598 int f(char *p, ...)
11599 #else
11600 int f(va_alist)
11601 va_dcl
11602 #endif
11603 {
11604         va_list ap;
11605 #ifndef I_STDARG
11606         char *p;
11607 #endif
11608 #ifdef I_STDARG
11609         va_start(ap,p);
11610 #else
11611         va_start(ap);
11612         p = va_arg(ap, char *);
11613 #endif
11614         va_end(ap);
11615         return 0;
11616 }
11617 EOP
11618 $cat > varargs <<EOP
11619 $startsh
11620 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11621         echo "true"
11622 else
11623         echo "false"
11624 fi
11625 $rm -f varargs$_o
11626 EOP
11627 chmod +x varargs
11628
11629 : now check which varargs header should be included
11630 echo " "
11631 i_varhdr=''
11632 val=''
11633 case "$valstd" in
11634 "$define")
11635         if `./varargs I_STDARG`; then
11636                 val='stdarg.h'
11637         elif `./varargs I_VARARGS`; then
11638                 val='varargs.h'
11639         fi
11640         ;;
11641 *)
11642         if `./varargs I_VARARGS`; then
11643                 val='varargs.h'
11644         fi
11645         ;;
11646 esac
11647 case "$val" in
11648 '')
11649         echo " "
11650         echo "*** WHOA THERE!!! ***" >&4
11651         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11652         case "$knowitall" in
11653         '')
11654         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11655                 exit 1
11656                 ;;
11657         esac
11658 echo "I could not find the definition for va_dcl... You have problems..." >&4
11659         val="$undef"; set i_stdarg; eval $setvar
11660         val="$undef"; set i_varargs; eval $setvar
11661         ;;
11662 *)
11663         set i_varhdr
11664         eval $setvar
11665         case "$i_varhdr" in
11666         stdarg.h)
11667                 val="$define"; set i_stdarg; eval $setvar
11668                 val="$undef"; set i_varargs; eval $setvar
11669                 ;;
11670         varargs.h)
11671                 val="$undef"; set i_stdarg; eval $setvar
11672                 val="$define"; set i_varargs; eval $setvar
11673                 ;;
11674         esac
11675         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11676 esac
11677 $rm -f varargs*
11678
11679 : see if the Compiler supports C99 variadic macros
11680 case "$i_stdarg$i_stdlib" in
11681     "$define$define")
11682     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11683     $cat >try.c <<EOCP
11684 #include <stdio.h>
11685 #include <stdarg.h>
11686
11687 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11688
11689 int main() {
11690   char buf[20];
11691   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11692   puts(buf);
11693   return 0;
11694 }
11695 EOCP
11696     set try
11697     if eval $compile && $run ./try 2>&1 >/dev/null; then
11698         case "`$run ./try`" in
11699             "123 456 789")
11700             echo "You have C99 variadic macros." >&4
11701             d_c99_variadic_macros="$define"
11702             ;;
11703             *)
11704             echo "You don't have functional C99 variadic macros." >&4
11705             d_c99_variadic_macros="$undef"
11706             ;;
11707         esac
11708     else
11709         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11710         d_c99_variadic_macros="$undef"
11711     fi
11712     $rm_try
11713     ;;
11714     *)
11715     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11716     d_c99_variadic_macros="$undef"
11717     ;;
11718 esac
11719
11720 : see if signal is declared as pointer to function returning int or void
11721 echo " "
11722 xxx=`./findhdr signal.h`
11723 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11724 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11725         echo "You have int (*signal())() instead of void." >&4
11726         val="$undef"
11727 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11728         echo "You have void (*signal())()." >&4
11729         val="$define"
11730 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11731         echo "You have int (*signal())() instead of void." >&4
11732         val="$undef"
11733 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11734         echo "You have void (*signal())()." >&4
11735         val="$define"
11736 else
11737         case "$d_voidsig" in
11738         '')
11739         echo "I can't determine whether signal handler returns void or int..." >&4
11740                 dflt=void
11741                 rp="What type does your signal handler return?"
11742                 . ./myread
11743                 case "$ans" in
11744                 v*) val="$define";;
11745                 *) val="$undef";;
11746                 esac;;
11747         "$define")
11748                 echo "As you already told me, signal handler returns void." >&4
11749                 val="$define"
11750                 ;;
11751         *)      echo "As you already told me, signal handler returns int." >&4
11752                 val="$undef"
11753                 ;;
11754         esac
11755 fi
11756 set d_voidsig
11757 eval $setvar
11758 case "$d_voidsig" in
11759 "$define") signal_t="void";;
11760 *) signal_t="int";;
11761 esac
11762 $rm -f $$.tmp
11763
11764 : check for ability to cast large floats to 32-bit ints.
11765 echo " "
11766 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11767 if $test "$intsize" -ge 4; then
11768         xxx=int
11769 else
11770         xxx=long
11771 fi
11772 $cat >try.c <<EOCP
11773 #include <stdio.h>
11774 #$i_stdlib I_STDLIB
11775 #ifdef I_STDLIB
11776 #include <stdlib.h>
11777 #endif
11778 #include <sys/types.h>
11779 #include <signal.h>
11780 $signal_t blech(int s) { exit(3); }
11781 int main()
11782 {
11783         $xxx i32;
11784         double f, g;
11785         int result = 0;
11786         char str[16];
11787         signal(SIGFPE, blech);
11788
11789         /* Don't let compiler optimize the test away.  Store the number
11790            in a writable string for gcc to pass to sscanf under HP-UX.
11791         */
11792         sprintf(str, "2147483647");
11793         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11794         g = 10 * f;
11795         i32  = ($xxx) g;
11796
11797         /* x86 processors will probably give 0x8000 0000, which is a
11798            sign change.  We don't want that.  We want to mimic SPARC
11799            behavior here, which is to preserve the sign and give
11800            back 0x7fff ffff.
11801         */
11802         if (i32 != ($xxx) f)
11803                 result |= 1;
11804         exit(result);
11805 }
11806 EOCP
11807 set try
11808 if eval $compile_ok; then
11809         $run ./try 2>/dev/null
11810         yyy=$?
11811 else
11812         echo "(I can't seem to compile the test program--assuming it can't)"
11813         yyy=1
11814 fi
11815 case "$yyy" in
11816 0)      val="$define"
11817         echo "Yup, it can."
11818         ;;
11819 *)      val="$undef"
11820         echo "Nope, it can't."
11821         ;;
11822 esac
11823 set d_casti32
11824 eval $setvar
11825 $rm_try
11826
11827 : check for ability to cast negative floats to unsigned
11828 echo " "
11829 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11830 $cat >try.c <<EOCP
11831 #include <stdio.h>
11832 #$i_stdlib I_STDLIB
11833 #ifdef I_STDLIB
11834 #include <stdlib.h>
11835 #endif
11836 #include <sys/types.h>
11837 #include <signal.h>
11838 $signal_t blech(int s) { exit(7); }
11839 $signal_t blech_in_list(int s) { exit(4); }
11840 unsigned long dummy_long(unsigned long p) { return p; }
11841 unsigned int dummy_int(unsigned int p) { return p; }
11842 unsigned short dummy_short(unsigned short p) { return p; }
11843 int main()
11844 {
11845         double f;
11846         unsigned long along;
11847         unsigned int aint;
11848         unsigned short ashort;
11849         int result = 0;
11850         char str[16];
11851
11852         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11853            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11854            optimized the whole file away
11855         */
11856         /* Store the number in a writable string for gcc to pass to
11857            sscanf under HP-UX.
11858         */
11859         sprintf(str, "-123");
11860         sscanf(str, "%lf", &f);  /* f = -123.; */
11861
11862         signal(SIGFPE, blech);
11863         along = (unsigned long)f;
11864         aint = (unsigned int)f;
11865         ashort = (unsigned short)f;
11866         if (along != (unsigned long)-123)
11867                 result |= 1;
11868         if (aint != (unsigned int)-123)
11869                 result |= 1;
11870         if (ashort != (unsigned short)-123)
11871                 result |= 1;
11872         sprintf(str, "1073741824.");
11873         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11874         f = f + f;
11875         along = 0;
11876         along = (unsigned long)f;
11877         if (along != 0x80000000)
11878                 result |= 2;
11879         f -= 1.;
11880         along = 0;
11881         along = (unsigned long)f;
11882         if (along != 0x7fffffff)
11883                 result |= 1;
11884         f += 2.;
11885         along = 0;
11886         along = (unsigned long)f;
11887         if (along != 0x80000001)
11888                 result |= 2;
11889         if (result)
11890                 exit(result);
11891         signal(SIGFPE, blech_in_list);
11892         sprintf(str, "123.");
11893         sscanf(str, "%lf", &f);  /* f = 123.; */
11894         along = dummy_long((unsigned long)f);
11895         aint = dummy_int((unsigned int)f);
11896         ashort = dummy_short((unsigned short)f);
11897         if (along != (unsigned long)123)
11898                 result |= 4;
11899         if (aint != (unsigned int)123)
11900                 result |= 4;
11901         if (ashort != (unsigned short)123)
11902                 result |= 4;
11903         exit(result);
11904
11905 }
11906 EOCP
11907 set try
11908 if eval $compile_ok; then
11909         $run ./try 2>/dev/null
11910         castflags=$?
11911 else
11912         echo "(I can't seem to compile the test program--assuming it can't)"
11913         castflags=7
11914 fi
11915 case "$castflags" in
11916 0)      val="$define"
11917         echo "Yup, it can."
11918         ;;
11919 *)      val="$undef"
11920         echo "Nope, it can't."
11921         ;;
11922 esac
11923 set d_castneg
11924 eval $setvar
11925 $rm_try
11926
11927 : see if cbrt exists
11928 set cbrt d_cbrt
11929 eval $inlibc
11930
11931 : see if vprintf exists
11932 echo " "
11933 if set vprintf val -f d_vprintf; eval $csym; $val; then
11934         echo 'vprintf() found.' >&4
11935         val="$define"
11936         $cat >try.c <<EOF
11937 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11938 #$i_varargs I_VARARGS
11939
11940 #$i_stdlib I_STDLIB
11941 #$i_unistd I_UNISTD
11942
11943 #ifdef I_STDARG
11944 #  include <stdarg.h>
11945 #else /* I_VARARGS */
11946 #  include <varargs.h>
11947 #endif
11948
11949 #ifdef I_UNISTD
11950 #  include <unistd.h>
11951 #endif
11952
11953 #ifdef I_STDLIB
11954 #  include <stdlib.h>
11955 #endif
11956
11957 #include <stdio.h> /* vsprintf prototype */
11958
11959 #ifdef I_STDARG
11960 void xxx(int n, ...)
11961 {
11962     va_list args;
11963     char buf[10];
11964     va_start(args, n);
11965     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11966 }
11967 int main() { xxx(1, "foo"); }
11968
11969 #else /* I_VARARGS */
11970
11971 xxx(va_alist)
11972 va_dcl
11973 {
11974     va_list args;
11975     char buf[10];
11976     va_start(args);
11977     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11978 }
11979 int main() { xxx("foo"); }
11980
11981 #endif
11982
11983 EOF
11984         set try
11985         if eval $compile_ok; then
11986                 if $run ./try; then
11987                         echo "Your vsprintf() returns (int)." >&4
11988                         val2="$undef"
11989                 else
11990                         echo "Your vsprintf() returns (char*)." >&4
11991                         val2="$define"
11992                 fi
11993         else
11994                 echo 'I am unable to compile the vsprintf() test program.' >&4
11995                 # We shouldn't get here.  If we do, assume the standard signature,
11996                 # not the old BSD one.
11997                 echo 'Guessing that vsprintf() returns (int).' >&4
11998                 val2="$undef"
11999         fi
12000 else
12001         echo 'vprintf() NOT found.' >&4
12002         val="$undef"
12003         val2="$undef"
12004 fi
12005 $rm_try
12006 set d_vprintf
12007 eval $setvar
12008 val=$val2
12009 set d_charvspr
12010 eval $setvar
12011
12012 : see if chown exists
12013 set chown d_chown
12014 eval $inlibc
12015
12016 : see if chroot exists
12017 set chroot d_chroot
12018 eval $inlibc
12019
12020 : see if chsize exists
12021 set chsize d_chsize
12022 eval $inlibc
12023
12024 : see if class exists
12025 set class d_class
12026 eval $inlibc
12027
12028 : see if clearenv exists
12029 set clearenv d_clearenv
12030 eval $inlibc
12031
12032 : Define hasstruct macro for Configure internal use
12033 hasstruct='varname=$1; struct=$2; shift; shift;
12034 while $test $# -ge 2; do
12035         case "$1" in
12036         $define) echo "#include <$2>";;
12037         esac ;
12038     shift 2;
12039 done > try.c;
12040 echo "int main () { struct $struct foo; }" >> try.c;
12041 set try;
12042 if eval $compile; then
12043         val="$define";
12044 else
12045         val="$undef";
12046 fi;
12047 set $varname;
12048 eval $setvar;
12049 $rm_try'
12050
12051 : see whether socket exists
12052 socketlib=''
12053 sockethdr=''
12054 echo " "
12055 $echo $n "Hmm... $c" >&4
12056 if set socket val -f d_socket; eval $csym; $val; then
12057     echo "Looks like you have Berkeley networking support." >&4
12058     d_socket="$define"
12059     if set setsockopt val -f; eval $csym; $val; then
12060         d_oldsock="$undef"
12061     else
12062         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
12063         d_oldsock="$define"
12064     fi
12065 else
12066     if $contains socklib libc.list >/dev/null 2>&1; then
12067         echo "Looks like you have Berkeley networking support." >&4
12068         d_socket="$define"
12069         : we will have to assume that it supports the 4.2 BSD interface
12070         d_oldsock="$undef"
12071     else
12072         echo "You don't have Berkeley networking in libc$_a..." >&4
12073         if test "X$d_socket" = "X$define"; then
12074             echo "...but you seem to believe that you have sockets." >&4
12075         else
12076             for net in net socket
12077             do
12078                 if test -f $sysroot/usr/lib/lib$net$_a; then
12079                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
12080                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
12081                     if $contains socket libc.list >/dev/null 2>&1; then
12082                         d_socket="$define"
12083                         socketlib="-l$net"
12084                         case "$net" in
12085                         net)
12086                             echo "...but the Wollongong group seems to have hacked it in." >&4
12087                             sockethdr="-I$sysroot/usr/netinclude"
12088                             ;;
12089                         esac
12090                         echo "Found Berkeley sockets interface in lib$net." >&4
12091                         if $contains setsockopt libc.list >/dev/null 2>&1; then
12092                             d_oldsock="$undef"
12093                         else
12094                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
12095                             d_oldsock="$define"
12096                         fi
12097                         break
12098                     fi
12099                 fi
12100             done
12101             if test "X$d_socket" != "X$define"; then
12102                echo "or anywhere else I see." >&4
12103                d_socket="$undef"
12104                d_oldsock="$undef"
12105             fi
12106         fi
12107     fi
12108 fi
12109
12110 : see if socketpair exists
12111 set socketpair d_sockpair
12112 eval $inlibc
12113
12114
12115 echo " "
12116 echo "Checking the availability sa_len in the sock struct ..." >&4
12117 $cat >try.c <<EOF
12118 #include <sys/types.h>
12119 #include <sys/socket.h>
12120 int main() {
12121 struct sockaddr sa;
12122 return (sa.sa_len);
12123 }
12124 EOF
12125 val="$undef"
12126 set try; if eval $compile; then
12127     val="$define"
12128 fi
12129 set d_sockaddr_sa_len; eval $setvar
12130 $rm_try
12131
12132 echo " "
12133 echo "Checking the availability struct sockaddr_in6 ..." >&4
12134 $cat >try.c <<EOF
12135 #include <sys/types.h>
12136 #include <sys/socket.h>
12137 #include <netinet/in.h>
12138 int main() {
12139 struct sockaddr_in6 sin6;
12140 return (sin6.sin6_family);
12141 }
12142 EOF
12143 val="$undef"
12144 set try; if eval $compile; then
12145     val="$define"
12146 fi
12147 set d_sockaddr_in6; eval $setvar
12148 $rm_try
12149
12150 echo " "
12151 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
12152 $cat >try.c <<EOF
12153 #include <sys/types.h>
12154 #include <sys/socket.h>
12155 #include <netinet/in.h>
12156 int main() {
12157 struct sockaddr_in6 sin6;
12158 return (sin6.sin6_scope_id);
12159 }
12160 EOF
12161 val="$undef"
12162 set try; if eval $compile; then
12163     val="$define"
12164 fi
12165 set d_sin6_scope_id; eval $setvar
12166 $rm_try
12167
12168 echo " "
12169 echo "Checking the availability struct ip_mreq ..." >&4
12170 $cat >try.c <<EOF
12171 #include <sys/types.h>
12172 #include <sys/socket.h>
12173 #include <netinet/in.h>
12174 int main() {
12175 struct ip_mreq mreq;
12176 return (mreq.imr_multiaddr.s_addr);
12177 }
12178 EOF
12179 val="$undef"
12180 set try; if eval $compile; then
12181        val="$define"
12182 fi
12183 set d_ip_mreq; eval $setvar
12184 $rm_try
12185
12186 echo " "
12187 echo "Checking the availability struct ip_mreq_source ..." >&4
12188 $cat >try.c <<EOF
12189 #include <sys/types.h>
12190 #include <sys/socket.h>
12191 #include <netinet/in.h>
12192 int main() {
12193 struct ip_mreq_source mreq;
12194 return (mreq.imr_multiaddr.s_addr);
12195 }
12196 EOF
12197 val="$undef"
12198 set try; if eval $compile; then
12199        val="$define"
12200 fi
12201 set d_ip_mreq_source; eval $setvar
12202 $rm_try
12203
12204 echo " "
12205 echo "Checking the availability struct ipv6_mreq ..." >&4
12206 $cat >try.c <<EOF
12207 #include <sys/types.h>
12208 #include <sys/socket.h>
12209 #include <netinet/in.h>
12210 int main() {
12211 struct ipv6_mreq mreq;
12212 return (mreq.ipv6mr_interface);
12213 }
12214 EOF
12215 val="$undef"
12216 set try; if eval $compile; then
12217     val="$define"
12218 fi
12219 set d_ipv6_mreq; eval $setvar
12220 $rm_try
12221
12222 echo " "
12223 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12224 $cat >try.c <<EOF
12225 #include <sys/types.h>
12226 #include <sys/socket.h>
12227 #include <netinet/in.h>
12228 int main() {
12229 struct ipv6_mreq_source mreq;
12230 return (mreq.imr_multiaddr.s_addr);
12231 }
12232 EOF
12233 val="$undef"
12234 set try; if eval $compile; then
12235        val="$define"
12236 fi
12237 set d_ipv6_mreq_source; eval $setvar
12238 $rm_try
12239
12240 echo " "
12241 echo "Checking the availability of certain socket constants..." >&4
12242 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12243     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12244     $cat >try.c <<EOF
12245 #include <sys/types.h>
12246 #include <sys/socket.h>
12247 int main() {
12248     int i = $ENUM;
12249 }
12250 EOF
12251     val="$undef"
12252     set try; if eval $compile; then
12253         val="$define"
12254     fi
12255     set d_${enum}; eval $setvar
12256     $rm_try
12257 done
12258
12259 : see if this is a sys/uio.h system
12260 set sys/uio.h i_sysuio
12261 eval $inhdr
12262
12263 : Check for cmsghdr support
12264 echo " "
12265 echo "Checking to see if your system supports struct cmsghdr..." >&4
12266 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12267 eval $hasstruct
12268 case "$d_cmsghdr_s" in
12269 "$define")      echo "Yes, it does."   ;;
12270 *)              echo "No, it doesn't." ;;
12271 esac
12272
12273
12274 : check for const keyword
12275 echo " "
12276 echo 'Checking to see if your C compiler knows about "const"...' >&4
12277 $cat >const.c <<'EOCP'
12278 typedef struct spug { int drokk; } spug;
12279 int main()
12280 {
12281         const char *foo;
12282         const spug y = { 0 };
12283 }
12284 EOCP
12285 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12286         val="$define"
12287         echo "Yup, it does."
12288 else
12289         val="$undef"
12290         echo "Nope, it doesn't."
12291 fi
12292 set d_const
12293 eval $setvar
12294
12295 : see if copysign exists
12296 set copysign d_copysign
12297 eval $inlibc
12298
12299 : see if copysignl exists
12300 set copysignl d_copysignl
12301 eval $inlibc
12302
12303 : see if crypt exists
12304 echo " "
12305 set crypt d_crypt
12306 eval $inlibc
12307 case "$d_crypt" in
12308 $define) cryptlib='' ;;
12309 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12310                 echo 'crypt() found.' >&4
12311                 val="$define"
12312                 cryptlib=''
12313         else
12314                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12315                 if $test -z "$cryptlib"; then
12316                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12317                 else
12318                         cryptlib=-lcrypt
12319                 fi
12320                 if $test -z "$cryptlib"; then
12321                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12322                 else
12323                         cryptlib=-lcrypt
12324                 fi
12325                 if $test -z "$cryptlib"; then
12326                         cryptlib=`./loc libcrypt$_a "" $libpth`
12327                 else
12328                         cryptlib=-lcrypt
12329                 fi
12330                 if $test -z "$cryptlib"; then
12331                         echo 'crypt() NOT found.' >&4
12332                         val="$undef"
12333                 else
12334                         val="$define"
12335                 fi
12336         fi
12337         set d_crypt
12338         eval $setvar
12339         ;;
12340 esac
12341
12342 : see if this is a crypt.h system
12343 set crypt.h i_crypt
12344 eval $inhdr
12345
12346 : see if crypt_r exists
12347 set crypt_r d_crypt_r
12348 eval $inlibc
12349 case "$d_crypt_r" in
12350 "$define")
12351         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12352         case "$d_crypt_r_proto:$usethreads" in
12353         ":define")      d_crypt_r_proto=define
12354                 set d_crypt_r_proto crypt_r $hdrs
12355                 eval $hasproto ;;
12356         *)      ;;
12357         esac
12358         case "$d_crypt_r_proto" in
12359         define)
12360         case "$crypt_r_proto" in
12361         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12362         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12363         esac
12364         case "$crypt_r_proto" in
12365         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12366         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12367         esac
12368         case "$crypt_r_proto" in
12369         ''|0)   d_crypt_r=undef
12370                 crypt_r_proto=0
12371                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12372         * )     case "$crypt_r_proto" in
12373                 REENTRANT_PROTO*) ;;
12374                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12375                 esac
12376                 echo "Prototype: $try" ;;
12377         esac
12378         ;;
12379         *)      case "$usethreads" in
12380                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12381                 esac
12382                 d_crypt_r=undef
12383                 crypt_r_proto=0
12384                 ;;
12385         esac
12386         ;;
12387 *)      crypt_r_proto=0
12388         ;;
12389 esac
12390
12391 : get csh whereabouts
12392 case "$csh" in
12393 'csh') val="$undef" ;;
12394 *) val="$define" ;;
12395 esac
12396 set d_csh
12397 eval $setvar
12398 : Respect a hint or command line value for full_csh.
12399 case "$full_csh" in
12400 '') full_csh=$csh ;;
12401 esac
12402
12403 : see if ctermid exists
12404 set ctermid d_ctermid
12405 eval $inlibc
12406
12407 : see if ctermid_r exists
12408 set ctermid_r d_ctermid_r
12409 eval $inlibc
12410 case "$d_ctermid_r" in
12411 "$define")
12412         hdrs="$i_systypes sys/types.h define stdio.h "
12413         case "$d_ctermid_r_proto:$usethreads" in
12414         ":define")      d_ctermid_r_proto=define
12415                 set d_ctermid_r_proto ctermid_r $hdrs
12416                 eval $hasproto ;;
12417         *)      ;;
12418         esac
12419         case "$d_ctermid_r_proto" in
12420         define)
12421         case "$ctermid_r_proto" in
12422         ''|0) try='char* ctermid_r(char*);'
12423         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12424         esac
12425         case "$ctermid_r_proto" in
12426         ''|0)   d_ctermid_r=undef
12427                 ctermid_r_proto=0
12428                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12429         * )     case "$ctermid_r_proto" in
12430                 REENTRANT_PROTO*) ;;
12431                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12432                 esac
12433                 echo "Prototype: $try" ;;
12434         esac
12435         ;;
12436         *)      case "$usethreads" in
12437                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12438                 esac
12439                 d_ctermid_r=undef
12440                 ctermid_r_proto=0
12441                 ;;
12442         esac
12443         ;;
12444 *)      ctermid_r_proto=0
12445         ;;
12446 esac
12447
12448 : see if ctime_r exists
12449 set ctime_r d_ctime_r
12450 eval $inlibc
12451 case "$d_ctime_r" in
12452 "$define")
12453         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12454         case "$d_ctime_r_proto:$usethreads" in
12455         ":define")      d_ctime_r_proto=define
12456                 set d_ctime_r_proto ctime_r $hdrs
12457                 eval $hasproto ;;
12458         *)      ;;
12459         esac
12460         case "$d_ctime_r_proto" in
12461         define)
12462         case "$ctime_r_proto" in
12463         ''|0) try='char* ctime_r(const time_t*, char*);'
12464         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12465         esac
12466         case "$ctime_r_proto" in
12467         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12468         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12469         esac
12470         case "$ctime_r_proto" in
12471         ''|0) try='int ctime_r(const time_t*, char*);'
12472         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12473         esac
12474         case "$ctime_r_proto" in
12475         ''|0) try='int ctime_r(const time_t*, char*, int);'
12476         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12477         esac
12478         case "$ctime_r_proto" in
12479         ''|0)   d_ctime_r=undef
12480                 ctime_r_proto=0
12481                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12482         * )     case "$ctime_r_proto" in
12483                 REENTRANT_PROTO*) ;;
12484                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12485                 esac
12486                 echo "Prototype: $try" ;;
12487         esac
12488         ;;
12489         *)      case "$usethreads" in
12490                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12491                 esac
12492                 d_ctime_r=undef
12493                 ctime_r_proto=0
12494                 ;;
12495         esac
12496         ;;
12497 *)      ctime_r_proto=0
12498         ;;
12499 esac
12500
12501 : see if cuserid exists
12502 set cuserid d_cuserid
12503 eval $inlibc
12504
12505 : see if this is a limits.h system
12506 set limits.h i_limits
12507 eval $inhdr
12508
12509 : See if number of significant digits in a double precision number is known
12510 echo " "
12511 $cat >dbl_dig.c <<EOM
12512 #$i_limits I_LIMITS
12513 #$i_float I_FLOAT
12514 #ifdef I_LIMITS
12515 #include <limits.h>
12516 #endif
12517 #ifdef I_FLOAT
12518 #include <float.h>
12519 #endif
12520 #ifdef DBL_DIG
12521 printf("Contains DBL_DIG");
12522 #endif
12523 EOM
12524 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12525 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12526         echo "DBL_DIG found." >&4
12527         val="$define"
12528 else
12529         echo "DBL_DIG NOT found." >&4
12530         val="$undef"
12531 fi
12532 $rm -f dbl_dig.?
12533 set d_dbl_dig
12534 eval $setvar
12535
12536 : see if dbm.h is available
12537 : see if dbmclose exists
12538 set dbmclose d_dbmclose
12539 eval $inlibc
12540
12541 case "$d_dbmclose" in
12542 $define)
12543         set dbm.h i_dbm
12544         eval $inhdr
12545         case "$i_dbm" in
12546         $define)
12547                 val="$undef"
12548                 set i_rpcsvcdbm
12549                 eval $setvar
12550                 ;;
12551         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12552                 eval $inhdr
12553                 ;;
12554         esac
12555         ;;
12556 *)      echo "We won't be including <dbm.h>"
12557         val="$undef"
12558         set i_dbm
12559         eval $setvar
12560         val="$undef"
12561         set i_rpcsvcdbm
12562         eval $setvar
12563         ;;
12564 esac
12565
12566 : see if prototype for dbminit is available
12567 echo " "
12568 set d_dbminitproto dbminit $i_dbm dbm.h
12569 eval $hasproto
12570
12571 : see if difftime exists
12572 set difftime d_difftime
12573 eval $inlibc
12574
12575 : see if this is a dirent system
12576 echo " "
12577 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12578         val="$define"
12579         echo "<dirent.h> found." >&4
12580 else
12581         val="$undef"
12582         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12583                 echo "<sys/dir.h> found." >&4
12584                 echo " "
12585         else
12586                 xinc=`./findhdr sys/ndir.h`
12587         fi
12588         echo "<dirent.h> NOT found." >&4
12589 fi
12590 set i_dirent
12591 eval $setvar
12592
12593 : Look for type of directory structure.
12594 echo " "
12595 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12596
12597 case "$direntrytype" in
12598 ''|' ')
12599         case "$i_dirent" in
12600         $define) guess1='struct dirent' ;;
12601         *) guess1='struct direct'  ;;
12602         esac
12603         ;;
12604 *)      guess1="$direntrytype"
12605         ;;
12606 esac
12607
12608 case "$guess1" in
12609 'struct dirent') guess2='struct direct' ;;
12610 *) guess2='struct dirent' ;;
12611 esac
12612
12613 if $contains "$guess1" try.c >/dev/null 2>&1; then
12614         direntrytype="$guess1"
12615         echo "Your directory entries are $direntrytype." >&4
12616 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12617         direntrytype="$guess2"
12618         echo "Your directory entries seem to be $direntrytype." >&4
12619 else
12620         echo "I don't recognize your system's directory entries." >&4
12621         rp="What type is used for directory entries on this system?"
12622         dflt="$guess1"
12623         . ./myread
12624         direntrytype="$ans"
12625 fi
12626 $rm_try
12627
12628 : see if the directory entry stores field length
12629 echo " "
12630 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12631 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12632         echo "Good, your directory entry keeps length information in d_namlen." >&4
12633         val="$define"
12634 else
12635         echo "Your directory entry does not know about the d_namlen field." >&4
12636         val="$undef"
12637 fi
12638 set d_dirnamlen
12639 eval $setvar
12640 $rm_try
12641
12642 : Look for DIR.dd_fd
12643 case "$i_dirent" in
12644 "$define")
12645     echo "Checking to see if DIR has a dd_fd member variable" >&4
12646     $cat >try.c <<EOCP
12647 #$i_stdlib I_STDLIB
12648 #ifdef I_STDLIB
12649 #include <stdlib.h>
12650 #endif
12651 #include <dirent.h>
12652
12653 int main() {
12654     DIR dir;
12655     dir.dd_fd = 1;
12656     return 0;
12657 }
12658 EOCP
12659     val=$undef
12660     set try
12661     if eval $compile; then
12662         echo "Yes, it does."
12663         val="$define"
12664     else
12665         echo "No, it does not."
12666         val="$undef"
12667     fi
12668     ;;
12669 *)
12670     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12671     val="$undef"
12672     ;;
12673 esac
12674 set d_dir_dd_fd
12675 eval $setvar
12676 $rm_try
12677
12678 : see if this is an sysdir system
12679 set sys/dir.h i_sysdir
12680 eval $inhdr
12681
12682 : see if this is an sysndir system
12683 set sys/ndir.h i_sysndir
12684 eval $inhdr
12685
12686 : Look for dirfd
12687 echo " "
12688 $cat >dirfd.c <<EOM
12689 #include <stdio.h>
12690 #$i_stdlib I_STDLIB
12691 #ifdef I_STDLIB
12692 #include <stdlib.h>
12693 #endif
12694 #$i_dirent I_DIRENT             /**/
12695 #$i_sysdir I_SYS_DIR            /**/
12696 #$i_sysndir I_SYS_NDIR          /**/
12697 #$i_systypes I_SYS_TYPES        /**/
12698 #if defined(I_SYS_TYPES)
12699 #include <sys/types.h>
12700 #endif
12701 #if defined(I_DIRENT)
12702 #include <dirent.h>
12703 #else
12704 #ifdef I_SYS_NDIR
12705 #include <sys/ndir.h>
12706 #else
12707 #ifdef I_SYS_DIR
12708 #ifdef hp9000s500
12709 #include <ndir.h>       /* may be wrong in the future */
12710 #else
12711 #include <sys/dir.h>
12712 #endif
12713 #endif
12714 #endif
12715 #endif
12716 int main() {
12717         DIR *dirp = opendir(".");
12718         if (dirfd(dirp) >= 0)
12719                 exit(0);
12720         else
12721                 exit(1);
12722 }
12723 EOM
12724 val=$undef
12725 set dirfd
12726 if eval $compile; then
12727         val="$define"
12728 fi
12729 case "$val" in
12730 $define)        echo "dirfd() found." >&4       ;;
12731 *)              echo "dirfd() NOT found." >&4   ;;
12732 esac
12733 set d_dirfd
12734 eval $setvar
12735 $rm -f dirfd*
12736
12737 : see if dladdr exists
12738 set dladdr d_dladdr
12739 eval $inlibc
12740
12741 : see if dlerror exists
12742 xxx_runnm="$runnm"
12743 runnm=false
12744 set dlerror d_dlerror
12745 eval $inlibc
12746 runnm="$xxx_runnm"
12747
12748 : see if dlfcn is available
12749 set dlfcn.h i_dlfcn
12750 eval $inhdr
12751
12752 : Check what extension to use for shared libs
12753 case "$usedl" in
12754 $define|y|true)
12755         $cat << EOM
12756
12757 On a few systems, the dynamically loaded modules that perl generates and uses
12758 will need a different extension than shared libs. The default will probably
12759 be appropriate.
12760
12761 EOM
12762         case "$dlext" in
12763         '')     dflt="$so" ;;
12764         *)      dflt="$dlext" ;;
12765         esac
12766         rp='What is the extension of dynamically loaded modules'
12767         . ./myread
12768         dlext="$ans"
12769         ;;
12770 *)
12771         dlext="none"
12772         ;;
12773 esac
12774
12775 : Check if dlsym need a leading underscore
12776 echo " "
12777 val="$undef"
12778
12779 case "$dlsrc" in
12780 dl_dlopen.xs)
12781         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12782         $cat >dyna.c <<'EOM'
12783 fred () { }
12784 EOM
12785
12786 $cat >fred.c<<EOM
12787
12788 #include <stdio.h>
12789 #$i_stdlib I_STDLIB
12790 #ifdef I_STDLIB
12791 #include <stdlib.h>
12792 #endif
12793 #$i_dlfcn I_DLFCN
12794 #ifdef I_DLFCN
12795 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12796 #else
12797 #include <sys/types.h>
12798 #include <nlist.h>
12799 #include <link.h>
12800 #endif
12801
12802 extern int fred() ;
12803
12804 int main()
12805 {
12806     void * handle ;
12807     void * symbol ;
12808 #ifndef RTLD_LAZY
12809     int mode = 1 ;
12810 #else
12811     int mode = RTLD_LAZY ;
12812 #endif
12813     handle = dlopen("./dyna.$dlext", mode) ;
12814     if (handle == NULL) {
12815         printf ("1\n") ;
12816         fflush (stdout) ;
12817         exit(0);
12818     }
12819     symbol = dlsym(handle, "fred") ;
12820     if (symbol == NULL) {
12821         /* try putting a leading underscore */
12822         symbol = dlsym(handle, "_fred") ;
12823         if (symbol == NULL) {
12824             printf ("2\n") ;
12825             fflush (stdout) ;
12826             exit(0);
12827         }
12828         printf ("3\n") ;
12829     }
12830     else
12831         printf ("4\n") ;
12832     fflush (stdout) ;
12833     exit(0);
12834 }
12835 EOM
12836         : Call the object file tmp-dyna.o in case dlext=o.
12837         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12838                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12839                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12840                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12841                 xxx=`$run ./fred`
12842                 case $xxx in
12843                 1)      echo "Test program failed using dlopen." >&4
12844                         echo "Perhaps you should not use dynamic loading." >&4;;
12845                 2)      echo "Test program failed using dlsym." >&4
12846                         echo "Perhaps you should not use dynamic loading." >&4;;
12847                 3)      echo "dlsym needs a leading underscore" >&4
12848                         val="$define" ;;
12849                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12850                 esac
12851         else
12852                 echo "I can't compile and run the test program." >&4
12853                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12854         fi
12855         ;;
12856 esac
12857
12858 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12859
12860 set d_dlsymun
12861 eval $setvar
12862
12863 : see if drand48_r exists
12864 set drand48_r d_drand48_r
12865 eval $inlibc
12866 case "$d_drand48_r" in
12867 "$define")
12868         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12869         case "$d_drand48_r_proto:$usethreads" in
12870         ":define")      d_drand48_r_proto=define
12871                 set d_drand48_r_proto drand48_r $hdrs
12872                 eval $hasproto ;;
12873         *)      ;;
12874         esac
12875         case "$d_drand48_r_proto" in
12876         define)
12877         case "$drand48_r_proto" in
12878         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12879         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12880         esac
12881         case "$drand48_r_proto" in
12882         ''|0)   d_drand48_r=undef
12883                 drand48_r_proto=0
12884                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12885         * )     case "$drand48_r_proto" in
12886                 REENTRANT_PROTO*) ;;
12887                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12888                 esac
12889                 echo "Prototype: $try" ;;
12890         esac
12891         ;;
12892         *)      case "$usethreads" in
12893                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12894                 esac
12895                 d_drand48_r=undef
12896                 drand48_r_proto=0
12897                 ;;
12898         esac
12899         ;;
12900 *)      drand48_r_proto=0
12901         ;;
12902 esac
12903
12904 : see if prototype for drand48 is available
12905 echo " "
12906 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12907 eval $hasproto
12908
12909 : see if dup2 exists
12910 set dup2 d_dup2
12911 eval $inlibc
12912
12913 : see if eaccess exists
12914 set eaccess d_eaccess
12915 eval $inlibc
12916
12917 : see if endgrent exists
12918 set endgrent d_endgrent
12919 eval $inlibc
12920
12921 : see if this is an grp system
12922 set grp.h i_grp
12923 eval $inhdr
12924
12925 case "$i_grp" in
12926 $define)
12927         xxx=`./findhdr grp.h`
12928         $cppstdin $cppflags $cppminus < $xxx >$$.h
12929
12930         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12931                 val="$define"
12932         else
12933                 val="$undef"
12934         fi
12935         set d_grpasswd
12936         eval $setvar
12937
12938         $rm -f $$.h
12939         ;;
12940 *)
12941         val="$undef";
12942         set d_grpasswd; eval $setvar
12943         ;;
12944 esac
12945
12946 : see if endgrent_r exists
12947 set endgrent_r d_endgrent_r
12948 eval $inlibc
12949 case "$d_endgrent_r" in
12950 "$define")
12951         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12952         case "$d_endgrent_r_proto:$usethreads" in
12953         ":define")      d_endgrent_r_proto=define
12954                 set d_endgrent_r_proto endgrent_r $hdrs
12955                 eval $hasproto ;;
12956         *)      ;;
12957         esac
12958         case "$d_endgrent_r_proto" in
12959         define)
12960         case "$endgrent_r_proto" in
12961         ''|0) try='int endgrent_r(FILE**);'
12962         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12963         esac
12964         case "$endgrent_r_proto" in
12965         ''|0) try='void endgrent_r(FILE**);'
12966         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12967         esac
12968         case "$endgrent_r_proto" in
12969         ''|0)   d_endgrent_r=undef
12970                 endgrent_r_proto=0
12971                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12972         * )     case "$endgrent_r_proto" in
12973                 REENTRANT_PROTO*) ;;
12974                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12975                 esac
12976                 echo "Prototype: $try" ;;
12977         esac
12978         ;;
12979         *)      case "$usethreads" in
12980                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12981                 esac
12982                 d_endgrent_r=undef
12983                 endgrent_r_proto=0
12984                 ;;
12985         esac
12986         ;;
12987 *)      endgrent_r_proto=0
12988         ;;
12989 esac
12990
12991 : see if endhostent exists
12992 set endhostent d_endhent
12993 eval $inlibc
12994
12995 : see if this is a netdb.h system
12996 set netdb.h i_netdb
12997 eval $inhdr
12998
12999 : see if endhostent_r exists
13000 set endhostent_r d_endhostent_r
13001 eval $inlibc
13002 case "$d_endhostent_r" in
13003 "$define")
13004         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13005         case "$d_endhostent_r_proto:$usethreads" in
13006         ":define")      d_endhostent_r_proto=define
13007                 set d_endhostent_r_proto endhostent_r $hdrs
13008                 eval $hasproto ;;
13009         *)      ;;
13010         esac
13011         case "$d_endhostent_r_proto" in
13012         define)
13013         case "$endhostent_r_proto" in
13014         ''|0) try='int endhostent_r(struct hostent_data*);'
13015         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
13016         esac
13017         case "$endhostent_r_proto" in
13018         ''|0) try='void endhostent_r(struct hostent_data*);'
13019         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
13020         esac
13021         case "$endhostent_r_proto" in
13022         ''|0)   d_endhostent_r=undef
13023                 endhostent_r_proto=0
13024                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
13025         * )     case "$endhostent_r_proto" in
13026                 REENTRANT_PROTO*) ;;
13027                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
13028                 esac
13029                 echo "Prototype: $try" ;;
13030         esac
13031         ;;
13032         *)      case "$usethreads" in
13033                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
13034                 esac
13035                 d_endhostent_r=undef
13036                 endhostent_r_proto=0
13037                 ;;
13038         esac
13039         ;;
13040 *)      endhostent_r_proto=0
13041         ;;
13042 esac
13043
13044 : see if endnetent exists
13045 set endnetent d_endnent
13046 eval $inlibc
13047
13048 : see if endnetent_r exists
13049 set endnetent_r d_endnetent_r
13050 eval $inlibc
13051 case "$d_endnetent_r" in
13052 "$define")
13053         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13054         case "$d_endnetent_r_proto:$usethreads" in
13055         ":define")      d_endnetent_r_proto=define
13056                 set d_endnetent_r_proto endnetent_r $hdrs
13057                 eval $hasproto ;;
13058         *)      ;;
13059         esac
13060         case "$d_endnetent_r_proto" in
13061         define)
13062         case "$endnetent_r_proto" in
13063         ''|0) try='int endnetent_r(struct netent_data*);'
13064         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
13065         esac
13066         case "$endnetent_r_proto" in
13067         ''|0) try='void endnetent_r(struct netent_data*);'
13068         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
13069         esac
13070         case "$endnetent_r_proto" in
13071         ''|0)   d_endnetent_r=undef
13072                 endnetent_r_proto=0
13073                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
13074         * )     case "$endnetent_r_proto" in
13075                 REENTRANT_PROTO*) ;;
13076                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
13077                 esac
13078                 echo "Prototype: $try" ;;
13079         esac
13080         ;;
13081         *)      case "$usethreads" in
13082                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
13083                 esac
13084                 d_endnetent_r=undef
13085                 endnetent_r_proto=0
13086                 ;;
13087         esac
13088         ;;
13089 *)      endnetent_r_proto=0
13090         ;;
13091 esac
13092
13093 : see if endprotoent exists
13094 set endprotoent d_endpent
13095 eval $inlibc
13096
13097 : see if endprotoent_r exists
13098 set endprotoent_r d_endprotoent_r
13099 eval $inlibc
13100 case "$d_endprotoent_r" in
13101 "$define")
13102         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13103         case "$d_endprotoent_r_proto:$usethreads" in
13104         ":define")      d_endprotoent_r_proto=define
13105                 set d_endprotoent_r_proto endprotoent_r $hdrs
13106                 eval $hasproto ;;
13107         *)      ;;
13108         esac
13109         case "$d_endprotoent_r_proto" in
13110         define)
13111         case "$endprotoent_r_proto" in
13112         ''|0) try='int endprotoent_r(struct protoent_data*);'
13113         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
13114         esac
13115         case "$endprotoent_r_proto" in
13116         ''|0) try='void endprotoent_r(struct protoent_data*);'
13117         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
13118         esac
13119         case "$endprotoent_r_proto" in
13120         ''|0)   d_endprotoent_r=undef
13121                 endprotoent_r_proto=0
13122                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
13123         * )     case "$endprotoent_r_proto" in
13124                 REENTRANT_PROTO*) ;;
13125                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
13126                 esac
13127                 echo "Prototype: $try" ;;
13128         esac
13129         ;;
13130         *)      case "$usethreads" in
13131                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
13132                 esac
13133                 d_endprotoent_r=undef
13134                 endprotoent_r_proto=0
13135                 ;;
13136         esac
13137         ;;
13138 *)      endprotoent_r_proto=0
13139         ;;
13140 esac
13141
13142 : see if endpwent exists
13143 set endpwent d_endpwent
13144 eval $inlibc
13145
13146 : see if this is a pwd.h system
13147 set pwd.h i_pwd
13148 eval $inhdr
13149
13150 case "$i_pwd" in
13151 $define)
13152         xxx=`./findhdr pwd.h`
13153         $cppstdin $cppflags $cppminus < $xxx >$$.h
13154
13155         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
13156                 val="$define"
13157         else
13158                 val="$undef"
13159         fi
13160         set d_pwquota
13161         eval $setvar
13162
13163         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13164                 val="$define"
13165         else
13166                 val="$undef"
13167         fi
13168         set d_pwage
13169         eval $setvar
13170
13171         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13172                 val="$define"
13173         else
13174                 val="$undef"
13175         fi
13176         set d_pwchange
13177         eval $setvar
13178
13179         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13180                 val="$define"
13181         else
13182                 val="$undef"
13183         fi
13184         set d_pwclass
13185         eval $setvar
13186
13187         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13188                 val="$define"
13189         else
13190                 val="$undef"
13191         fi
13192         set d_pwexpire
13193         eval $setvar
13194
13195         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13196                 val="$define"
13197         else
13198                 val="$undef"
13199         fi
13200         set d_pwcomment
13201         eval $setvar
13202
13203         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13204                 val="$define"
13205         else
13206                 val="$undef"
13207         fi
13208         set d_pwgecos
13209         eval $setvar
13210
13211         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13212                 val="$define"
13213         else
13214                 val="$undef"
13215         fi
13216         set d_pwpasswd
13217         eval $setvar
13218
13219         $rm -f $$.h
13220         ;;
13221 *)
13222         val="$undef";
13223         set d_pwquota; eval $setvar
13224         set d_pwage; eval $setvar
13225         set d_pwchange; eval $setvar
13226         set d_pwclass; eval $setvar
13227         set d_pwexpire; eval $setvar
13228         set d_pwcomment; eval $setvar
13229         set d_pwgecos; eval $setvar
13230         set d_pwpasswd; eval $setvar
13231         ;;
13232 esac
13233
13234 : see if endpwent_r exists
13235 set endpwent_r d_endpwent_r
13236 eval $inlibc
13237 case "$d_endpwent_r" in
13238 "$define")
13239         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13240         case "$d_endpwent_r_proto:$usethreads" in
13241         ":define")      d_endpwent_r_proto=define
13242                 set d_endpwent_r_proto endpwent_r $hdrs
13243                 eval $hasproto ;;
13244         *)      ;;
13245         esac
13246         case "$d_endpwent_r_proto" in
13247         define)
13248         case "$endpwent_r_proto" in
13249         ''|0) try='int endpwent_r(FILE**);'
13250         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13251         esac
13252         case "$endpwent_r_proto" in
13253         ''|0) try='void endpwent_r(FILE**);'
13254         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13255         esac
13256         case "$endpwent_r_proto" in
13257         ''|0)   d_endpwent_r=undef
13258                 endpwent_r_proto=0
13259                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13260         * )     case "$endpwent_r_proto" in
13261                 REENTRANT_PROTO*) ;;
13262                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13263                 esac
13264                 echo "Prototype: $try" ;;
13265         esac
13266         ;;
13267         *)      case "$usethreads" in
13268                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13269                 esac
13270                 d_endpwent_r=undef
13271                 endpwent_r_proto=0
13272                 ;;
13273         esac
13274         ;;
13275 *)      endpwent_r_proto=0
13276         ;;
13277 esac
13278
13279 : see if endservent exists
13280 set endservent d_endsent
13281 eval $inlibc
13282
13283 : see if endservent_r exists
13284 set endservent_r d_endservent_r
13285 eval $inlibc
13286 case "$d_endservent_r" in
13287 "$define")
13288         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13289         case "$d_endservent_r_proto:$usethreads" in
13290         ":define")      d_endservent_r_proto=define
13291                 set d_endservent_r_proto endservent_r $hdrs
13292                 eval $hasproto ;;
13293         *)      ;;
13294         esac
13295         case "$d_endservent_r_proto" in
13296         define)
13297         case "$endservent_r_proto" in
13298         ''|0) try='int endservent_r(struct servent_data*);'
13299         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13300         esac
13301         case "$endservent_r_proto" in
13302         ''|0) try='void endservent_r(struct servent_data*);'
13303         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13304         esac
13305         case "$endservent_r_proto" in
13306         ''|0)   d_endservent_r=undef
13307                 endservent_r_proto=0
13308                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13309         * )     case "$endservent_r_proto" in
13310                 REENTRANT_PROTO*) ;;
13311                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13312                 esac
13313                 echo "Prototype: $try" ;;
13314         esac
13315         ;;
13316         *)      case "$usethreads" in
13317                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13318                 esac
13319                 d_endservent_r=undef
13320                 endservent_r_proto=0
13321                 ;;
13322         esac
13323         ;;
13324 *)      endservent_r_proto=0
13325         ;;
13326 esac
13327
13328 : Locate the flags for 'open()'
13329 echo " "
13330 $cat >try.c <<EOCP
13331 #include <sys/types.h>
13332 #ifdef I_FCNTL
13333 #include <fcntl.h>
13334 #endif
13335 #ifdef I_SYS_FILE
13336 #include <sys/file.h>
13337 #endif
13338 #$i_stdlib I_STDLIB
13339 #ifdef I_STDLIB
13340 #include <stdlib.h>
13341 #endif
13342 int main() {
13343         if(O_RDONLY);
13344 #ifdef O_TRUNC
13345         exit(0);
13346 #else
13347         exit(1);
13348 #endif
13349 }
13350 EOCP
13351 : check sys/file.h first to get FREAD on Sun
13352 if $test `./findhdr sys/file.h` && \
13353                 set try -DI_SYS_FILE && eval $compile; then
13354         h_sysfile=true;
13355         echo "<sys/file.h> defines the O_* constants..." >&4
13356         if $run ./try; then
13357                 echo "and you have the 3 argument form of open()." >&4
13358                 val="$define"
13359         else
13360                 echo "but not the 3 argument form of open().  Oh, well." >&4
13361                 val="$undef"
13362         fi
13363 elif $test `./findhdr fcntl.h` && \
13364                 set try -DI_FCNTL && eval $compile; then
13365         h_fcntl=true;
13366         echo "<fcntl.h> defines the O_* constants..." >&4
13367         if $run ./try; then
13368                 echo "and you have the 3 argument form of open()." >&4
13369                 val="$define"
13370         else
13371                 echo "but not the 3 argument form of open().  Oh, well." >&4
13372                 val="$undef"
13373         fi
13374 else
13375         val="$undef"
13376         echo "I can't find the O_* constant definitions!  You got problems." >&4
13377 fi
13378 set d_open3
13379 eval $setvar
13380 $rm_try
13381
13382 : see if this is a sys/file.h system
13383 val=''
13384 set sys/file.h val
13385 eval $inhdr
13386
13387 : do we need to include sys/file.h ?
13388 case "$val" in
13389 "$define")
13390         echo " "
13391         if $h_sysfile; then
13392                 val="$define"
13393                 echo "We'll be including <sys/file.h>." >&4
13394         else
13395                 val="$undef"
13396                 echo "We won't be including <sys/file.h>." >&4
13397         fi
13398         ;;
13399 *)
13400         h_sysfile=false
13401         ;;
13402 esac
13403 set i_sysfile
13404 eval $setvar
13405
13406 : see if fcntl.h is there
13407 val=''
13408 set fcntl.h val
13409 eval $inhdr
13410
13411 : see if we can include fcntl.h
13412 case "$val" in
13413 "$define")
13414         echo " "
13415         if $h_fcntl; then
13416                 val="$define"
13417                 echo "We'll be including <fcntl.h>." >&4
13418         else
13419                 val="$undef"
13420                 if $h_sysfile; then
13421         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13422                 else
13423                         echo "We won't be including <fcntl.h>." >&4
13424                 fi
13425         fi
13426         ;;
13427 *)
13428         h_fcntl=false
13429         val="$undef"
13430         ;;
13431 esac
13432 set i_fcntl
13433 eval $setvar
13434
13435 : see if fork exists
13436 set fork d_fork
13437 eval $inlibc
13438
13439 : see if pipe exists
13440 set pipe d_pipe
13441 eval $inlibc
13442
13443 : check for non-blocking I/O stuff
13444 case "$h_sysfile" in
13445 true) echo "#include <sys/file.h>" > head.c;;
13446 *)
13447        case "$h_fcntl" in
13448        true) echo "#include <fcntl.h>" > head.c;;
13449        *) echo "#include <sys/fcntl.h>" > head.c;;
13450        esac
13451        ;;
13452 esac
13453 echo " "
13454 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13455 case "$o_nonblock" in
13456 '')
13457         $cat head.c > try.c
13458         $cat >>try.c <<EOCP
13459 #include <stdio.h>
13460 #$i_stdlib I_STDLIB
13461 #ifdef I_STDLIB
13462 #include <stdlib.h>
13463 #endif
13464 #$i_fcntl I_FCNTL
13465 #ifdef I_FCNTL
13466 #include <fcntl.h>
13467 #endif
13468 int main() {
13469 #ifdef O_NONBLOCK
13470         printf("O_NONBLOCK\n");
13471         exit(0);
13472 #endif
13473 #ifdef O_NDELAY
13474         printf("O_NDELAY\n");
13475         exit(0);
13476 #endif
13477 #ifdef FNDELAY
13478         printf("FNDELAY\n");
13479         exit(0);
13480 #endif
13481         exit(0);
13482 }
13483 EOCP
13484         set try
13485         if eval $compile_ok; then
13486                 o_nonblock=`$run ./try`
13487                 case "$o_nonblock" in
13488                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13489                 *) echo "Seems like we can use $o_nonblock.";;
13490                 esac
13491         else
13492                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13493         fi
13494         ;;
13495 *) echo "Using $hint value $o_nonblock.";;
13496 esac
13497 $rm_try
13498
13499 echo " "
13500 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13501 case "$eagain" in
13502 '')
13503         case "$d_fork:$d_pipe:$d_alarm" in
13504         define:define:define)
13505         $cat head.c > try.c
13506         $cat >>try.c <<EOCP
13507 #include <errno.h>
13508 #include <sys/types.h>
13509 #include <signal.h>
13510 #include <stdio.h>
13511 #$i_stdlib I_STDLIB
13512 #ifdef I_STDLIB
13513 #include <stdlib.h>
13514 #endif
13515 #$i_fcntl I_FCNTL
13516 #ifdef I_FCNTL
13517 #include <fcntl.h>
13518 #endif
13519 #define MY_O_NONBLOCK $o_nonblock
13520 #ifndef errno  /* XXX need better Configure test */
13521 extern int errno;
13522 #endif
13523 #$i_unistd I_UNISTD
13524 #ifdef I_UNISTD
13525 #include <unistd.h>
13526 #endif
13527 #$i_string I_STRING
13528 #ifdef I_STRING
13529 #include <string.h>
13530 #else
13531 #include <strings.h>
13532 #endif
13533 $signal_t blech(int x) { exit(3); }
13534 EOCP
13535         $cat >> try.c <<'EOCP'
13536 int main()
13537 {
13538         int pd[2];
13539         int pu[2];
13540         char buf[1];
13541         char string[100];
13542         int ret;
13543
13544         ret = pipe(pd); /* Down: child -> parent */
13545         if (ret != 0)
13546                 exit(3);
13547         ret = pipe(pu); /* Up: parent -> child */
13548         if (ret != 0)
13549                 exit(3);
13550         if (0 != fork()) {
13551                 close(pd[1]);   /* Parent reads from pd[0] */
13552                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13553 #ifdef F_SETFL
13554                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13555                         exit(1);
13556 #else
13557                 exit(4);
13558 #endif
13559                 signal(SIGALRM, blech);
13560                 alarm(5);
13561                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13562                         exit(2);
13563                 sprintf(string, "%d\n", ret);
13564                 ret = write(2, string, strlen(string));
13565                 if (ret != strlen(string))
13566                         exit(3);
13567                 alarm(0);
13568 #ifdef EAGAIN
13569                 if (errno == EAGAIN) {
13570                         printf("EAGAIN\n");
13571                         goto ok;
13572                 }
13573 #endif
13574 #ifdef EWOULDBLOCK
13575                 if (errno == EWOULDBLOCK)
13576                         printf("EWOULDBLOCK\n");
13577 #endif
13578         ok:
13579                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13580                 if (ret != 1)
13581                         exit(3);
13582                 sleep(2);                               /* Give it time to close our pipe */
13583                 alarm(5);
13584                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13585                 alarm(0);
13586                 sprintf(string, "%d\n", ret);
13587                 ret = write(4, string, strlen(string));
13588                 if (ret != strlen(string))
13589                         exit(3);
13590                 exit(0);
13591         }
13592
13593         close(pd[0]);                   /* We write to pd[1] */
13594         close(pu[1]);                   /* We read from pu[0] */
13595         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13596         if (ret != 1)
13597                 exit(3);
13598         close(pd[1]);                   /* Pipe pd is now fully closed! */
13599         exit(0);                                /* Bye bye, thank you for playing! */
13600 }
13601 EOCP
13602         set try
13603         if eval $compile_ok; then
13604                 echo "$startsh" >mtry
13605                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13606                 chmod +x mtry
13607                 $run ./mtry >/dev/null 2>&1
13608                 case $? in
13609                 0) eagain=`$cat try.out`;;
13610                 1) echo "Could not perform non-blocking setting!";;
13611                 2) echo "I did a successful read() for something that was not there!";;
13612                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13613                 4) echo "Could not find F_SETFL!";;
13614                 *) echo "Something terribly wrong happened during testing.";;
13615                 esac
13616                 rd_nodata=`$cat try.ret`
13617                 echo "A read() system call with no data present returns $rd_nodata."
13618                 case "$rd_nodata" in
13619                 0|-1) ;;
13620                 *)
13621                         echo "(That's peculiar, fixing that to be -1.)"
13622                         rd_nodata=-1
13623                         ;;
13624                 esac
13625                 case "$eagain" in
13626                 '')
13627                         echo "Forcing errno EAGAIN on read() with no data available."
13628                         eagain=EAGAIN
13629                         ;;
13630                 *)
13631                         echo "Your read() sets errno to $eagain when no data is available."
13632                         ;;
13633                 esac
13634                 status=`$cat try.err`
13635                 case "$status" in
13636                 0) echo "And it correctly returns 0 to signal EOF.";;
13637                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13638                 *) echo "However, your read() returns '$status' on EOF??";;
13639                 esac
13640                 val="$define"
13641                 if test "$status" = "$rd_nodata"; then
13642                         echo "WARNING: you can't distinguish between EOF and no data!"
13643                         val="$undef"
13644                 fi
13645         else
13646                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13647                 eagain=EAGAIN
13648         fi
13649         ;;
13650         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13651                 eagain=EAGAIN
13652                 val="$define"
13653                 ;;
13654         esac
13655         set d_eofnblk
13656         eval $setvar
13657         ;;
13658 *)
13659         echo "Using $hint value $eagain."
13660         echo "Your read() returns $rd_nodata when no data is present."
13661         case "$d_eofnblk" in
13662         "$define") echo "And you can see EOF because read() returns 0.";;
13663         "$undef") echo "But you can't see EOF status from read() returned value.";;
13664         *)
13665                 echo "(Assuming you can't see EOF status from read anyway.)"
13666                 d_eofnblk=$undef
13667                 ;;
13668         esac
13669         ;;
13670 esac
13671 $rm_try head.c mtry
13672
13673 : see if erf exists
13674 set erf d_erf
13675 eval $inlibc
13676
13677 : see if erfc exists
13678 set erfc d_erfc
13679 eval $inlibc
13680
13681 : see if exp2 exists
13682 set exp2 d_exp2
13683 eval $inlibc
13684
13685 : see if expm1 exists
13686 set expm1 d_expm1
13687 eval $inlibc
13688
13689 : see if _ptr and _cnt from stdio act std
13690 echo " "
13691
13692 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13693         echo "(Looks like you have stdio.h from BSD.)"
13694         case "$stdio_ptr" in
13695         '') stdio_ptr='((fp)->_p)'
13696                 ptr_lval=$define
13697                 ;;
13698         *)      ptr_lval=$d_stdio_ptr_lval;;
13699         esac
13700         case "$stdio_cnt" in
13701         '') stdio_cnt='((fp)->_r)'
13702                 cnt_lval=$define
13703                 ;;
13704         *)      cnt_lval=$d_stdio_cnt_lval;;
13705         esac
13706         case "$stdio_base" in
13707         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13708         esac
13709         case "$stdio_bufsiz" in
13710         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13711         esac
13712 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13713         echo "(Looks like you have stdio.h from Linux.)"
13714         case "$stdio_ptr" in
13715         '') stdio_ptr='((fp)->_IO_read_ptr)'
13716                 ptr_lval=$define
13717                 ;;
13718         *)      ptr_lval=$d_stdio_ptr_lval;;
13719         esac
13720         case "$stdio_cnt" in
13721         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13722                 cnt_lval=$undef
13723                 ;;
13724         *)      cnt_lval=$d_stdio_cnt_lval;;
13725         esac
13726         case "$stdio_base" in
13727         '') stdio_base='((fp)->_IO_read_base)';;
13728         esac
13729         case "$stdio_bufsiz" in
13730         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13731         esac
13732 else
13733         case "$stdio_ptr" in
13734         '') stdio_ptr='((fp)->_ptr)'
13735                 ptr_lval=$define
13736                 ;;
13737         *)      ptr_lval=$d_stdio_ptr_lval;;
13738         esac
13739         case "$stdio_cnt" in
13740         '') stdio_cnt='((fp)->_cnt)'
13741                 cnt_lval=$define
13742                 ;;
13743         *)      cnt_lval=$d_stdio_cnt_lval;;
13744         esac
13745         case "$stdio_base" in
13746         '') stdio_base='((fp)->_base)';;
13747         esac
13748         case "$stdio_bufsiz" in
13749         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13750         esac
13751 fi
13752
13753 : test whether _ptr and _cnt really work
13754 echo "Checking how std your stdio is..." >&4
13755 $cat >try.c <<EOP
13756 #include <stdio.h>
13757 #$i_stdlib I_STDLIB
13758 #ifdef I_STDLIB
13759 #include <stdlib.h>
13760 #endif
13761 #define FILE_ptr(fp)    $stdio_ptr
13762 #define FILE_cnt(fp)    $stdio_cnt
13763 int main() {
13764         FILE *fp = fopen("try.c", "r");
13765         char c = getc(fp);
13766         if (
13767                 18 <= FILE_cnt(fp) &&
13768                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13769         )
13770                 exit(0);
13771         exit(1);
13772 }
13773 EOP
13774 val="$undef"
13775 set try
13776 if eval $compile && $to try.c; then
13777         if $run ./try; then
13778                 echo "Your stdio acts pretty std."
13779                 val="$define"
13780         else
13781                 echo "Your stdio isn't very std."
13782         fi
13783 else
13784         echo "Your stdio doesn't appear very std."
13785 fi
13786 $rm_try
13787
13788 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13789 # direct buffer manipulation no longer works.  The Configure tests
13790 # should be changed to correctly detect this, but until then,
13791 # the following check should at least let perl compile and run.
13792 # (This quick fix should be updated before 5.8.1.)
13793 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13794 # A. Dougherty, June 3, 2002.
13795 case "$d_gnulibc" in
13796 $define)
13797         case "$gnulibc_version" in
13798         2.[01]*)  ;;
13799         2.2) ;;
13800         2.2.[0-9]) ;;
13801         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13802                 val="$undef"
13803                 ;;
13804         esac
13805         ;;
13806 esac
13807 set d_stdstdio
13808 eval $setvar
13809
13810 : Can _ptr be used as an lvalue?
13811 case "$d_stdstdio$ptr_lval" in
13812 $define$define) val=$define ;;
13813 *) val=$undef ;;
13814 esac
13815 set d_stdio_ptr_lval
13816 eval $setvar
13817
13818 : Can _cnt be used as an lvalue?
13819 case "$d_stdstdio$cnt_lval" in
13820 $define$define) val=$define ;;
13821 *) val=$undef ;;
13822 esac
13823 set d_stdio_cnt_lval
13824 eval $setvar
13825
13826
13827 : test whether setting _ptr sets _cnt as a side effect
13828 d_stdio_ptr_lval_sets_cnt="$undef"
13829 d_stdio_ptr_lval_nochange_cnt="$undef"
13830 case "$d_stdio_ptr_lval$d_stdstdio" in
13831 $define$define)
13832         echo "Checking to see what happens if we set the stdio ptr..." >&4
13833 $cat >try.c <<EOP
13834 #include <stdio.h>
13835 /* Can we scream? */
13836 /* Eat dust sed :-) */
13837 /* In the buffer space, no one can hear you scream. */
13838 #$i_stdlib I_STDLIB
13839 #ifdef I_STDLIB
13840 #include <stdlib.h>
13841 #endif
13842 #define FILE_ptr(fp)    $stdio_ptr
13843 #define FILE_cnt(fp)    $stdio_cnt
13844 #include <sys/types.h>
13845 int main() {
13846         FILE *fp = fopen("try.c", "r");
13847         int c;
13848         char *ptr;
13849         size_t cnt;
13850         if (!fp) {
13851             puts("Fail even to read");
13852             exit(1);
13853         }
13854         c = getc(fp); /* Read away the first # */
13855         if (c == EOF) {
13856             puts("Fail even to read");
13857             exit(1);
13858         }
13859         if (!(
13860                 18 <= FILE_cnt(fp) &&
13861                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13862         )) {
13863                 puts("Fail even to read");
13864                 exit (1);
13865         }
13866         ptr = (char*) FILE_ptr(fp);
13867         cnt = (size_t)FILE_cnt(fp);
13868
13869         FILE_ptr(fp) += 42;
13870
13871         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13872                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13873                 exit (1);
13874         }
13875         if (FILE_cnt(fp) <= 20) {
13876                 printf ("Fail (<20 chars to test)");
13877                 exit (1);
13878         }
13879         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13880                 puts("Fail compare");
13881                 exit (1);
13882         }
13883         if (cnt == FILE_cnt(fp)) {
13884                 puts("Pass_unchanged");
13885                 exit (0);
13886         }
13887         if (FILE_cnt(fp) == (cnt - 42)) {
13888                 puts("Pass_changed");
13889                 exit (0);
13890         }
13891         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13892         return 1;
13893
13894 }
13895 EOP
13896         set try
13897         if eval $compile && $to try.c; then
13898                 case `$run ./try` in
13899                 Pass_changed)
13900                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13901                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13902                 Pass_unchanged)
13903                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13904                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13905                 Fail*)
13906                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13907                 *)
13908                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13909         esac
13910         else
13911                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13912         fi
13913         $rm_try
13914         ;;
13915 esac
13916
13917 : see if _base is also standard
13918 val="$undef"
13919 case "$d_stdstdio" in
13920 $define)
13921         $cat >try.c <<EOP
13922 #include <stdio.h>
13923 #$i_stdlib I_STDLIB
13924 #ifdef I_STDLIB
13925 #include <stdlib.h>
13926 #endif
13927 #define FILE_base(fp)   $stdio_base
13928 #define FILE_bufsiz(fp) $stdio_bufsiz
13929 int main() {
13930         FILE *fp = fopen("try.c", "r");
13931         char c = getc(fp);
13932         if (
13933                 19 <= FILE_bufsiz(fp) &&
13934                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13935         )
13936                 exit(0);
13937         exit(1);
13938 }
13939 EOP
13940         set try
13941         if eval $compile && $to try.c; then
13942                 if $run ./try; then
13943                         echo "And its _base field acts std."
13944                         val="$define"
13945                 else
13946                         echo "But its _base field isn't std."
13947                 fi
13948         else
13949                 echo "However, it seems to be lacking the _base field."
13950         fi
13951         $rm_try
13952         ;;
13953 esac
13954 set d_stdiobase
13955 eval $setvar
13956
13957 : see if fast_stdio exists
13958 val="$undef"
13959 case "$d_stdstdio:$d_stdio_ptr_lval" in
13960 "$define:$define")
13961         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13962         *$define*)
13963                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13964                 val="$define"
13965                 ;;
13966         esac
13967         ;;
13968 esac
13969 set d_faststdio
13970 eval $setvar
13971
13972
13973
13974 : see if fchdir exists
13975 set fchdir d_fchdir
13976 eval $inlibc
13977
13978 : see if fchmod exists
13979 set fchmod d_fchmod
13980 eval $inlibc
13981
13982 : see if fchown exists
13983 set fchown d_fchown
13984 eval $inlibc
13985
13986 : see if this is an fcntl system
13987 set fcntl d_fcntl
13988 eval $inlibc
13989
13990 : See if fcntl-based locking works.
13991 echo " "
13992 $cat >try.c <<EOCP
13993 #$i_stdlib I_STDLIB
13994 #ifdef I_STDLIB
13995 #include <stdlib.h>
13996 #endif
13997 #include <unistd.h>
13998 #include <fcntl.h>
13999 #include <signal.h>
14000 $signal_t blech(int x) { exit(3); }
14001 int main() {
14002 #if defined(F_SETLK) && defined(F_SETLKW)
14003      struct flock flock;
14004      int retval, fd;
14005      fd = open("try.c", O_RDONLY);
14006      flock.l_type = F_RDLCK;
14007      flock.l_whence = SEEK_SET;
14008      flock.l_start = flock.l_len = 0;
14009      signal(SIGALRM, blech);
14010      alarm(10);
14011      retval = fcntl(fd, F_SETLK, &flock);
14012      close(fd);
14013      (retval < 0 ? exit(2) : exit(0));
14014 #else
14015      exit(2);
14016 #endif
14017 }
14018 EOCP
14019 echo "Checking if fcntl-based file locking works... "
14020 case "$d_fcntl" in
14021 "$define")
14022         set try
14023         if eval $compile_ok; then
14024                 if $run ./try; then
14025                         echo "Yes, it seems to work."
14026                         val="$define"
14027                 else
14028                         echo "Nope, it didn't work."
14029                         val="$undef"
14030                         case "$?" in
14031                         3) $cat >&4 <<EOM
14032 ***
14033 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
14034 *** This is (almost) impossible.
14035 *** If your NFS lock daemons are not feeling well, something like
14036 *** this may happen, please investigate.  Cannot continue, aborting.
14037 ***
14038 EOM
14039                                 exit 1
14040                                 ;;
14041                         esac
14042                 fi
14043         else
14044                 echo "I'm unable to compile the test program, so I'll assume not."
14045                 val="$undef"
14046         fi
14047         ;;
14048 *) val="$undef";
14049         echo "Nope, since you don't even have fcntl()."
14050         ;;
14051 esac
14052 set d_fcntl_can_lock
14053 eval $setvar
14054 $rm_try
14055
14056 : check for fd_set items
14057 $cat <<EOM
14058
14059 Checking to see how well your C compiler handles fd_set and friends ...
14060 EOM
14061 $cat >try.c <<EOCP
14062 #$i_stdlib I_STDLIB
14063 #ifdef I_STDLIB
14064 #include <stdlib.h>
14065 #endif
14066 #$i_systime I_SYS_TIME
14067 #$i_sysselct I_SYS_SELECT
14068 #$d_socket HAS_SOCKET
14069 #include <sys/types.h>
14070 #ifdef HAS_SOCKET
14071 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14072 #endif
14073 #ifdef I_SYS_TIME
14074 #include <sys/time.h>
14075 #endif
14076 #ifdef I_SYS_SELECT
14077 #include <sys/select.h>
14078 #endif
14079 int main() {
14080         fd_set fds;
14081
14082 #ifdef TRYBITS
14083         if(fds.fds_bits);
14084 #endif
14085
14086 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
14087         exit(0);
14088 #else
14089         exit(1);
14090 #endif
14091 }
14092 EOCP
14093 set try -DTRYBITS
14094 if eval $compile; then
14095         d_fds_bits="$define"
14096         d_fd_set="$define"
14097         echo "Well, your system knows about the normal fd_set typedef..." >&4
14098         if $run ./try; then
14099                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
14100                 d_fd_macros="$define"
14101         else
14102                 $cat >&4 <<'EOM'
14103 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
14104 EOM
14105                 d_fd_macros="$undef"
14106         fi
14107 else
14108         $cat <<'EOM'
14109 Hmm, your compiler has some difficulty with fd_set.  Checking further...
14110 EOM
14111         set try
14112         if eval $compile; then
14113                 d_fds_bits="$undef"
14114                 d_fd_set="$define"
14115                 echo "Well, your system has some sort of fd_set available..." >&4
14116                 if $run ./try; then
14117                         echo "and you have the normal fd_set macros." >&4
14118                         d_fd_macros="$define"
14119                 else
14120                         $cat <<'EOM'
14121 but not the normal fd_set macros!  Gross!  More work for me...
14122 EOM
14123                         d_fd_macros="$undef"
14124                 fi
14125         else
14126         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
14127                 d_fd_set="$undef"
14128                 d_fds_bits="$undef"
14129                 d_fd_macros="$undef"
14130         fi
14131 fi
14132 $rm_try
14133
14134 : see if fdclose exists
14135 set fdclose d_fdclose
14136 eval $inlibc
14137
14138 : see if fdim exists
14139 set fdim d_fdim
14140 eval $inlibc
14141
14142 : see if fegetround exists
14143 set fegetround d_fegetround
14144 eval $inlibc
14145
14146 : see if fgetpos exists
14147 set fgetpos d_fgetpos
14148 eval $inlibc
14149
14150 : see if finite exists
14151 set finite d_finite
14152 eval $inlibc
14153
14154 : see if finitel exists
14155 set finitel d_finitel
14156 eval $inlibc
14157
14158 : see if flock exists
14159 set flock d_flock
14160 eval $inlibc
14161
14162 : see if prototype for flock is available
14163 echo " "
14164 set d_flockproto flock $i_sysfile sys/file.h
14165 eval $hasproto
14166
14167 : see if fma exists
14168 set fma d_fma
14169 eval $inlibc
14170
14171 : see if fmax exists
14172 set fmax d_fmax
14173 eval $inlibc
14174
14175 : see if fmin exists
14176 set fmin d_fmin
14177 eval $inlibc
14178
14179 : see if fp_class exists
14180 set fp_class d_fp_class
14181 eval $inlibc
14182
14183 : see if this is a math.h system
14184 set math.h i_math
14185 eval $inhdr
14186
14187 : check for fpclassify
14188 echo "Checking to see if you have fpclassify..." >&4
14189 $cat >try.c <<EOCP
14190 #$i_math I_MATH
14191 #ifdef I_MATH
14192 #include <math.h>
14193 #endif
14194 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14195 EOCP
14196 set try
14197 if eval $compile; then
14198         val="$define"
14199         echo "You have fpclassify."
14200 else
14201         val="$undef"
14202         echo "You do not have fpclassify."
14203 fi
14204 $rm_try
14205 set d_fpclassify
14206 eval $setvar
14207
14208 : see if fp_classify exists
14209 set fp_classify d_fp_classify
14210 eval $inlibc
14211
14212 : see if fp_classl exists
14213 set fp_classl d_fp_classl
14214 eval $inlibc
14215
14216 : see if pathconf exists
14217 set pathconf d_pathconf
14218 eval $inlibc
14219
14220 : see if fpathconf exists
14221 set fpathconf d_fpathconf
14222 eval $inlibc
14223
14224 : see if fpclass exists
14225 set fpclass d_fpclass
14226 eval $inlibc
14227
14228 : see if fpclassl exists
14229 set fpclassl d_fpclassl
14230 eval $inlibc
14231
14232 : see if fpgetround exists
14233 set fpgetround d_fpgetround
14234 eval $inlibc
14235
14236 : check for fpos64_t
14237 echo " "
14238 echo "Checking to see if you have fpos64_t..." >&4
14239 $cat >try.c <<EOCP
14240 #include <stdio.h>
14241 int main() { fpos64_t x = 7; }
14242 EOCP
14243 set try
14244 if eval $compile; then
14245         val="$define"
14246         echo "You have fpos64_t."
14247 else
14248         val="$undef"
14249         echo "You do not have fpos64_t."
14250         case "$fpossize" in
14251         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14252         esac
14253 fi
14254 $rm_try
14255 set d_fpos64_t
14256 eval $setvar
14257
14258 : see if this is an xlocale.h system
14259 set xlocale.h i_xlocale
14260 eval $inhdr
14261
14262 : see if newlocale exists
14263 set newlocale d_newlocale
14264 eval $inlibc
14265
14266 : see if freelocale exists
14267 set freelocale d_freelocale
14268 eval $inlibc
14269
14270 : see if uselocale exists
14271 set uselocale d_uselocale
14272 eval $inlibc
14273
14274 : see if duplocale exists
14275 set duplocale d_duplocale
14276 eval $inlibc
14277
14278 : see if querylocale exists
14279 set querylocale d_querylocale
14280 eval $inlibc
14281
14282 : see if frexpl exists
14283 set frexpl d_frexpl
14284 eval $inlibc
14285
14286 : see if this is a sys/param system
14287 set sys/param.h i_sysparam
14288 eval $inhdr
14289
14290 : see if this is a sys/mount.h system
14291 set sys/mount.h i_sysmount
14292 eval $inhdr
14293
14294 : Check for fs_data_s
14295 echo " "
14296 echo "Checking to see if your system supports struct fs_data..." >&4
14297 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14298 eval $hasstruct
14299 case "$d_fs_data_s" in
14300 "$define")      echo "Yes, it does."   ;;
14301 *)              echo "No, it doesn't." ;;
14302 esac
14303
14304 : see if fseeko exists
14305 set fseeko d_fseeko
14306 eval $inlibc
14307 case "$longsize" in
14308 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14309 esac
14310
14311 : see if fsetpos exists
14312 set fsetpos d_fsetpos
14313 eval $inlibc
14314
14315 : see if fstatfs exists
14316 set fstatfs d_fstatfs
14317 eval $inlibc
14318
14319 : see if statvfs exists
14320 set statvfs d_statvfs
14321 eval $inlibc
14322
14323 : see if fstatvfs exists
14324 set fstatvfs d_fstatvfs
14325 eval $inlibc
14326
14327
14328 : see if fsync exists
14329 set fsync d_fsync
14330 eval $inlibc
14331
14332 : see if ftello exists
14333 set ftello d_ftello
14334 eval $inlibc
14335 case "$longsize" in
14336 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14337 esac
14338
14339 : check for a working futimes
14340 d_futimes="$undef"
14341 echo " "
14342 echo "Checking if you have a working futimes()" >&4
14343 $cat >try.c <<EOCP
14344 #include <stdio.h>
14345 #include <sys/time.h>
14346 #include <errno.h>
14347 #include <fcntl.h>
14348
14349 int main ()
14350 {
14351     int fd, rv;
14352     fd = open ("try.c", O_RDWR);
14353     if (-1 == fd) exit (1);
14354     rv = futimes (fd, NULL);
14355     exit (rv == -1 ? errno : 0);
14356 }
14357 EOCP
14358 set try
14359 if eval $compile; then
14360     `$run ./try`
14361     rc=$?
14362     case "$rc" in
14363         0)  echo "Yes, you have" >&4
14364             d_futimes="$define"
14365             ;;
14366         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14367             ;;
14368     esac
14369 else
14370     echo "No, it does not (probably harmless)" >&4
14371 fi
14372 $rm_try
14373
14374 : look for gai_strerror
14375 echo " "
14376 $cat >try.c <<'EOCP'
14377 #include <sys/types.h>
14378 #include <sys/socket.h>
14379 #include <netdb.h>
14380 int main ()
14381 {
14382     return (gai_strerror (0) ? 0 : 1);
14383     }
14384 EOCP
14385 set try
14386 val="$undef"
14387 if eval $compile; then
14388     `$run ./try`
14389     case "$?" in
14390         0)  echo "A working gai_strerror() found." >&4
14391             val="$define" ;;
14392         *)  echo "gai_strerror() found, but it doesn't work" >&4
14393             ;;
14394         esac
14395 else
14396     echo "gai_strerror() NOT found." >&4
14397     fi
14398 set d_gai_strerror
14399 eval $setvar
14400 $rm_try
14401
14402 : see if ndbm.h is available
14403 set ndbm.h i_ndbm
14404 eval $inhdr
14405 : Compatibility location for RedHat 7.1
14406 set gdbm/ndbm.h i_gdbmndbm
14407 eval $inhdr
14408 : Compatibility location for Debian 4.0
14409 set gdbm-ndbm.h i_gdbm_ndbm
14410 eval $inhdr
14411
14412 val="$undef"
14413 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14414         : see if dbm_open exists
14415         set dbm_open d_dbm_open
14416         eval $inlibc
14417         case "$d_dbm_open" in
14418         $undef)
14419                 i_ndbm="$undef"
14420                 i_gdbmndbm="$undef"
14421                 i_gdbm_ndbm="$undef"
14422                 echo "We won't be including <ndbm.h>"
14423                 val="$undef"
14424                 ;;
14425         *) val="$define"
14426            ;;
14427         esac
14428 fi
14429 set d_ndbm
14430 eval $setvar
14431
14432 ndbm_hdr_protochk='name=$1; hdr=$2;
14433 eval "ihdr=\$""i_$name";
14434 val="$undef";
14435 if $test "$ihdr" = "$define"; then
14436         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14437         case "$d_cplusplus" in
14438         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14439         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14440         esac;
14441         case "$val" in
14442         $define) $echo "Your <$hdr> seems to have prototypes";;
14443         *) $echo "Your <$hdr> does not seem to have prototypes";;
14444         esac;
14445 fi;
14446 set "d_${name}_h_uses_prototypes";
14447 eval $setvar'
14448
14449 set ndbm ndbm.h
14450 eval $ndbm_hdr_protochk
14451 set gdbmndbm gdbm/ndbm.h
14452 eval $ndbm_hdr_protochk
14453 set gdbm_ndbm gdbm-ndbm.h
14454 eval $ndbm_hdr_protochk
14455
14456 : see if getaddrinfo exists
14457 set getaddrinfo d_getaddrinfo
14458 eval $inlibc
14459
14460 : see if getcwd exists
14461 set getcwd d_getcwd
14462 eval $inlibc
14463
14464 : see if getespwnam exists
14465 set getespwnam d_getespwnam
14466 eval $inlibc
14467
14468 : see if getfsstat exists
14469 set getfsstat d_getfsstat
14470 eval $inlibc
14471
14472 : see if getgrent exists
14473 set getgrent d_getgrent
14474 eval $inlibc
14475
14476 : see if getgrent_r exists
14477 set getgrent_r d_getgrent_r
14478 eval $inlibc
14479 case "$d_getgrent_r" in
14480 "$define")
14481         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14482         case "$d_getgrent_r_proto:$usethreads" in
14483         ":define")      d_getgrent_r_proto=define
14484                 set d_getgrent_r_proto getgrent_r $hdrs
14485                 eval $hasproto ;;
14486         *)      ;;
14487         esac
14488         case "$d_getgrent_r_proto" in
14489         define)
14490         case "$getgrent_r_proto" in
14491         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14492         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14493         esac
14494         case "$getgrent_r_proto" in
14495         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14496         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14497         esac
14498         case "$getgrent_r_proto" in
14499         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14500         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14501         esac
14502         case "$getgrent_r_proto" in
14503         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14504         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14505         esac
14506         case "$getgrent_r_proto" in
14507         ''|0) try='int getgrent_r(struct group*, char*, int);'
14508         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14509         esac
14510         case "$getgrent_r_proto" in
14511         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14512         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14513         esac
14514         case "$getgrent_r_proto" in
14515         ''|0)   d_getgrent_r=undef
14516                 getgrent_r_proto=0
14517                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14518         * )     case "$getgrent_r_proto" in
14519                 REENTRANT_PROTO*) ;;
14520                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14521                 esac
14522                 echo "Prototype: $try" ;;
14523         esac
14524         ;;
14525         *)      case "$usethreads" in
14526                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14527                 esac
14528                 d_getgrent_r=undef
14529                 getgrent_r_proto=0
14530                 ;;
14531         esac
14532         ;;
14533 *)      getgrent_r_proto=0
14534         ;;
14535 esac
14536
14537 : see if getgrgid_r exists
14538 set getgrgid_r d_getgrgid_r
14539 eval $inlibc
14540 case "$d_getgrgid_r" in
14541 "$define")
14542         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14543         case "$d_getgrgid_r_proto:$usethreads" in
14544         ":define")      d_getgrgid_r_proto=define
14545                 set d_getgrgid_r_proto getgrgid_r $hdrs
14546                 eval $hasproto ;;
14547         *)      ;;
14548         esac
14549         case "$d_getgrgid_r_proto" in
14550         define)
14551         case "$getgrgid_r_proto" in
14552         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14553         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14554         esac
14555         case "$getgrgid_r_proto" in
14556         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14557         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14558         esac
14559         case "$getgrgid_r_proto" in
14560         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14561         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14562         esac
14563         case "$getgrgid_r_proto" in
14564         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14565         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14566         esac
14567         case "$getgrgid_r_proto" in
14568         ''|0)   d_getgrgid_r=undef
14569                 getgrgid_r_proto=0
14570                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14571         * )     case "$getgrgid_r_proto" in
14572                 REENTRANT_PROTO*) ;;
14573                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14574                 esac
14575                 echo "Prototype: $try" ;;
14576         esac
14577         ;;
14578         *)      case "$usethreads" in
14579                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14580                 esac
14581                 d_getgrgid_r=undef
14582                 getgrgid_r_proto=0
14583                 ;;
14584         esac
14585         ;;
14586 *)      getgrgid_r_proto=0
14587         ;;
14588 esac
14589
14590 : see if getgrnam_r exists
14591 set getgrnam_r d_getgrnam_r
14592 eval $inlibc
14593 case "$d_getgrnam_r" in
14594 "$define")
14595         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14596         case "$d_getgrnam_r_proto:$usethreads" in
14597         ":define")      d_getgrnam_r_proto=define
14598                 set d_getgrnam_r_proto getgrnam_r $hdrs
14599                 eval $hasproto ;;
14600         *)      ;;
14601         esac
14602         case "$d_getgrnam_r_proto" in
14603         define)
14604         case "$getgrnam_r_proto" in
14605         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14606         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14607         esac
14608         case "$getgrnam_r_proto" in
14609         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14610         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14611         esac
14612         case "$getgrnam_r_proto" in
14613         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14614         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14615         esac
14616         case "$getgrnam_r_proto" in
14617         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14618         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14619         esac
14620         case "$getgrnam_r_proto" in
14621         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14622         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14623         esac
14624         case "$getgrnam_r_proto" in
14625         ''|0)   d_getgrnam_r=undef
14626                 getgrnam_r_proto=0
14627                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14628         * )     case "$getgrnam_r_proto" in
14629                 REENTRANT_PROTO*) ;;
14630                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14631                 esac
14632                 echo "Prototype: $try" ;;
14633         esac
14634         ;;
14635         *)      case "$usethreads" in
14636                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14637                 esac
14638                 d_getgrnam_r=undef
14639                 getgrnam_r_proto=0
14640                 ;;
14641         esac
14642         ;;
14643 *)      getgrnam_r_proto=0
14644         ;;
14645 esac
14646
14647 : see if gethostbyaddr exists
14648 set gethostbyaddr d_gethbyaddr
14649 eval $inlibc
14650
14651 : see if gethostbyname exists
14652 set gethostbyname d_gethbyname
14653 eval $inlibc
14654
14655 : see if gethostent exists
14656 set gethostent d_gethent
14657 eval $inlibc
14658
14659 : see how we will look up host name
14660 echo " "
14661 call=''
14662 if set gethostname val -f d_gethname; eval $csym; $val; then
14663         echo 'gethostname() found.' >&4
14664         d_gethname="$define"
14665         call=gethostname
14666 fi
14667 if set uname val -f d_uname; eval $csym; $val; then
14668         if ./xenix; then
14669                 $cat <<'EOM'
14670 uname() was found, but you're running xenix, and older versions of xenix
14671 have a broken uname(). If you don't really know whether your xenix is old
14672 enough to have a broken system call, use the default answer.
14673
14674 EOM
14675                 dflt=y
14676                 case "$d_uname" in
14677                 "$define") dflt=n;;
14678                 esac
14679                 rp='Is your uname() broken?'
14680                 . ./myread
14681                 case "$ans" in
14682                 n*) d_uname="$define"; call=uname;;
14683                 esac
14684         else
14685                 echo 'uname() found.' >&4
14686                 d_uname="$define"
14687                 case "$call" in
14688                 '') call=uname ;;
14689                 esac
14690         fi
14691 fi
14692 case "$d_gethname" in
14693 '') d_gethname="$undef";;
14694 esac
14695 case "$d_uname" in
14696 '') d_uname="$undef";;
14697 esac
14698 case "$d_uname$d_gethname" in
14699 *define*)
14700         dflt=n
14701         cat <<EOM
14702
14703 Every now and then someone has a $call() that lies about the hostname
14704 but can't be fixed for political or economic reasons.  If you wish, I can
14705 pretend $call() isn't there and maybe compute hostname at run-time
14706 thanks to the '$phostname' command.
14707
14708 EOM
14709         rp="Shall I ignore $call() from now on?"
14710         . ./myread
14711         case "$ans" in
14712         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14713         esac;;
14714 esac
14715 case "$phostname" in
14716 '') aphostname='';;
14717 *) case "$aphostname" in
14718         /*) ;;
14719         *) set X $phostname
14720                 shift
14721                 file=$1
14722                 shift
14723                 file=`./loc $file $file $pth`
14724                 aphostname=`echo $file $*`
14725                 ;;
14726         esac
14727         ;;
14728 esac
14729 case "$d_uname$d_gethname" in
14730 *define*) ;;
14731 *)
14732         case "$phostname" in
14733         '')
14734                 echo "There will be no way for $package to get your hostname." >&4;;
14735         *)
14736         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14737                 ;;
14738         esac;;
14739 esac
14740 case "$d_phostname" in
14741 '') d_phostname="$undef";;
14742 esac
14743
14744 : see if gethostbyaddr_r exists
14745 set gethostbyaddr_r d_gethostbyaddr_r
14746 eval $inlibc
14747 case "$d_gethostbyaddr_r" in
14748 "$define")
14749         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14750         case "$d_gethostbyaddr_r_proto:$usethreads" in
14751         ":define")      d_gethostbyaddr_r_proto=define
14752                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14753                 eval $hasproto ;;
14754         *)      ;;
14755         esac
14756         case "$d_gethostbyaddr_r_proto" in
14757         define)
14758         case "$gethostbyaddr_r_proto" in
14759         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14760         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14761         esac
14762         case "$gethostbyaddr_r_proto" in
14763         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14764         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14765         esac
14766         case "$gethostbyaddr_r_proto" in
14767         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14768         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14769         esac
14770         case "$gethostbyaddr_r_proto" in
14771         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14772         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14773         esac
14774         case "$gethostbyaddr_r_proto" in
14775         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14776         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14777         esac
14778         case "$gethostbyaddr_r_proto" in
14779         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14780         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14781         esac
14782         case "$gethostbyaddr_r_proto" in
14783         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14784         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14785         esac
14786         case "$gethostbyaddr_r_proto" in
14787         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14788         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14789         esac
14790         case "$gethostbyaddr_r_proto" in
14791         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14792         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14793         esac
14794         case "$gethostbyaddr_r_proto" in
14795         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14796         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14797         esac
14798         case "$gethostbyaddr_r_proto" in
14799         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14800         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14801         esac
14802         case "$gethostbyaddr_r_proto" in
14803         ''|0)   d_gethostbyaddr_r=undef
14804                 gethostbyaddr_r_proto=0
14805                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14806         * )     case "$gethostbyaddr_r_proto" in
14807                 REENTRANT_PROTO*) ;;
14808                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14809                 esac
14810                 echo "Prototype: $try" ;;
14811         esac
14812         ;;
14813         *)      case "$usethreads" in
14814                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14815                 esac
14816                 d_gethostbyaddr_r=undef
14817                 gethostbyaddr_r_proto=0
14818                 ;;
14819         esac
14820         ;;
14821 *)      gethostbyaddr_r_proto=0
14822         ;;
14823 esac
14824
14825 : see if gethostbyname_r exists
14826 set gethostbyname_r d_gethostbyname_r
14827 eval $inlibc
14828 case "$d_gethostbyname_r" in
14829 "$define")
14830         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14831         case "$d_gethostbyname_r_proto:$usethreads" in
14832         ":define")      d_gethostbyname_r_proto=define
14833                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14834                 eval $hasproto ;;
14835         *)      ;;
14836         esac
14837         case "$d_gethostbyname_r_proto" in
14838         define)
14839         case "$gethostbyname_r_proto" in
14840         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14841         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14842         esac
14843         case "$gethostbyname_r_proto" in
14844         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14845         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14846         esac
14847         case "$gethostbyname_r_proto" in
14848         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14849         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14850         esac
14851         case "$gethostbyname_r_proto" in
14852         ''|0)   d_gethostbyname_r=undef
14853                 gethostbyname_r_proto=0
14854                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14855         * )     case "$gethostbyname_r_proto" in
14856                 REENTRANT_PROTO*) ;;
14857                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14858                 esac
14859                 echo "Prototype: $try" ;;
14860         esac
14861         ;;
14862         *)      case "$usethreads" in
14863                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14864                 esac
14865                 d_gethostbyname_r=undef
14866                 gethostbyname_r_proto=0
14867                 ;;
14868         esac
14869         ;;
14870 *)      gethostbyname_r_proto=0
14871         ;;
14872 esac
14873
14874 : see if gethostent_r exists
14875 set gethostent_r d_gethostent_r
14876 eval $inlibc
14877 case "$d_gethostent_r" in
14878 "$define")
14879         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14880         case "$d_gethostent_r_proto:$usethreads" in
14881         ":define")      d_gethostent_r_proto=define
14882                 set d_gethostent_r_proto gethostent_r $hdrs
14883                 eval $hasproto ;;
14884         *)      ;;
14885         esac
14886         case "$d_gethostent_r_proto" in
14887         define)
14888         case "$gethostent_r_proto" in
14889         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14890         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14891         esac
14892         case "$gethostent_r_proto" in
14893         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14894         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14895         esac
14896         case "$gethostent_r_proto" in
14897         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14898         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14899         esac
14900         case "$gethostent_r_proto" in
14901         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14902         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14903         esac
14904         case "$gethostent_r_proto" in
14905         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14906         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14907         esac
14908         case "$gethostent_r_proto" in
14909         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14910         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14911         esac
14912         case "$gethostent_r_proto" in
14913         ''|0)   d_gethostent_r=undef
14914                 gethostent_r_proto=0
14915                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14916         * )     case "$gethostent_r_proto" in
14917                 REENTRANT_PROTO*) ;;
14918                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14919                 esac
14920                 echo "Prototype: $try" ;;
14921         esac
14922         ;;
14923         *)      case "$usethreads" in
14924                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14925                 esac
14926                 d_gethostent_r=undef
14927                 gethostent_r_proto=0
14928                 ;;
14929         esac
14930         ;;
14931 *)      gethostent_r_proto=0
14932         ;;
14933 esac
14934
14935 : see if prototypes for various gethostxxx netdb.h functions are available
14936 echo " "
14937 set d_gethostprotos gethostent $i_netdb netdb.h
14938 eval $hasproto
14939
14940 : see if getitimer exists
14941 set getitimer d_getitimer
14942 eval $inlibc
14943
14944 : see if getlogin exists
14945 set getlogin d_getlogin
14946 eval $inlibc
14947
14948 : see if getlogin_r exists
14949 set getlogin_r d_getlogin_r
14950 eval $inlibc
14951 case "$d_getlogin_r" in
14952 "$define")
14953         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14954         case "$d_getlogin_r_proto:$usethreads" in
14955         ":define")      d_getlogin_r_proto=define
14956                 set d_getlogin_r_proto getlogin_r $hdrs
14957                 eval $hasproto ;;
14958         *)      ;;
14959         esac
14960         case "$d_getlogin_r_proto" in
14961         define)
14962         case "$getlogin_r_proto" in
14963         ''|0) try='int getlogin_r(char*, size_t);'
14964         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14965         esac
14966         case "$getlogin_r_proto" in
14967         ''|0) try='int getlogin_r(char*, int);'
14968         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14969         esac
14970         case "$getlogin_r_proto" in
14971         ''|0) try='char* getlogin_r(char*, size_t);'
14972         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14973         esac
14974         case "$getlogin_r_proto" in
14975         ''|0) try='char* getlogin_r(char*, int);'
14976         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14977         esac
14978         case "$getlogin_r_proto" in
14979         ''|0)   d_getlogin_r=undef
14980                 getlogin_r_proto=0
14981                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14982         * )     case "$getlogin_r_proto" in
14983                 REENTRANT_PROTO*) ;;
14984                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14985                 esac
14986                 echo "Prototype: $try" ;;
14987         esac
14988         ;;
14989         *)      case "$usethreads" in
14990                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14991                 esac
14992                 d_getlogin_r=undef
14993                 getlogin_r_proto=0
14994                 ;;
14995         esac
14996         ;;
14997 *)      getlogin_r_proto=0
14998         ;;
14999 esac
15000
15001 : see if getmnt exists
15002 set getmnt d_getmnt
15003 eval $inlibc
15004
15005 : see if getmntent exists
15006 set getmntent d_getmntent
15007 eval $inlibc
15008
15009 : see if getnameinfo exists
15010 set getnameinfo d_getnameinfo
15011 eval $inlibc
15012
15013 : see if getnetbyaddr exists
15014 set getnetbyaddr d_getnbyaddr
15015 eval $inlibc
15016
15017 : see if getnetbyname exists
15018 set getnetbyname d_getnbyname
15019 eval $inlibc
15020
15021 : see if getnetent exists
15022 set getnetent d_getnent
15023 eval $inlibc
15024
15025 : see if getnetbyaddr_r exists
15026 set getnetbyaddr_r d_getnetbyaddr_r
15027 eval $inlibc
15028 case "$d_getnetbyaddr_r" in
15029 "$define")
15030         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15031         case "$d_getnetbyaddr_r_proto:$usethreads" in
15032         ":define")      d_getnetbyaddr_r_proto=define
15033                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
15034                 eval $hasproto ;;
15035         *)      ;;
15036         esac
15037         case "$d_getnetbyaddr_r_proto" in
15038         define)
15039         case "$getnetbyaddr_r_proto" in
15040         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
15041         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
15042         esac
15043         case "$getnetbyaddr_r_proto" in
15044         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
15045         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
15046         esac
15047         case "$getnetbyaddr_r_proto" in
15048         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
15049         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
15050         esac
15051         case "$getnetbyaddr_r_proto" in
15052         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
15053         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
15054         esac
15055         case "$getnetbyaddr_r_proto" in
15056         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
15057         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
15058         esac
15059         case "$getnetbyaddr_r_proto" in
15060         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
15061         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
15062         esac
15063         case "$getnetbyaddr_r_proto" in
15064         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
15065         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
15066         esac
15067         case "$getnetbyaddr_r_proto" in
15068         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
15069         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
15070         esac
15071         case "$getnetbyaddr_r_proto" in
15072         ''|0)   d_getnetbyaddr_r=undef
15073                 getnetbyaddr_r_proto=0
15074                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
15075         * )     case "$getnetbyaddr_r_proto" in
15076                 REENTRANT_PROTO*) ;;
15077                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
15078                 esac
15079                 echo "Prototype: $try" ;;
15080         esac
15081         ;;
15082         *)      case "$usethreads" in
15083                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
15084                 esac
15085                 d_getnetbyaddr_r=undef
15086                 getnetbyaddr_r_proto=0
15087                 ;;
15088         esac
15089         ;;
15090 *)      getnetbyaddr_r_proto=0
15091         ;;
15092 esac
15093
15094 : see if getnetbyname_r exists
15095 set getnetbyname_r d_getnetbyname_r
15096 eval $inlibc
15097 case "$d_getnetbyname_r" in
15098 "$define")
15099         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15100         case "$d_getnetbyname_r_proto:$usethreads" in
15101         ":define")      d_getnetbyname_r_proto=define
15102                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
15103                 eval $hasproto ;;
15104         *)      ;;
15105         esac
15106         case "$d_getnetbyname_r_proto" in
15107         define)
15108         case "$getnetbyname_r_proto" in
15109         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
15110         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
15111         esac
15112         case "$getnetbyname_r_proto" in
15113         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
15114         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
15115         esac
15116         case "$getnetbyname_r_proto" in
15117         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
15118         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
15119         esac
15120         case "$getnetbyname_r_proto" in
15121         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
15122         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
15123         esac
15124         case "$getnetbyname_r_proto" in
15125         ''|0)   d_getnetbyname_r=undef
15126                 getnetbyname_r_proto=0
15127                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
15128         * )     case "$getnetbyname_r_proto" in
15129                 REENTRANT_PROTO*) ;;
15130                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
15131                 esac
15132                 echo "Prototype: $try" ;;
15133         esac
15134         ;;
15135         *)      case "$usethreads" in
15136                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
15137                 esac
15138                 d_getnetbyname_r=undef
15139                 getnetbyname_r_proto=0
15140                 ;;
15141         esac
15142         ;;
15143 *)      getnetbyname_r_proto=0
15144         ;;
15145 esac
15146
15147 : see if getnetent_r exists
15148 set getnetent_r d_getnetent_r
15149 eval $inlibc
15150 case "$d_getnetent_r" in
15151 "$define")
15152         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15153         case "$d_getnetent_r_proto:$usethreads" in
15154         ":define")      d_getnetent_r_proto=define
15155                 set d_getnetent_r_proto getnetent_r $hdrs
15156                 eval $hasproto ;;
15157         *)      ;;
15158         esac
15159         case "$d_getnetent_r_proto" in
15160         define)
15161         case "$getnetent_r_proto" in
15162         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
15163         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
15164         esac
15165         case "$getnetent_r_proto" in
15166         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
15167         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
15168         esac
15169         case "$getnetent_r_proto" in
15170         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
15171         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
15172         esac
15173         case "$getnetent_r_proto" in
15174         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
15175         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
15176         esac
15177         case "$getnetent_r_proto" in
15178         ''|0) try='int getnetent_r(struct netent*, char*, int);'
15179         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
15180         esac
15181         case "$getnetent_r_proto" in
15182         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
15183         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
15184         esac
15185         case "$getnetent_r_proto" in
15186         ''|0)   d_getnetent_r=undef
15187                 getnetent_r_proto=0
15188                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
15189         * )     case "$getnetent_r_proto" in
15190                 REENTRANT_PROTO*) ;;
15191                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15192                 esac
15193                 echo "Prototype: $try" ;;
15194         esac
15195         ;;
15196         *)      case "$usethreads" in
15197                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15198                 esac
15199                 d_getnetent_r=undef
15200                 getnetent_r_proto=0
15201                 ;;
15202         esac
15203         ;;
15204 *)      getnetent_r_proto=0
15205         ;;
15206 esac
15207
15208 : see if prototypes for various getnetxxx netdb.h functions are available
15209 echo " "
15210 set d_getnetprotos getnetent $i_netdb netdb.h
15211 eval $hasproto
15212
15213 : see if getpagesize exists
15214 set getpagesize d_getpagsz
15215 eval $inlibc
15216
15217 : Optional checks for getprotobyname and getprotobynumber
15218
15219 : see if getprotobyname exists
15220 set getprotobyname d_getpbyname
15221 eval $inlibc
15222
15223 : see if getprotobynumber exists
15224 set getprotobynumber d_getpbynumber
15225 eval $inlibc
15226
15227 : see if getprotoent exists
15228 set getprotoent d_getpent
15229 eval $inlibc
15230
15231 : see if getpgid exists
15232 set getpgid d_getpgid
15233 eval $inlibc
15234
15235 : see if getpgrp2 exists
15236 set getpgrp2 d_getpgrp2
15237 eval $inlibc
15238
15239 : see if getppid exists
15240 set getppid d_getppid
15241 eval $inlibc
15242
15243 : see if getpriority exists
15244 set getpriority d_getprior
15245 eval $inlibc
15246
15247 : see if getprotobyname_r exists
15248 set getprotobyname_r d_getprotobyname_r
15249 eval $inlibc
15250 case "$d_getprotobyname_r" in
15251 "$define")
15252         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15253         case "$d_getprotobyname_r_proto:$usethreads" in
15254         ":define")      d_getprotobyname_r_proto=define
15255                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15256                 eval $hasproto ;;
15257         *)      ;;
15258         esac
15259         case "$d_getprotobyname_r_proto" in
15260         define)
15261         case "$getprotobyname_r_proto" in
15262         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15263         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15264         esac
15265         case "$getprotobyname_r_proto" in
15266         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15267         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15268         esac
15269         case "$getprotobyname_r_proto" in
15270         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15271         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15272         esac
15273         case "$getprotobyname_r_proto" in
15274         ''|0)   d_getprotobyname_r=undef
15275                 getprotobyname_r_proto=0
15276                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15277         * )     case "$getprotobyname_r_proto" in
15278                 REENTRANT_PROTO*) ;;
15279                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15280                 esac
15281                 echo "Prototype: $try" ;;
15282         esac
15283         ;;
15284         *)      case "$usethreads" in
15285                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15286                 esac
15287                 d_getprotobyname_r=undef
15288                 getprotobyname_r_proto=0
15289                 ;;
15290         esac
15291         ;;
15292 *)      getprotobyname_r_proto=0
15293         ;;
15294 esac
15295
15296 : see if getprotobynumber_r exists
15297 set getprotobynumber_r d_getprotobynumber_r
15298 eval $inlibc
15299 case "$d_getprotobynumber_r" in
15300 "$define")
15301         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15302         case "$d_getprotobynumber_r_proto:$usethreads" in
15303         ":define")      d_getprotobynumber_r_proto=define
15304                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15305                 eval $hasproto ;;
15306         *)      ;;
15307         esac
15308         case "$d_getprotobynumber_r_proto" in
15309         define)
15310         case "$getprotobynumber_r_proto" in
15311         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15312         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15313         esac
15314         case "$getprotobynumber_r_proto" in
15315         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15316         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15317         esac
15318         case "$getprotobynumber_r_proto" in
15319         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15320         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15321         esac
15322         case "$getprotobynumber_r_proto" in
15323         ''|0)   d_getprotobynumber_r=undef
15324                 getprotobynumber_r_proto=0
15325                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15326         * )     case "$getprotobynumber_r_proto" in
15327                 REENTRANT_PROTO*) ;;
15328                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15329                 esac
15330                 echo "Prototype: $try" ;;
15331         esac
15332         ;;
15333         *)      case "$usethreads" in
15334                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15335                 esac
15336                 d_getprotobynumber_r=undef
15337                 getprotobynumber_r_proto=0
15338                 ;;
15339         esac
15340         ;;
15341 *)      getprotobynumber_r_proto=0
15342         ;;
15343 esac
15344
15345 : see if getprotoent_r exists
15346 set getprotoent_r d_getprotoent_r
15347 eval $inlibc
15348 case "$d_getprotoent_r" in
15349 "$define")
15350         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15351         case "$d_getprotoent_r_proto:$usethreads" in
15352         ":define")      d_getprotoent_r_proto=define
15353                 set d_getprotoent_r_proto getprotoent_r $hdrs
15354                 eval $hasproto ;;
15355         *)      ;;
15356         esac
15357         case "$d_getprotoent_r_proto" in
15358         define)
15359         case "$getprotoent_r_proto" in
15360         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15361         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15362         esac
15363         case "$getprotoent_r_proto" in
15364         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15365         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15366         esac
15367         case "$getprotoent_r_proto" in
15368         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15369         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15370         esac
15371         case "$getprotoent_r_proto" in
15372         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15373         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15374         esac
15375         case "$getprotoent_r_proto" in
15376         ''|0)   d_getprotoent_r=undef
15377                 getprotoent_r_proto=0
15378                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15379         * )     case "$getprotoent_r_proto" in
15380                 REENTRANT_PROTO*) ;;
15381                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15382                 esac
15383                 echo "Prototype: $try" ;;
15384         esac
15385         ;;
15386         *)      case "$usethreads" in
15387                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15388                 esac
15389                 d_getprotoent_r=undef
15390                 getprotoent_r_proto=0
15391                 ;;
15392         esac
15393         ;;
15394 *)      getprotoent_r_proto=0
15395         ;;
15396 esac
15397
15398 : see if prototypes for various getprotoxxx netdb.h functions are available
15399 echo " "
15400 set d_getprotoprotos getprotoent $i_netdb netdb.h
15401 eval $hasproto
15402
15403 : see if getprpwnam exists
15404 set getprpwnam d_getprpwnam
15405 eval $inlibc
15406
15407 : see if getpwent exists
15408 set getpwent d_getpwent
15409 eval $inlibc
15410
15411 : see if getpwent_r exists
15412 set getpwent_r d_getpwent_r
15413 eval $inlibc
15414 case "$d_getpwent_r" in
15415 "$define")
15416         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15417         case "$d_getpwent_r_proto:$usethreads" in
15418         ":define")      d_getpwent_r_proto=define
15419                 set d_getpwent_r_proto getpwent_r $hdrs
15420                 eval $hasproto ;;
15421         *)      ;;
15422         esac
15423         case "$d_getpwent_r_proto" in
15424         define)
15425         case "$getpwent_r_proto" in
15426         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15427         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15428         esac
15429         case "$getpwent_r_proto" in
15430         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15431         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15432         esac
15433         case "$getpwent_r_proto" in
15434         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15435         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15436         esac
15437         case "$getpwent_r_proto" in
15438         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15439         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15440         esac
15441         case "$getpwent_r_proto" in
15442         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15443         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15444         esac
15445         case "$getpwent_r_proto" in
15446         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15447         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15448         esac
15449         case "$getpwent_r_proto" in
15450         ''|0)   d_getpwent_r=undef
15451                 getpwent_r_proto=0
15452                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15453         * )     case "$getpwent_r_proto" in
15454                 REENTRANT_PROTO*) ;;
15455                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15456                 esac
15457                 echo "Prototype: $try" ;;
15458         esac
15459         ;;
15460         *)      case "$usethreads" in
15461                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15462                 esac
15463                 d_getpwent_r=undef
15464                 getpwent_r_proto=0
15465                 ;;
15466         esac
15467         ;;
15468 *)      getpwent_r_proto=0
15469         ;;
15470 esac
15471
15472 : see if getpwnam_r exists
15473 set getpwnam_r d_getpwnam_r
15474 eval $inlibc
15475 case "$d_getpwnam_r" in
15476 "$define")
15477         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15478         case "$d_getpwnam_r_proto:$usethreads" in
15479         ":define")      d_getpwnam_r_proto=define
15480                 set d_getpwnam_r_proto getpwnam_r $hdrs
15481                 eval $hasproto ;;
15482         *)      ;;
15483         esac
15484         case "$d_getpwnam_r_proto" in
15485         define)
15486         case "$getpwnam_r_proto" in
15487         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15488         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15489         esac
15490         case "$getpwnam_r_proto" in
15491         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15492         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15493         esac
15494         case "$getpwnam_r_proto" in
15495         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15496         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15497         esac
15498         case "$getpwnam_r_proto" in
15499         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15500         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15501         esac
15502         case "$getpwnam_r_proto" in
15503         ''|0)   d_getpwnam_r=undef
15504                 getpwnam_r_proto=0
15505                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15506         * )     case "$getpwnam_r_proto" in
15507                 REENTRANT_PROTO*) ;;
15508                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15509                 esac
15510                 echo "Prototype: $try" ;;
15511         esac
15512         ;;
15513         *)      case "$usethreads" in
15514                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15515                 esac
15516                 d_getpwnam_r=undef
15517                 getpwnam_r_proto=0
15518                 ;;
15519         esac
15520         ;;
15521 *)      getpwnam_r_proto=0
15522         ;;
15523 esac
15524
15525 : see if getpwuid_r exists
15526 set getpwuid_r d_getpwuid_r
15527 eval $inlibc
15528 case "$d_getpwuid_r" in
15529 "$define")
15530         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15531         case "$d_getpwuid_r_proto:$usethreads" in
15532         ":define")      d_getpwuid_r_proto=define
15533                 set d_getpwuid_r_proto getpwuid_r $hdrs
15534                 eval $hasproto ;;
15535         *)      ;;
15536         esac
15537         case "$d_getpwuid_r_proto" in
15538         define)
15539         case "$getpwuid_r_proto" in
15540         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15541         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15542         esac
15543         case "$getpwuid_r_proto" in
15544         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15545         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15546         esac
15547         case "$getpwuid_r_proto" in
15548         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15549         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15550         esac
15551         case "$getpwuid_r_proto" in
15552         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15553         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15554         esac
15555         case "$getpwuid_r_proto" in
15556         ''|0)   d_getpwuid_r=undef
15557                 getpwuid_r_proto=0
15558                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15559         * )     case "$getpwuid_r_proto" in
15560                 REENTRANT_PROTO*) ;;
15561                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15562                 esac
15563                 echo "Prototype: $try" ;;
15564         esac
15565         ;;
15566         *)      case "$usethreads" in
15567                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15568                 esac
15569                 d_getpwuid_r=undef
15570                 getpwuid_r_proto=0
15571                 ;;
15572         esac
15573         ;;
15574 *)      getpwuid_r_proto=0
15575         ;;
15576 esac
15577
15578 : Optional checks for getsbyname and getsbyport
15579
15580 : see if getservbyname exists
15581 set getservbyname d_getsbyname
15582 eval $inlibc
15583
15584 : see if getservbyport exists
15585 set getservbyport d_getsbyport
15586 eval $inlibc
15587
15588 : see if getservent exists
15589 set getservent d_getsent
15590 eval $inlibc
15591
15592 : see if getservbyname_r exists
15593 set getservbyname_r d_getservbyname_r
15594 eval $inlibc
15595 case "$d_getservbyname_r" in
15596 "$define")
15597         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15598         case "$d_getservbyname_r_proto:$usethreads" in
15599         ":define")      d_getservbyname_r_proto=define
15600                 set d_getservbyname_r_proto getservbyname_r $hdrs
15601                 eval $hasproto ;;
15602         *)      ;;
15603         esac
15604         case "$d_getservbyname_r_proto" in
15605         define)
15606         case "$getservbyname_r_proto" in
15607         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15608         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15609         esac
15610         case "$getservbyname_r_proto" in
15611         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15612         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15613         esac
15614         case "$getservbyname_r_proto" in
15615         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15616         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15617         esac
15618         case "$getservbyname_r_proto" in
15619         ''|0)   d_getservbyname_r=undef
15620                 getservbyname_r_proto=0
15621                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15622         * )     case "$getservbyname_r_proto" in
15623                 REENTRANT_PROTO*) ;;
15624                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15625                 esac
15626                 echo "Prototype: $try" ;;
15627         esac
15628         ;;
15629         *)      case "$usethreads" in
15630                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15631                 esac
15632                 d_getservbyname_r=undef
15633                 getservbyname_r_proto=0
15634                 ;;
15635         esac
15636         ;;
15637 *)      getservbyname_r_proto=0
15638         ;;
15639 esac
15640
15641 : see if getservbyport_r exists
15642 set getservbyport_r d_getservbyport_r
15643 eval $inlibc
15644 case "$d_getservbyport_r" in
15645 "$define")
15646         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15647         case "$d_getservbyport_r_proto:$usethreads" in
15648         ":define")      d_getservbyport_r_proto=define
15649                 set d_getservbyport_r_proto getservbyport_r $hdrs
15650                 eval $hasproto ;;
15651         *)      ;;
15652         esac
15653         case "$d_getservbyport_r_proto" in
15654         define)
15655         case "$getservbyport_r_proto" in
15656         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15657         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15658         esac
15659         case "$getservbyport_r_proto" in
15660         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15661         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15662         esac
15663         case "$getservbyport_r_proto" in
15664         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15665         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15666         esac
15667         case "$getservbyport_r_proto" in
15668         ''|0)   d_getservbyport_r=undef
15669                 getservbyport_r_proto=0
15670                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15671         * )     case "$getservbyport_r_proto" in
15672                 REENTRANT_PROTO*) ;;
15673                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15674                 esac
15675                 echo "Prototype: $try" ;;
15676         esac
15677         ;;
15678         *)      case "$usethreads" in
15679                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15680                 esac
15681                 d_getservbyport_r=undef
15682                 getservbyport_r_proto=0
15683                 ;;
15684         esac
15685         ;;
15686 *)      getservbyport_r_proto=0
15687         ;;
15688 esac
15689
15690 : see if getservent_r exists
15691 set getservent_r d_getservent_r
15692 eval $inlibc
15693 case "$d_getservent_r" in
15694 "$define")
15695         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15696         case "$d_getservent_r_proto:$usethreads" in
15697         ":define")      d_getservent_r_proto=define
15698                 set d_getservent_r_proto getservent_r $hdrs
15699                 eval $hasproto ;;
15700         *)      ;;
15701         esac
15702         case "$d_getservent_r_proto" in
15703         define)
15704         case "$getservent_r_proto" in
15705         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15706         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15707         esac
15708         case "$getservent_r_proto" in
15709         ''|0) try='int getservent_r(struct servent*, char*, int);'
15710         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15711         esac
15712         case "$getservent_r_proto" in
15713         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15714         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15715         esac
15716         case "$getservent_r_proto" in
15717         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15718         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15719         esac
15720         case "$getservent_r_proto" in
15721         ''|0)   d_getservent_r=undef
15722                 getservent_r_proto=0
15723                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15724         * )     case "$getservent_r_proto" in
15725                 REENTRANT_PROTO*) ;;
15726                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15727                 esac
15728                 echo "Prototype: $try" ;;
15729         esac
15730         ;;
15731         *)      case "$usethreads" in
15732                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15733                 esac
15734                 d_getservent_r=undef
15735                 getservent_r_proto=0
15736                 ;;
15737         esac
15738         ;;
15739 *)      getservent_r_proto=0
15740         ;;
15741 esac
15742
15743 : see if prototypes for various getservxxx netdb.h functions are available
15744 echo " "
15745 set d_getservprotos getservent $i_netdb netdb.h
15746 eval $hasproto
15747
15748 : see if getspnam exists
15749 set getspnam d_getspnam
15750 eval $inlibc
15751
15752 : see if this is a shadow.h system
15753 set shadow.h i_shadow
15754 eval $inhdr
15755
15756 : see if getspnam_r exists
15757 set getspnam_r d_getspnam_r
15758 eval $inlibc
15759 case "$d_getspnam_r" in
15760 "$define")
15761         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15762         case "$d_getspnam_r_proto:$usethreads" in
15763         ":define")      d_getspnam_r_proto=define
15764                 set d_getspnam_r_proto getspnam_r $hdrs
15765                 eval $hasproto ;;
15766         *)      ;;
15767         esac
15768         case "$d_getspnam_r_proto" in
15769         define)
15770         case "$getspnam_r_proto" in
15771         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15772         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15773         esac
15774         case "$getspnam_r_proto" in
15775         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15776         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15777         esac
15778         case "$getspnam_r_proto" in
15779         ''|0)   d_getspnam_r=undef
15780                 getspnam_r_proto=0
15781                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15782         * )     case "$getspnam_r_proto" in
15783                 REENTRANT_PROTO*) ;;
15784                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15785                 esac
15786                 echo "Prototype: $try" ;;
15787         esac
15788         ;;
15789         *)      case "$usethreads" in
15790                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15791                 esac
15792                 d_getspnam_r=undef
15793                 getspnam_r_proto=0
15794                 ;;
15795         esac
15796         ;;
15797 *)      getspnam_r_proto=0
15798         ;;
15799 esac
15800
15801 : see if gettimeofday or ftime exists
15802 set gettimeofday d_gettimeod
15803 eval $inlibc
15804 case "$d_gettimeod" in
15805 "$undef")
15806         set ftime d_ftime 
15807         eval $inlibc
15808         ;;
15809 *)
15810         val="$undef"; set d_ftime; eval $setvar
15811         ;;
15812 esac
15813 case "$d_gettimeod$d_ftime" in
15814 "$undef$undef")
15815         echo " "
15816         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15817         ;;
15818 esac
15819
15820 : see if gmtime_r exists
15821 set gmtime_r d_gmtime_r
15822 eval $inlibc
15823 case "$d_gmtime_r" in
15824 "$define")
15825         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15826         case "$d_gmtime_r_proto:$usethreads" in
15827         ":define")      d_gmtime_r_proto=define
15828                 set d_gmtime_r_proto gmtime_r $hdrs
15829                 eval $hasproto ;;
15830         *)      ;;
15831         esac
15832         case "$d_gmtime_r_proto" in
15833         define)
15834         case "$gmtime_r_proto" in
15835         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15836         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15837         esac
15838         case "$gmtime_r_proto" in
15839         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15840         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15841         esac
15842         case "$gmtime_r_proto" in
15843         ''|0)   d_gmtime_r=undef
15844                 gmtime_r_proto=0
15845                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15846         * )     case "$gmtime_r_proto" in
15847                 REENTRANT_PROTO*) ;;
15848                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15849                 esac
15850                 echo "Prototype: $try" ;;
15851         esac
15852         ;;
15853         *)      case "$usethreads" in
15854                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15855                 esac
15856                 d_gmtime_r=undef
15857                 gmtime_r_proto=0
15858                 ;;
15859         esac
15860         ;;
15861 *)      gmtime_r_proto=0
15862         ;;
15863 esac
15864
15865 : see if hasmntopt exists
15866 set hasmntopt d_hasmntopt
15867 eval $inlibc
15868
15869 : see if this is a netinet/in.h or sys/in.h system
15870 set netinet/in.h i_niin sys/in.h i_sysin
15871 eval $inhdr
15872
15873 : see if arpa/inet.h has to be included
15874 set arpa/inet.h i_arpainet
15875 eval $inhdr
15876
15877 : see if htonl --and friends-- exists
15878 val=''
15879 set htonl val
15880 eval $inlibc
15881
15882 : Maybe they are macros.
15883 case "$val" in
15884 $undef)
15885         $cat >htonl.c <<EOM
15886 #include <stdio.h>
15887 #include <sys/types.h>
15888 #$i_niin I_NETINET_IN
15889 #$i_sysin I_SYS_IN
15890 #$i_arpainet I_ARPA_INET
15891 #ifdef I_NETINET_IN
15892 #include <netinet/in.h>
15893 #endif
15894 #ifdef I_SYS_IN
15895 #include <sys/in.h>
15896 #endif
15897 #ifdef I_ARPA_INET
15898 #include <arpa/inet.h>
15899 #endif
15900 #ifdef htonl
15901 printf("Defined as a macro.");
15902 #endif
15903 EOM
15904         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15905         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15906                 val="$define"
15907                 echo "But it seems to be defined as a macro." >&4
15908         fi
15909         $rm -f htonl.?
15910         ;;
15911 esac
15912 set d_htonl
15913 eval $setvar
15914
15915 : see if hypot exists
15916 set hypot d_hypot
15917 eval $inlibc
15918
15919 : see if ilogb exists
15920 set ilogb d_ilogb
15921 eval $inlibc
15922
15923 : see if ilogbl exists
15924 set ilogbl d_ilogbl
15925 eval $inlibc
15926
15927 : index or strchr
15928 echo " "
15929 if set index val -f; eval $csym; $val; then
15930         if set strchr val -f d_strchr; eval $csym; $val; then
15931                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15932                         val="$define"
15933                         vali="$undef"
15934                         echo "strchr() found." >&4
15935                 else
15936                         val="$undef"
15937                         vali="$define"
15938                         echo "index() found." >&4
15939                 fi
15940         else
15941                 val="$undef"
15942                 vali="$define"
15943                 echo "index() found." >&4
15944         fi
15945 else
15946         if set strchr val -f d_strchr; eval $csym; $val; then
15947                 val="$define"
15948                 vali="$undef"
15949                 echo "strchr() found." >&4
15950         else
15951                 echo "No index() or strchr() found!" >&4
15952                 val="$undef"
15953                 vali="$undef"
15954         fi
15955 fi
15956 set d_strchr; eval $setvar
15957 val="$vali"
15958 set d_index; eval $setvar
15959
15960 : check whether inet_aton exists
15961 set inet_aton d_inetaton
15962 eval $inlibc
15963
15964 : see if inet_ntop exists
15965 set inet_ntop d_inetntop
15966 eval $inlibc
15967
15968 : see if inet_pton exists
15969 set inet_pton d_inetpton
15970 eval $inlibc
15971
15972 : Look for isascii
15973 echo " "
15974 $cat >isascii.c <<EOCP
15975 #include <stdio.h>
15976 #include <ctype.h>
15977 #$i_stdlib I_STDLIB
15978 #ifdef I_STDLIB
15979 #include <stdlib.h>
15980 #endif
15981 int main() {
15982         int c = 'A';
15983         if (isascii(c))
15984                 exit(0);
15985         else
15986                 exit(1);
15987 }
15988 EOCP
15989 set isascii
15990 if eval $compile; then
15991         echo "isascii() found." >&4
15992         val="$define"
15993 else
15994         echo "isascii() NOT found." >&4
15995         val="$undef"
15996 fi
15997 set d_isascii
15998 eval $setvar
15999 $rm -f isascii*
16000
16001 : Look for isblank
16002 echo " "
16003 $cat >isblank.c <<'EOCP'
16004 #include <stdio.h>
16005 #include <ctype.h>
16006 int main() {
16007         int c = ' ';
16008         if (isblank(c))
16009                 return 0 ;
16010         else
16011                 return 1 ;
16012 }
16013 EOCP
16014 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
16015         echo "isblank() found." >&4
16016         val="$define"
16017 else
16018         echo "isblank() NOT found." >&4
16019         val="$undef"
16020 fi
16021 set d_isblank
16022 eval $setvar
16023 $rm -f isblank*
16024
16025 : check for isfinite
16026 echo "Checking to see if you have isfinite..." >&4
16027 $cat >try.c <<EOCP
16028 #$i_math I_MATH
16029 #ifdef I_MATH
16030 #include <math.h>
16031 #endif
16032 int main() { return isfinite(0.0); }
16033 EOCP
16034 set try
16035 if eval $compile; then
16036         val="$define"
16037         echo "You have isfinite."
16038 else
16039         val="$undef"
16040         echo "You do not have isfinite."
16041 fi
16042 $rm_try
16043 set d_isfinite
16044 eval $setvar
16045
16046 : see if isfinitel exists
16047 set isfinitel d_isfinitel
16048 eval $inlibc
16049
16050 : check for isinf
16051 echo "Checking to see if you have isinf..." >&4
16052 $cat >try.c <<EOCP
16053 #$i_math I_MATH
16054 #ifdef I_MATH
16055 #include <math.h>
16056 #endif
16057 int main() { return isinf(0.0); }
16058 EOCP
16059 set try
16060 if eval $compile; then
16061         val="$define"
16062         echo "You have isinf."
16063 else
16064         val="$undef"
16065         echo "You do not have isinf."
16066 fi
16067 $rm_try
16068 set d_isinf
16069 eval $setvar
16070
16071 : see if isinfl exists
16072 set isinfl d_isinfl
16073 eval $inlibc
16074
16075 : check for isless
16076 echo "Checking to see if you have isless..." >&4
16077 $cat >try.c <<EOCP
16078 #$i_math I_MATH
16079 #ifdef I_MATH
16080 #include <math.h>
16081 #endif
16082 int main() { return isless(0.0); }
16083 EOCP
16084 set try
16085 if eval $compile; then
16086         val="$define"
16087         echo "You have isless."
16088 else
16089         val="$undef"
16090         echo "You do not have isless."
16091 fi
16092 $rm_try
16093 set d_isless
16094 eval $setvar
16095
16096 : check for isnan
16097 echo "Checking to see if you have isnan..." >&4
16098 $cat >try.c <<EOCP
16099 #$i_math I_MATH
16100 #ifdef I_MATH
16101 #include <math.h>
16102 #endif
16103 int main() { return isnan(0.0); }
16104 EOCP
16105 set try
16106 if eval $compile; then
16107         val="$define"
16108         echo "You have isnan."
16109 else
16110         val="$undef"
16111         echo "You do not have isnan."
16112 fi
16113 $rm_try
16114 set d_isnan
16115 eval $setvar
16116
16117 : see if isnanl exists
16118 set isnanl d_isnanl
16119 eval $inlibc
16120
16121 : check for isnormal
16122 echo "Checking to see if you have isnormal..." >&4
16123 $cat >try.c <<EOCP
16124 #$i_math I_MATH
16125 #ifdef I_MATH
16126 #include <math.h>
16127 #endif
16128 int main() { return isnormal(0.0); }
16129 EOCP
16130 set try
16131 if eval $compile; then
16132         val="$define"
16133         echo "You have isnormal."
16134 else
16135         val="$undef"
16136         echo "You do not have isnormal."
16137 fi
16138 $rm_try
16139 set d_isnormal
16140 eval $setvar
16141
16142 : see if j0 exists
16143 set j0 d_j0
16144 eval $inlibc
16145
16146 : see if j0l exists
16147 set j0l d_j0l
16148 eval $inlibc
16149
16150 : see if killpg exists
16151 set killpg d_killpg
16152 eval $inlibc
16153
16154 : see if localeconv exists
16155 set localeconv d_locconv
16156 eval $inlibc
16157
16158 : see if libc has the POSIX.1-2008 currency locale rules
16159 case "$d_locconv:$d_lc_monetary_2008" in
16160 $define:)
16161         $cat >try.c <<EOCP
16162 #include <locale.h>
16163 int main() {
16164         struct lconv *lc = localeconv();
16165         char int_p_cs_precedes = lc->int_p_cs_precedes;
16166         return 0;
16167 }
16168 EOCP
16169         set try
16170         if eval $compile; then
16171                 d_lc_monetary_2008="$define"
16172         else
16173                 d_lc_monetary_2008="$undef"
16174         fi;
16175         $rm_try
16176         ;;
16177 esac
16178
16179 : see if lchown exists
16180 echo " "
16181 $cat > try.c <<'EOCP'
16182 /* System header to define __stub macros and hopefully few prototypes,
16183     which can conflict with char lchown(); below.  */
16184 #include <assert.h>
16185 /* Override any gcc2 internal prototype to avoid an error.  */
16186 /* We use char because int might match the return type of a gcc2
16187    builtin and then its argument prototype would still apply.  */
16188 char lchown();
16189 int main() {
16190     /*  The GNU C library defines this for functions which it implements
16191         to always fail with ENOSYS.  Some functions are actually named
16192         something starting with __ and the normal name is an alias.  */
16193 #if defined (__stub_lchown) || defined (__stub___lchown)
16194 choke me
16195 #else
16196 lchown();
16197 #endif
16198 ; return 0; }
16199 EOCP
16200 set try
16201 if eval $compile; then
16202     $echo "lchown() found." >&4
16203     val="$define"
16204 else
16205     $echo "lchown() NOT found." >&4
16206     val="$undef"
16207 fi
16208 set d_lchown
16209 eval $setvar
16210
16211 : See if number of significant digits in a double precision number is known
16212 echo " "
16213 $cat >ldbl_dig.c <<EOM
16214 #$i_limits I_LIMITS
16215 #$i_float I_FLOAT
16216 #ifdef I_LIMITS
16217 #include <limits.h>
16218 #endif
16219 #ifdef I_FLOAT
16220 #include <float.h>
16221 #endif
16222 #ifdef LDBL_DIG
16223 printf("Contains LDBL_DIG");
16224 #endif
16225 EOM
16226 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16227 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16228         echo "LDBL_DIG found." >&4
16229         val="$define"
16230 else
16231         echo "LDBL_DIG NOT found." >&4
16232         val="$undef"
16233 fi
16234 $rm -f ldbl_dig.?
16235 set d_ldbl_dig
16236 eval $setvar
16237
16238 : see if lgamma exists
16239 set lgamma d_lgamma
16240 eval $inlibc
16241
16242 : see if lgamma_r exists
16243 set lgamma_r d_lgamma_r
16244 eval $inlibc
16245
16246 : check to see if math.h defines _LIB_VERSION
16247 d_libm_lib_version="$undef"
16248 case $i_math in
16249     $define)
16250         echo " "
16251         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16252         $cat >try.c <<EOCP
16253 #include <unistd.h>
16254 #include <math.h>
16255 int main (int argc, char *argv[])
16256 {
16257     printf ("%d\n", _LIB_VERSION);
16258     return (0);
16259     } /* main */
16260 EOCP
16261         set try
16262         if eval $compile; then
16263             foo=`$run ./try`
16264             echo "Yes, it does ($foo)" >&4
16265             d_libm_lib_version="$define"
16266         else
16267             echo "No, it does not (probably harmless)" >&4
16268             fi
16269         $rm_try
16270         ;;
16271
16272     esac
16273
16274 : see if link exists
16275 set link d_link
16276 eval $inlibc
16277
16278 : see if llrint exists
16279 set llrint d_llrint
16280 eval $inlibc
16281
16282 : see if llrintl exists
16283 set llrintl d_llrintl
16284 eval $inlibc
16285
16286 : see if llround exists
16287 set llround d_llround
16288 eval $inlibc
16289
16290 : see if llroundl exists
16291 set llroundl d_llroundl
16292 eval $inlibc
16293
16294 : see if localtime_r exists
16295 set localtime_r d_localtime_r
16296 eval $inlibc
16297 case "$d_localtime_r" in
16298 "$define")
16299         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16300         case "$d_localtime_r_proto:$usethreads" in
16301         ":define")      d_localtime_r_proto=define
16302                 set d_localtime_r_proto localtime_r $hdrs
16303                 eval $hasproto ;;
16304         *)      ;;
16305         esac
16306         case "$d_localtime_r_proto" in
16307         define)
16308         case "$localtime_r_proto" in
16309         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16310         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16311         esac
16312         case "$localtime_r_proto" in
16313         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16314         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16315         esac
16316         case "$localtime_r_proto" in
16317         ''|0)   d_localtime_r=undef
16318                 localtime_r_proto=0
16319                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16320         * )     case "$localtime_r_proto" in
16321                 REENTRANT_PROTO*) ;;
16322                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16323                 esac
16324                 echo "Prototype: $try" ;;
16325         esac
16326         ;;
16327         *)      case "$usethreads" in
16328                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16329                 esac
16330                 d_localtime_r=undef
16331                 localtime_r_proto=0
16332                 ;;
16333         esac
16334         ;;
16335 *)      localtime_r_proto=0
16336         ;;
16337 esac
16338
16339 : see if localtime_r calls tzset
16340 case "$localtime_r_proto" in
16341 REENTRANT_PROTO*)
16342         $cat >try.c <<EOCP
16343 /*  Does our libc's localtime_r call tzset ?
16344  *  return 0 if so, 1 otherwise.
16345  */
16346 #$i_systypes    I_SYS_TYPES
16347 #$i_unistd      I_UNISTD
16348 #$i_time        I_TIME
16349 #$i_stdlib      I_STDLIB
16350 #$i_string      I_STRING
16351 #$i_malloc      I_MALLOC
16352 #ifdef I_SYS_TYPES
16353 #  include <sys/types.h>
16354 #endif
16355 #ifdef I_UNISTD
16356 #  include <unistd.h>
16357 #endif
16358 #ifdef I_TIME
16359 #  include <time.h>
16360 #endif
16361 #ifdef I_STDLIB
16362 #include <stdlib.h>
16363 #endif
16364 #ifdef I_STRING
16365 #  include <string.h>
16366 #else
16367 #  include <strings.h>
16368 #endif
16369 #ifdef I_MALLOC
16370 #  include <malloc.h>
16371 #endif
16372 int main()
16373 {
16374     time_t t = time(0L);
16375     char w_tz[]="TZ" "=GMT+5",
16376          e_tz[]="TZ" "=GMT-5",
16377         *tz_e = (char*)malloc(16),
16378         *tz_w = (char*)malloc(16);
16379     struct tm tm_e, tm_w;
16380     memset(&tm_e,'\0',sizeof(struct tm));
16381     memset(&tm_w,'\0',sizeof(struct tm));
16382     strcpy(tz_e,e_tz);
16383     strcpy(tz_w,w_tz);
16384
16385     putenv(tz_e);
16386     localtime_r(&t, &tm_e);
16387
16388     putenv(tz_w);
16389     localtime_r(&t, &tm_w);
16390
16391     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16392         return 1;
16393     return 0;
16394 }
16395 EOCP
16396         set try
16397         if eval $compile; then
16398             if $run ./try; then
16399                 d_localtime_r_needs_tzset=undef;
16400             else
16401                 d_localtime_r_needs_tzset=define;
16402             fi;
16403         else
16404             d_localtime_r_needs_tzset=undef;
16405         fi;
16406      ;;
16407   *)
16408      d_localtime_r_needs_tzset=undef;
16409      ;;
16410 esac
16411 $rm_try
16412
16413 : see if lockf exists
16414 set lockf d_lockf
16415 eval $inlibc
16416
16417 : see if log1p exists
16418 set log1p d_log1p
16419 eval $inlibc
16420
16421 : see if log2 exists
16422 set log2 d_log2
16423 eval $inlibc
16424
16425 : see if logb exists
16426 set logb d_logb
16427 eval $inlibc
16428
16429 : see if lrint exists
16430 set lrint d_lrint
16431 eval $inlibc
16432
16433 : see if lrintl exists
16434 set lrintl d_lrintl
16435 eval $inlibc
16436
16437 : see if lround exists
16438 set lround d_lround
16439 eval $inlibc
16440
16441 : see if lroundl exists
16442 set lroundl d_lroundl
16443 eval $inlibc
16444
16445 : see if prototype for lseek is available
16446 echo " "
16447 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16448 eval $hasproto
16449
16450 : see if lstat exists
16451 set lstat d_lstat
16452 eval $inlibc
16453
16454 : see if madvise exists
16455 set madvise d_madvise
16456 eval $inlibc
16457
16458 : see if malloc_size exists
16459 set malloc_size d_malloc_size
16460 eval $inlibc
16461
16462 : see if malloc_size_good exists
16463 set malloc_good_size d_malloc_good_size
16464 eval $inlibc
16465
16466 : see if mblen exists
16467 set mblen d_mblen
16468 eval $inlibc
16469
16470 : see if mbstowcs exists
16471 set mbstowcs d_mbstowcs
16472 eval $inlibc
16473
16474 : see if mbtowc exists
16475 set mbtowc d_mbtowc
16476 eval $inlibc
16477
16478 : see if memchr exists
16479 set memchr d_memchr
16480 eval $inlibc
16481
16482 : see if memcmp exists
16483 set memcmp d_memcmp
16484 eval $inlibc
16485
16486 : see if memcpy exists
16487 set memcpy d_memcpy
16488 eval $inlibc
16489
16490 : see if memmem exists
16491 set memmem d_memmem
16492 eval $inlibc
16493
16494 : see if memmove exists
16495 set memmove d_memmove
16496 eval $inlibc
16497
16498 : see if memset exists
16499 set memset d_memset
16500 eval $inlibc
16501
16502 : see if mkdir exists
16503 set mkdir d_mkdir
16504 eval $inlibc
16505
16506 : see if mkdtemp exists
16507 set mkdtemp d_mkdtemp
16508 eval $inlibc
16509
16510 : see if mkfifo exists
16511 set mkfifo d_mkfifo
16512 eval $inlibc
16513
16514 : see if mkstemp exists
16515 set mkstemp d_mkstemp
16516 eval $inlibc
16517
16518 : see if mkstemps exists
16519 set mkstemps d_mkstemps
16520 eval $inlibc
16521
16522 : see if mktime exists
16523 set mktime d_mktime
16524 eval $inlibc
16525
16526 : see if this is a sys/mman.h system
16527 set sys/mman.h i_sysmman
16528 eval $inhdr
16529
16530 : see if mmap exists
16531 set mmap d_mmap
16532 eval $inlibc
16533 : see what shmat returns
16534 : default to something harmless
16535 mmaptype='void *'
16536 case "$i_sysmman$d_mmap" in
16537 "$define$define")
16538         $cat >mmap.c <<'END'
16539 #include <sys/mman.h>
16540 void *mmap();
16541 END
16542         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16543                 mmaptype='void *'
16544         else
16545                 mmaptype='caddr_t'
16546         fi
16547         echo "and it returns ($mmaptype)." >&4
16548         ;;
16549 esac
16550
16551
16552
16553 : see if sqrtl exists
16554 set sqrtl d_sqrtl
16555 eval $inlibc
16556
16557 : see if scalbnl exists
16558 set scalbnl d_scalbnl
16559 eval $inlibc
16560
16561 : see if truncl exists
16562 set truncl d_truncl
16563 eval $inlibc
16564
16565 : see if modfl exists
16566 set modfl d_modfl
16567 eval $inlibc
16568
16569 : see if prototype for modfl is available
16570 echo " "
16571 set d_modflproto modfl $i_math math.h
16572 eval $hasproto
16573
16574 if $test "$uselongdouble" = "$define"; then
16575     message=""
16576     if $test "$d_sqrtl" != "$define"; then
16577         message="$message sqrtl"
16578     fi
16579     if $test "$d_modfl" != "$define"; then
16580         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16581             echo "You have both truncl and copysignl, so I can emulate modfl."
16582         else
16583             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16584                 echo "You have both aintl and copysignl, so I can emulate modfl."
16585             else
16586                 message="$message modfl"
16587             fi
16588         fi
16589     fi
16590     if $test "$d_frexpl" != "$define"; then
16591         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16592             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16593         else
16594             message="$message frexpl"
16595         fi
16596     fi
16597     if $test "$d_ldexpl" != "$define"; then
16598         message="$message ldexpl"
16599     fi
16600
16601     if $test "$message" != ""; then
16602         $cat <<EOM >&4
16603
16604 *** You requested the use of long doubles but you do not seem to have
16605 *** the following mathematical functions needed for long double support:
16606 ***    $message
16607 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16608 *** Cannot continue, aborting.
16609
16610 EOM
16611
16612         exit 1
16613     fi
16614 fi
16615
16616 : see if mprotect exists
16617 set mprotect d_mprotect
16618 eval $inlibc
16619
16620 : see if msgctl exists
16621 set msgctl d_msgctl
16622 eval $inlibc
16623
16624 : see if msgget exists
16625 set msgget d_msgget
16626 eval $inlibc
16627
16628 : see if msgsnd exists
16629 set msgsnd d_msgsnd
16630 eval $inlibc
16631
16632 : see if msgrcv exists
16633 set msgrcv d_msgrcv
16634 eval $inlibc
16635
16636 : see how much of the 'msg*(2)' library is present.
16637 h_msg=true
16638 echo " "
16639 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16640 *"$undef"*) h_msg=false;;
16641 esac
16642 case "$osname" in
16643 freebsd)
16644     case "`ipcs 2>&1`" in
16645     "SVID messages"*"not configured"*)
16646         echo "Your $osname does not have the msg*(2) configured." >&4
16647         h_msg=false
16648         val="$undef"
16649         set msgctl d_msgctl
16650         eval $setvar
16651         set msgget d_msgget
16652         eval $setvar
16653         set msgsnd d_msgsnd
16654         eval $setvar
16655         set msgrcv d_msgrcv
16656         eval $setvar
16657         ;;
16658     esac
16659     ;;
16660 esac
16661 : we could also check for sys/ipc.h ...
16662 if $h_msg && $test `./findhdr sys/msg.h`; then
16663         echo "You have the full msg*(2) library." >&4
16664         val="$define"
16665 else
16666         echo "You don't have the full msg*(2) library." >&4
16667         val="$undef"
16668 fi
16669 set d_msg
16670 eval $setvar
16671
16672 : Check for msghdr_s
16673 echo " "
16674 echo "Checking to see if your system supports struct msghdr..." >&4
16675 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16676 eval $hasstruct
16677 case "$d_msghdr_s" in
16678 "$define")      echo "Yes, it does."   ;;
16679 *)              echo "No, it doesn't." ;;
16680 esac
16681
16682
16683 : see if msync exists
16684 set msync d_msync
16685 eval $inlibc
16686
16687 : see if munmap exists
16688 set munmap d_munmap
16689 eval $inlibc
16690
16691 : see if nan exists
16692 set nan d_nan
16693 eval $inlibc
16694
16695 : see if nearbyint exists
16696 set nearbyint d_nearbyint
16697 eval $inlibc
16698
16699 : see if nextafter exists
16700 set nextafter d_nextafter
16701 eval $inlibc
16702
16703 : see if nexttoward exists
16704 set nexttoward d_nexttoward
16705 eval $inlibc
16706
16707 : see if nice exists
16708 set nice d_nice
16709 eval $inlibc
16710
16711 : see if this is a langinfo.h system
16712 set langinfo.h i_langinfo
16713 eval $inhdr
16714
16715 : see if nl_langinfo exists
16716 set nl_langinfo d_nl_langinfo
16717 eval $inlibc
16718
16719 : see if this is a quadmath.h system
16720 set quadmath.h i_quadmath
16721 eval $inhdr
16722
16723 : check for volatile keyword
16724 echo " "
16725 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16726 $cat >try.c <<'EOCP'
16727 int main()
16728 {
16729         typedef struct _goo_struct goo_struct;
16730         goo_struct * volatile goo = ((goo_struct *)0);
16731         struct _goo_struct {
16732                 long long_int;
16733                 int reg_int;
16734                 char char_var;
16735         };
16736         typedef unsigned short foo_t;
16737         char *volatile foo;
16738         volatile int bar;
16739         volatile foo_t blech;
16740         foo = foo;
16741 }
16742 EOCP
16743 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16744         val="$define"
16745         echo "Yup, it does."
16746 else
16747         val="$undef"
16748         echo "Nope, it doesn't."
16749 fi
16750 set d_volatile
16751 eval $setvar
16752 $rm_try
16753
16754 : Check basic sizes
16755 echo " "
16756 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16757
16758 case "$use64bitint:$d_quad:$quadtype" in
16759 define:define:?*)
16760         ivtype="$quadtype"
16761         uvtype="$uquadtype"
16762         ivsize=8
16763         uvsize=8
16764         ;;
16765 *)      ivtype="long"
16766         uvtype="unsigned long"
16767         ivsize=$longsize
16768         uvsize=$longsize
16769         ;;
16770 esac
16771
16772 case "$uselongdouble:$d_longdbl" in
16773 define:define)
16774         nvtype="long double"
16775         nvsize=$longdblsize
16776         ;;
16777 *)      nvtype=double
16778         nvsize=$doublesize
16779         ;;
16780 esac
16781
16782 case "$usequadmath:$i_quadmath" in
16783 define:define)
16784   nvtype="__float128"
16785   nvsize=16
16786   case "$libs" in
16787   *quadmath*) ;;
16788   *) $cat <<EOM >&4
16789
16790 *** You requested the use of the quadmath library, but you
16791 *** do not seem to have the quadmath library installed.
16792 *** Cannot continue, aborting.
16793 EOM
16794     exit 1
16795     ;;
16796   esac
16797   ;;
16798 define:*) $cat <<EOM >&4
16799
16800 *** You requested the use of the quadmath library, but you
16801 *** do not seem to have the required header, <quadmath.h>.
16802 EOM
16803   case "$gccversion" in
16804   [23].*|4.[0-5]*)
16805    $cat <<EOM >&4
16806 *** Your gcc looks a bit old:
16807 *** $gccversion
16808 EOM
16809     ;;
16810   '')
16811    $cat <<EOM >&4
16812 *** You are not running a gcc.
16813 EOM
16814     ;;
16815   esac
16816   $cat <<EOM >&4
16817 *** For the quadmath library you need at least gcc 4.6.
16818 *** Cannot continue, aborting.
16819 EOM
16820   exit 1
16821   ;;
16822 esac
16823
16824 $echo "(IV will be "$ivtype", $ivsize bytes)"
16825 $echo "(UV will be "$uvtype", $uvsize bytes)"
16826 $echo "(NV will be "$nvtype", $nvsize bytes)"
16827
16828 $cat >try.c <<EOCP
16829 #$i_inttypes I_INTTYPES
16830 #ifdef I_INTTYPES
16831 #include <inttypes.h>
16832 #endif
16833 #include <stdio.h>
16834 int main() {
16835 #ifdef INT8
16836    int8_t i =  INT8_MAX;
16837   uint8_t u = UINT8_MAX;
16838   printf("int8_t\n");
16839 #endif
16840 #ifdef INT16
16841    int16_t i =  INT16_MAX;
16842   uint16_t u = UINT16_MAX;
16843   printf("int16_t\n");
16844 #endif
16845 #ifdef INT32
16846    int32_t i =  INT32_MAX;
16847   uint32_t u = UINT32_MAX;
16848   printf("int32_t\n");
16849 #endif
16850 }
16851 EOCP
16852
16853 i8type="signed char"
16854 u8type="unsigned char"
16855 i8size=1
16856 u8size=1
16857
16858 case "$i16type" in
16859 '')     case "$shortsize" in
16860         2)      i16type=short
16861                 u16type="unsigned short"
16862                 i16size=$shortsize
16863                 u16size=$shortsize
16864                 ;;
16865         esac
16866         ;;
16867 esac
16868 case "$i16type" in
16869 '')     set try -DINT16
16870         if eval $compile; then
16871                 case "`$run ./try`" in
16872                 int16_t)
16873                         i16type=int16_t
16874                         u16type=uint16_t
16875                         i16size=2
16876                         u16size=2
16877                         ;;
16878                 esac
16879         fi
16880         ;;
16881 esac
16882 case "$i16type" in
16883 '')     if $test $shortsize -ge 2; then
16884                 i16type=short
16885                 u16type="unsigned short"
16886                 i16size=$shortsize
16887                 u16size=$shortsize
16888         fi
16889         ;;
16890 esac
16891
16892 case "$i32type" in
16893 '')     case "$longsize" in
16894         4)      i32type=long
16895                 u32type="unsigned long"
16896                 i32size=$longsize
16897                 u32size=$longsize
16898                 ;;
16899         *)      case "$intsize" in
16900                 4)      i32type=int
16901                         u32type="unsigned int"
16902                         i32size=$intsize
16903                         u32size=$intsize
16904                         ;;
16905                 esac
16906                 ;;
16907         esac
16908         ;;
16909 esac
16910 case "$i32type" in
16911 '')     set try -DINT32
16912         if eval $compile; then
16913                 case "`$run ./try`" in
16914                 int32_t)
16915                         i32type=int32_t
16916                         u32type=uint32_t
16917                         i32size=4
16918                         u32size=4
16919                         ;;
16920                 esac
16921         fi
16922         ;;
16923 esac
16924 case "$i32type" in
16925 '')     if $test $intsize -ge 4; then
16926                 i32type=int
16927                 u32type="unsigned int"
16928                 i32size=$intsize
16929                 u32size=$intsize
16930         fi
16931         ;;
16932 esac
16933
16934 case "$i64type" in
16935 '')     case "$d_quad:$quadtype" in
16936         define:?*)
16937                 i64type="$quadtype"
16938                 u64type="$uquadtype"
16939                 i64size=8
16940                 u64size=8
16941                 ;;
16942         esac
16943         ;;
16944 esac
16945
16946 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16947 : volatile so that the compiler has to store it out to memory.
16948 if test X"$d_volatile" = X"$define"; then
16949         volatile=volatile
16950 fi
16951 $cat <<EOP >try.c
16952 #include <stdio.h>
16953 #$i_stdlib I_STDLIB
16954 #ifdef I_STDLIB
16955 #include <stdlib.h>
16956 #endif
16957 #include <sys/types.h>
16958 #include <signal.h>
16959 #ifdef SIGFPE
16960 $volatile int bletched = 0;
16961 $signal_t blech(int s) { bletched = 1; }
16962 #endif
16963 int main() {
16964     $uvtype u = 0;
16965     $nvtype d;
16966     int     n = 8 * $uvsize;
16967     int     i;
16968 #ifdef SIGFPE
16969     signal(SIGFPE, blech);
16970 #endif
16971
16972     for (i = 0; i < n; i++) {
16973       u = u << 1 | ($uvtype)1;
16974       d = ($nvtype)u;
16975       if (($uvtype)d != u)
16976         break;
16977       if (d <= 0)
16978         break;
16979       d = ($nvtype)(u - 1);
16980       if (($uvtype)d != (u - 1))
16981         break;
16982 #ifdef SIGFPE
16983       if (bletched)
16984         break;
16985 #endif
16986     }
16987     printf("%d\n", ((i == n) ? -n : i));
16988     exit(0);
16989 }
16990 EOP
16991 set try
16992
16993 d_nv_preserves_uv="$undef"
16994 if eval $compile; then
16995         nv_preserves_uv_bits="`$run ./try`"
16996 fi
16997 case "$nv_preserves_uv_bits" in
16998 \-[1-9]*)
16999         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
17000         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
17001         d_nv_preserves_uv="$define"
17002         ;;
17003 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
17004         d_nv_preserves_uv="$undef" ;;
17005 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
17006         nv_preserves_uv_bits="0" ;;
17007 esac
17008 $rm_try
17009
17010 $echo "Checking to find the largest integer value your NVs can hold..." >&4
17011 : volatile so that the compiler has to store it out to memory.
17012 if test X"$d_volatile" = X"$define"; then
17013         volatile=volatile
17014 fi
17015 $cat <<EOP >try.c
17016 #include <stdio.h>
17017
17018 typedef $nvtype NV;
17019
17020 int
17021 main() {
17022   NV value = 2;
17023   int count = 1;
17024
17025   while(count < 256) {
17026     $volatile NV up = value + 1.0;
17027     $volatile NV negated = -value;
17028     $volatile NV down = negated - 1.0;
17029     $volatile NV got_up = up - value;
17030     int up_good = got_up == 1.0;
17031     int got_down = down - negated;
17032     int down_good = got_down == -1.0;
17033
17034     if (down_good != up_good) {
17035       fprintf(stderr,
17036               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
17037               up_good, (double) got_up, down_good, (double) got_down,
17038               count, (double) value);
17039       return 1;
17040     }
17041     if (!up_good) {
17042       while (1) {
17043         if (count > 8) {
17044           count -= 8;
17045           fputs("256.0", stdout);
17046         } else {
17047           count--;
17048           fputs("2.0", stdout);
17049         }
17050         if (!count) {
17051           puts("");
17052           return 0;
17053         }
17054         fputs("*", stdout);
17055       }
17056     }
17057     value *= 2;
17058     ++count;
17059   }
17060   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
17061           count, (double) value);
17062   return 1;
17063 }
17064 EOP
17065 set try
17066
17067 nv_overflows_integers_at='0'
17068 if eval $compile; then
17069     xxx="`$run ./try`"
17070     case "$?" in
17071         0)
17072             case "$xxx" in
17073                 2*)  cat >&4 <<EOM
17074 The largest integer your NVs can preserve is equal to $xxx
17075 EOM
17076                     nv_overflows_integers_at="$xxx"
17077                     ;;
17078                 *)  cat >&4 <<EOM
17079 Cannot determine the largest integer value your NVs can hold, unexpected output
17080 '$xxx'
17081 EOM
17082                     ;;
17083             esac
17084             ;;
17085         *)  cat >&4 <<EOM
17086 Cannot determine the largest integer value your NVs can hold
17087 EOM
17088             ;;
17089     esac
17090 fi
17091 $rm_try
17092
17093 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
17094 : volatile so that the compiler has to store it out to memory.
17095 if test X"$d_volatile" = X"$define"; then
17096         volatile=volatile
17097 fi
17098 $cat <<EOP >try.c
17099 #include <stdio.h>
17100 #$i_stdlib I_STDLIB
17101 #ifdef I_STDLIB
17102 #include <stdlib.h>
17103 #endif
17104 #$i_string I_STRING
17105 #ifdef I_STRING
17106 #  include <string.h>
17107 #else
17108 #  include <strings.h>
17109 #endif
17110 #include <sys/types.h>
17111 #include <signal.h>
17112 #ifdef SIGFPE
17113 $volatile int bletched = 0;
17114 $signal_t blech(int s) { bletched = 1; }
17115 #endif
17116
17117 int checkit($nvtype d, char *where) {
17118     unsigned char *p = (char *)&d;
17119     unsigned char *end = p + sizeof(d);
17120     int fail = 0;
17121
17122     while (p < end)
17123         fail += *p++;
17124
17125     if (!fail)
17126         return 0;
17127
17128     p = (char *)&d;
17129     printf("No - %s: 0x", where);
17130     while (p < end)
17131         printf ("%02X", *p++);
17132     printf("\n");
17133     return 1;
17134 }
17135
17136 int main(int argc, char **argv) {
17137     $nvtype d = 0.0;
17138     int fail = 0;
17139     fail += checkit(d, "0.0");
17140
17141     /* The compiler shouldn't be assuming that bletched is 0  */
17142     d = bletched;
17143
17144     fail += checkit(d, "bleched");
17145
17146 #ifdef SIGFPE
17147     signal(SIGFPE, blech);
17148 #endif
17149
17150     /* Paranoia - the compiler should have no way of knowing that ANSI says
17151        that argv[argc] will always be NULL.  Actually, if it did assume this it
17152        would be buggy, as this is C and main() can be called from elsewhere in
17153        the program.  */
17154     d = argv[argc] ? 1 : 0;
17155
17156     if (d) {
17157         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17158     }
17159
17160     fail += checkit(d, "ternary");
17161
17162     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17163
17164     if (d != 0.0) {
17165         printf("No - memset doesn't give 0.0\n");
17166         /* This might just blow up:  */
17167         printf("(gives %g)\n", d);
17168         return 1;
17169     }
17170
17171 #ifdef SIGFPE
17172     if (bletched) {
17173         printf("No - something bleched\n");
17174         return 1;
17175     }
17176 #endif
17177     if (fail) {
17178       printf("No - %d fail(s)\n", fail);
17179       return 1;
17180     }
17181     printf("Yes\n");
17182     return 0;
17183 }
17184 EOP
17185 set try
17186
17187 d_nv_zero_is_allbits_zero="$undef"
17188 if eval $compile; then
17189     xxx="`$run ./try`"
17190     case "$?" in
17191         0)
17192             case "$xxx" in
17193                 Yes)  cat >&4 <<EOM
17194 0.0 is represented as all bits zero in memory
17195 EOM
17196                     d_nv_zero_is_allbits_zero="$define"
17197                     ;;
17198                 *)  cat >&4 <<EOM
17199 0.0 is not represented as all bits zero in memory
17200 EOM
17201                     d_nv_zero_is_allbits_zero="$undef"
17202                     ;;
17203             esac
17204             ;;
17205         *)  cat >&4 <<EOM
17206 0.0 is not represented as all bits zero in memory
17207 EOM
17208             d_nv_zero_is_allbits_zero="$undef"
17209             ;;
17210     esac
17211 fi
17212 $rm_try
17213
17214 : check for off64_t
17215 echo " "
17216 echo "Checking to see if you have off64_t..." >&4
17217 $cat >try.c <<EOCP
17218 #include <sys/types.h>
17219 #include <unistd.h>
17220 int main() { off64_t x = 7; }
17221 EOCP
17222 set try
17223 if eval $compile; then
17224         val="$define"
17225         echo "You have off64_t."
17226 else
17227         val="$undef"
17228         echo "You do not have off64_t."
17229         case "$lseeksize" in
17230         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17231         esac
17232 fi
17233 $rm_try
17234 set d_off64_t
17235 eval $setvar
17236
17237 : how to create joinable pthreads
17238 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17239         echo " "
17240         echo "Checking what constant to use for creating joinable pthreads..." >&4
17241         $cat >try.c <<'EOCP'
17242 #include <pthread.h>
17243 int main() {
17244     int detachstate = JOINABLE;
17245 }
17246 EOCP
17247         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17248         if eval $compile; then
17249                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17250                 val="$undef" # Yes, undef.
17251                 set d_old_pthread_create_joinable
17252                 eval $setvar
17253                 val=""
17254                 set old_pthread_create_joinable
17255                 eval $setvar
17256         else
17257                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17258                 if eval $compile; then
17259                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17260                         val="$define"
17261                         set d_old_pthread_create_joinable
17262                         eval $setvar
17263                         val=PTHREAD_CREATE_UNDETACHED
17264                         set old_pthread_create_joinable
17265                         eval $setvar
17266                 else
17267                         set try -DJOINABLE=__UNDETACHED
17268                         if eval $compile; then
17269                                 echo "You seem to use __UNDETACHED." >&4
17270                                 val="$define"
17271                                 set d_old_pthread_create_joinable
17272                                 eval $setvar
17273                                 val=__UNDETACHED
17274                                 set old_pthread_create_joinable
17275                                 eval $setvar
17276                         else
17277                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17278                                 val="$define"
17279                                 set d_old_pthread_create_joinable
17280                                 eval $setvar
17281                                 val=0
17282                                 set old_pthread_create_joinable
17283                                 eval $setvar
17284                         fi
17285                 fi
17286         fi
17287         $rm_try
17288 else
17289     d_old_pthread_create_joinable="$undef"
17290     old_pthread_create_joinable=""
17291 fi
17292
17293 : see if pause exists
17294 set pause d_pause
17295 eval $inlibc
17296
17297 : see if poll exists
17298 set poll d_poll
17299 eval $inlibc
17300
17301 : see if prctl exists
17302 set prctl d_prctl
17303 eval $inlibc
17304
17305 : see if prctl supports PR_SET_NAME
17306 d_prctl_set_name=$undef
17307 case $d_prctl in
17308     $define)
17309         $cat >try.c <<EOM
17310 #ifdef __ANDROID__
17311 #include <unistd.h>
17312 #endif
17313 #include <sys/prctl.h>
17314
17315 int main (int argc, char *argv[])
17316 {
17317     return (prctl (PR_SET_NAME, "Test"));
17318     } /* main */
17319 EOM
17320         set try
17321         if eval $compile_ok && $run ./try; then
17322             echo "Your prctl (PR_SET_NAME, ...) works"
17323             d_prctl_set_name=$define
17324             fi
17325         $rm_try
17326         ;;
17327     esac
17328
17329 : see if readlink exists
17330 set readlink d_readlink
17331 eval $inlibc
17332
17333 : Check if there is a /proc symlink to the abs path of
17334 : the executing program.  We will honor hints of d_procselfexe=$undef
17335 : or procselfexe being non-empty, otherwise will try to determine both
17336 : if we have readlink.
17337 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17338 : referenced, and AmigaOS does not have a proc filesystem anyway.
17339 echo " "
17340 val="$undef"
17341 if $test "X$d_procselfexe" = Xundef; then
17342         procselfexe=''
17343 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17344         val="$define"
17345 elif $test "X$d_readlink" = Xdefine; then
17346         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17347         : and it feels more tidy to avoid an extra level of symlink
17348         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17349         while test $# -gt 0; do
17350             type=$1; try=$2
17351             shift; shift
17352             if $issymlink $try; then
17353                 $ls -l $try > reflect
17354                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17355                     echo "You have $type-like $try."
17356                     procselfexe='"'$try'"'
17357                     val="$define"
17358                     : This will break out of the loop
17359                     set X; shift
17360                 fi
17361             fi
17362         done
17363 fi
17364 $rm -f reflect
17365 set d_procselfexe
17366 eval $setvar
17367
17368 : backward compatibility for d_hvfork
17369 if test X$d_hvfork != X; then
17370         d_vfork="$d_hvfork"
17371         d_hvfork=''
17372 fi
17373 : see if there is a vfork
17374 val=''
17375 set vfork val
17376 eval $inlibc
17377
17378 d_pseudofork=$undef
17379
17380 : Ok, but do we want to use it. vfork is reportedly unreliable in
17381 : perl on Solaris 2.x, and probably elsewhere.
17382 case "$val" in
17383 $define)
17384         echo " "
17385         case "$usevfork" in
17386         false) dflt='n';;
17387         *) dflt='y';;
17388         esac
17389         cat <<'EOM'
17390
17391 Perl can only use a vfork() that doesn't suffer from strict
17392 restrictions on calling functions or modifying global data in
17393 the child.  For example, glibc-2.1 contains such a vfork()
17394 that is unsuitable.  If your system provides a proper fork()
17395 call, chances are that you do NOT want perl to use vfork().
17396
17397 EOM
17398         rp="Do you still want to use vfork()?"
17399         . ./myread
17400         case "$ans" in
17401         y|Y) ;;
17402         *)
17403                 echo "Ok, we won't use vfork()."
17404                 val="$undef"
17405                 ;;
17406         esac
17407         ;;
17408 esac
17409 set d_vfork
17410 eval $setvar
17411 case "$d_vfork" in
17412 $define) usevfork='true';;
17413 *) usevfork='false';;
17414 esac
17415
17416 : see whether the pthread_atfork exists
17417 $cat >try.c <<EOP
17418 #include <pthread.h>
17419 #include <stdio.h>
17420 int main() {
17421 #ifdef  PTHREAD_ATFORK
17422         pthread_atfork(NULL,NULL,NULL);
17423 #endif
17424 }
17425 EOP
17426
17427 : see if pthread_atfork exists
17428 set try -DPTHREAD_ATFORK
17429 if eval $compile; then
17430     val="$define"
17431 else
17432     val="$undef"
17433 fi
17434 case "$usethreads" in
17435 $define)
17436         case "$val" in
17437         $define) echo 'pthread_atfork found.' >&4        ;;
17438         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17439         esac
17440 esac
17441 set d_pthread_atfork
17442 eval $setvar
17443
17444 : see if pthread_attr_setscope exists
17445 set pthread_attr_setscope d_pthread_attr_setscope
17446 eval $inlibc
17447
17448 : see whether the various POSIXish _yields exist
17449 $cat >try.c <<EOP
17450 #include <pthread.h>
17451 #include <stdio.h>
17452 int main() {
17453 #ifdef SCHED_YIELD
17454         sched_yield();
17455 #else
17456 #ifdef PTHREAD_YIELD
17457         pthread_yield();
17458 #else
17459 #ifdef PTHREAD_YIELD_NULL
17460         pthread_yield(NULL);
17461 #endif
17462 #endif
17463 #endif
17464 }
17465 EOP
17466 : see if sched_yield exists
17467 set try -DSCHED_YIELD
17468 if eval $compile; then
17469     val="$define"
17470     sched_yield='sched_yield()'
17471 else
17472     val="$undef"
17473 fi
17474 case "$usethreads" in
17475 $define)
17476         case "$val" in
17477         $define) echo 'sched_yield() found.' >&4        ;;
17478         *)       echo 'sched_yield() NOT found.' >&4    ;;
17479         esac
17480 esac
17481 set d_sched_yield
17482 eval $setvar
17483
17484 : see if pthread_yield exists
17485 set try -DPTHREAD_YIELD
17486 if eval $compile; then
17487     val="$define"
17488     case "$sched_yield" in
17489     '') sched_yield='pthread_yield()' ;;
17490     esac
17491 else
17492     set try -DPTHREAD_YIELD_NULL
17493     if eval $compile; then
17494         val="$define"
17495         case "$sched_yield" in
17496         '') sched_yield='pthread_yield(NULL)' ;;
17497         esac
17498     else
17499         val="$undef"
17500     fi
17501 fi
17502 case "$usethreads" in
17503 $define)
17504         case "$val" in
17505         $define) echo 'pthread_yield() found.' >&4      ;;
17506         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17507         esac
17508         ;;
17509 esac
17510 set d_pthread_yield
17511 eval $setvar
17512 case "$sched_yield" in
17513 '') sched_yield=undef ;;
17514 esac
17515 $rm_try
17516
17517 : check for ptrdiff_t
17518 echo " "
17519 echo "Checking to see if you have ptrdiff_t..." >&4
17520 $cat >try.c <<EOCP
17521 #include <stddef.h>
17522 int main() { ptrdiff_t x = 7; }
17523 EOCP
17524 set try
17525 if eval $compile; then
17526         val="$define"
17527         echo "You have ptrdiff_t."
17528 else
17529         val="$undef"
17530         echo "You do not have ptrdiff_t."
17531 fi
17532 $rm_try
17533 set d_ptrdiff_t
17534 eval $setvar
17535
17536 : see if random_r exists
17537 set random_r d_random_r
17538 eval $inlibc
17539 case "$d_random_r" in
17540 "$define")
17541         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17542         case "$d_random_r_proto:$usethreads" in
17543         ":define")      d_random_r_proto=define
17544                 set d_random_r_proto random_r $hdrs
17545                 eval $hasproto ;;
17546         *)      ;;
17547         esac
17548         case "$d_random_r_proto" in
17549         define)
17550         case "$random_r_proto" in
17551         ''|0) try='int random_r(int*, struct random_data*);'
17552         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17553         esac
17554         case "$random_r_proto" in
17555         ''|0) try='int random_r(long*, struct random_data*);'
17556         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17557         esac
17558         case "$random_r_proto" in
17559         ''|0) try='int random_r(struct random_data*, int32_t*);'
17560         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17561         esac
17562         case "$random_r_proto" in
17563         ''|0)   d_random_r=undef
17564                 random_r_proto=0
17565                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17566         * )     case "$random_r_proto" in
17567                 REENTRANT_PROTO*) ;;
17568                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17569                 esac
17570                 echo "Prototype: $try" ;;
17571         esac
17572         ;;
17573         *)      case "$usethreads" in
17574                 define) echo "random_r has no prototype, not using it." >&4 ;;
17575                 esac
17576                 d_random_r=undef
17577                 random_r_proto=0
17578                 ;;
17579         esac
17580         ;;
17581 *)      random_r_proto=0
17582         ;;
17583 esac
17584
17585 : see if readdir and friends exist
17586 set readdir d_readdir
17587 eval $inlibc
17588 set seekdir d_seekdir
17589 eval $inlibc
17590 set telldir d_telldir
17591 eval $inlibc
17592 set rewinddir d_rewinddir
17593 eval $inlibc
17594
17595 : see if readdir64_r exists
17596 set readdir64_r d_readdir64_r
17597 eval $inlibc
17598 case "$d_readdir64_r" in
17599 "$define")
17600         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17601         case "$d_readdir64_r_proto:$usethreads" in
17602         ":define")      d_readdir64_r_proto=define
17603                 set d_readdir64_r_proto readdir64_r $hdrs
17604                 eval $hasproto ;;
17605         *)      ;;
17606         esac
17607         case "$d_readdir64_r_proto" in
17608         define)
17609         case "$readdir64_r_proto" in
17610         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17611         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17612         esac
17613         case "$readdir64_r_proto" in
17614         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17615         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17616         esac
17617         case "$readdir64_r_proto" in
17618         ''|0)   d_readdir64_r=undef
17619                 readdir64_r_proto=0
17620                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17621         * )     case "$readdir64_r_proto" in
17622                 REENTRANT_PROTO*) ;;
17623                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17624                 esac
17625                 echo "Prototype: $try" ;;
17626         esac
17627         ;;
17628         *)      case "$usethreads" in
17629                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17630                 esac
17631                 d_readdir64_r=undef
17632                 readdir64_r_proto=0
17633                 ;;
17634         esac
17635         ;;
17636 *)      readdir64_r_proto=0
17637         ;;
17638 esac
17639
17640 : see if readdir_r exists
17641 set readdir_r d_readdir_r
17642 eval $inlibc
17643 case "$d_readdir_r" in
17644 "$define")
17645         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17646         case "$d_readdir_r_proto:$usethreads" in
17647         ":define")      d_readdir_r_proto=define
17648                 set d_readdir_r_proto readdir_r $hdrs
17649                 eval $hasproto ;;
17650         *)      ;;
17651         esac
17652         case "$d_readdir_r_proto" in
17653         define)
17654         case "$readdir_r_proto" in
17655         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17656         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17657         esac
17658         case "$readdir_r_proto" in
17659         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17660         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17661         esac
17662         case "$readdir_r_proto" in
17663         ''|0)   d_readdir_r=undef
17664                 readdir_r_proto=0
17665                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17666         * )     case "$readdir_r_proto" in
17667                 REENTRANT_PROTO*) ;;
17668                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17669                 esac
17670                 echo "Prototype: $try" ;;
17671         esac
17672         ;;
17673         *)      case "$usethreads" in
17674                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17675                 esac
17676                 d_readdir_r=undef
17677                 readdir_r_proto=0
17678                 ;;
17679         esac
17680         ;;
17681 *)      readdir_r_proto=0
17682         ;;
17683 esac
17684
17685 : see if readv exists
17686 set readv d_readv
17687 eval $inlibc
17688
17689 : see if recvmsg exists
17690 set recvmsg d_recvmsg
17691 eval $inlibc
17692
17693 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17694 echo " "
17695 if set regcomp val -f d_regcomp; eval $csym; $val; then
17696         echo 'regcomp() found.' >&4
17697         d_regcomp="$define"
17698         d_regcmp="$undef"
17699         d_re_comp="$undef"
17700 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17701         echo 'regcmp() found.' >&4
17702         d_regcmp="$define"
17703         d_regcomp="$undef"
17704         d_re_comp="$undef"
17705 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17706         echo 're_comp() found, assuming re_exec() also exists.' >&4
17707         d_re_comp="$define"
17708         d_regcomp="$undef"
17709         d_regcmp="$undef"
17710 else
17711         $cat >&4 <<EOM
17712 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17713 EOM
17714         d_regcmp="$undef"
17715         d_re_comp="$undef"
17716         d_regcomp="$undef"
17717 fi
17718
17719 : see if remainder exists
17720 set remainder d_remainder
17721 eval $inlibc
17722
17723 : see if remquo exists
17724 set remquo d_remquo
17725 eval $inlibc
17726
17727 : see if rename exists
17728 set rename d_rename
17729 eval $inlibc
17730
17731 : see if rint exists
17732 set rint d_rint
17733 eval $inlibc
17734
17735 : see if rmdir exists
17736 set rmdir d_rmdir
17737 eval $inlibc
17738
17739 : see if round exists
17740 set round d_round
17741 eval $inlibc
17742
17743 : see if memory.h is available.
17744 val=''
17745 set memory.h val
17746 eval $inhdr
17747
17748 : See if it conflicts with string.h
17749 case "$val" in
17750 $define)
17751         case "$strings" in
17752         '') ;;
17753         *)
17754                 $cppstdin $cppflags $cppminus < $strings > mem.h
17755                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17756                         echo " "
17757                         echo "We won't be including <memory.h>."
17758                         val="$undef"
17759                 fi
17760                 $rm -f mem.h
17761                 ;;
17762         esac
17763 esac
17764 set i_memory
17765 eval $setvar
17766
17767 : can bcopy handle overlapping blocks?
17768 echo " "
17769 val="$undef"
17770 case "$d_memmove" in
17771 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17772 *)      case "$d_bcopy" in
17773         "$define")
17774                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17775                 $cat >try.c <<EOCP
17776 #$i_memory I_MEMORY
17777 #$i_stdlib I_STDLIB
17778 #$i_string I_STRING
17779 #$i_unistd I_UNISTD
17780 EOCP
17781         $cat >>try.c <<'EOCP'
17782 #include <stdio.h>
17783 #ifdef I_MEMORY
17784 #  include <memory.h>
17785 #endif
17786 #ifdef I_STDLIB
17787 #  include <stdlib.h>
17788 #endif
17789 #ifdef I_STRING
17790 #  include <string.h>
17791 #else
17792 #  include <strings.h>
17793 #endif
17794 #ifdef I_UNISTD
17795 #  include <unistd.h>  /* Needed for NetBSD */
17796 #endif
17797 int main()
17798 {
17799 char buf[128], abc[128];
17800 char *b;
17801 int len;
17802 int off;
17803 int align;
17804
17805 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17806    try to store the string in read-only memory. */
17807 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17808
17809 for (align = 7; align >= 0; align--) {
17810         for (len = 36; len; len--) {
17811                 b = buf+align;
17812                 bcopy(abc, b, len);
17813                 for (off = 1; off <= len; off++) {
17814                         bcopy(b, b+off, len);
17815                         bcopy(b+off, b, len);
17816                         if (bcmp(b, abc, len))
17817                                 exit(1);
17818                 }
17819         }
17820 }
17821 exit(0);
17822 }
17823 EOCP
17824                 set try
17825                 if eval $compile_ok; then
17826                         if $run ./try 2>/dev/null; then
17827                                 echo "Yes, it can."
17828                                 val="$define"
17829                         else
17830                                 echo "It can't, sorry."
17831                         fi
17832                 else
17833                         echo "(I can't compile the test program, so we'll assume not...)"
17834                 fi
17835                 ;;
17836         esac
17837         $rm_try
17838         ;;
17839 esac
17840 set d_safebcpy
17841 eval $setvar
17842
17843 : can memcpy handle overlapping blocks?
17844 echo " "
17845 val="$undef"
17846 case "$d_memmove" in
17847 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17848 *)      case "$d_memcpy" in
17849         "$define")
17850                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17851                 $cat >try.c <<EOCP
17852 #$i_memory I_MEMORY
17853 #$i_stdlib I_STDLIB
17854 #$i_string I_STRING
17855 #$i_unistd I_UNISTD
17856 EOCP
17857         $cat >>try.c <<'EOCP'
17858 #include <stdio.h>
17859 #ifdef I_MEMORY
17860 #  include <memory.h>
17861 #endif
17862 #ifdef I_STDLIB
17863 #  include <stdlib.h>
17864 #endif
17865 #ifdef I_STRING
17866 #  include <string.h>
17867 #else
17868 #  include <strings.h>
17869 #endif
17870 #ifdef I_UNISTD
17871 #  include <unistd.h>  /* Needed for NetBSD */
17872 #endif
17873 int main()
17874 {
17875 char buf[128], abc[128];
17876 char *b;
17877 int len;
17878 int off;
17879 int align;
17880
17881 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17882    try to store the string in read-only memory. */
17883 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17884
17885 for (align = 7; align >= 0; align--) {
17886         for (len = 36; len; len--) {
17887                 b = buf+align;
17888                 memcpy(b, abc, len);
17889                 for (off = 1; off <= len; off++) {
17890                         memcpy(b+off, b, len);
17891                         memcpy(b, b+off, len);
17892                         if (memcmp(b, abc, len))
17893                                 exit(1);
17894                 }
17895         }
17896 }
17897 exit(0);
17898 }
17899 EOCP
17900                 set try
17901                 if eval $compile_ok; then
17902                         if $run ./try 2>/dev/null; then
17903                                 echo "Yes, it can."
17904                                 val="$define"
17905                         else
17906                                 echo "It can't, sorry."
17907                         fi
17908                 else
17909                         echo "(I can't compile the test program, so we'll assume not...)"
17910                 fi
17911                 ;;
17912         esac
17913         $rm_try
17914         ;;
17915 esac
17916 set d_safemcpy
17917 eval $setvar
17918
17919 : can memcmp be trusted to compare relative magnitude?
17920 val="$undef"
17921 case "$d_memcmp" in
17922 "$define")
17923         echo " "
17924         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17925         $cat >try.c <<EOCP
17926 #$i_memory I_MEMORY
17927 #$i_stdlib I_STDLIB
17928 #$i_string I_STRING
17929 #$i_unistd I_UNISTD
17930 EOCP
17931         $cat >>try.c <<'EOCP'
17932 #include <stdio.h>
17933 #ifdef I_MEMORY
17934 #  include <memory.h>
17935 #endif
17936 #ifdef I_STDLIB
17937 #  include <stdlib.h>
17938 #endif
17939 #ifdef I_STRING
17940 #  include <string.h>
17941 #else
17942 #  include <strings.h>
17943 #endif
17944 #ifdef I_UNISTD
17945 #  include <unistd.h>  /* Needed for NetBSD */
17946 #endif
17947 int main()
17948 {
17949 char a = -1;
17950 char b = 0;
17951 if ((a < b) && memcmp(&a, &b, 1) < 0)
17952         exit(1);
17953 exit(0);
17954 }
17955 EOCP
17956         set try
17957         if eval $compile_ok; then
17958                 if $run ./try 2>/dev/null; then
17959                         echo "Yes, it can."
17960                         val="$define"
17961                 else
17962                         echo "No, it can't (it uses signed chars)."
17963                 fi
17964         else
17965                 echo "(I can't compile the test program, so we'll assume not...)"
17966         fi
17967         ;;
17968 esac
17969 $rm_try
17970 set d_sanemcmp
17971 eval $setvar
17972
17973 : see if prototype for sbrk is available
17974 echo " "
17975 set d_sbrkproto sbrk $i_unistd unistd.h
17976 eval $hasproto
17977
17978 : see if scalbn exists
17979 set scalbn d_scalbn
17980 eval $inlibc
17981
17982 : see if select exists
17983 set select d_select
17984 eval $inlibc
17985
17986 : see if semctl exists
17987 set semctl d_semctl
17988 eval $inlibc
17989
17990 : see if semget exists
17991 set semget d_semget
17992 eval $inlibc
17993
17994 : see if semop exists
17995 set semop d_semop
17996 eval $inlibc
17997
17998 : see how much of the 'sem*(2)' library is present.
17999 h_sem=true
18000 echo " "
18001 case "$d_semctl$d_semget$d_semop" in
18002 *"$undef"*) h_sem=false;;
18003 esac
18004 case "$osname" in
18005 freebsd)
18006     case "`ipcs 2>&1`" in
18007     "SVID messages"*"not configured"*)
18008         echo "Your $osname does not have the sem*(2) configured." >&4
18009         h_sem=false
18010         val="$undef"
18011         set semctl d_semctl
18012         eval $setvar
18013         set semget d_semget
18014         eval $setvar
18015         set semop d_semop
18016         eval $setvar
18017         ;;
18018     esac
18019     ;;
18020 esac
18021 : we could also check for sys/ipc.h ...
18022 if $h_sem && $test `./findhdr sys/sem.h`; then
18023         echo "You have the full sem*(2) library." >&4
18024         val="$define"
18025 else
18026         echo "You don't have the full sem*(2) library." >&4
18027         val="$undef"
18028 fi
18029 set d_sem
18030 eval $setvar
18031
18032 : see whether sys/sem.h defines union semun
18033 echo " "
18034 $cat > try.c <<'END'
18035 #include <sys/types.h>
18036 #include <sys/ipc.h>
18037 #include <sys/sem.h>
18038 int main () { union semun semun; semun.buf = 0; }
18039 END
18040 set try
18041 if eval $compile; then
18042     echo "You have union semun in <sys/sem.h>." >&4
18043     val="$define"
18044 else
18045     echo "You do not have union semun in <sys/sem.h>." >&4
18046     val="$undef"
18047 fi
18048 $rm_try
18049 set d_union_semun
18050 eval $setvar
18051
18052 : see how to do semctl IPC_STAT
18053 case "$d_sem" in
18054 $define)
18055     echo " "
18056     $cat > tryh.h <<END
18057 #ifndef S_IRUSR
18058 #   ifdef S_IREAD
18059 #       define S_IRUSR S_IREAD
18060 #       define S_IWUSR S_IWRITE
18061 #       define S_IXUSR S_IEXEC
18062 #   else
18063 #       define S_IRUSR 0400
18064 #       define S_IWUSR 0200
18065 #       define S_IXUSR 0100
18066 #   endif
18067 #   define S_IRGRP (S_IRUSR>>3)
18068 #   define S_IWGRP (S_IWUSR>>3)
18069 #   define S_IXGRP (S_IXUSR>>3)
18070 #   define S_IROTH (S_IRUSR>>6)
18071 #   define S_IWOTH (S_IWUSR>>6)
18072 #   define S_IXOTH (S_IXUSR>>6)
18073 #endif
18074 #ifndef S_IRWXU
18075 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
18076 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
18077 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
18078 #endif
18079 END
18080     : see whether semctl IPC_STAT can use union semun
18081     case "$d_semctl_semun" in
18082     '')
18083       val="$undef"
18084       $cat > try.c <<END
18085 #include <sys/types.h>
18086 #include <sys/ipc.h>
18087 #include <sys/sem.h>
18088 #include <sys/stat.h>
18089 #include <stdio.h>
18090 #include <errno.h>
18091 #include "tryh.h"
18092 #ifndef errno
18093 extern int errno;
18094 #endif
18095 #$d_union_semun HAS_UNION_SEMUN
18096 int main() {
18097     union semun
18098 #ifndef HAS_UNION_SEMUN
18099     {
18100         int val;
18101         struct semid_ds *buf;
18102         unsigned short *array;
18103     }
18104 #endif
18105     arg;
18106     int sem, st;
18107
18108 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
18109     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18110     if (sem > -1) {
18111         struct semid_ds argbuf;
18112         arg.buf = &argbuf;
18113 #       ifdef IPC_STAT
18114         st = semctl(sem, 0, IPC_STAT, arg);
18115         if (st == 0)
18116             printf("semun\n");
18117         else
18118 #       endif /* IPC_STAT */
18119             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18120 #       ifdef IPC_RMID
18121         if (semctl(sem, 0, IPC_RMID, arg) != 0)
18122 #       endif /* IPC_RMID */
18123             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18124     } else
18125 #endif /* IPC_PRIVATE && ... */
18126         printf("semget failed: errno = %d\n", errno);
18127   return 0;
18128 }
18129 END
18130       set try
18131       if eval $compile; then
18132           xxx=`$run ./try`
18133           case "$xxx" in
18134           semun) val="$define" ;;
18135           esac
18136       fi
18137       $rm_try
18138       set d_semctl_semun
18139       eval $setvar
18140       ;;
18141     esac
18142     case "$d_semctl_semun" in
18143     $define)
18144         echo "You can use union semun for semctl IPC_STAT." >&4
18145         also='also'
18146         ;;
18147     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
18148         also=''
18149         ;;
18150     esac
18151
18152     : see whether semctl IPC_STAT can use struct semid_ds pointer
18153     case "$d_semctl_semid_ds" in
18154     '')
18155       val="$undef"
18156       $cat > try.c <<'END'
18157 #include <sys/types.h>
18158 #include <sys/ipc.h>
18159 #include <sys/sem.h>
18160 #include <sys/stat.h>
18161 #include "tryh.h"
18162 #include <stdio.h>
18163 #include <errno.h>
18164 #ifndef errno
18165 extern int errno;
18166 #endif
18167 int main() {
18168     struct semid_ds arg;
18169     int sem, st;
18170
18171 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18172     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18173     if (sem > -1) {
18174 #       ifdef IPC_STAT
18175         st = semctl(sem, 0, IPC_STAT, &arg);
18176         if (st == 0)
18177             printf("semid_ds\n");
18178         else
18179 #       endif /* IPC_STAT */
18180             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18181 #       ifdef IPC_RMID
18182         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
18183 #       endif /* IPC_RMID */
18184             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18185     } else
18186 #endif /* IPC_PRIVATE && ... */
18187         printf("semget failed: errno = %d\n", errno);
18188
18189     return 0;
18190 }
18191 END
18192       set try
18193       if eval $compile; then
18194           xxx=`$run ./try`
18195           case "$xxx" in
18196           semid_ds) val="$define" ;;
18197           esac
18198       fi
18199       $rm_try
18200       set d_semctl_semid_ds
18201       eval $setvar
18202       ;;
18203     esac
18204     case "$d_semctl_semid_ds" in
18205     $define)
18206         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18207         ;;
18208     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18209         ;;
18210     esac
18211     ;;
18212 *)  val="$undef"
18213
18214     # We do not have the full sem*(2) library, so assume we can not
18215     # use either.
18216
18217     set d_semctl_semun
18218     eval $setvar
18219
18220     set d_semctl_semid_ds
18221     eval $setvar
18222     ;;
18223 esac
18224 $rm_try tryh.h
18225
18226 : see if sendmsg exists
18227 set sendmsg d_sendmsg
18228 eval $inlibc
18229
18230 : see if setegid exists
18231 set setegid d_setegid
18232 eval $inlibc
18233
18234 : see if seteuid exists
18235 set seteuid d_seteuid
18236 eval $inlibc
18237
18238 : see if setgrent exists
18239 set setgrent d_setgrent
18240 eval $inlibc
18241
18242 : see if setgrent_r exists
18243 set setgrent_r d_setgrent_r
18244 eval $inlibc
18245 case "$d_setgrent_r" in
18246 "$define")
18247         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18248         case "$d_setgrent_r_proto:$usethreads" in
18249         ":define")      d_setgrent_r_proto=define
18250                 set d_setgrent_r_proto setgrent_r $hdrs
18251                 eval $hasproto ;;
18252         *)      ;;
18253         esac
18254         case "$d_setgrent_r_proto" in
18255         define)
18256         case "$setgrent_r_proto" in
18257         ''|0) try='int setgrent_r(FILE**);'
18258         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18259         esac
18260         case "$setgrent_r_proto" in
18261         ''|0) try='void setgrent_r(FILE**);'
18262         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18263         esac
18264         case "$setgrent_r_proto" in
18265         ''|0)   d_setgrent_r=undef
18266                 setgrent_r_proto=0
18267                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18268         * )     case "$setgrent_r_proto" in
18269                 REENTRANT_PROTO*) ;;
18270                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18271                 esac
18272                 echo "Prototype: $try" ;;
18273         esac
18274         ;;
18275         *)      case "$usethreads" in
18276                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18277                 esac
18278                 d_setgrent_r=undef
18279                 setgrent_r_proto=0
18280                 ;;
18281         esac
18282         ;;
18283 *)      setgrent_r_proto=0
18284         ;;
18285 esac
18286
18287 : see if sethostent exists
18288 set sethostent d_sethent
18289 eval $inlibc
18290
18291 : see if sethostent_r exists
18292 set sethostent_r d_sethostent_r
18293 eval $inlibc
18294 case "$d_sethostent_r" in
18295 "$define")
18296         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18297         case "$d_sethostent_r_proto:$usethreads" in
18298         ":define")      d_sethostent_r_proto=define
18299                 set d_sethostent_r_proto sethostent_r $hdrs
18300                 eval $hasproto ;;
18301         *)      ;;
18302         esac
18303         case "$d_sethostent_r_proto" in
18304         define)
18305         case "$sethostent_r_proto" in
18306         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18307         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18308         esac
18309         case "$sethostent_r_proto" in
18310         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18311         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18312         esac
18313         case "$sethostent_r_proto" in
18314         ''|0)   d_sethostent_r=undef
18315                 sethostent_r_proto=0
18316                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18317         * )     case "$sethostent_r_proto" in
18318                 REENTRANT_PROTO*) ;;
18319                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18320                 esac
18321                 echo "Prototype: $try" ;;
18322         esac
18323         ;;
18324         *)      case "$usethreads" in
18325                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18326                 esac
18327                 d_sethostent_r=undef
18328                 sethostent_r_proto=0
18329                 ;;
18330         esac
18331         ;;
18332 *)      sethostent_r_proto=0
18333         ;;
18334 esac
18335
18336 : see if setitimer exists
18337 set setitimer d_setitimer
18338 eval $inlibc
18339
18340 : see if setlinebuf exists
18341 set setlinebuf d_setlinebuf
18342 eval $inlibc
18343
18344 : see if setlocale exists
18345 set setlocale d_setlocale
18346 eval $inlibc
18347
18348 : see if locale.h is available
18349 set locale.h i_locale
18350 eval $inhdr
18351
18352 : see if setlocale_r exists
18353 set setlocale_r d_setlocale_r
18354 eval $inlibc
18355 case "$d_setlocale_r" in
18356 "$define")
18357         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18358         case "$d_setlocale_r_proto:$usethreads" in
18359         ":define")      d_setlocale_r_proto=define
18360                 set d_setlocale_r_proto setlocale_r $hdrs
18361                 eval $hasproto ;;
18362         *)      ;;
18363         esac
18364         case "$d_setlocale_r_proto" in
18365         define)
18366         case "$setlocale_r_proto" in
18367         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18368         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18369         esac
18370         case "$setlocale_r_proto" in
18371         ''|0)   d_setlocale_r=undef
18372                 setlocale_r_proto=0
18373                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18374         * )     case "$setlocale_r_proto" in
18375                 REENTRANT_PROTO*) ;;
18376                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18377                 esac
18378                 echo "Prototype: $try" ;;
18379         esac
18380         ;;
18381         *)      case "$usethreads" in
18382                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18383                 esac
18384                 d_setlocale_r=undef
18385                 setlocale_r_proto=0
18386                 ;;
18387         esac
18388         ;;
18389 *)      setlocale_r_proto=0
18390         ;;
18391 esac
18392
18393 : see if setnetent exists
18394 set setnetent d_setnent
18395 eval $inlibc
18396
18397 : see if setnetent_r exists
18398 set setnetent_r d_setnetent_r
18399 eval $inlibc
18400 case "$d_setnetent_r" in
18401 "$define")
18402         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18403         case "$d_setnetent_r_proto:$usethreads" in
18404         ":define")      d_setnetent_r_proto=define
18405                 set d_setnetent_r_proto setnetent_r $hdrs
18406                 eval $hasproto ;;
18407         *)      ;;
18408         esac
18409         case "$d_setnetent_r_proto" in
18410         define)
18411         case "$setnetent_r_proto" in
18412         ''|0) try='int setnetent_r(int, struct netent_data*);'
18413         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18414         esac
18415         case "$setnetent_r_proto" in
18416         ''|0) try='void setnetent_r(int, struct netent_data*);'
18417         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18418         esac
18419         case "$setnetent_r_proto" in
18420         ''|0)   d_setnetent_r=undef
18421                 setnetent_r_proto=0
18422                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18423         * )     case "$setnetent_r_proto" in
18424                 REENTRANT_PROTO*) ;;
18425                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18426                 esac
18427                 echo "Prototype: $try" ;;
18428         esac
18429         ;;
18430         *)      case "$usethreads" in
18431                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18432                 esac
18433                 d_setnetent_r=undef
18434                 setnetent_r_proto=0
18435                 ;;
18436         esac
18437         ;;
18438 *)      setnetent_r_proto=0
18439         ;;
18440 esac
18441
18442 : see if setprotoent exists
18443 set setprotoent d_setpent
18444 eval $inlibc
18445
18446 : see if setpgid exists
18447 set setpgid d_setpgid
18448 eval $inlibc
18449
18450 : see if setpgrp2 exists
18451 set setpgrp2 d_setpgrp2
18452 eval $inlibc
18453
18454 : see if setpriority exists
18455 set setpriority d_setprior
18456 eval $inlibc
18457
18458 : see if setproctitle exists
18459 set setproctitle d_setproctitle
18460 eval $inlibc
18461
18462 : see if setprotoent_r exists
18463 set setprotoent_r d_setprotoent_r
18464 eval $inlibc
18465 case "$d_setprotoent_r" in
18466 "$define")
18467         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18468         case "$d_setprotoent_r_proto:$usethreads" in
18469         ":define")      d_setprotoent_r_proto=define
18470                 set d_setprotoent_r_proto setprotoent_r $hdrs
18471                 eval $hasproto ;;
18472         *)      ;;
18473         esac
18474         case "$d_setprotoent_r_proto" in
18475         define)
18476         case "$setprotoent_r_proto" in
18477         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18478         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18479         esac
18480         case "$setprotoent_r_proto" in
18481         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18482         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18483         esac
18484         case "$setprotoent_r_proto" in
18485         ''|0)   d_setprotoent_r=undef
18486                 setprotoent_r_proto=0
18487                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18488         * )     case "$setprotoent_r_proto" in
18489                 REENTRANT_PROTO*) ;;
18490                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18491                 esac
18492                 echo "Prototype: $try" ;;
18493         esac
18494         ;;
18495         *)      case "$usethreads" in
18496                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18497                 esac
18498                 d_setprotoent_r=undef
18499                 setprotoent_r_proto=0
18500                 ;;
18501         esac
18502         ;;
18503 *)      setprotoent_r_proto=0
18504         ;;
18505 esac
18506
18507 : see if setpwent exists
18508 set setpwent d_setpwent
18509 eval $inlibc
18510
18511 : see if setpwent_r exists
18512 set setpwent_r d_setpwent_r
18513 eval $inlibc
18514 case "$d_setpwent_r" in
18515 "$define")
18516         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18517         case "$d_setpwent_r_proto:$usethreads" in
18518         ":define")      d_setpwent_r_proto=define
18519                 set d_setpwent_r_proto setpwent_r $hdrs
18520                 eval $hasproto ;;
18521         *)      ;;
18522         esac
18523         case "$d_setpwent_r_proto" in
18524         define)
18525         case "$setpwent_r_proto" in
18526         ''|0) try='int setpwent_r(FILE**);'
18527         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18528         esac
18529         case "$setpwent_r_proto" in
18530         ''|0) try='void setpwent_r(FILE**);'
18531         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18532         esac
18533         case "$setpwent_r_proto" in
18534         ''|0)   d_setpwent_r=undef
18535                 setpwent_r_proto=0
18536                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18537         * )     case "$setpwent_r_proto" in
18538                 REENTRANT_PROTO*) ;;
18539                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18540                 esac
18541                 echo "Prototype: $try" ;;
18542         esac
18543         ;;
18544         *)      case "$usethreads" in
18545                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18546                 esac
18547                 d_setpwent_r=undef
18548                 setpwent_r_proto=0
18549                 ;;
18550         esac
18551         ;;
18552 *)      setpwent_r_proto=0
18553         ;;
18554 esac
18555
18556 : see if setregid exists
18557 set setregid d_setregid
18558 eval $inlibc
18559 set setresgid d_setresgid
18560 eval $inlibc
18561
18562 : see if setreuid exists
18563 set setreuid d_setreuid
18564 eval $inlibc
18565 set setresuid d_setresuid
18566 eval $inlibc
18567
18568 : see if setrgid exists
18569 set setrgid d_setrgid
18570 eval $inlibc
18571
18572 : see if setruid exists
18573 set setruid d_setruid
18574 eval $inlibc
18575
18576 : see if setservent exists
18577 set setservent d_setsent
18578 eval $inlibc
18579
18580 : see if setservent_r exists
18581 set setservent_r d_setservent_r
18582 eval $inlibc
18583 case "$d_setservent_r" in
18584 "$define")
18585         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18586         case "$d_setservent_r_proto:$usethreads" in
18587         ":define")      d_setservent_r_proto=define
18588                 set d_setservent_r_proto setservent_r $hdrs
18589                 eval $hasproto ;;
18590         *)      ;;
18591         esac
18592         case "$d_setservent_r_proto" in
18593         define)
18594         case "$setservent_r_proto" in
18595         ''|0) try='int setservent_r(int, struct servent_data*);'
18596         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18597         esac
18598         case "$setservent_r_proto" in
18599         ''|0) try='void setservent_r(int, struct servent_data*);'
18600         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18601         esac
18602         case "$setservent_r_proto" in
18603         ''|0)   d_setservent_r=undef
18604                 setservent_r_proto=0
18605                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18606         * )     case "$setservent_r_proto" in
18607                 REENTRANT_PROTO*) ;;
18608                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18609                 esac
18610                 echo "Prototype: $try" ;;
18611         esac
18612         ;;
18613         *)      case "$usethreads" in
18614                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18615                 esac
18616                 d_setservent_r=undef
18617                 setservent_r_proto=0
18618                 ;;
18619         esac
18620         ;;
18621 *)      setservent_r_proto=0
18622         ;;
18623 esac
18624
18625 : see if setsid exists
18626 set setsid d_setsid
18627 eval $inlibc
18628
18629 : see if setvbuf exists
18630 set setvbuf d_setvbuf
18631 eval $inlibc
18632
18633 : see if shmctl exists
18634 set shmctl d_shmctl
18635 eval $inlibc
18636
18637 : see if shmget exists
18638 set shmget d_shmget
18639 eval $inlibc
18640
18641 : see if shmat exists
18642 set shmat d_shmat
18643 eval $inlibc
18644 : see what shmat returns
18645 case "$d_shmat" in
18646 "$define")
18647         $cat >shmat.c <<'END'
18648 #include <sys/shm.h>
18649 void *shmat();
18650 END
18651         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18652                 shmattype='void *'
18653         else
18654                 shmattype='char *'
18655         fi
18656         echo "and it returns ($shmattype)." >&4
18657         : see if a prototype for shmat is available
18658         xxx=`./findhdr sys/shm.h`
18659         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18660         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18661                 val="$define"
18662         else
18663                 val="$undef"
18664         fi
18665         $rm -f shmat.[co]
18666         ;;
18667 *)
18668         val="$undef"
18669         ;;
18670 esac
18671 set d_shmatprototype
18672 eval $setvar
18673
18674 : see if shmdt exists
18675 set shmdt d_shmdt
18676 eval $inlibc
18677
18678 : see how much of the 'shm*(2)' library is present.
18679 h_shm=true
18680 echo " "
18681 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18682 *"$undef"*) h_shm=false;;
18683 esac
18684 case "$osname" in
18685 freebsd)
18686     case "`ipcs 2>&1`" in
18687     "SVID shared memory"*"not configured"*)
18688         echo "Your $osname does not have the shm*(2) configured." >&4
18689         h_shm=false
18690         val="$undef"
18691         set shmctl d_shmctl
18692         eval $setvar
18693         set shmget d_shmget
18694         eval $setvar
18695         set shmat d_shmat
18696         eval $setvar
18697         set shmdt d_shmdt
18698         eval $setvar
18699         ;;
18700     esac
18701     ;;
18702 esac
18703 : we could also check for sys/ipc.h ...
18704 if $h_shm && $test `./findhdr sys/shm.h`; then
18705         echo "You have the full shm*(2) library." >&4
18706         val="$define"
18707 else
18708         echo "You don't have the full shm*(2) library." >&4
18709         val="$undef"
18710 fi
18711 set d_shm
18712 eval $setvar
18713
18714 : see if we have sigaction
18715 echo " "
18716 if set sigaction val -f d_sigaction; eval $csym; $val; then
18717         echo 'sigaction() found.' >&4
18718         $cat > try.c <<EOP
18719 #include <stdio.h>
18720 #include <sys/types.h>
18721 #include <signal.h>
18722 #$i_stdlib I_STDLIB
18723 #ifdef I_STDLIB
18724 #include <stdlib.h>
18725 #endif
18726 int main()
18727 {
18728     struct sigaction act, oact;
18729     act.sa_flags = 0;
18730     oact.sa_handler = 0;
18731     /* so that act and oact are used */
18732     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18733 }
18734 EOP
18735         set try
18736         if eval $compile_ok; then
18737                 val="$define"
18738         else
18739                 echo "But you don't seem to have a usable struct sigaction." >&4
18740                 val="$undef"
18741         fi
18742 else
18743         echo 'sigaction NOT found.' >&4
18744         val="$undef"
18745 fi
18746 set d_sigaction; eval $setvar
18747 $rm_try
18748
18749 : see what type pids are declared as in the kernel
18750 rp="What is the type of process ids on this system?"
18751 set pid_t pidtype int stdio.h sys/types.h
18752 eval $typedef_ask
18753
18754 : see what type uids are declared as in the kernel
18755 echo " "
18756 echo "Looking for the type for user ids returned by getuid()."
18757 set uid_t uidtype xxx stdio.h sys/types.h
18758 eval $typedef
18759 case "$uidtype" in
18760 xxx)
18761         xxx=`./findhdr sys/user.h`
18762         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18763         case $1 in
18764         unsigned) dflt="$1 $2" ;;
18765         *) dflt="$1" ;;
18766         esac
18767         ;;
18768 *) dflt="$uidtype";;
18769 esac
18770 case "$uidtype" in
18771 uid_t)  echo "uid_t found." ;;
18772 *)      rp="What is the type for user ids returned by getuid()?"
18773         . ./myread
18774         uidtype="$ans"
18775         ;;
18776 esac
18777
18778 : Define hasfield_t macro for Configure internal use
18779 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18780 while $test $# -ge 2; do
18781     case "$1" in
18782         $define) echo "#include <$2>";;
18783     esac ;
18784     shift 2;
18785 done > try.c;
18786 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18787 set try;
18788 if eval $compile; then
18789         val="$define";
18790 else
18791         val="$undef";
18792 fi;
18793 set $varname;
18794 eval $setvar;
18795 $rm_try'
18796
18797 : see what siginfo fields we have
18798 case "$d_sigaction" in
18799 "$define")
18800         echo "Checking if your siginfo_t has si_errno field...">&4
18801         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18802         eval $hasfield_t;
18803
18804         echo "Checking if your siginfo_t has si_pid field...">&4
18805         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18806         eval $hasfield_t;
18807
18808         echo "Checking if your siginfo_t has si_uid field...">&4
18809         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18810         eval $hasfield_t;
18811
18812         echo "Checking if your siginfo_t has si_addr field...">&4
18813         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18814         eval $hasfield_t;
18815
18816         echo "Checking if your siginfo_t has si_status field...">&4
18817         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18818         eval $hasfield_t;
18819
18820         echo "Checking if your siginfo_t has si_band field...">&4
18821         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18822         eval $hasfield_t;
18823
18824         echo "Checking if your siginfo_t has si_value field...">&4
18825         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18826         eval $hasfield_t;
18827
18828         echo "Checking if your siginfo_t has si_fd field...">&4
18829         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18830         eval $hasfield_t;
18831
18832         ;;
18833 *)
18834         d_siginfo_si_errno="$undef"
18835         d_siginfo_si_pid="$undef"
18836         d_siginfo_si_uid="$undef"
18837         d_siginfo_si_addr="$undef"
18838         d_siginfo_si_status="$undef"
18839         d_siginfo_si_band="$undef"
18840         d_siginfo_si_value="$undef"
18841         d_siginfo_si_fd="$undef"
18842         ;;
18843 esac
18844
18845 : see if this is a sunmath.h system
18846 set sunmath.h i_sunmath
18847 eval $inhdr
18848
18849 : see if signbit exists
18850 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18851 $cat >try.c <<EOCP
18852 #$i_math I_MATH
18853 #$i_sunmath I_SUNMATH
18854 #ifdef I_MATH
18855 #  include <math.h>
18856 #endif
18857 #ifdef I_SUNMATH  /* Solaris special math library */
18858 #  include <sunmath.h>
18859 #endif
18860 #define NV $nvtype
18861 int main(int argc, char **argv)
18862 {
18863     NV x = 0.0;
18864     NV y = -1.0;
18865     if ((signbit(x) == 0) && (signbit(y) != 0))
18866         return 0;
18867     else
18868         return 1;
18869 }
18870 EOCP
18871 val="$undef"
18872 set try
18873 if eval $compile; then
18874     if $run ./try; then
18875         $echo "Yes." >&4
18876         val="$define"
18877     else
18878         $echo "Signbit seems to be available, but doesn't work as I expected."
18879         $echo "I won't use it." >&4
18880         val="$undef"
18881     fi
18882 else
18883     $echo "Nope." >&4
18884     dflt="$undef"
18885 fi
18886 set d_signbit
18887 eval $setvar
18888 $rm_try
18889
18890 : see if sigprocmask exists
18891 set sigprocmask d_sigprocmask
18892 eval $inlibc
18893
18894 : see if sigsetjmp exists
18895 echo " "
18896 case "$d_sigsetjmp" in
18897 '')
18898         $cat >try.c <<EOP
18899 #include <setjmp.h>
18900 #$i_stdlib I_STDLIB
18901 #ifdef I_STDLIB
18902 #include <stdlib.h>
18903 #endif
18904 sigjmp_buf env;
18905 int set = 1;
18906 int main()
18907 {
18908         if (sigsetjmp(env,1))
18909                 exit(set);
18910         set = 0;
18911         siglongjmp(env, 1);
18912         exit(1);
18913 }
18914 EOP
18915         set try
18916         if eval $compile; then
18917                 if $run ./try >/dev/null 2>&1; then
18918                         echo "POSIX sigsetjmp found." >&4
18919                         val="$define"
18920                 else
18921                         $cat >&4 <<EOM
18922 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18923 I'll ignore them.
18924 EOM
18925                         val="$undef"
18926                 fi
18927         else
18928                 echo "sigsetjmp not found." >&4
18929                 val="$undef"
18930         fi
18931         ;;
18932 *) val="$d_sigsetjmp"
18933         case "$d_sigsetjmp" in
18934         $define) echo "POSIX sigsetjmp found." >&4;;
18935         $undef) echo "sigsetjmp not found." >&4;;
18936         esac
18937         ;;
18938 esac
18939 set d_sigsetjmp
18940 eval $setvar
18941 $rm_try
18942
18943 : see if snprintf exists
18944 set snprintf d_snprintf
18945 eval $inlibc
18946
18947 : see if vsnprintf exists
18948 set vsnprintf d_vsnprintf
18949 eval $inlibc
18950
18951 case "$d_snprintf-$d_vsnprintf" in
18952 "$define-$define")
18953     $cat <<EOM
18954 Checking whether your snprintf() and vsnprintf() work okay...
18955 EOM
18956     $cat >try.c <<'EOCP'
18957 /* v?snprintf testing logic courtesy of Russ Allbery.
18958  * According to C99:
18959  * - if the buffer is too short it still must be \0-terminated
18960  * - if the buffer is too short the potentially required length
18961  *   must be returned and not -1
18962  * - if the buffer is NULL the potentially required length
18963  *   must be returned and not -1 or core dump
18964  */
18965 #include <stdio.h>
18966 #include <stdarg.h>
18967
18968 char buf[2];
18969
18970 int test (char *format, ...)
18971 {
18972     va_list args;
18973     int count;
18974
18975     va_start (args, format);
18976     count = vsnprintf (buf, sizeof buf, format, args);
18977     va_end (args);
18978     return count;
18979 }
18980
18981 int main ()
18982 {
18983     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18984              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18985 }
18986 EOCP
18987     set try
18988     if eval $compile; then
18989         `$run ./try`
18990         case "$?" in
18991         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18992         *) cat <<EOM >&4
18993 Your snprintf() and snprintf() don't seem to be working okay.
18994 EOM
18995            d_snprintf="$undef"
18996            d_vsnprintf="$undef"
18997            ;;
18998         esac
18999     else
19000         echo "(I can't seem to compile the test program--assuming they don't)"
19001         d_snprintf="$undef"
19002         d_vsnprintf="$undef"
19003     fi
19004     $rm_try
19005     ;;
19006 esac
19007
19008 : see if sockatmark exists
19009 set sockatmark d_sockatmark
19010 eval $inlibc
19011
19012 : see if prototype for sockatmark is available
19013 echo " "
19014 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
19015 eval $hasproto
19016
19017 : see if socks5_init exists
19018 set socks5_init d_socks5_init
19019 eval $inlibc
19020
19021 : see if sprintf returns the length of the string in the buffer as per ANSI
19022 $echo "Checking whether sprintf returns the length of the string..." >&4
19023 $cat <<EOP >try.c
19024 #include <stdio.h>
19025 #$i_stdlib I_STDLIB
19026 #ifdef I_STDLIB
19027 #include <stdlib.h>
19028 #endif
19029 #$i_string I_STRING
19030 #ifdef I_STRING
19031 #  include <string.h>
19032 #else
19033 #  include <strings.h>
19034 #endif
19035 #$i_math I_MATH
19036 #ifdef I_MATH
19037 #include <math.h>
19038 #endif
19039
19040 char buffer[256];
19041
19042 int check (size_t expect, int test) {
19043   size_t got = strlen(buffer);
19044   if (expect == got)
19045     return 0;
19046
19047   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
19048        test, buffer);
19049   exit (test);
19050 }
19051
19052 int main(int argc, char **argv) {
19053   int test = 0;
19054
19055   check(sprintf(buffer, ""), ++test);
19056   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
19057   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
19058
19059   return 0;
19060 }
19061 EOP
19062 set try
19063
19064 if eval $compile; then
19065     xxx="`$run ./try`"
19066     case "$?" in
19067         0) cat >&4 <<EOM
19068 sprintf returns the length of the string (as ANSI says it should)
19069 EOM
19070         d_sprintf_returns_strlen="$define"
19071         ;;
19072         *) cat >&4 <<EOM
19073 sprintf does not return the length of the string (how old is this system?)
19074 EOM
19075         d_sprintf_returns_strlen="$undef"
19076         ;;
19077     esac
19078 else
19079     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
19080     d_sprintf_returns_strlen="$undef"
19081 fi
19082 $rm_try
19083
19084 : see if srand48_r exists
19085 set srand48_r d_srand48_r
19086 eval $inlibc
19087 case "$d_srand48_r" in
19088 "$define")
19089         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19090         case "$d_srand48_r_proto:$usethreads" in
19091         ":define")      d_srand48_r_proto=define
19092                 set d_srand48_r_proto srand48_r $hdrs
19093                 eval $hasproto ;;
19094         *)      ;;
19095         esac
19096         case "$d_srand48_r_proto" in
19097         define)
19098         case "$srand48_r_proto" in
19099         ''|0) try='int srand48_r(long, struct drand48_data*);'
19100         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
19101         esac
19102         case "$srand48_r_proto" in
19103         ''|0)   d_srand48_r=undef
19104                 srand48_r_proto=0
19105                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
19106         * )     case "$srand48_r_proto" in
19107                 REENTRANT_PROTO*) ;;
19108                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
19109                 esac
19110                 echo "Prototype: $try" ;;
19111         esac
19112         ;;
19113         *)      case "$usethreads" in
19114                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
19115                 esac
19116                 d_srand48_r=undef
19117                 srand48_r_proto=0
19118                 ;;
19119         esac
19120         ;;
19121 *)      srand48_r_proto=0
19122         ;;
19123 esac
19124
19125 : see if srandom_r exists
19126 set srandom_r d_srandom_r
19127 eval $inlibc
19128 case "$d_srandom_r" in
19129 "$define")
19130         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19131         case "$d_srandom_r_proto:$usethreads" in
19132         ":define")      d_srandom_r_proto=define
19133                 set d_srandom_r_proto srandom_r $hdrs
19134                 eval $hasproto ;;
19135         *)      ;;
19136         esac
19137         case "$d_srandom_r_proto" in
19138         define)
19139         case "$srandom_r_proto" in
19140         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
19141         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
19142         esac
19143         case "$srandom_r_proto" in
19144         ''|0)   d_srandom_r=undef
19145                 srandom_r_proto=0
19146                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
19147         * )     case "$srandom_r_proto" in
19148                 REENTRANT_PROTO*) ;;
19149                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
19150                 esac
19151                 echo "Prototype: $try" ;;
19152         esac
19153         ;;
19154         *)      case "$usethreads" in
19155                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
19156                 esac
19157                 d_srandom_r=undef
19158                 srandom_r_proto=0
19159                 ;;
19160         esac
19161         ;;
19162 *)      srandom_r_proto=0
19163         ;;
19164 esac
19165
19166 : see if prototype for setresgid is available
19167 echo " "
19168 set d_sresgproto setresgid $i_unistd unistd.h
19169 eval $hasproto
19170
19171 : see if prototype for setresuid is available
19172 echo " "
19173 set d_sresuproto setresuid $i_unistd unistd.h
19174 eval $hasproto
19175
19176 : see if stat exists
19177 set stat d_stat
19178 eval $inlibc
19179
19180 : see if sys/stat.h is available
19181 set sys/stat.h i_sysstat
19182 eval $inhdr
19183
19184 : see if stat knows about block sizes
19185 echo " "
19186 echo "Checking to see if your struct stat has st_blocks field..." >&4
19187 set d_statblks stat st_blocks $i_sysstat sys/stat.h
19188 eval $hasfield
19189
19190 : see if this is a sys/vfs.h system
19191 set sys/vfs.h i_sysvfs
19192 eval $inhdr
19193
19194 : see if this is a sys/statfs.h system
19195 set sys/statfs.h i_sysstatfs
19196 eval $inhdr
19197
19198 : Check for statfs_s
19199 echo " "
19200 echo "Checking to see if your system supports struct statfs..." >&4
19201 set d_statfs_s statfs $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
19202 eval $hasstruct
19203 case "$d_statfs_s" in
19204 "$define")      echo "Yes, it does."   ;;
19205 *)              echo "No, it doesn't." ;;
19206 esac
19207
19208
19209 : see if struct statfs knows about f_flags
19210 case "$d_statfs_s" in
19211 define)
19212         echo " "
19213         echo "Checking to see if your struct statfs has f_flags field..." >&4
19214         set d_statfs_f_flags statfs f_flags $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
19215         eval $hasfield
19216         ;;
19217 *)      val="$undef"
19218         set d_statfs_f_flags
19219         eval $setvar
19220         ;;
19221 esac
19222 case "$d_statfs_f_flags" in
19223 "$define")      echo "Yes, it does."   ;;
19224 *)              echo "No, it doesn't." ;;
19225 esac
19226
19227 : see what flavor, if any, of static inline is supported
19228 echo " "
19229 echo "Checking to see if your system supports static inline..."
19230 $cat > try.c <<'EOCP'
19231 #include <stdlib.h>
19232 extern int f_via_a(int x);
19233 extern int f_via_b(int x);
19234 int main(int argc, char **argv)
19235 {
19236     int y;
19237
19238     y = f_via_a(0);
19239 #ifdef USE_B
19240     y = f_via_b(0);
19241 #endif
19242     if (y == 42) {
19243         return EXIT_SUCCESS;
19244     }
19245     else {
19246         return EXIT_FAILURE;
19247     }
19248 }
19249 EOCP
19250 $cat > a.c <<'EOCP'
19251 static INLINE int f(int x) {
19252     int y;
19253     y = x + 42;
19254     return y;
19255 }
19256
19257 int f_via_a(int x)
19258 {
19259     return f(x);
19260 }
19261 EOCP
19262 $cat > b.c <<'EOCP'
19263 extern int f(int x);
19264
19265 int f_via_b(int x)
19266 {
19267     return f(x);
19268 }
19269 EOCP
19270
19271 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19272 case "$perl_static_inline" in
19273 '')     # Check the various possibilities, and break out on success.
19274         # For gcc, prefer __inline__, which will still permit
19275         # cflags.SH to add in -ansi.
19276         case "$gccversion" in
19277                 '') xxx="inline __inline__ __inline _inline";;
19278                 *)  xxx="__inline__ inline __inline _inline";;
19279         esac
19280         for inline in $xxx; do
19281                 set try -DINLINE=$inline a.c
19282                 if eval $compile && $run ./try; then
19283                         # Now make sure there is no external linkage of static
19284                         # functions
19285                         set try -DINLINE=$inline -DUSE_B a.c b.c
19286                         if eval $compile && $run ./try; then
19287                                 $echo "Your compiler supports static $inline, " >&4
19288                                 $echo "but it also creates an external definition," >&4
19289                                 $echo "so I won't use it." >&4
19290                                 val=$undef
19291                         else
19292                                 $echo "Your compiler supports static $inline." >&4
19293                                 val=$define
19294                                 perl_static_inline="static $inline";
19295                                 break;
19296                         fi
19297                 else
19298                         $echo "Your compiler does NOT support static $inline." >&4
19299                         val="$undef"
19300                 fi
19301         done
19302         ;;
19303 *inline*) # Some variant of inline exists.
19304         echo "Keeping your $hint value of $perl_static_inline."
19305         val=$define
19306         ;;
19307 static)  # No inline capabilities
19308         echo "Keeping your $hint value of $perl_static_inline."
19309         val=$undef
19310         ;;
19311 *)  # Unrecognized previous value -- blindly trust the supplied
19312         # value and hope it makes sense.  Use old value for
19313         # d_static_inline, if there is one.
19314         echo "Keeping your $hint value of $perl_static_inline."
19315         case "$d_static_inline" in
19316                 '') val=$define ;;
19317                 *)  val=$d_static_inline ;;
19318         esac
19319         ;;
19320 esac
19321 # Fallback to plain 'static' if nothing worked.
19322 case "$perl_static_inline" in
19323 '')
19324         perl_static_inline="static"
19325         val=$undef
19326         ;;
19327 esac
19328 set d_static_inline
19329 eval $setvar
19330 $rm -f a.[co] b.[co]
19331 $rm_try
19332
19333 : Check stream access
19334 $cat >&4 <<EOM
19335 Checking how to access stdio streams by file descriptor number...
19336 EOM
19337 case "$stdio_stream_array" in
19338 '')     $cat >try.c <<EOCP
19339 #include <stdio.h>
19340 int main() {
19341   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19342     printf("yes\n");
19343 }
19344 EOCP
19345         for s in _iob __iob __sF
19346         do
19347                 set try -DSTDIO_STREAM_ARRAY=$s
19348                 if eval $compile; then
19349                         case "`$run ./try`" in
19350                         yes)    stdio_stream_array=$s; break ;;
19351                         esac
19352                 fi
19353         done
19354         $rm_try
19355 esac
19356 case "$stdio_stream_array" in
19357 '')     $cat >&4 <<EOM
19358 I can't figure out how to access stdio streams by file descriptor number.
19359 EOM
19360         d_stdio_stream_array="$undef"
19361         ;;
19362 *)      $cat >&4 <<EOM
19363 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19364 EOM
19365         d_stdio_stream_array="$define"
19366         ;;
19367 esac
19368
19369 : see if strcoll exists
19370 set strcoll d_strcoll
19371 eval $inlibc
19372
19373 : check for structure copying
19374 echo " "
19375 echo "Checking to see if your C compiler can copy structs..." >&4
19376 $cat >try.c <<'EOCP'
19377 int main()
19378 {
19379         struct blurfl {
19380                 int dyick;
19381         } foo, bar;
19382
19383         foo = bar;
19384 }
19385 EOCP
19386 if $cc -c try.c >/dev/null 2>&1 ; then
19387         val="$define"
19388         echo "Yup, it can."
19389 else
19390         val="$undef"
19391         echo "Nope, it can't."
19392 fi
19393 set d_strctcpy
19394 eval $setvar
19395 $rm_try
19396
19397 : see if strerror and/or sys_errlist[] exist
19398 echo " "
19399 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19400     if set strerror val -f d_strerror; eval $csym; $val; then
19401                 echo 'strerror() found.' >&4
19402                 d_strerror="$define"
19403                 d_strerrm='strerror(e)'
19404                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19405                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19406                         d_syserrlst="$define"
19407                 else
19408                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19409                         d_syserrlst="$undef"
19410                 fi
19411     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19412                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19413                 echo 'strerror() found in string header.' >&4
19414                 d_strerror="$define"
19415                 d_strerrm='strerror(e)'
19416                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19417                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19418                                 d_syserrlst="$define"
19419                 else
19420                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19421                         d_syserrlst="$undef"
19422                 fi
19423     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19424                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19425                 d_strerror="$undef"
19426                 d_syserrlst="$define"
19427                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19428     else
19429                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19430                 d_strerror="$undef"
19431                 d_syserrlst="$undef"
19432                 d_strerrm='"unknown"'
19433     fi
19434 fi
19435
19436 : see if strerror_l exists
19437 set strerror_l d_strerror_l
19438 eval $inlibc
19439
19440 : see if strerror_r exists
19441 set strerror_r d_strerror_r
19442 eval $inlibc
19443 case "$d_strerror_r" in
19444 "$define")
19445         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19446         case "$d_strerror_r_proto:$usethreads" in
19447         ":define")      d_strerror_r_proto=define
19448                 set d_strerror_r_proto strerror_r $hdrs
19449                 eval $hasproto ;;
19450         *)      ;;
19451         esac
19452         case "$d_strerror_r_proto" in
19453         define)
19454         case "$strerror_r_proto" in
19455         ''|0) try='int strerror_r(int, char*, size_t);'
19456         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19457         esac
19458         case "$strerror_r_proto" in
19459         ''|0) try='int strerror_r(int, char*, int);'
19460         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19461         esac
19462         case "$strerror_r_proto" in
19463         ''|0) try='char* strerror_r(int, char*, size_t);'
19464         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19465         esac
19466         case "$strerror_r_proto" in
19467         ''|0)   d_strerror_r=undef
19468                 strerror_r_proto=0
19469                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19470         * )     case "$strerror_r_proto" in
19471                 REENTRANT_PROTO*) ;;
19472                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19473                 esac
19474                 echo "Prototype: $try" ;;
19475         esac
19476         ;;
19477         *)      case "$usethreads" in
19478                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19479                 esac
19480                 d_strerror_r=undef
19481                 strerror_r_proto=0
19482                 ;;
19483         esac
19484         ;;
19485 *)      strerror_r_proto=0
19486         ;;
19487 esac
19488
19489 : see if strftime exists
19490 set strftime d_strftime
19491 eval $inlibc
19492
19493 : see if strlcat exists
19494 set strlcat d_strlcat
19495 eval $inlibc
19496
19497 : see if strlcpy exists
19498 set strlcpy d_strlcpy
19499 eval $inlibc
19500
19501 : see if strtod exists
19502 set strtod d_strtod
19503 eval $inlibc
19504
19505 : see if strtol exists
19506 set strtol d_strtol
19507 eval $inlibc
19508
19509 : see if strtold exists
19510 set strtold d_strtold
19511 eval $inlibc
19512
19513 : see if strtoll exists
19514 set strtoll d_strtoll
19515 eval $inlibc
19516
19517 case "$d_longlong-$d_strtoll" in
19518 "$define-$define")
19519         $cat <<EOM
19520 Checking whether your strtoll() works okay...
19521 EOM
19522         $cat >try.c <<'EOCP'
19523 #include <errno.h>
19524 #ifdef __hpux
19525 #define strtoll __strtoll
19526 #endif
19527 #ifdef __EMX__
19528 #define strtoll _strtoll
19529 #endif
19530 #include <stdio.h>
19531 extern long long int strtoll(char *s, char **, int);
19532 static int bad = 0;
19533 int check(char *s, long long ell, int een) {
19534         long long gll;
19535         errno = 0;
19536         gll = strtoll(s, 0, 10);
19537         if (!((gll == ell) && (errno == een)))
19538                 bad++;
19539 }
19540 int main() {
19541         check(" 1",                                      1LL, 0);
19542         check(" 0",                                      0LL, 0);
19543         check("-1",                                     -1LL, 0);
19544         check("-9223372036854775808", -9223372036854775808LL, 0);
19545         check("-9223372036854775808", -9223372036854775808LL, 0);
19546         check(" 9223372036854775807",  9223372036854775807LL, 0);
19547         check("-9223372036854775808", -9223372036854775808LL, 0);
19548         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19549         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19550         if (!bad)
19551                 printf("ok\n");
19552 }
19553 EOCP
19554         set try
19555         if eval $compile; then
19556                 yyy=`$run ./try`
19557                 case "$yyy" in
19558                 ok) echo "Your strtoll() seems to be working okay." ;;
19559                 *) cat <<EOM >&4
19560 Your strtoll() doesn't seem to be working okay.
19561 EOM
19562                    d_strtoll="$undef"
19563                    ;;
19564                 esac
19565         else
19566                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19567                 d_strtoll="$undef"
19568         fi
19569         ;;
19570 esac
19571
19572 : see if strtoq exists
19573 set strtoq d_strtoq
19574 eval $inlibc
19575
19576 : see if strtoul exists
19577 set strtoul d_strtoul
19578 eval $inlibc
19579
19580 case "$d_strtoul" in
19581 "$define")
19582         $cat <<EOM
19583 Checking whether your strtoul() works okay...
19584 EOM
19585         $cat >try.c <<'EOCP'
19586 #include <errno.h>
19587 #include <stdio.h>
19588 extern unsigned long int strtoul(char *s, char **, int);
19589 static int bad = 0;
19590 void check(char *s, unsigned long eul, int een) {
19591         unsigned long gul;
19592         errno = 0;
19593         gul = strtoul(s, 0, 10);
19594         if (!((gul == eul) && (errno == een)))
19595                 bad++;
19596 }
19597 int main() {
19598         check(" 1", 1L, 0);
19599         check(" 0", 0L, 0);
19600 EOCP
19601         case "$longsize" in
19602         8)
19603             $cat >>try.c <<'EOCP'
19604         check("18446744073709551615", 18446744073709551615UL, 0);
19605         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19606 #if 0 /* strtoul() for /^-/ strings is undefined. */
19607         check("-1", 18446744073709551615UL, 0);
19608         check("-18446744073709551614", 2, 0);
19609         check("-18446744073709551615", 1, 0);
19610         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19611         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19612 #endif
19613 EOCP
19614                 ;;
19615         4)
19616                     $cat >>try.c <<'EOCP'
19617         check("4294967295", 4294967295UL, 0);
19618         check("4294967296", 4294967295UL, ERANGE);
19619 #if 0 /* strtoul() for /^-/ strings is undefined. */
19620         check("-1", 4294967295UL, 0);
19621         check("-4294967294", 2, 0);
19622         check("-4294967295", 1, 0);
19623         check("-4294967296", 4294967295UL, ERANGE);
19624         check("-4294967297", 4294967295UL, ERANGE);
19625 #endif
19626 EOCP
19627                 ;;
19628         *)
19629 : Should we write these tests to be more portable by sprintf-ing
19630 : ~0 and then manipulating that char string as input for strtol?
19631                 ;;
19632         esac
19633         $cat >>try.c <<'EOCP'
19634         if (!bad)
19635                 printf("ok\n");
19636         return 0;
19637 }
19638 EOCP
19639         set try
19640         if eval $compile; then
19641                 case "`$run ./try`" in
19642                 ok) echo "Your strtoul() seems to be working okay." ;;
19643                 *) cat <<EOM >&4
19644 Your strtoul() doesn't seem to be working okay.
19645 EOM
19646                    d_strtoul="$undef"
19647                    ;;
19648                 esac
19649         else
19650                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19651                 d_strtoul="$undef"
19652         fi
19653         ;;
19654 esac
19655
19656 : see if strtoull exists
19657 set strtoull d_strtoull
19658 eval $inlibc
19659
19660 case "$d_longlong-$d_strtoull" in
19661 "$define-$define")
19662         $cat <<EOM
19663 Checking whether your strtoull() works okay...
19664 EOM
19665         $cat >try.c <<'EOCP'
19666 #include <errno.h>
19667 #ifdef __hpux
19668 #define strtoull __strtoull
19669 #endif
19670 #include <stdio.h>
19671 extern unsigned long long int strtoull(char *s, char **, int);
19672 static int bad = 0;
19673 int check(char *s, long long eull, int een) {
19674         long long gull;
19675         errno = 0;
19676         gull = strtoull(s, 0, 10);
19677         if (!((gull == eull) && (errno == een)))
19678                 bad++;
19679 }
19680 int main() {
19681         check(" 1",                                        1LL, 0);
19682         check(" 0",                                        0LL, 0);
19683         check("18446744073709551615",  18446744073709551615ULL, 0);
19684         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19685 #if 0 /* strtoull() for /^-/ strings is undefined. */
19686         check("-1",                    18446744073709551615ULL, 0);
19687         check("-18446744073709551614",                     2LL, 0);
19688         check("-18446744073709551615",                     1LL, 0);
19689         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19690         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19691 #endif
19692         if (!bad)
19693                 printf("ok\n");
19694 }
19695 EOCP
19696         set try
19697         if eval $compile; then
19698                 case "`$run ./try`" in
19699                 ok) echo "Your strtoull() seems to be working okay." ;;
19700                 *) cat <<EOM >&4
19701 Your strtoull() doesn't seem to be working okay.
19702 EOM
19703                    d_strtoull="$undef"
19704                    ;;
19705                 esac
19706         else
19707                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19708                 d_strtoull="$undef"
19709         fi
19710         ;;
19711 esac
19712
19713 : see if strtouq exists
19714 set strtouq d_strtouq
19715 eval $inlibc
19716
19717 case "$d_strtouq" in
19718 "$define")
19719         $cat <<EOM
19720 Checking whether your strtouq() works okay...
19721 EOM
19722         $cat >try.c <<'EOCP'
19723 #include <errno.h>
19724 #include <stdio.h>
19725 extern unsigned long long int strtouq(char *s, char **, int);
19726 static int bad = 0;
19727 void check(char *s, unsigned long long eull, int een) {
19728         unsigned long long gull;
19729         errno = 0;
19730         gull = strtouq(s, 0, 10);
19731         if (!((gull == eull) && (errno == een)))
19732                 bad++;
19733 }
19734 int main() {
19735         check(" 1",                                        1LL, 0);
19736         check(" 0",                                        0LL, 0);
19737         check("18446744073709551615",  18446744073709551615ULL, 0);
19738         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19739 #if 0 /* strtouq() for /^-/ strings is undefined. */
19740         check("-1",                    18446744073709551615ULL, 0);
19741         check("-18446744073709551614",                     2LL, 0);
19742         check("-18446744073709551615",                     1LL, 0);
19743         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19744         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19745 #endif
19746         if (!bad)
19747                 printf("ok\n");
19748         return 0;
19749 }
19750 EOCP
19751         set try
19752         if eval $compile; then
19753                 case "`$run ./try`" in
19754                 ok) echo "Your strtouq() seems to be working okay." ;;
19755                 *) cat <<EOM >&4
19756 Your strtouq() doesn't seem to be working okay.
19757 EOM
19758                    d_strtouq="$undef"
19759                    ;;
19760                 esac
19761         else
19762                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19763                 d_strtouq="$undef"
19764         fi
19765         ;;
19766 esac
19767
19768 : see if strxfrm exists
19769 set strxfrm d_strxfrm
19770 eval $inlibc
19771
19772 : see if symlink exists
19773 set symlink d_symlink
19774 eval $inlibc
19775
19776 : see if syscall exists
19777 set syscall d_syscall
19778 eval $inlibc
19779
19780 : see if prototype for syscall is available
19781 echo " "
19782 set d_syscallproto syscall $i_unistd unistd.h
19783 eval $hasproto
19784
19785 : see if sysconf exists
19786 set sysconf d_sysconf
19787 eval $inlibc
19788
19789 : see if system exists
19790 set system d_system
19791 eval $inlibc
19792
19793 : see if tcgetpgrp exists
19794 set tcgetpgrp d_tcgetpgrp
19795 eval $inlibc
19796
19797 : see if tcsetpgrp exists
19798 set tcsetpgrp d_tcsetpgrp
19799 eval $inlibc
19800
19801 : see if prototype for telldir is available
19802 echo " "
19803 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19804 eval $hasproto
19805
19806 : see if tgamma exists
19807 set tgamma d_tgamma
19808 eval $inlibc
19809
19810 : see if time exists
19811 echo " "
19812 if test "X$d_time" = X -o X"$timetype" = X; then
19813     if set time val -f d_time; eval $csym; $val; then
19814                 echo 'time() found.' >&4
19815                 val="$define"
19816                 rp="What is the type returned by time() on this system?"
19817                 set time_t timetype long stdio.h sys/types.h
19818                 eval $typedef_ask
19819     else
19820                 echo 'time() not found, hope that will do.' >&4
19821                 val="$undef"
19822                 timetype='int';
19823     fi
19824     set d_time
19825     eval $setvar
19826 fi
19827
19828 : see if timegm exists
19829 set timegm d_timegm
19830 eval $inlibc
19831
19832 : see if this is a sys/times.h system
19833 set sys/times.h i_systimes
19834 eval $inhdr
19835
19836 : see if times exists
19837 echo " "
19838 if set times val -f d_times; eval $csym; $val; then
19839         echo 'times() found.' >&4
19840         d_times="$define"
19841         inc=''
19842         case "$i_systimes" in
19843         "$define") inc='sys/times.h';;
19844         esac
19845         rp="What is the type returned by times() on this system?"
19846         set clock_t clocktype long stdio.h sys/types.h $inc
19847         eval $typedef_ask
19848 else
19849         echo 'times() NOT found, hope that will do.' >&4
19850         d_times="$undef"
19851         clocktype='int'
19852 fi
19853
19854 : see if tmpnam_r exists
19855 set tmpnam_r d_tmpnam_r
19856 eval $inlibc
19857 case "$d_tmpnam_r" in
19858 "$define")
19859         hdrs="$i_systypes sys/types.h define stdio.h "
19860         case "$d_tmpnam_r_proto:$usethreads" in
19861         ":define")      d_tmpnam_r_proto=define
19862                 set d_tmpnam_r_proto tmpnam_r $hdrs
19863                 eval $hasproto ;;
19864         *)      ;;
19865         esac
19866         case "$d_tmpnam_r_proto" in
19867         define)
19868         case "$tmpnam_r_proto" in
19869         ''|0) try='char* tmpnam_r(char*);'
19870         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19871         esac
19872         case "$tmpnam_r_proto" in
19873         ''|0)   d_tmpnam_r=undef
19874                 tmpnam_r_proto=0
19875                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19876         * )     case "$tmpnam_r_proto" in
19877                 REENTRANT_PROTO*) ;;
19878                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19879                 esac
19880                 echo "Prototype: $try" ;;
19881         esac
19882         ;;
19883         *)      case "$usethreads" in
19884                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19885                 esac
19886                 d_tmpnam_r=undef
19887                 tmpnam_r_proto=0
19888                 ;;
19889         esac
19890         ;;
19891 *)      tmpnam_r_proto=0
19892         ;;
19893 esac
19894
19895 : see if trunc exists
19896 set trunc d_trunc
19897 eval $inlibc
19898
19899 : see if truncate exists
19900 set truncate d_truncate
19901 eval $inlibc
19902
19903 : see if ttyname_r exists
19904 set ttyname_r d_ttyname_r
19905 eval $inlibc
19906 case "$d_ttyname_r" in
19907 "$define")
19908         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19909         case "$d_ttyname_r_proto:$usethreads" in
19910         ":define")      d_ttyname_r_proto=define
19911                 set d_ttyname_r_proto ttyname_r $hdrs
19912                 eval $hasproto ;;
19913         *)      ;;
19914         esac
19915         case "$d_ttyname_r_proto" in
19916         define)
19917         case "$ttyname_r_proto" in
19918         ''|0) try='int ttyname_r(int, char*, size_t);'
19919         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19920         esac
19921         case "$ttyname_r_proto" in
19922         ''|0) try='int ttyname_r(int, char*, int);'
19923         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19924         esac
19925         case "$ttyname_r_proto" in
19926         ''|0) try='char* ttyname_r(int, char*, int);'
19927         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19928         esac
19929         case "$ttyname_r_proto" in
19930         ''|0)   d_ttyname_r=undef
19931                 ttyname_r_proto=0
19932                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19933         * )     case "$ttyname_r_proto" in
19934                 REENTRANT_PROTO*) ;;
19935                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19936                 esac
19937                 echo "Prototype: $try" ;;
19938         esac
19939         ;;
19940         *)      case "$usethreads" in
19941                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19942                 esac
19943                 d_ttyname_r=undef
19944                 ttyname_r_proto=0
19945                 ;;
19946         esac
19947         ;;
19948 *)      ttyname_r_proto=0
19949         ;;
19950 esac
19951
19952 : see if tzname[] exists
19953 echo " "
19954 if set tzname val -a d_tzname; eval $csym; $val; then
19955         val="$define"
19956         echo 'tzname[] found.' >&4
19957 else
19958         val="$undef"
19959         echo 'tzname[] NOT found.' >&4
19960 fi
19961 set d_tzname
19962 eval $setvar
19963
19964 : Check if is a multiplatform env
19965 case "$osname" in
19966 darwin) multiarch="$define" ;;
19967 esac
19968 case "$multiarch" in
19969 ''|[nN]*) multiarch="$undef" ;;
19970 esac
19971
19972 : check for ordering of bytes in a UV
19973 echo " "
19974 case "$multiarch" in
19975 *$define*)
19976         $cat <<EOM
19977 You seem to be doing a multiarchitecture build,
19978 skipping the byteorder check.
19979
19980 EOM
19981         byteorder='ffff'
19982         ;;
19983 *)
19984         case "$byteorder" in
19985         '')
19986                 $cat <<'EOM'
19987 In the following, larger digits indicate more significance.  A big-endian
19988 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19989 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19990 machines may have weird orders like 3412.  A Cray will report 87654321,
19991 an Alpha will report 12345678. If the test program works the default is
19992 probably right.
19993 I'm now running the test program...
19994 EOM
19995                 $cat >try.c <<EOCP
19996 #include <stdio.h>
19997 #$i_stdlib I_STDLIB
19998 #ifdef I_STDLIB
19999 #include <stdlib.h>
20000 #endif
20001 #include <sys/types.h>
20002 typedef $uvtype UV;
20003 int main()
20004 {
20005         int i;
20006         union {
20007                 UV l;
20008                 char c[$uvsize];
20009         } u;
20010
20011         if ($uvsize > 4)
20012                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
20013         else
20014                 u.l = (UV)0x04030201;
20015         for (i = 0; i < $uvsize; i++)
20016                 printf("%c", u.c[i]+'0');
20017         printf("\n");
20018         exit(0);
20019 }
20020 EOCP
20021                 xxx_prompt=y
20022                 set try
20023                 if eval $compile && $run ./try > /dev/null; then
20024                         dflt=`$run ./try`
20025                         case "$dflt" in
20026                         [1-4][1-4][1-4][1-4]|12345678|87654321)
20027                                 echo "(The test program ran ok.)"
20028                                 echo "byteorder=$dflt"
20029                                 xxx_prompt=n
20030                         ;;
20031                         ????|????????) echo "(The test program ran ok.)" ;;
20032                         *) echo "(The test program didn't run right for some reason.)" ;;
20033                         esac
20034                 else
20035                         dflt='4321'
20036                         cat <<'EOM'
20037 (I can't seem to compile the test program.  Guessing big-endian...)
20038 EOM
20039                 fi
20040                 case "$xxx_prompt" in
20041                 y)
20042                         rp="What is the order of bytes in $uvtype?"
20043                         . ./myread
20044                         byteorder="$ans"
20045                         ;;
20046                 *)      byteorder=$dflt
20047                         ;;
20048                 esac
20049                 ;;
20050         esac
20051         $rm_try
20052         ;;
20053 esac
20054
20055 : Checking 32bit alignedness
20056 $cat <<EOM
20057
20058 Checking to see whether you can access character data unalignedly...
20059 EOM
20060 case "$d_u32align" in
20061 '')   $cat >try.c <<EOCP
20062 #include <stdio.h>
20063 #$i_stdlib I_STDLIB
20064 #ifdef I_STDLIB
20065 #include <stdlib.h>
20066 #endif
20067 #define U32 $u32type
20068 #define BYTEORDER 0x$byteorder
20069 #define U8 $u8type
20070 #include <signal.h>
20071 #ifdef SIGBUS
20072 $signal_t bletch(int s) { exit(4); }
20073 #endif
20074 int main() {
20075 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
20076     volatile U8 buf[8];
20077     volatile U32 *up;
20078     int i;
20079
20080     if (sizeof(U32) != 4) {
20081         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
20082         exit(1);
20083     }
20084
20085     fflush(stdout);
20086
20087 #ifdef SIGBUS
20088     signal(SIGBUS, bletch);
20089 #endif
20090
20091     buf[0] = 0;
20092     buf[1] = 0;
20093     buf[2] = 0;
20094     buf[3] = 1;
20095     buf[4] = 0;
20096     buf[5] = 0;
20097     buf[6] = 0;
20098     buf[7] = 1;
20099
20100     for (i = 0; i < 4; i++) {
20101         up = (U32*)(buf + i);
20102         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
20103                (*up == 1 << (8*(3-i)))  /* little-endian */
20104               )
20105            )
20106         {
20107             printf("read failed (%x)\n", *up);
20108             exit(2);
20109         }
20110     }
20111
20112     /* write test */
20113     for (i = 0; i < 4; i++) {
20114         up = (U32*)(buf + i);
20115         *up = 0xBeef;
20116         if (*up != 0xBeef) {
20117             printf("write failed (%x)\n", *up);
20118             exit(3);
20119         }
20120     }
20121
20122     exit(0);
20123 #else
20124     printf("1\n");
20125     exit(1);
20126 #endif
20127     return 0;
20128 }
20129 EOCP
20130 set try
20131 if eval $compile_ok; then
20132         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
20133         $run ./try 2>&1 >/dev/null
20134         case "$?" in
20135         0)      cat >&4 <<EOM
20136 You can access character data pretty unalignedly.
20137 EOM
20138                 d_u32align="$undef"
20139                 ;;
20140         *)      cat >&4 <<EOM
20141 It seems that you must access character data in an aligned manner.
20142 EOM
20143                 d_u32align="$define"
20144                 ;;
20145         esac
20146 else
20147         rp='Can you access character data at unaligned addresses?'
20148         dflt='n'
20149         . ./myread
20150         case "$ans" in
20151         [yY]*)  d_u32align="$undef"  ;;
20152         *)      d_u32align="$define" ;;
20153         esac
20154 fi
20155 $rm_try
20156 ;;
20157 esac
20158
20159 : see if ualarm exists
20160 set ualarm d_ualarm
20161 eval $inlibc
20162
20163 : see if umask exists
20164 set umask d_umask
20165 eval $inlibc
20166
20167 : see if unordered exists
20168 set unordered d_unordered
20169 eval $inlibc
20170
20171 : see if unsetenv exists
20172 set unsetenv d_unsetenv
20173 eval $inlibc
20174
20175 : see if usleep exists
20176 set usleep d_usleep
20177 eval $inlibc
20178
20179 : see if prototype for usleep is available
20180 echo " "
20181 set d_usleepproto usleep $i_unistd unistd.h
20182 eval $hasproto
20183
20184 : see if ustat exists
20185 set ustat d_ustat
20186 eval $inlibc
20187
20188 : see if closedir exists
20189 set closedir d_closedir
20190 eval $inlibc
20191
20192 case "$d_closedir" in
20193 "$define")
20194         echo " "
20195         echo "Checking whether closedir() returns a status..." >&4
20196         cat > try.c <<EOM
20197 #$i_dirent I_DIRENT             /**/
20198 #$i_sysdir I_SYS_DIR            /**/
20199 #$i_sysndir I_SYS_NDIR          /**/
20200 #$i_systypes I_SYS_TYPES        /**/
20201
20202 #if defined(I_SYS_TYPES)
20203 #include <sys/types.h>
20204 #endif
20205 #if defined(I_DIRENT)
20206 #include <dirent.h>
20207 #else
20208 #ifdef I_SYS_NDIR
20209 #include <sys/ndir.h>
20210 #else
20211 #ifdef I_SYS_DIR
20212 #ifdef hp9000s500
20213 #include <ndir.h>       /* may be wrong in the future */
20214 #else
20215 #include <sys/dir.h>
20216 #endif
20217 #endif
20218 #endif
20219 #endif
20220 int main() { return closedir(opendir(".")); }
20221 EOM
20222         set try
20223         if eval $compile_ok; then
20224                 if $run ./try > /dev/null 2>&1 ; then
20225                         echo "Yes, it does."
20226                         val="$undef"
20227                 else
20228                         echo "No, it doesn't."
20229                         val="$define"
20230                 fi
20231         else
20232                 echo "(I can't seem to compile the test program--assuming it doesn't)"
20233                 val="$define"
20234         fi
20235         ;;
20236 *)
20237         val="$undef";
20238         ;;
20239 esac
20240 set d_void_closedir
20241 eval $setvar
20242 $rm_try
20243
20244 : see if there is a wait4
20245 set wait4 d_wait4
20246 eval $inlibc
20247
20248 : see if waitpid exists
20249 set waitpid d_waitpid
20250 eval $inlibc
20251
20252 : look for wcscmp
20253 echo " "
20254 $cat >try.c <<'EOCP'
20255 #include <stdio.h>
20256 #include <wchar.h>
20257 int main ()
20258 {
20259     wchar_t *s = L" ";
20260     return (wcscmp (s, s) ? 1 : 0);
20261     }
20262 EOCP
20263 set try
20264 val="$undef"
20265 if eval $compile; then
20266     `$run ./try`
20267     case "$?" in
20268         0)  echo "A working wcscmp() found." >&4
20269             val="$define" ;;
20270         *)  echo "wcscmp() found, but it doesn't work" >&4
20271             ;;
20272         esac
20273 else
20274     echo "wcscmp() NOT found." >&4
20275     fi
20276 set d_wcscmp
20277 eval $setvar
20278 $rm_try
20279
20280 : see if wcstombs exists
20281 set wcstombs d_wcstombs
20282 eval $inlibc
20283
20284 : look for wcsxfrm
20285 echo " "
20286 $cat >try.c <<'EOCP'
20287 #include <errno.h>
20288 #include <wchar.h>
20289 int main ()
20290 {
20291     wchar_t dst[4], *src = L" ";
20292     errno = 0;
20293     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20294     }
20295 EOCP
20296 set try
20297 val="$undef"
20298 if eval $compile; then
20299     `$run ./try`
20300     case "$?" in
20301         0)  echo "A working wcsxfrm() found." >&4
20302             val="$define" ;;
20303         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20304             ;;
20305         esac
20306 else
20307     echo "wcsxfrm() NOT found." >&4
20308     fi
20309 set d_wcsxfrm
20310 eval $setvar
20311 $rm_try
20312
20313 : see if wctomb exists
20314 set wctomb d_wctomb
20315 eval $inlibc
20316
20317 : see if writev exists
20318 set writev d_writev
20319 eval $inlibc
20320
20321 : check for alignment requirements
20322 echo " "
20323 case "$alignbytes" in
20324     '') echo "Checking alignment constraints..." >&4
20325         $cat >try.c <<EOCP
20326 #include <stdio.h>
20327 struct foobar {
20328     char foo;
20329     $nvtype bar;
20330 } try_algn;
20331 int main()
20332 {
20333     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20334     return(0);
20335 }
20336 EOCP
20337         set try
20338         if eval $compile_ok; then
20339             dflt=`$run ./try`
20340         else
20341             dflt='8'
20342             echo "(I can't seem to compile the test program...)"
20343         fi
20344         case "$multiarch" in
20345             *$define*)
20346                 : The usual safe value is 8, but Darwin with -Duselongdouble
20347                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20348                 : Configure to pick a larger value if needed.
20349                 if $test "$dflt" -lt 8; then
20350                     dflt='8'
20351                     echo "Setting alignment to 8 for multiarch support.">&4
20352                 fi
20353                 ;;
20354         esac
20355         ;;
20356     *) dflt="$alignbytes"
20357         ;;
20358 esac
20359 rp="Doubles must be aligned on a how-many-byte boundary?"
20360 . ./myread
20361 alignbytes="$ans"
20362 $rm_try
20363
20364 : set the base revision
20365 baserev=5.0
20366
20367 : length of character in bytes. Is always 1, otherwise it is not C
20368 : This used to be a test using sizeof
20369 charsize=1
20370
20371 : Check for the number of bits in a character
20372 case "$charbits" in
20373 '')     echo "Checking how long a character is (in bits)..." >&4
20374         $cat >try.c <<EOCP
20375 #include <stdio.h>
20376 int main ()
20377 {
20378     int n;
20379     unsigned char c;
20380     for (c = 1, n = 0; c; c <<= 1, n++) ;
20381     printf ("%d\n", n);
20382     return (0);
20383     }
20384 EOCP
20385         set try
20386         if eval $compile_ok; then
20387                 dflt=`$run ./try`
20388         else
20389                 dflt='8'
20390                 echo "(I can't seem to compile the test program.  Guessing...)"
20391         fi
20392         ;;
20393 *)
20394         dflt="$charbits"
20395         ;;
20396 esac
20397 rp="What is the length of a character (in bits)?"
20398 . ./myread
20399 charbits="$ans"
20400 $rm_try
20401 case "$charbits" in
20402 8)      ;;
20403 *)      cat >&4 << EOM
20404 Your system has an unsigned character size of $charbits bits, which
20405 is rather unusual (normally it is 8 bits).  Perl likely will not work
20406 correctly on your system, with subtle bugs in various places.
20407 EOM
20408         rp='Do you really want to continue?'
20409         dflt='n'
20410         . ./myread
20411         case "$ans" in
20412                 [yY])   echo >&4 "Okay, continuing."    ;;
20413                 *)      exit 1                          ;;
20414         esac
20415 esac
20416
20417 : how do we concatenate cpp tokens here?
20418 echo " "
20419 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20420 $cat >cpp_stuff.c <<'EOCP'
20421 #define RCAT(a,b)a/**/b
20422 #define ACAT(a,b)a ## b
20423 RCAT(Rei,ser)
20424 ACAT(Cir,cus)
20425 EOCP
20426 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20427 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20428         echo "Oh!  Smells like ANSI's been here." >&4
20429         echo "We can catify or stringify, separately or together!"
20430         cpp_stuff=42
20431 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20432         echo "Ah, yes!  The good old days!" >&4
20433         echo "However, in the good old days we don't know how to stringify and"
20434         echo "catify at the same time."
20435         cpp_stuff=1
20436 else
20437         $cat >&4 <<EOM
20438 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20439 You're going to have to edit the values of CAT[2-5] in config.h...
20440 EOM
20441         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20442 fi
20443 $rm -f cpp_stuff.*
20444
20445 : see if this is a db.h system
20446 set db.h i_db
20447 eval $inhdr
20448
20449 case "$i_db" in
20450 $define)
20451         : Check db version.
20452         echo " "
20453         echo "Checking Berkeley DB version ..." >&4
20454         $cat >try.c <<EOCP
20455 #$d_const HASCONST
20456 #ifndef HASCONST
20457 #define const
20458 #endif
20459 #include <sys/types.h>
20460 #include <stdio.h>
20461 #$i_stdlib I_STDLIB
20462 #ifdef I_STDLIB
20463 #include <stdlib.h>
20464 #endif
20465 #include <db.h>
20466 int main(int argc, char *argv[])
20467 {
20468 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20469     int Major, Minor, Patch ;
20470     unsigned long Version ;
20471     (void)db_version(&Major, &Minor, &Patch) ;
20472     if (argc == 2) {
20473         printf("%d %d %d %d %d %d\n",
20474                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20475                Major, Minor, Patch);
20476         exit(0);
20477     }
20478     printf("You have Berkeley DB Version 2 or greater.\n");
20479
20480     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20481                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20482     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20483                 Major, Minor, Patch) ;
20484
20485     /* check that db.h & libdb are compatible */
20486     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20487         printf("db.h and libdb are incompatible.\n") ;
20488         exit(3);
20489     }
20490
20491     printf("db.h and libdb are compatible.\n") ;
20492
20493     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20494                 + DB_VERSION_PATCH ;
20495
20496     /* needs to be >= 2.3.4 */
20497     if (Version < 2003004) {
20498     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20499         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20500         exit(2);
20501     }
20502
20503     exit(0);
20504 #else
20505 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20506     if (argc == 2) {
20507         printf("1 0 0\n");
20508         exit(0);
20509     }
20510     printf("You have Berkeley DB Version 1.\n");
20511     exit(0);    /* DB version < 2: the coast is clear. */
20512 #else
20513     exit(1);    /* <db.h> not Berkeley DB? */
20514 #endif
20515 #endif
20516 }
20517 EOCP
20518         set try
20519         if eval $compile_ok && $run ./try; then
20520                 echo 'Looks OK.' >&4
20521                 set `$run ./try 1`
20522                 db_version_major=$1
20523                 db_version_minor=$2
20524                 db_version_patch=$3
20525         else
20526                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20527                 i_db=$undef
20528                 case " $libs " in
20529                 *"-ldb "*)
20530                         : Remove db from list of libraries to use
20531                         echo "Removing unusable -ldb from library list" >&4
20532                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20533                         shift
20534                         libs="$*"
20535                         echo "libs = $libs" >&4
20536                         ;;
20537                 esac
20538         fi
20539         $rm_try
20540         ;;
20541 esac
20542
20543 case "$i_db" in
20544 define)
20545         : Check the return type needed for hash
20546         echo " "
20547         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20548         $cat >try.c <<EOCP
20549 #$d_const HASCONST
20550 #ifndef HASCONST
20551 #define const
20552 #endif
20553 #include <sys/types.h>
20554 #include <db.h>
20555
20556 #ifndef DB_VERSION_MAJOR
20557 u_int32_t hash_cb (const void* ptr, size_t size)
20558 {
20559 }
20560 HASHINFO info;
20561 int main()
20562 {
20563         info.hash = hash_cb;
20564 }
20565 #endif
20566 EOCP
20567         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20568                 if $contains warning try.out >>/dev/null 2>&1 ; then
20569                         db_hashtype='int'
20570                 else
20571                         db_hashtype='u_int32_t'
20572                 fi
20573         else
20574                 : XXX Maybe we should just give up here.
20575                 db_hashtype=u_int32_t
20576                 $cat try.out >&4
20577                 echo "Help:  I can't seem to compile the db test program." >&4
20578                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20579         fi
20580         $rm_try
20581         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20582         ;;
20583 *)      db_hashtype=u_int32_t
20584         ;;
20585 esac
20586 case "$i_db" in
20587 define)
20588         : Check the return type needed for prefix
20589         echo " "
20590         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20591         cat >try.c <<EOCP
20592 #$d_const HASCONST
20593 #ifndef HASCONST
20594 #define const
20595 #endif
20596 #include <sys/types.h>
20597 #include <db.h>
20598
20599 #ifndef DB_VERSION_MAJOR
20600 size_t prefix_cb (const DBT *key1, const DBT *key2)
20601 {
20602 }
20603 BTREEINFO info;
20604 int main()
20605 {
20606         info.prefix = prefix_cb;
20607 }
20608 #endif
20609 EOCP
20610         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20611                 if $contains warning try.out >>/dev/null 2>&1 ; then
20612                         db_prefixtype='int'
20613                 else
20614                         db_prefixtype='size_t'
20615                 fi
20616         else
20617                 db_prefixtype='size_t'
20618                 : XXX Maybe we should just give up here.
20619                 $cat try.out >&4
20620                 echo "Help:  I can't seem to compile the db test program." >&4
20621                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20622         fi
20623         $rm_try
20624         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20625         ;;
20626 *)      db_prefixtype='size_t'
20627         ;;
20628 esac
20629
20630 : Include . in @INC
20631 $cat <<EOM
20632
20633 Historically Perl has provided a final fallback of the current working
20634 directory '.' when searching for a library. This, however, can lead to
20635 problems when a Perl program which loads optional modules is called from
20636 a shared directory. This can lead to executing unexpected code.
20637
20638 EOM
20639
20640 # When changing to exclude by default:
20641 case "$default_inc_excludes_dot" in
20642     $undef|false|[nN]*) dflt="n" ;;
20643     *)                  dflt="y" ;;
20644 esac
20645 # To turn exclude off by default:
20646 #case "$default_inc_excludes_dot" in
20647 #    $define|true|[yY]*) dflt="y" ;;
20648 #    *)                  dflt="n" ;;
20649 #esac
20650
20651 rp='Exclude '.' from @INC by default? '
20652 . ./myread
20653 case "$ans" in
20654     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20655     *)          default_inc_excludes_dot="$define" ;;
20656 esac
20657
20658 : Check what kind of inf/nan your system has
20659 $echo "Checking the kind of infinities and nans you have..." >&4
20660 $echo "(The following tests may crash.  That's okay.)" >&4
20661 $cat >try.c <<EOP
20662 #define DOUBLESIZE $doublesize
20663 #$d_longdbl HAS_LONG_DOUBLE
20664 #ifdef HAS_LONG_DOUBLE
20665 #define LONG_DOUBLESIZE $longdblsize
20666 #define LONG_DOUBLEKIND $longdblkind
20667 #endif
20668 #$i_math I_MATH
20669 #ifdef I_MATH
20670 #include <math.h>
20671 #endif
20672 #include <stdio.h>
20673 /* Note that whether the sign bit is on or off
20674  * for NaN depends on the CPU/FPU, and possibly
20675  * can be affected by the build toolchain.
20676  *
20677  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20678  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20679  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20680  * (respectively) as opposed to the more usual
20681  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20682  *
20683  * Pre-IEEE-754 floating point format do not even have inf/nan support
20684  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20685  * to even mention, causing immediate SIGFPE or equivalent: this is
20686  * the case with VAX floating point, for example.
20687  */
20688 static void bytes(unsigned char *p, unsigned int n) {
20689   int i;
20690   for (i = 0; i < n; i++) {
20691     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20692   }
20693 }
20694 int main(int argc, char *argv[]) {
20695    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20696     * because some compilers are 'smart' and not only warn but refuse to
20697     * compile such 'illegal' values. */
20698    double dinf = exp(1e9);
20699    double dnan = sqrt(-1.0);
20700 #ifdef HAS_LONG_DOUBLE
20701    long double ldinf = (long double)exp(1e9);
20702    long double ldnan = (long double)sqrt(-1.0);
20703 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20704 /* the 80-bit long doubles might have garbage in their excess bytes */
20705     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20706     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20707 # endif
20708   if (argc == 2) {
20709     switch (argv[1][0]) {
20710     case '1': bytes(&dinf, sizeof(dinf)); break;
20711     case '2': bytes(&dnan, sizeof(dnan)); break;
20712     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20713     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20714 #endif
20715     }
20716   }
20717   return 0;
20718 }
20719 EOP
20720 set try
20721 if eval $compile; then
20722     doubleinfbytes=`$run ./try 1`
20723     doublenanbytes=`$run ./try 2`
20724     case "$d_longdbl" in
20725     $define)
20726       longdblinfbytes=`$run ./try 3`
20727       longdblnanbytes=`$run ./try 4`
20728       ;;
20729     esac
20730 else
20731     # Defaults in case the above test program failed.
20732     case "$doublekind" in
20733     1) # IEEE 754 32-bit LE
20734        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20735        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20736        ;;
20737     2) # IEEE 754 32-bit BE
20738        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20739        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20740        ;;
20741     3) # IEEE 754 64-bit LE
20742        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20743        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20744        ;;
20745     4) # IEEE 754 64-bit BE
20746        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20747        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20748        ;;
20749     5) # IEEE 754 128-bit LE
20750        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20751        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20752        ;;
20753     6) # IEEE 754 128-bit BE
20754        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20755        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20756        ;;
20757     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20758        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20759        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20760        ;;
20761     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20762        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20763        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20764        ;;
20765     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20766        doubleinfbytes=$undef
20767        doublenanbytes=$undef
20768        ;;
20769     *) # No idea.
20770        doubleinfbytes=$undef
20771        doublenanbytes=$undef
20772        ;;
20773     esac
20774     case "$longdblkind" in
20775     1) # IEEE 754 128-bit LE
20776        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20777        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20778        ;;
20779     2) # IEEE 754 128-bit BE
20780        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20781        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20782        ;;
20783     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20784        case "$longdblsize" in
20785        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20786            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20787            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20788            ;;
20789        16) # x86_64
20790            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20791            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20792            ;;
20793        *)  # No idea.
20794            longdblinfbytes=$undef
20795            longdblnanbytes=$undef
20796        ;;
20797        esac
20798        ;;
20799     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20800        case "$longdblsize" in
20801        12) # 32-bit system
20802            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20803            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20804            ;;
20805        16) # 64-bit system
20806            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20807            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20808            ;;
20809        *)  # No idea.
20810            longdblinfbytes=$undef
20811            longdblnanbytes=$undef
20812        ;;
20813        esac
20814        ;;
20815     5) # 128-bit LE-LE "double double"
20816        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20817        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20818        ;;
20819     6) # 128-bit BE-BE "double double"
20820        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20821        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20822        ;;
20823     7) # 128-bit LE-BE "double double"
20824        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20825        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20826        ;;
20827     8) # 128-bit BE-LE "double double"
20828        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20829        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20830        ;;
20831     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20832        longdblinfbytes=$undef
20833        longdblnanbytes=$undef
20834        ;;
20835     *) # No idea.
20836        longdblinfbytes=$undef
20837        longdblnanbytes=$undef
20838        ;;
20839     esac
20840 fi
20841 # In case the program crashed the values are empty, turn them undef.
20842 case "$doubleinfbytes" in
20843 '') doubleinfbytes=$undef ;;
20844 esac
20845 case "$doublenanbytes" in
20846 '') doublenanbytes=$undef ;;
20847 esac
20848 case "$longdblinfbytes" in
20849 '') longdblinfbytes=$undef ;;
20850 esac
20851 case "$longdblnanbytes" in
20852 '') longdblnanbytes=$undef ;;
20853 esac
20854 $rm_try
20855
20856 : Check the length of the double mantissa
20857 $echo "Checking how many mantissa bits your doubles have..." >&4
20858 $cat >try.c <<EOP
20859 #$i_float I_FLOAT
20860 #$i_sunmath I_SUNMATH
20861 #ifdef I_FLOAT
20862 # include <float.h>
20863 #endif
20864 #ifdef I_SUNMATH
20865 # include <sunmath.h>
20866 #endif
20867 #ifdef DBL_MANT_DIG
20868 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20869 #endif
20870 #include <stdio.h>
20871 int main(int argc, char *argv[]) {
20872 #ifdef BITS
20873   printf("%d\n", BITS);
20874 #endif
20875   return 0;
20876 }
20877 EOP
20878 set try
20879 if eval $compile; then
20880     doublemantbits=`$run ./try`
20881 else
20882     doublemantbits="$undef"
20883 fi
20884 $rm_try
20885
20886 : Check the length of the longdouble mantissa
20887 $echo "Checking how many mantissa bits your long doubles have..." >&4
20888 $cat >try.c <<EOP
20889 #$i_float I_FLOAT
20890 #$i_sunmath I_SUNMATH
20891 #ifdef I_FLOAT
20892 # include <float.h>
20893 #endif
20894 #ifdef I_SUNMATH
20895 # include <sunmath.h>
20896 #endif
20897 #$d_longdbl HAS_LONG_DOUBLE
20898 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20899 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20900 /* This format has no implicit bit.  Beware, however, that for
20901  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20902  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20903  * and the top bit must have been one since 387, zero is plain invalid.
20904  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20905 #  define BITS LDBL_MANT_DIG
20906 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20907 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20908  * reason e.g. Irix thinks 107.  But in any case, we want only
20909  * the number of real bits, the implicit bits are of no interest.  */
20910 #  define BITS 2 * (DBL_MANT_DIG - 1)
20911 # else
20912 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20913 # endif
20914 #endif
20915 #include <stdio.h>
20916 int main(int argc, char *argv[]) {
20917 #ifdef BITS
20918   printf("%d\n", BITS);
20919 #endif
20920   return 0;
20921 }
20922 EOP
20923 set try
20924 if eval $compile; then
20925     longdblmantbits=`$run ./try`
20926 else
20927     longdblmantbits="$undef"
20928 fi
20929 $rm_try
20930
20931 : Check the length of the NV mantissa
20932 $echo "Checking how many mantissa bits your NVs have..." >&4
20933 if test "X$usequadmath" = "X$define"; then
20934   nvmantbits=112 # 128-1-15
20935 else
20936   if test "X$nvsize" = "X$doublesize"; then
20937     nvmantbits="$doublemantbits"
20938   else
20939      if test "X$nvsize" = "X$longdblsize"; then
20940        nvmantbits="$longdblmantbits"
20941      else
20942        nvmantbits="$undef"
20943      fi
20944   fi
20945 fi
20946
20947 : How can we generate normalized random numbers ?
20948 echo " "
20949 echo "Using our internal random number implementation..." >&4
20950
20951 case "$ccflags" in
20952 *-Dmy_rand=*|*-Dmy_srand=*)
20953         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20954         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20955         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20956         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20957         ;;
20958 esac
20959
20960 randfunc=Perl_drand48
20961 drand01="Perl_drand48()"
20962 seedfunc="Perl_drand48_init"
20963 randbits=48
20964 randseedtype=U32
20965
20966 : Probe whether dtrace builds an object, as newer Illumos requires an input
20967 : object file that uses at least one of the probes defined in the .d file
20968 case "$usedtrace" in
20969 $define)
20970     case "$dtracexnolibs" in
20971     $define|true|[yY]*)
20972         dtracexnolibs=$define
20973         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20974         ;;
20975     ' '|'')
20976         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20977              dtracexnolibs=$define
20978              echo "Your dtrace accepts -xnolibs"
20979         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20980              dtracexnolibs=$undef
20981              echo "Your dtrace doesn't accept -xnolibs"
20982         else
20983              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20984              exit 1
20985         fi
20986         ;;
20987     *)
20988         dtracexnolibs=$undef
20989         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20990         ;;
20991     esac
20992     case $dtracexnolibs in
20993     $define) xnolibs=-xnolibs ;;
20994     *) xnolibs= ;;
20995     esac
20996
20997     case "$dtraceobject" in
20998     $define|true|[yY]*)
20999         dtraceobject=$define
21000         ;;
21001     ' '|'')
21002         $cat >try.c <<EOM
21003 #include "perldtrace.h"
21004 int main(void) {
21005     PERL_LOADED_FILE("dummy");
21006     return 0;
21007 }
21008 EOM
21009         dtraceobject=$undef
21010         if $cc -c -o try.o $optimize $ccflags try.c \
21011                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
21012                 dtraceobject=$define
21013             echo "Your dtrace builds an object file"
21014         fi
21015         ;;
21016     *) dtraceobject=$undef ;;
21017     esac
21018     $rm -f try.c try.o perldtrace.o perldtrace.h
21019 esac
21020
21021 : Determine if this is an EBCDIC system
21022 echo " "
21023 echo "Determining whether or not we are on an EBCDIC system..." >&4
21024 $cat >try.c <<'EOM'
21025 int main()
21026 {
21027   if ('M'==0xd4) return 0;
21028   return 1;
21029 }
21030 EOM
21031
21032 val=$undef
21033 set try
21034 if eval $compile_ok; then
21035         if $run ./try; then
21036                 echo "You seem to speak EBCDIC." >&4
21037                 val="$define"
21038         else
21039                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
21040         fi
21041 else
21042         echo "I'm unable to compile the test program." >&4
21043         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
21044 fi
21045 $rm_try
21046 set ebcdic
21047 eval $setvar
21048
21049 : Check how to flush
21050 echo " "
21051 $cat >&4 <<EOM
21052 Checking how to flush all pending stdio output...
21053 EOM
21054 # I only know how to find the first 32 possibly open files on SunOS.
21055 # See also hints/sunos_4_1.sh and util.c  --AD
21056 case "$osname" in
21057 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
21058 esac
21059 $cat >>try.c <<EOCP
21060 #include <stdio.h>
21061 #$i_stdlib I_STDLIB
21062 #ifdef I_STDLIB
21063 #include <stdlib.h>
21064 #endif
21065 #$i_unistd I_UNISTD
21066 #ifdef I_UNISTD
21067 # include <unistd.h>
21068 #endif
21069 #$d_sysconf HAS_SYSCONF
21070 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
21071 #ifdef HAS_STDIO_STREAM_ARRAY
21072 # define STDIO_STREAM_ARRAY $stdio_stream_array
21073 #endif
21074 int main() {
21075   FILE* p;
21076   unlink("try.out");
21077   p = fopen("try.out", "w");
21078 #ifdef TRY_FPUTC
21079   fputc('x', p);
21080 #else
21081 # ifdef TRY_FPRINTF
21082   fprintf(p, "x");
21083 # endif
21084 #endif
21085 #ifdef TRY_FFLUSH_NULL
21086   fflush(NULL);
21087 #endif
21088 #ifdef TRY_FFLUSH_ALL
21089   {
21090     long open_max = -1;
21091 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
21092     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
21093 # else
21094 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
21095     open_max = sysconf(_SC_OPEN_MAX);
21096 #  else
21097 #   ifdef FOPEN_MAX
21098     open_max = FOPEN_MAX;
21099 #   else
21100 #    ifdef OPEN_MAX
21101     open_max = OPEN_MAX;
21102 #    else
21103 #     ifdef _NFILE
21104     open_max = _NFILE;
21105 #     endif
21106 #    endif
21107 #   endif
21108 #  endif
21109 # endif
21110 # ifdef HAS_STDIO_STREAM_ARRAY
21111     if (open_max > 0) {
21112       long i;
21113       for (i = 0; i < open_max; i++)
21114             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
21115                 STDIO_STREAM_ARRAY[i]._file < open_max &&
21116                 STDIO_STREAM_ARRAY[i]._flag)
21117                 fflush(&STDIO_STREAM_ARRAY[i]);
21118     }
21119   }
21120 # endif
21121 #endif
21122   _exit(42);
21123 }
21124 EOCP
21125 : first we have to find out how _not_ to flush
21126 $to try.c
21127 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
21128     output=''
21129     set try -DTRY_FPUTC
21130     if eval $compile; then
21131             $run ./try 2>/dev/null
21132             code="$?"
21133             $from try.out
21134             if $test ! -s try.out -a "X$code" = X42; then
21135                 output=-DTRY_FPUTC
21136             fi
21137     fi
21138     case "$output" in
21139     '')
21140             set try -DTRY_FPRINTF
21141             if eval $compile; then
21142                     $run ./try 2>/dev/null
21143                     code="$?"
21144                     $from try.out
21145                     if $test ! -s try.out -a "X$code" = X42; then
21146                         output=-DTRY_FPRINTF
21147                     fi
21148             fi
21149         ;;
21150     esac
21151 fi
21152 : check for fflush NULL behavior
21153 case "$fflushNULL" in
21154 '')     set try -DTRY_FFLUSH_NULL $output
21155         if eval $compile; then
21156                 $run ./try 2>/dev/null
21157                 code="$?"
21158                 $from try.out
21159                 if $test -s try.out -a "X$code" = X42; then
21160                         fflushNULL="`$cat try.out`"
21161                 else
21162                         if $test "X$code" != X42; then
21163                                 $cat >&4 <<EOM
21164 (If this test failed, don't worry, we'll try another method shortly.)
21165 EOM
21166                         fi
21167                 fi
21168         fi
21169         $rm -f core try.core core.try.*
21170         case "$fflushNULL" in
21171         x)      $cat >&4 <<EOM
21172 Your fflush(NULL) works okay for output streams.
21173 Let's see if it clobbers input pipes...
21174 EOM
21175 # As of mid-March 2000 all versions of Solaris appear to have a stdio
21176 # bug that improperly flushes the input end of pipes.  So we avoid the
21177 # autoflush on fork/system/exec support for now. :-(
21178 $cat >tryp.c <<EOCP
21179 #include <stdio.h>
21180 int
21181 main(int argc, char **argv)
21182 {
21183     char buf[1024];
21184     int i;
21185     char *bp = buf;
21186     while (1) {
21187         while ((i = getc(stdin)) != -1
21188                && (*bp++ = i) != '\n'
21189                && bp < &buf[1024])
21190         /* DO NOTHING */ ;
21191         *bp = '\0';
21192         fprintf(stdout, "%s", buf);
21193         fflush(NULL);
21194         if (i == -1)
21195             return 0;
21196         bp = buf;
21197     }
21198 }
21199 EOCP
21200                 fflushNULL="$define"
21201                 set tryp
21202                 if eval $compile; then
21203                     $rm -f tryp.out
21204                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
21205                     if $test "X$targethost" != X; then
21206                         $to tryp.c
21207                         $to tryp
21208                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21209                     else
21210                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21211                     fi
21212                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
21213                        $cat >&4 <<EOM
21214 fflush(NULL) seems to behave okay with input streams.
21215 EOM
21216                         fflushNULL="$define"
21217                     else
21218                         $cat >&4 <<EOM
21219 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
21220 EOM
21221                         fflushNULL="$undef"
21222                     fi
21223                 fi
21224                 $rm -f core tryp.c tryp.core core.tryp.*
21225                 ;;
21226         '')     $cat >&4 <<EOM
21227 Your fflush(NULL) isn't working (contrary to ANSI C).
21228 EOM
21229                 fflushNULL="$undef"
21230                 ;;
21231         *)      $cat >&4 <<EOM
21232 Cannot figure out whether your fflush(NULL) works or not.
21233 I'm assuming it doesn't (contrary to ANSI C).
21234 EOM
21235                 fflushNULL="$undef"
21236                 ;;
21237         esac
21238         ;;
21239 $define|true|[yY]*)
21240         fflushNULL="$define"
21241         ;;
21242 *)
21243         fflushNULL="$undef"
21244         ;;
21245 esac
21246 : check explicit looping only if NULL did not work, and if the pipe
21247 : bug does not show up on an explicit flush too
21248 case "$fflushNULL" in
21249 "$undef")
21250         $cat >tryp.c <<EOCP
21251 #include <stdio.h>
21252 int
21253 main(int argc, char **argv)
21254 {
21255     char buf[1024];
21256     int i;
21257     char *bp = buf;
21258     while (1) {
21259         while ((i = getc(stdin)) != -1
21260                && (*bp++ = i) != '\n'
21261                && bp < &buf[1024])
21262         /* DO NOTHING */ ;
21263         *bp = '\0';
21264         fprintf(stdout, "%s", buf);
21265         fflush(stdin);
21266         if (i == -1)
21267             return 0;
21268         bp = buf;
21269     }
21270 }
21271 EOCP
21272         set tryp
21273         if eval $compile; then
21274             $rm -f tryp.out
21275             if $test "X$targethost" != X; then
21276                 $to tryp.c
21277                 $to tryp
21278                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21279             else
21280                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21281             fi
21282             if cmp tryp.c tryp.out >/dev/null 2>&1; then
21283                $cat >&4 <<EOM
21284 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
21285 EOM
21286                 : now check for fflushall behaviour
21287                 case "$fflushall" in
21288                 '')     set try -DTRY_FFLUSH_ALL $output
21289                         if eval $compile; then
21290                                 $cat >&4 <<EOM
21291 (Now testing the other method--but note that this also may fail.)
21292 EOM
21293                                 $run ./try 2>/dev/null
21294                                 code=$?
21295                                 $from try.out
21296                                 if $test -s try.out -a "X$code" = X42; then
21297                                         fflushall="`$cat try.out`"
21298                                 fi
21299                         fi
21300                         $rm_try
21301                         case "$fflushall" in
21302                         x)      $cat >&4 <<EOM
21303 Whew. Flushing explicitly all the stdio streams works.
21304 EOM
21305                                 fflushall="$define"
21306                                 ;;
21307                         '')     $cat >&4 <<EOM
21308 Sigh. Flushing explicitly all the stdio streams doesn't work.
21309 EOM
21310                                 fflushall="$undef"
21311                                 ;;
21312                         *)      $cat >&4 <<EOM
21313 Cannot figure out whether flushing stdio streams explicitly works or not.
21314 I'm assuming it doesn't.
21315 EOM
21316                                 fflushall="$undef"
21317                                 ;;
21318                         esac
21319                         ;;
21320                 "$define"|true|[yY]*)
21321                         fflushall="$define"
21322                         ;;
21323                 *)
21324                         fflushall="$undef"
21325                         ;;
21326                 esac
21327             else
21328                 $cat >&4 <<EOM
21329 All is futile.  Even fflush(stdin) clobbers input pipes!
21330 EOM
21331                 fflushall="$undef"
21332             fi
21333         else
21334             fflushall="$undef"
21335         fi
21336         $rm -f core tryp.c tryp.core core.tryp.*
21337         ;;
21338 *)      fflushall="$undef"
21339         ;;
21340 esac
21341
21342 case "$fflushNULL$fflushall" in
21343 undefundef)
21344         $cat <<EOM
21345 OK, I give up.  I cannot figure out how to flush pending stdio output.
21346 We won't be flushing handles at all before fork/exec/popen.
21347 EOM
21348         ;;
21349 esac
21350 $rm_try tryp
21351
21352 : Store the full pathname to the ar program for use in the C program
21353 : Respect a hint or command line value for full_ar.
21354 case "$full_ar" in
21355 '') full_ar=$ar ;;
21356 esac
21357
21358 : Store the full pathname to the sed program for use in the C program
21359 full_sed=$sed
21360
21361 : see what type gids are declared as in the kernel
21362 echo " "
21363 echo "Looking for the type for group ids returned by getgid()."
21364 set gid_t gidtype xxx stdio.h sys/types.h
21365 eval $typedef
21366 case "$gidtype" in
21367 xxx)
21368         xxx=`./findhdr sys/user.h`
21369         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21370         case $1 in
21371         unsigned) dflt="$1 $2" ;;
21372         *) dflt="$1" ;;
21373         esac
21374         ;;
21375 *) dflt="$gidtype";;
21376 esac
21377 case "$gidtype" in
21378 gid_t) echo "gid_t found." ;;
21379 *)      rp="What is the type for group ids returned by getgid()?"
21380         . ./myread
21381         gidtype="$ans"
21382         ;;
21383 esac
21384
21385 : Check the size of GID
21386 echo " "
21387 case "$gidtype" in
21388 *_t) zzz="$gidtype"     ;;
21389 *)   zzz="gid"          ;;
21390 esac
21391 echo "Checking the size of $zzz..." >&4
21392 cat > try.c <<EOCP
21393 #include <sys/types.h>
21394 #include <stdio.h>
21395 #$i_stdlib I_STDLIB
21396 #ifdef I_STDLIB
21397 #include <stdlib.h>
21398 #endif
21399 int main() {
21400     printf("%d\n", (int)sizeof($gidtype));
21401     exit(0);
21402 }
21403 EOCP
21404 set try
21405 if eval $compile_ok; then
21406         yyy=`$run ./try`
21407         case "$yyy" in
21408         '')     gidsize=4
21409                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21410                 ;;
21411         *)      gidsize=$yyy
21412                 echo "Your $zzz is $gidsize bytes long."
21413                 ;;
21414         esac
21415 else
21416         gidsize=4
21417         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21418 fi
21419
21420
21421 : Check if GID is signed
21422 echo " "
21423 case "$gidtype" in
21424 *_t) zzz="$gidtype"     ;;
21425 *)   zzz="gid"          ;;
21426 esac
21427 echo "Checking the sign of $zzz..." >&4
21428 cat > try.c <<EOCP
21429 #include <sys/types.h>
21430 #include <stdio.h>
21431 int main() {
21432         $gidtype foo = -1;
21433         if (foo < 0)
21434                 printf("-1\n");
21435         else
21436                 printf("1\n");
21437 }
21438 EOCP
21439 set try
21440 if eval $compile; then
21441         yyy=`$run ./try`
21442         case "$yyy" in
21443         '')     gidsign=1
21444                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21445                 ;;
21446         *)      gidsign=$yyy
21447                 case "$gidsign" in
21448                  1) echo "Your $zzz is unsigned." ;;
21449                 -1) echo "Your $zzz is signed."   ;;
21450                 esac
21451                 ;;
21452         esac
21453 else
21454         gidsign=1
21455         echo "(I can't compile the test program--guessing unsigned.)" >&4
21456 fi
21457
21458
21459 : Check 64bit sizes
21460 echo " "
21461
21462 if $test X"$quadtype" != X; then
21463
21464 echo "Checking how to print 64-bit integers..." >&4
21465
21466 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21467         $cat >try.c <<'EOCP'
21468 #include <sys/types.h>
21469 #include <stdio.h>
21470 int main() {
21471   int q = 12345678901;
21472   printf("%ld\n", q);
21473 }
21474 EOCP
21475         set try
21476         if eval $compile; then
21477                 yyy=`$run ./try`
21478                 case "$yyy" in
21479                 12345678901)
21480                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21481                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21482                         echo "We will use %d."
21483                         ;;
21484                 esac
21485         fi
21486 fi
21487
21488 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21489         $cat >try.c <<'EOCP'
21490 #include <sys/types.h>
21491 #include <stdio.h>
21492 int main() {
21493   long q = 12345678901;
21494   printf("%ld\n", q);
21495 }
21496 EOCP
21497         set try
21498         if eval $compile; then
21499                 yyy=`$run ./try`
21500                 case "$yyy" in
21501                 12345678901)
21502                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21503                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21504                         echo "We will use %ld."
21505                         ;;
21506                 esac
21507         fi
21508 fi
21509
21510 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21511         $cat >try.c <<'EOCP'
21512 #include <sys/types.h>
21513 #include <inttypes.h>
21514 #include <stdio.h>
21515 int main() {
21516   int64_t q = 12345678901;
21517   printf("%" PRId64 "\n", q);
21518 }
21519 EOCP
21520         set try
21521         if eval $compile; then
21522                 yyy=`$run ./try`
21523                 case "$yyy" in
21524                 12345678901)
21525                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21526                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21527                         echo "We will use the C9X style."
21528                         ;;
21529                 esac
21530         fi
21531 fi
21532
21533 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21534         $cat >try.c <<EOCP
21535 #include <sys/types.h>
21536 #include <stdio.h>
21537 int main() {
21538   $quadtype q = 12345678901;
21539   printf("%Ld\n", q);
21540 }
21541 EOCP
21542         set try
21543         if eval $compile; then
21544                 yyy=`$run ./try`
21545                 case "$yyy" in
21546                 12345678901)
21547                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21548                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21549                         echo "We will use %Ld."
21550                         ;;
21551                 esac
21552         fi
21553 fi
21554
21555 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21556         $cat >try.c <<'EOCP'
21557 #include <sys/types.h>
21558 #include <stdio.h>
21559 int main() {
21560   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21561   printf("%lld\n", q);
21562 }
21563 EOCP
21564         set try
21565         if eval $compile; then
21566                 yyy=`$run ./try`
21567                 case "$yyy" in
21568                 12345678901)
21569                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21570                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21571                         echo "We will use the %lld style."
21572                         ;;
21573                 esac
21574         fi
21575 fi
21576
21577 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21578         $cat >try.c <<EOCP
21579 #include <sys/types.h>
21580 #include <stdio.h>
21581 int main() {
21582   $quadtype q = 12345678901;
21583   printf("%qd\n", q);
21584 }
21585 EOCP
21586         set try
21587         if eval $compile; then
21588                 yyy=`$run ./try`
21589                 case "$yyy" in
21590                 12345678901)
21591                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21592                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21593                         echo "We will use %qd."
21594                         ;;
21595                 esac
21596         fi
21597 fi
21598
21599 if $test X"$sPRId64" = X; then
21600         echo "Cannot figure out how to print 64-bit integers." >&4
21601 fi
21602 $rm_try
21603
21604 fi
21605
21606 case "$sPRId64" in
21607 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21608         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21609         ;;
21610 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21611         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21612         ;;
21613 esac
21614
21615 : Check format strings for internal types
21616 echo " "
21617 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21618
21619 if $test X"$ivsize" = X8; then
21620         ivdformat="$sPRId64"
21621         uvuformat="$sPRIu64"
21622         uvoformat="$sPRIo64"
21623         uvxformat="$sPRIx64"
21624         uvXUformat="$sPRIXU64"
21625 else
21626         if $test X"$ivsize" = X"$longsize"; then
21627                 ivdformat='"ld"'
21628                 uvuformat='"lu"'
21629                 uvoformat='"lo"'
21630                 uvxformat='"lx"'
21631                 uvXUformat='"lX"'
21632         else
21633                 if $test X"$ivsize" = X"$intsize"; then
21634                         ivdformat='"d"'
21635                         uvuformat='"u"'
21636                         uvoformat='"o"'
21637                         uvxformat='"x"'
21638                         uvXUformat='"X"'
21639                 else
21640                         : far out
21641                         if $test X"$ivsize" = X"$shortsize"; then
21642                                 ivdformat='"hd"'
21643                                 uvuformat='"hu"'
21644                                 uvoformat='"ho"'
21645                                 uvxformat='"hx"'
21646                                 uvXUformat='"hX"'
21647                         fi
21648                 fi
21649         fi
21650 fi
21651
21652 if $test X"$usequadmath" = X"$define"; then
21653     nveformat='"Qe"'
21654     nvfformat='"Qf"'
21655     nvgformat='"Qg"'
21656     nvEUformat='"QE"'
21657     nvFUformat='"QF"'
21658     nvGUformat='"QG"'
21659 else
21660     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21661         nveformat="$sPRIeldbl"
21662         nvfformat="$sPRIfldbl"
21663         nvgformat="$sPRIgldbl"
21664         nvEUformat="$sPRIEUldbl"
21665         nvFUformat="$sPRIFUldbl"
21666         nvGUformat="$sPRIGUldbl"
21667     else
21668         nveformat='"e"'
21669         nvfformat='"f"'
21670         nvgformat='"g"'
21671         nvEUformat='"E"'
21672         nvFUformat='"F"'
21673         nvGUformat='"G"'
21674     fi
21675 fi
21676
21677 case "$ivdformat" in
21678 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21679     exit 1
21680     ;;
21681 esac
21682
21683 : Check format string for GID
21684
21685 echo " "
21686 $echo "Checking the format string to be used for gids..." >&4
21687
21688 case "$gidsign" in
21689 -1)     if $test X"$gidsize" = X"$ivsize"; then
21690                 gidformat="$ivdformat"
21691         else
21692                 if $test X"$gidsize" = X"$longsize"; then
21693                         gidformat='"ld"'
21694                 else
21695                         if $test X"$gidsize" = X"$intsize"; then
21696                                 gidformat='"d"'
21697                         else
21698                                 if $test X"$gidsize" = X"$shortsize"; then
21699                                         gidformat='"hd"'
21700                                 fi
21701                         fi
21702                 fi
21703         fi
21704         ;;
21705 *)      if $test X"$gidsize" = X"$uvsize"; then
21706                 gidformat="$uvuformat"
21707         else
21708                 if $test X"$gidsize" = X"$longsize"; then
21709                         gidformat='"lu"'
21710                 else
21711                         if $test X"$gidsize" = X"$intsize"; then
21712                                 gidformat='"u"'
21713                         else
21714                                 if $test X"$gidsize" = X"$shortsize"; then
21715                                         gidformat='"hu"'
21716                                 fi
21717                         fi
21718                 fi
21719         fi
21720         ;;
21721 esac
21722
21723 : see if getgroups exists
21724 set getgroups d_getgrps
21725 eval $inlibc
21726
21727 : see if setgroups exists
21728 set setgroups d_setgrps
21729 eval $inlibc
21730
21731 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21732 echo " "
21733 case "$d_getgrps$d_setgrps" in
21734 *define*)
21735         case "$groupstype" in
21736         '') dflt="$gidtype" ;;
21737         *)  dflt="$groupstype" ;;
21738         esac
21739         $cat <<EOM
21740 What type of pointer is the second argument to getgroups() and setgroups()?
21741 Usually this is the same as group ids, $gidtype, but not always.
21742
21743 EOM
21744         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21745         . ./myread
21746         groupstype="$ans"
21747         ;;
21748 *)  groupstype="$gidtype";;
21749 esac
21750
21751 : check whether make sets MAKE
21752 echo " "
21753 echo "Checking if your $make program sets \$(MAKE)..." >&4
21754 case "$make_set_make" in
21755 '')
21756         $sed 's/^X //' > testmake.mak << 'EOF'
21757 Xall:
21758 X       @echo 'maketemp="$(MAKE)"'
21759 EOF
21760         case "`$make -f testmake.mak 2>/dev/null`" in
21761         *maketemp=*) make_set_make='#' ;;
21762         *)      make_set_make="MAKE=$make" ;;
21763         esac
21764         $rm -f testmake.mak
21765         ;;
21766 esac
21767 case "$make_set_make" in
21768 '#') echo "Yup, it does.";;
21769 *) echo "Nope, it doesn't.";;
21770 esac
21771
21772 : see what type is used for mode_t
21773 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21774 set mode_t modetype int stdio.h sys/types.h
21775 eval $typedef_ask
21776
21777 : see if we need va_copy
21778 echo " "
21779 case "$i_stdarg" in
21780 "$define")
21781         $cat >try.c <<EOCP
21782 #include <stdarg.h>
21783 #include <stdio.h>
21784 #$i_stdlib I_STDLIB
21785 #ifdef I_STDLIB
21786 #include <stdlib.h>
21787 #endif
21788 #include <signal.h>
21789
21790 int
21791 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21792 {
21793   return vfprintf(f, fmt, *valp);
21794 }
21795
21796 int
21797 myvfprintf(FILE *f, const  char *fmt, va_list val)
21798 {
21799   return ivfprintf(f, fmt, &val);
21800 }
21801
21802 int
21803 myprintf(char *fmt, ...)
21804 {
21805   va_list val;
21806   va_start(val, fmt);
21807   return myvfprintf(stdout, fmt, val);
21808 }
21809
21810 int
21811 main(int ac, char **av)
21812 {
21813   signal(SIGSEGV, exit);
21814
21815   myprintf("%s%cs all right, then\n", "that", '\'');
21816   exit(0);
21817 }
21818 EOCP
21819         set try
21820         if eval $compile && $run ./try 2>&1 >/dev/null; then
21821                 case "`$run ./try`" in
21822                 "that's all right, then")
21823                         okay=yes
21824                         ;;
21825                 esac
21826         fi
21827         case "$okay" in
21828         yes)    echo "It seems that you don't need va_copy()." >&4
21829                 need_va_copy="$undef"
21830                 ;;
21831         *)      echo "It seems that va_copy() or similar will be needed." >&4
21832                 need_va_copy="$define"
21833                 ;;
21834         esac
21835         $rm_try
21836         ;;
21837 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21838         need_va_copy="$undef"
21839         ;;
21840 esac
21841
21842 : see what type is used for size_t
21843 rp="What is the type used for the length parameter for string functions?"
21844 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21845 eval $typedef_ask
21846
21847 : check for type of arguments to gethostbyaddr.
21848 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21849         case "$d_gethbyaddr" in
21850         $define)
21851                 $cat <<EOM
21852
21853 Checking to see what type of arguments are accepted by gethostbyaddr().
21854 EOM
21855                 hdrs="$define sys/types.h
21856                         $d_socket sys/socket.h
21857                         $i_niin netinet/in.h
21858                         $i_netdb netdb.h
21859                         $i_unistd unistd.h"
21860                 : The first arg can 'char *' or 'void *'
21861                 : The second arg is some of integral type
21862                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21863                         for yyy in size_t long int; do
21864                                 case "$netdb_host_type" in
21865                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21866                                         if ./protochk "$try" $hdrs; then
21867                                                 echo "Your system accepts $xxx for the first arg."
21868                                                 echo "...and $yyy for the second arg."
21869                                                 netdb_host_type="$xxx"
21870                                                 netdb_hlen_type="$yyy"
21871                                         fi
21872                                         ;;
21873                                 esac
21874                         done
21875                 done
21876                 : In case none of those worked, prompt the user.
21877                 case "$netdb_host_type" in
21878                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21879                         dflt='char *'
21880                         . ./myread
21881                         netdb_host_type=$ans
21882                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21883                         dflt="$sizetype"
21884                         . ./myread
21885                         netdb_hlen_type=$ans
21886                         ;;
21887                 esac
21888                 ;;
21889         *)      : no gethostbyaddr, so pick harmless defaults
21890                 netdb_host_type='char *'
21891                 netdb_hlen_type="$sizetype"
21892                 ;;
21893         esac
21894         # Remove the "const" if needed. -- but then we'll have a
21895         # prototype clash!
21896         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21897 fi
21898
21899 : check for type of argument to gethostbyname.
21900 if test "X$netdb_name_type" = X ; then
21901         case "$d_gethbyname" in
21902         $define)
21903                 $cat <<EOM
21904
21905 Checking to see what type of argument is accepted by gethostbyname().
21906 EOM
21907                 hdrs="$define sys/types.h
21908                         $d_socket sys/socket.h
21909                         $i_niin netinet/in.h
21910                         $i_netdb netdb.h
21911                         $i_unistd unistd.h"
21912                 for xxx in "const char *" "char *"; do
21913                         case "$netdb_name_type" in
21914                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21915                                 if ./protochk "$try" $hdrs; then
21916                                         echo "Your system accepts $xxx."
21917                                         netdb_name_type="$xxx"
21918                                 fi
21919                                 ;;
21920                         esac
21921                 done
21922                 : In case none of those worked, prompt the user.
21923                 case "$netdb_name_type" in
21924                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21925                         dflt='char *'
21926                         . ./myread
21927                         netdb_name_type=$ans
21928                         ;;
21929                 esac
21930                 ;;
21931         *)      : no gethostbyname, so pick harmless default
21932                 netdb_name_type='char *'
21933                 ;;
21934         esac
21935 fi
21936
21937 : check for type of 1st argument to getnetbyaddr.
21938 if test "X$netdb_net_type" = X ; then
21939         case "$d_getnbyaddr" in
21940         $define)
21941                 $cat <<EOM
21942
21943 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21944 EOM
21945                 hdrs="$define sys/types.h
21946                         $d_socket sys/socket.h
21947                         $i_niin netinet/in.h
21948                         $i_netdb netdb.h
21949                         $i_unistd unistd.h"
21950                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21951                         case "$netdb_net_type" in
21952                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21953                                 if ./protochk "$try" $hdrs; then
21954                                         echo "Your system accepts $xxx."
21955                                         netdb_net_type="$xxx"
21956                                 fi
21957                                 ;;
21958                         esac
21959                 done
21960                 : In case none of those worked, prompt the user.
21961                 case "$netdb_net_type" in
21962                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21963                         dflt='long'
21964                         . ./myread
21965                         netdb_net_type=$ans
21966                         ;;
21967                 esac
21968                 ;;
21969         *)      : no getnetbyaddr, so pick harmless default
21970                 netdb_net_type='long'
21971                 ;;
21972         esac
21973 fi
21974 : locate the preferred pager for this system
21975 fn=f/
21976 case "$pager" in
21977 '')
21978         dflt=''
21979         case "$pg" in
21980         /*) dflt=$pg;;
21981         [a-zA-Z]:/*) dflt=$pg;;
21982         esac
21983         case "$more" in
21984         /*) dflt=$more;;
21985         [a-zA-Z]:/*) dflt=$more;;
21986         esac
21987         case "$less" in
21988         /*) dflt=$less;;
21989         [a-zA-Z]:/*) dflt=$less;;
21990         esac
21991         case "$dflt" in
21992         '') dflt=/usr/ucb/more;;
21993         esac
21994         ;;
21995 *)      dflt="$pager"
21996         ;;
21997 esac
21998 fn="f/($dflt)"
21999 echo " "
22000 rp='What pager is used on your system?'
22001 . ./getfile
22002 pager="$ans"
22003
22004 : see if ar generates random libraries by itself
22005 echo " "
22006 echo "Checking how to generate random libraries on your machine..." >&4
22007 echo 'int bar1() { return bar2(); }' > bar1.c
22008 echo 'int bar2() { return 2; }' > bar2.c
22009 $cat > foo.c <<EOP
22010 #$i_stdlib I_STDLIB
22011 #ifdef I_STDLIB
22012 #include <stdlib.h>
22013 #endif
22014 int main() { printf("%d\n", bar1()); exit(0); }
22015 EOP
22016 $cc $ccflags -c bar1.c >/dev/null 2>&1
22017 $cc $ccflags -c bar2.c >/dev/null 2>&1
22018 $cc $ccflags -c foo.c >/dev/null 2>&1
22019 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
22020 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22021         $run ./foobar >/dev/null 2>&1; then
22022         echo "$ar appears to generate random libraries itself."
22023         orderlib=false
22024         if [ "X$ranlib" = "X" ]; then
22025             ranlib=":"
22026         fi
22027 elif $ar s bar$_a >/dev/null 2>&1 &&
22028         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22029         $run ./foobar >/dev/null 2>&1; then
22030                 echo "a table of contents needs to be added with '$ar s'."
22031                 orderlib=false
22032                 ranlib="$ar s"
22033 elif $ar ts bar$_a >/dev/null 2>&1 &&
22034         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22035         $run ./foobar >/dev/null 2>&1; then
22036                 echo "a table of contents needs to be added with '$ar ts'."
22037                 orderlib=false
22038                 ranlib="$ar ts"
22039 else
22040         case "$ranlib" in
22041         :) ranlib='';;
22042         '')
22043                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
22044                 $test -f $ranlib || ranlib=''
22045                 ;;
22046         esac
22047         if $test -n "$ranlib"; then
22048                 echo "your system has '$ranlib'; we'll use that."
22049                 orderlib=false
22050         else
22051                 echo "your system doesn't seem to support random libraries"
22052                 echo "so we'll use lorder and tsort to order the libraries."
22053                 orderlib=true
22054                 ranlib=":"
22055         fi
22056 fi
22057 $rm -f foo* bar*
22058
22059 : see if this is a values.h system
22060 set values.h i_values
22061 eval $inhdr
22062
22063 : Check the max offset that gmtime and localtime accept
22064 echo "Checking max offsets that gmtime () accepts"
22065
22066 case $i_values in
22067     define) yyy="#include <values.h>" ;;
22068     *)      yyy="" ;;
22069     esac
22070
22071 case "$sGMTIME_min/$sGMTIME_max" in
22072     0/0|/)
22073         $cat >try.c <<EOCP
22074 #include <sys/types.h>
22075 #include <stdio.h>
22076 #include <time.h>
22077 $yyy
22078
22079 int i;
22080 struct tm *tmp;
22081 time_t pt;
22082
22083 void gm_check (time_t t, int min_year, int max_year)
22084 {
22085     tmp = gmtime (&t);
22086     if ( tmp == NULL ||
22087         /* Check tm_year overflow */
22088          tmp->tm_year < min_year || tmp->tm_year > max_year)
22089         tmp = NULL;
22090     else
22091         pt = t;
22092     } /* gm_check */
22093
22094 int check_max ()
22095 {
22096     tmp = NULL;
22097     pt  = 0;
22098 #ifdef MAXLONG
22099     gm_check (MAXLONG, 69, 0x7fffffff);
22100 #endif
22101     if (tmp == NULL || tmp->tm_year < 0) {
22102         for (i = 63; i >= 0; i--) {
22103             time_t x = pt | ((time_t)1 << i);
22104             if (x < 0 || x < pt) continue;
22105             gm_check (x, 69, 0x7fffffff);
22106             }
22107         }
22108     printf ("sGMTIME_max=%ld\n", pt);
22109     return (0);
22110     } /* check_max */
22111
22112 int check_min ()
22113 {
22114     tmp = NULL;
22115     pt  = 0;
22116 #ifdef MINLONG
22117     gm_check (MINLONG, -1900, 70);
22118 #endif
22119     if (tmp == NULL) {
22120         for (i = 36; i >= 0; i--) {
22121             time_t x = pt - ((time_t)1 << i);
22122             if (x > 0) continue;
22123             gm_check (x, -1900, 70);
22124             }
22125         }
22126     printf ("sGMTIME_min=%ld\n", pt);
22127     return (0);
22128     } /* check_min */
22129
22130 int main (int argc, char *argv[])
22131 {
22132     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
22133     check_max ();
22134     check_min ();
22135     return (0);
22136     } /* main */
22137 EOCP
22138         set try
22139         if eval $compile; then
22140             eval `$run ./try 2>/dev/null`
22141         else
22142             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
22143             fi
22144         $rm_try
22145         ;;
22146     esac
22147
22148 echo "Checking max offsets that localtime () accepts"
22149
22150 case "$sLOCALTIME_min/$sLOCALTIME_max" in
22151     0/0|/)
22152         $cat >try.c <<EOCP
22153 #include <sys/types.h>
22154 #include <stdio.h>
22155 #include <time.h>
22156 $yyy
22157
22158 int i;
22159 struct tm *tmp;
22160 time_t pt;
22161
22162 void local_check (time_t t, int min_year, int max_year)
22163 {
22164     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
22165         tmp = NULL;
22166     else
22167         tmp = localtime (&t);
22168     if ( tmp == NULL ||
22169         /* Check tm_year overflow */
22170          tmp->tm_year < min_year || tmp->tm_year > max_year)
22171         tmp = NULL;
22172     else
22173         pt = t;
22174     } /* local_check */
22175
22176 int check_max ()
22177 {
22178     tmp = NULL;
22179     pt  = 0;
22180 #ifdef MAXLONG
22181     local_check (MAXLONG, 69, 0x7fffffff);
22182 #endif
22183     if (tmp == NULL || tmp->tm_year < 0) {
22184         for (i = 63; i >= 0; i--) {
22185             time_t x = pt | ((time_t)1 << i);
22186             if (x < 0 || x < pt) continue;
22187             local_check (x, 69, 0x7fffffff);
22188             }
22189         }
22190     printf ("sLOCALTIME_max=%ld\n", pt);
22191     return (0);
22192    } /* check_max */
22193
22194 int check_min ()
22195 {
22196     tmp = NULL;
22197     pt  = 0;
22198 #ifdef MINLONG
22199     local_check (MINLONG, -1900, 70);
22200 #endif
22201     if (tmp == NULL) {
22202         for (i = 36; i >= 0; i--) {
22203             time_t x = pt - ((time_t)1 << i);
22204             if (x > 0) continue;
22205             local_check (x, -1900, 70);
22206             }
22207         }
22208     printf ("sLOCALTIME_min=%ld\n", pt);
22209     return (0);
22210     } /* check_min */
22211
22212 int main (int argc, char *argv[])
22213 {
22214     check_max ();
22215     check_min ();
22216     return (0);
22217     } /* main */
22218 EOCP
22219         set try
22220         if eval $compile; then
22221             eval `$run ./try 2>/dev/null`
22222         else
22223             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
22224             fi
22225         $rm_try
22226         ;;
22227     esac
22228
22229 : check for type of arguments to select.
22230 case "$selecttype" in
22231 '') case "$d_select" in
22232         $define)
22233                 echo " "
22234                 $cat <<EOM
22235 Checking to see what type of arguments are accepted by select().
22236 EOM
22237                 hdrs="$define sys/types.h
22238                         $i_systime sys/time.h
22239                         $i_sysselct sys/select.h
22240                         $d_socket sys/socket.h"
22241                 : The first arg can be int, unsigned, or size_t
22242                 : The last arg may or may not be 'const'
22243                 val=''
22244                 : void pointer has been seen but using that
22245                 : breaks the selectminbits test
22246                 for xxx in 'fd_set *' 'int *'; do
22247                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
22248                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
22249                                         case "$val" in
22250                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
22251                                                 if ./protochk "$try" $hdrs; then
22252                                                         echo "Your system accepts $xxx."
22253                                                         val="$xxx"
22254                                                 fi
22255                                                 ;;
22256                                         esac
22257                                 done
22258                         done
22259                 done
22260                 case "$val" in
22261                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
22262                         case "$d_fd_set" in
22263                                 $define) dflt="fd_set *" ;;
22264                                 *)              dflt="int *" ;;
22265                         esac
22266                         . ./myread
22267                         val=$ans
22268                         ;;
22269                 esac
22270                 selecttype="$val"
22271                 ;;
22272         *)      : no select, so pick a harmless default
22273                 selecttype='int *'
22274                 ;;
22275         esac
22276         ;;
22277 esac
22278
22279 : check for the select 'width'
22280 case "$selectminbits" in
22281 '') safebits=`expr $ptrsize \* 8`
22282     case "$d_select" in
22283         $define)
22284                 $cat <<EOM
22285
22286 Checking to see on how many bits at a time your select() operates...
22287 EOM
22288                 $cat >try.c <<EOCP
22289 #include <sys/types.h>
22290 #$i_time I_TIME
22291 #$i_systime I_SYS_TIME
22292 #$i_systimek I_SYS_TIME_KERNEL
22293 #ifdef I_TIME
22294 #   include <time.h>
22295 #endif
22296 #ifdef I_SYS_TIME
22297 #   ifdef I_SYS_TIME_KERNEL
22298 #       define KERNEL
22299 #   endif
22300 #   include <sys/time.h>
22301 #   ifdef I_SYS_TIME_KERNEL
22302 #       undef KERNEL
22303 #   endif
22304 #endif
22305 #$i_sysselct I_SYS_SELECT
22306 #ifdef I_SYS_SELECT
22307 #include <sys/select.h>
22308 #endif
22309 #$d_socket HAS_SOCKET
22310 #ifdef HAS_SOCKET
22311 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
22312 #endif
22313 #include <stdio.h>
22314 #$i_stdlib I_STDLIB
22315 #ifdef I_STDLIB
22316 #include <stdlib.h>
22317 #endif
22318 $selecttype b;
22319 #define S sizeof(*(b))
22320 #define MINBITS 64
22321 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
22322 #define NBITS  (NBYTES * 8)
22323 int main() {
22324     char *s = (char *)malloc(NBYTES);
22325     struct timeval t;
22326     int i;
22327     FILE* fp;
22328     int fd;
22329
22330     if (!s)
22331         exit(1);
22332     fclose(stdin);
22333     fp = fopen("try.c", "r");
22334     if (fp == 0)
22335       exit(2);
22336     fd = fileno(fp);
22337     if (fd < 0)
22338       exit(3);
22339     b = ($selecttype)s;
22340     for (i = 0; i < NBITS; i++)
22341         FD_SET(i, b);
22342     t.tv_sec  = 0;
22343     t.tv_usec = 0;
22344     select(fd + 1, b, 0, 0, &t);
22345     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22346     free(s);
22347     printf("%d\n", i + 1);
22348     return 0;
22349 }
22350 EOCP
22351                 set try
22352                 if eval $compile_ok; then
22353                         selectminbits=`$run ./try 2>/dev/null`
22354                         case "$selectminbits" in
22355                         '')     cat >&4 <<EOM
22356 Cannot figure out on how many bits at a time your select() operates.
22357 I'll play safe and guess it is $safebits bits.
22358 EOM
22359                                 selectminbits=$safebits
22360                                 bits="$safebits bits"
22361                                 ;;
22362                         1)      bits="1 bit" ;;
22363                         *)      bits="$selectminbits bits" ;;
22364                         esac
22365                         echo "Your select() operates on $bits at a time." >&4
22366                 else
22367                         rp='What is the minimum number of bits your select() operates on?'
22368                         case "$byteorder" in
22369                         12345678)       dflt=64 ;;
22370                         1234)           dflt=32 ;;
22371                         *)              dflt=1  ;;
22372                         esac
22373                         . ./myread
22374                         val=$ans
22375                         selectminbits="$val"
22376                 fi
22377                 $rm_try
22378                 ;;
22379         *)      : no select, so pick a harmless default
22380                 selectminbits=$safebits
22381                 ;;
22382         esac
22383         ;;
22384 esac
22385
22386 : Trace out the files included by signal.h, then look for SIGxxx names.
22387 case "$sig_num_init" in
22388 '')
22389 if [ "X$fieldn" = X ]; then
22390         : Just make some guesses.  We check them later.
22391         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22392 else
22393         xxx=`echo '#include <signal.h>' |
22394         $cppstdin $cppminus $cppflags 2>/dev/null |
22395         $grep '^[       ]*#.*include' |
22396         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22397                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22398 fi
22399 xxxfiles=''
22400 for xx in $xxx /dev/null ; do
22401         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22402 done
22403 case "$xxxfiles" in
22404 '')     xxxfiles=`./findhdr signal.h` ;;
22405 esac
22406 xxx=`awk '
22407 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22408         print substr($2, 4, 20)
22409 }
22410 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22411         print substr($3, 4, 20)
22412 }' $xxxfiles`
22413 : Append some common names just in case the awk scan failed.
22414 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22415 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22416 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22417 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22418 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22419
22420 : generate a few handy files for later
22421 $cat > signal.c <<EOCP
22422 #include <sys/types.h>
22423 #include <signal.h>
22424 #$i_stdlib I_STDLIB
22425 #ifdef I_STDLIB
22426 #include <stdlib.h>
22427 #endif
22428 #include <stdio.h>
22429 int main() {
22430
22431 /* Strange style to avoid deeply-nested #if/#else/#endif */
22432 #ifndef NSIG
22433 #  ifdef _NSIG
22434 #    define NSIG (_NSIG)
22435 #  endif
22436 #endif
22437
22438 #ifndef NSIG
22439 #  ifdef SIGMAX
22440 #    define NSIG (SIGMAX+1)
22441 #  endif
22442 #endif
22443
22444 #ifndef NSIG
22445 #  ifdef SIG_MAX
22446 #    define NSIG (SIG_MAX+1)
22447 #  endif
22448 #endif
22449
22450 #ifndef NSIG
22451 #  ifdef _SIG_MAX
22452 #    define NSIG (_SIG_MAX+1)
22453 #  endif
22454 #endif
22455
22456 #ifndef NSIG
22457 #  ifdef MAXSIG
22458 #    define NSIG (MAXSIG+1)
22459 #  endif
22460 #endif
22461
22462 #ifndef NSIG
22463 #  ifdef MAX_SIG
22464 #    define NSIG (MAX_SIG+1)
22465 #  endif
22466 #endif
22467
22468 #ifndef NSIG
22469 #  ifdef SIGARRAYSIZE
22470 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22471 #  endif
22472 #endif
22473
22474 #ifndef NSIG
22475 #  ifdef _sys_nsig
22476 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22477 #  endif
22478 #endif
22479
22480 /* Default to some arbitrary number that's big enough to get most
22481    of the common signals.
22482 */
22483 #ifndef NSIG
22484 #    define NSIG 50
22485 #endif
22486
22487 printf("NSIG %d\n", NSIG);
22488
22489 #ifndef JUST_NSIG
22490
22491 EOCP
22492
22493 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22494 {
22495         printf "#ifdef SIG"; printf $1; printf "\n"
22496         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22497         printf $1; printf ");\n"
22498         printf "#endif\n"
22499 }
22500 END {
22501         printf "#endif /* JUST_NSIG */\n";
22502         printf "exit(0);\n}\n";
22503 }
22504 ' >>signal.c
22505 $cat >signal.awk <<'EOP'
22506 BEGIN { ndups = 0 }
22507 $1 ~ /^NSIG$/ { nsig = $2 }
22508 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22509     if ($2 > maxsig) { maxsig = $2 }
22510     if (sig_name[$2]) {
22511         dup_name[ndups] = $1
22512         dup_num[ndups] = $2
22513         ndups++
22514     }
22515     else {
22516         sig_name[$2] = $1
22517         sig_num[$2] = $2
22518     }
22519 }
22520 END {
22521     if (nsig == 0) {
22522         nsig = maxsig + 1
22523     }
22524     printf("NSIG %d\n", nsig);
22525     for (n = 1; n < nsig; n++) {
22526         if (sig_name[n]) {
22527             printf("%s %d\n", sig_name[n], sig_num[n])
22528         }
22529         else {
22530             printf("NUM%d %d\n", n, n)
22531         }
22532     }
22533     for (n = 0; n < ndups; n++) {
22534         printf("%s %d\n", dup_name[n], dup_num[n])
22535     }
22536 }
22537 EOP
22538 $cat >signal_cmd <<EOS
22539 $startsh
22540 if $test -s signal.lst; then
22541     echo "Using your existing signal.lst file"
22542         exit 0
22543 fi
22544 xxx="$xxx"
22545 EOS
22546 $cat >>signal_cmd <<'EOS'
22547
22548 set signal
22549 if eval $compile_ok; then
22550         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22551                 $uniq | $awk -f signal.awk >signal.lst
22552 else
22553         echo "(I can't seem be able to compile the whole test program)" >&4
22554         echo "(I'll try it in little pieces.)" >&4
22555         set signal -DJUST_NSIG
22556         if eval $compile_ok; then
22557                 $run ./signal$_exe > signal.nsg
22558                 $cat signal.nsg
22559         else
22560                 echo "I can't seem to figure out how many signals you have." >&4
22561                 echo "Guessing 50." >&4
22562                 echo 'NSIG 50' > signal.nsg
22563         fi
22564         : Now look at all the signal names, one at a time.
22565         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22566                 $cat > signal.c <<EOCP
22567 #include <sys/types.h>
22568 #include <signal.h>
22569 #include <stdio.h>
22570 int main() {
22571 printf("$xx %d\n", SIG${xx});
22572 return 0;
22573 }
22574 EOCP
22575                 set signal
22576                 if eval $compile; then
22577                         echo "SIG${xx} found."
22578                         $run ./signal$_exe  >> signal.ls1
22579                 else
22580                         echo "SIG${xx} NOT found."
22581                 fi
22582         done
22583         if $test -s signal.ls1; then
22584                 $cat signal.nsg signal.ls1 |
22585                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22586         fi
22587
22588 fi
22589 if $test -s signal.lst; then
22590         :
22591 else
22592         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22593         echo 'kill -l' >signal
22594         set X `csh -f <signal`
22595         $rm -f signal
22596         shift
22597         case $# in
22598         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22599         esac
22600         echo $@ | $tr ' ' $trnl | \
22601             $awk '{ printf "%s %d\n", $1, ++s; }
22602                   END { printf "NSIG %d\n", ++s }' >signal.lst
22603 fi
22604 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22605 EOS
22606 chmod a+x signal_cmd
22607 $eunicefix signal_cmd
22608 ;;
22609 esac
22610
22611 : generate list of signal names
22612 case "$sig_num_init" in
22613 '')
22614 echo " "
22615 case "$sig_name_init" in
22616 '') doinit=yes ;;
22617 *)  case "$sig_num_init" in
22618     ''|*,*) doinit=yes ;;
22619     esac ;;
22620 esac
22621 case "$doinit" in
22622 yes)
22623         echo "Generating a list of signal names and numbers..." >&4
22624         . ./signal_cmd
22625         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22626         sig_name=`$awk 'BEGIN { printf "ZERO " }
22627                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22628         sig_num=`$awk  'BEGIN { printf "0 " }
22629                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22630         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22631                              !/^NSIG/   { printf "\"%s\", ", $1 }
22632                              END        { printf "0\n" }' signal.lst`
22633         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22634                              !/^NSIG/   { printf "%d, ", $2}
22635                              END        { printf "0\n"}' signal.lst`
22636         ;;
22637 esac
22638 echo "The following $sig_count signals are available:"
22639 echo " "
22640 echo $sig_name | $awk \
22641 'BEGIN { linelen = 0 }
22642 {
22643         for (i = 1; i <= NF; i++) {
22644                 name = "SIG" $i " "
22645                 linelen = linelen + length(name)
22646                 if (linelen > 70) {
22647                         printf "\n"
22648                         linelen = length(name)
22649                 }
22650                 printf "%s", name
22651         }
22652         printf "\n"
22653 }'
22654 sig_size=`echo $sig_name | awk '{print NF}'`
22655 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22656 ;;
22657 esac
22658
22659 : Check size of size
22660 echo " "
22661 case "$sizetype" in
22662 *_t) zzz="$sizetype"    ;;
22663 *)   zzz="filesize"     ;;
22664 esac
22665 echo "Checking the size of $zzz..." >&4
22666 cat > try.c <<EOCP
22667 #include <sys/types.h>
22668 #include <stdio.h>
22669 #$i_stdlib I_STDLIB
22670 #ifdef I_STDLIB
22671 #include <stdlib.h>
22672 #endif
22673 int main() {
22674     printf("%d\n", (int)sizeof($sizetype));
22675     exit(0);
22676 }
22677 EOCP
22678 set try
22679 if eval $compile_ok; then
22680         yyy=`$run ./try`
22681         case "$yyy" in
22682         '')     sizesize=4
22683                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22684                 ;;
22685         *)      sizesize=$yyy
22686                 echo "Your $zzz size is $sizesize bytes."
22687                 ;;
22688         esac
22689 else
22690         sizesize=4
22691         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22692 fi
22693
22694
22695 : check for socklen_t
22696 echo " "
22697 echo "Checking to see if you have socklen_t..." >&4
22698 $cat >try.c <<EOCP
22699 #include <sys/types.h>
22700 #$d_socket HAS_SOCKET
22701 #ifdef HAS_SOCKET
22702 #include <sys/socket.h>
22703 #endif
22704 int main() { socklen_t x = 16; }
22705 EOCP
22706 set try
22707 if eval $compile; then
22708         val="$define"
22709         echo "You have socklen_t."
22710 else
22711         val="$undef"
22712         echo "You do not have socklen_t."
22713         case "$sizetype" in
22714         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22715         esac
22716 fi
22717 $rm_try
22718 set d_socklen_t
22719 eval $setvar
22720
22721 : see if this is a socks.h system
22722 set socks.h i_socks
22723 eval $inhdr
22724
22725 : check for type of the size argument to socket calls
22726 case "$d_socket" in
22727 "$define")
22728         $cat <<EOM
22729
22730 Checking to see what type is the last argument of accept().
22731 EOM
22732         yyy=''
22733         case "$d_socklen_t" in
22734         "$define") yyy="$yyy socklen_t"
22735         esac
22736         yyy="$yyy $sizetype int long unsigned"
22737         for xxx in $yyy; do
22738                 case "$socksizetype" in
22739                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22740                         case "$usesocks" in
22741                         "$define")
22742                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22743                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22744                                         socksizetype="$xxx"
22745                                 fi
22746                                 ;;
22747                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22748                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22749                                         socksizetype="$xxx"
22750                                 fi
22751                                 ;;
22752                         esac
22753                         ;;
22754                 esac
22755         done
22756 : In case none of those worked, prompt the user.
22757         case "$socksizetype" in
22758         '')     rp='What is the type for socket address structure sizes?'
22759                 dflt='int'
22760                 . ./myread
22761                 socksizetype=$ans
22762                 ;;
22763         esac
22764         ;;
22765 *)      : no sockets, so pick relatively harmless default
22766         socksizetype='int'
22767         ;;
22768 esac
22769
22770 : see what type is used for signed size_t
22771 set ssize_t ssizetype int stdio.h sys/types.h
22772 eval $typedef
22773 dflt="$ssizetype"
22774 $cat > try.c <<EOM
22775 #include <stdio.h>
22776 #$i_stdlib I_STDLIB
22777 #ifdef I_STDLIB
22778 #include <stdlib.h>
22779 #endif
22780 #include <sys/types.h>
22781 #define Size_t $sizetype
22782 #define SSize_t $dflt
22783 int main()
22784 {
22785         if (sizeof(Size_t) == sizeof(SSize_t))
22786                 printf("$dflt\n");
22787         else if (sizeof(Size_t) == sizeof(int))
22788                 printf("int\n");
22789         else
22790                 printf("long\n");
22791         exit(0);
22792 }
22793 EOM
22794 echo " "
22795 set try
22796 if eval $compile_ok && $run ./try > /dev/null; then
22797         ssizetype=`$run ./try`
22798         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22799 else
22800         $cat >&4 <<EOM
22801 Help! I can't compile and run the ssize_t test program: please enlighten me!
22802 (This is probably a misconfiguration in your system or libraries, and
22803 you really ought to fix it.  Still, I'll try anyway.)
22804
22805 I need a type that is the same size as $sizetype, but is guaranteed to
22806 be signed.  Common values are ssize_t, int and long.
22807
22808 EOM
22809         rp="What signed type is the same size as $sizetype?"
22810         . ./myread
22811         ssizetype="$ans"
22812 fi
22813 $rm_try
22814
22815 : Check the size of st_ino
22816 $echo " "
22817 $echo "Checking the size of st_ino..." >&4
22818 $cat > try.c <<EOCP
22819 #include <sys/stat.h>
22820 #include <stdio.h>
22821 #$i_stdlib I_STDLIB
22822 #ifdef I_STDLIB
22823 #include <stdlib.h>
22824 #endif
22825 int main() {
22826     struct stat st;
22827     printf("%d\n", (int)sizeof(st.st_ino));
22828     exit(0);
22829 }
22830 EOCP
22831 set try
22832 if eval $compile_ok; then
22833         val=`$run ./try`
22834         case "$val" in
22835         '')     st_ino_size=4
22836                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22837                 ;;
22838         *)      st_ino_size=$val
22839                 $echo "Your st_ino is $st_ino_size bytes long."
22840                 ;;
22841         esac
22842 else
22843         st_ino_size=4
22844         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22845 fi
22846 $rm_try
22847
22848 : Check if st_ino is signed
22849 $echo " "
22850 $echo "Checking the sign of st_ino..." >&4
22851 $cat > try.c <<EOCP
22852 #include <sys/stat.h>
22853 #include <stdio.h>
22854 int main() {
22855         struct stat foo;
22856         foo.st_ino = -1;
22857         if (foo.st_ino < 0)
22858                 printf("-1\n");
22859         else
22860                 printf("1\n");
22861 }
22862 EOCP
22863 set try
22864 if eval $compile; then
22865         val=`$run ./try`
22866         case "$val" in
22867         '')     st_ino_sign=1
22868                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22869                 ;;
22870         *)      st_ino_sign=$val
22871                 case "$st_ino_sign" in
22872                  1) $echo "Your st_ino is unsigned." ;;
22873                 -1) $echo "Your st_ino is signed."   ;;
22874                 esac
22875                 ;;
22876         esac
22877 else
22878         st_ino_sign=1
22879         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22880 fi
22881 $rm_try
22882
22883 : see what type of char stdio uses.
22884 echo " "
22885 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22886 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22887         echo "Your stdio uses unsigned chars." >&4
22888         stdchar="unsigned char"
22889 else
22890         echo "Your stdio uses signed chars." >&4
22891         stdchar="char"
22892 fi
22893 $rm -f stdioh
22894
22895 : Check size of UID
22896 echo " "
22897 case "$uidtype" in
22898 *_t) zzz="$uidtype"     ;;
22899 *)   zzz="uid"          ;;
22900 esac
22901 echo "Checking the size of $zzz..." >&4
22902 cat > try.c <<EOCP
22903 #include <sys/types.h>
22904 #include <stdio.h>
22905 #$i_stdlib I_STDLIB
22906 #ifdef I_STDLIB
22907 #include <stdlib.h>
22908 #endif
22909 int main() {
22910     printf("%d\n", (int)sizeof($uidtype));
22911     exit(0);
22912 }
22913 EOCP
22914 set try
22915 if eval $compile_ok; then
22916         yyy=`$run ./try`
22917         case "$yyy" in
22918         '')     uidsize=4
22919                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22920                 ;;
22921         *)      uidsize=$yyy
22922                 echo "Your $zzz is $uidsize bytes long."
22923                 ;;
22924         esac
22925 else
22926         uidsize=4
22927         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22928 fi
22929
22930 : Check if UID is signed
22931 echo " "
22932 case "$uidtype" in
22933 *_t) zzz="$uidtype"     ;;
22934 *)   zzz="uid"          ;;
22935 esac
22936 echo "Checking the sign of $zzz..." >&4
22937 cat > try.c <<EOCP
22938 #include <sys/types.h>
22939 #include <stdio.h>
22940 int main() {
22941         $uidtype foo = -1;
22942         if (foo < 0)
22943                 printf("-1\n");
22944         else
22945                 printf("1\n");
22946 }
22947 EOCP
22948 set try
22949 if eval $compile; then
22950         yyy=`$run ./try`
22951         case "$yyy" in
22952         '')     uidsign=1
22953                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22954                 ;;
22955         *)      uidsign=$yyy
22956                 case "$uidsign" in
22957                  1) echo "Your $zzz is unsigned." ;;
22958                 -1) echo "Your $zzz is signed."   ;;
22959                 esac
22960                 ;;
22961         esac
22962 else
22963         uidsign=1
22964         echo "(I can't compile the test program--guessing unsigned.)" >&4
22965 fi
22966
22967
22968 : Check format string for UID
22969 echo " "
22970 $echo "Checking the format string to be used for uids..." >&4
22971
22972 case "$uidsign" in
22973 -1)     if $test X"$uidsize" = X"$ivsize"; then
22974                 uidformat="$ivdformat"
22975         else
22976                 if $test X"$uidsize" = X"$longsize"; then
22977                         uidformat='"ld"'
22978                 else
22979                         if $test X"$uidsize" = X"$intsize"; then
22980                                 uidformat='"d"'
22981                         else
22982                                 if $test X"$uidsize" = X"$shortsize"; then
22983                                         uidformat='"hd"'
22984                                 fi
22985                         fi
22986                 fi
22987         fi
22988         ;;
22989 *)      if $test X"$uidsize" = X"$uvsize"; then
22990                 uidformat="$uvuformat"
22991         else
22992                 if $test X"$uidsize" = X"$longsize"; then
22993                         uidformat='"lu"'
22994                 else
22995                         if $test X"$uidsize" = X"$intsize"; then
22996                                 uidformat='"u"'
22997                         else
22998                                 if $test X"$uidsize" = X"$shortsize"; then
22999                                         uidformat='"hu"'
23000                                 fi
23001                         fi
23002                 fi
23003         fi
23004         ;;
23005 esac
23006
23007 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
23008 echo " "
23009 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
23010 $cat >try.c <<'EOM'
23011 /* Intentionally a long probe as I'd like to sanity check that the exact
23012    approach is going to work, as thinking it will work, but only having it
23013    part working at runtime is worse than not having it.  */
23014
23015 #include <sys/types.h>
23016 #include <sys/sysctl.h>
23017 #include <sys/param.h>
23018 #include <stdio.h>
23019 #include <string.h>
23020 #include <stdlib.h>
23021 #include <unistd.h>
23022
23023 int
23024 main(int argc, char **argv) {
23025     char *buffer;
23026     char *argv_leaf = strrchr(argv[0], '/');
23027     char *buffer_leaf;
23028     size_t size = 0;
23029     int mib[4];
23030
23031     mib[0] = CTL_KERN;
23032     mib[1] = KERN_PROC;
23033     mib[2] = KERN_PROC_PATHNAME;
23034     mib[3] = -1;
23035
23036     if (!argv_leaf) {
23037         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23038         return 1;
23039     }
23040
23041     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
23042         perror("sysctl");
23043         return 2;
23044     }
23045
23046     if (size < strlen(argv_leaf) + 1) {
23047         fprintf(stderr, "size %lu is too short for a path\n",
23048                 (unsigned long) size);
23049         return 3;
23050     }
23051
23052     if (size > MAXPATHLEN * MAXPATHLEN) {
23053         fprintf(stderr, "size %lu is too long for a path\n",
23054                 (unsigned long) size);
23055         return 4;
23056     }
23057
23058     buffer = malloc(size);
23059     if (!buffer) {
23060         perror("malloc");
23061         return 5;
23062     }
23063
23064     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
23065         perror("sysctl");
23066         return 6;
23067     }
23068
23069     if (strlen(buffer) + 1 != size) {
23070         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
23071                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
23072         return 7;
23073     }
23074
23075
23076     if (*buffer != '/') {
23077         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
23078         return 8;
23079     }
23080
23081     if (strstr(buffer, "/./")) {
23082         fprintf(stderr, "Contains /./: '%s'\n", buffer);
23083         return 9;
23084     }
23085
23086     if (strstr(buffer, "/../")) {
23087         fprintf(stderr, "Contains /../: '%s'\n", buffer);
23088         return 10;
23089     }
23090
23091     buffer_leaf = strrchr(buffer, '/');
23092     if (strcmp(buffer_leaf, argv_leaf) != 0) {
23093         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
23094         return 11;
23095     }
23096
23097     free(buffer);
23098
23099     return 0;
23100 }
23101 EOM
23102
23103 val=$undef
23104 set try
23105 if eval $compile; then
23106         if $run ./try; then
23107                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
23108                 val="$define"
23109         else
23110                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
23111                 val="$undef"
23112         fi
23113 else
23114         echo "I'm unable to compile the test program." >&4
23115         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
23116         val="$undef"
23117 fi
23118 $rm_try
23119 set usekernprocpathname
23120 eval $setvar
23121
23122 : Determine if we can use _NSGetExecutablePath to find executing program
23123 echo " "
23124 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
23125 $cat >try.c <<'EOM'
23126 /* Intentionally a long probe as I'd like to sanity check that the exact
23127    approach is going to work, as thinking it will work, but only having it
23128    part working at runtime is worse than not having it.  */
23129 #include <mach-o/dyld.h>
23130 #include <stdio.h>
23131 #include <stdlib.h>
23132 #include <sys/param.h>
23133 #include <string.h>
23134
23135 int
23136 main(int argc, char **argv) {
23137     char buf[1];
23138     uint32_t size = sizeof(buf);
23139     int result;
23140     char *buffer;
23141     char *tidied;
23142     char *argv_leaf = strrchr(argv[0], '/');
23143     char *tidied_leaf;
23144
23145     if (!argv_leaf) {
23146         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23147         return 1;
23148     }
23149
23150     _NSGetExecutablePath(buf, &size);
23151     if (size > MAXPATHLEN * MAXPATHLEN) {
23152         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
23153                 (unsigned int) size);
23154         return 2;
23155     }
23156
23157     buffer = malloc(size);
23158     if (!buffer) {
23159         perror("malloc");
23160         return 3;
23161     }
23162
23163     result = _NSGetExecutablePath(buffer, &size);
23164     if (result != 0) {
23165         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
23166                 result, (unsigned int) size);
23167         return 4;
23168     }
23169
23170     tidied = realpath(buffer, NULL);
23171     if (!tidied) {
23172         perror("realpath");
23173         return 5;
23174     }
23175
23176     free(buffer);
23177
23178     if (*tidied != '/') {
23179         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
23180         return 6;
23181     }
23182
23183     if (strstr(tidied, "/./")) {
23184         fprintf(stderr, "Contains /./: '%s'\n", tidied);
23185         return 7;
23186     }
23187
23188     if (strstr(tidied, "/../")) {
23189         fprintf(stderr, "Contains /../: '%s'\n", tidied);
23190         return 8;
23191     }
23192
23193     tidied_leaf = strrchr(tidied, '/');
23194     if (strcmp(tidied_leaf, argv_leaf) != 0) {
23195         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
23196         return 9;
23197     }
23198
23199     free(tidied);
23200
23201     return 0;
23202 }
23203 EOM
23204
23205 val=$undef
23206 set try
23207 if eval $compile; then
23208         if $run ./try; then
23209                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
23210                 val="$define"
23211         else
23212                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
23213         fi
23214 else
23215         echo "I'm unable to compile the test program." >&4
23216         echo "I'll assume no _NSGetExecutablePath here." >&4
23217 fi
23218 $rm_try
23219 set usensgetexecutablepath
23220 eval $setvar
23221
23222 : Check if site customization support was requested
23223 case "$usesitecustomize" in
23224     $define|true|[Yy]*)
23225         usesitecustomize="$define"
23226         ;;
23227     *)
23228         usesitecustomize="$undef"
23229         ;;
23230     esac
23231
23232 : see if prototypes support variable argument declarations
23233 echo " "
23234 case "$prototype$i_stdarg" in
23235 $define$define)
23236         echo "It appears we'll be able to prototype varargs functions." >&4
23237         val="$define"
23238         ;;
23239 *)
23240         echo "Too bad... We won't be using prototyped varargs functions..." >&4
23241         val="$undef"
23242         ;;
23243 esac
23244 set vaproto
23245 eval $setvar
23246
23247 : determine compiler compiler
23248 case "$yacc" in
23249 '')
23250         dflt=yacc;;
23251 *)
23252         dflt="$yacc";;
23253 esac
23254 echo " "
23255 comp='yacc'
23256 if $test -f "$byacc$_exe"; then
23257         dflt="$byacc"
23258         comp="byacc or $comp"
23259 fi
23260 if $test -f "$bison$_exe"; then
23261         comp="$comp or bison -y"
23262 fi
23263 rp="Which compiler compiler ($comp) shall I use?"
23264 . ./myread
23265 yacc="$ans"
23266 case "$yacc" in
23267 *bis*)
23268         case "$yacc" in
23269         *-y*) ;;
23270         *)
23271                 yacc="$yacc -y"
23272                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
23273                 ;;
23274         esac
23275         ;;
23276 esac
23277
23278 : see if this is a assert.h system
23279 set assert.h i_assert
23280 eval $inhdr
23281
23282 : see if this is a bfd.h system
23283 set bfd.h i_bfd
23284 eval $inhdr
23285
23286 : see if this is an execinfo.h system
23287 set execinfo.h i_execinfo
23288 eval $inhdr
23289
23290 : see if this is a fenv.h system
23291 set fenv.h i_fenv
23292 eval $inhdr
23293
23294 : see if this is a fp.h system
23295 set fp.h i_fp
23296 eval $inhdr
23297
23298 : see if this is a fp_class.h system
23299 set fp_class.h i_fp_class
23300 eval $inhdr
23301
23302 : see if gdbm.h is available
23303 set gdbm.h t_gdbm
23304 eval $inhdr
23305 case "$t_gdbm" in
23306 $define)
23307         : see if gdbm_open exists
23308         set gdbm_open d_gdbm_open
23309         eval $inlibc
23310         case "$d_gdbm_open" in
23311         $undef)
23312                 t_gdbm="$undef"
23313                 echo "We won't be including <gdbm.h>"
23314                 ;;
23315         esac
23316         ;;
23317 esac
23318 val="$t_gdbm"
23319 set i_gdbm
23320 eval $setvar
23321
23322 : see if this is a ieeefp.h system
23323 case "$i_ieeefp" in
23324 '' ) set ieeefp.h i_ieeefp
23325      eval $inhdr
23326      ;;
23327 esac
23328
23329 : see if this is a libutil.h system
23330 set libutil.h i_libutil
23331 eval $inhdr
23332
23333 : see if mach cthreads are available
23334 if test "X$usethreads" = "X$define"; then
23335         set mach/cthreads.h i_machcthr
23336         eval $inhdr
23337 else
23338         i_machcthr="$undef"
23339 fi
23340
23341 : see if this is a mntent.h system
23342 set mntent.h i_mntent
23343 eval $inhdr
23344
23345 : see if net/errno.h is available
23346 val=''
23347 set net/errno.h val
23348 eval $inhdr
23349
23350 : Unfortunately, it causes problems on some systems.  Arrgh.
23351 case "$val" in
23352 $define)
23353         cat > try.c <<'EOM'
23354 #include <stdio.h>
23355 #include <errno.h>
23356 #include <net/errno.h>
23357 int func()
23358 {
23359         return ENOTSOCK;
23360 }
23361 EOM
23362         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23363                 echo "We'll be including <net/errno.h>." >&4
23364         else
23365                 echo "We won't be including <net/errno.h>." >&4
23366                 val="$undef"
23367         fi
23368         $rm_try
23369         ;;
23370 esac
23371 set i_neterrno
23372 eval $setvar
23373
23374 : see if netinet/tcp.h is available
23375 set netinet/tcp.h i_netinettcp
23376 eval $inhdr
23377
23378 : see if this is a poll.h system
23379 set poll.h i_poll
23380 eval $inhdr
23381
23382 : see if this is a prot.h system
23383 set prot.h i_prot
23384 eval $inhdr
23385
23386 : Preprocessor symbols
23387 echo " "
23388 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23389 $cat <<'EOSH' > Cppsym.know
23390 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23391 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23392 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23393 arch_pwr ardent ARM ARM32 atarist att386 att3b
23394 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23395 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23396 byteorder byte_order
23397 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23398 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23399 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23400 ELF encore EPI EXTENSIONS
23401 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23402 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23403 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23404 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23405 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
23406 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23407 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23408 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23409 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23410 ksr1
23411 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23412 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23413 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23414 luna88k Lynx
23415 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23416 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23417 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23418 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23419 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
23420 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23421 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23422 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23423 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23424 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23425 ns32000 ns32016 ns32332 ns32k nsc32000
23426 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23427 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23428 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23429 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23430 QK_USER QNX
23431 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23432 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23433 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23434 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23435 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23436 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23437 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23438 SYSV4 SYSV5 sysV68 sysV88
23439 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23440 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23441 tower32_800 tower32_850 tss
23442 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23443 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23444 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23445 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23446 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23447 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23448 uxpm uxps
23449 vax venix VMESA vms
23450 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23451 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23452 z8000 zarch
23453 EOSH
23454 # Maybe put other stuff here too.
23455 ./tr '-' '_' <<EOSH >>Cppsym.know
23456 $osname
23457 EOSH
23458 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23459 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23460 $cat Cppsym.know > Cppsym.c
23461 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23462 $rm -f Cppsym.a Cppsym.b Cppsym.c
23463 cat <<EOSH > Cppsym
23464 $startsh
23465 if $test \$# -gt 0; then
23466     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23467     if $test -s Cppsym.got; then
23468         $rm -f Cppsym.got
23469         exit 0
23470     fi
23471     $rm -f Cppsym.got
23472     exit 1
23473 else
23474     $tr " " "$trnl" | ./Cppsym.try
23475     exit 0
23476 fi
23477 EOSH
23478 chmod +x Cppsym
23479 $eunicefix Cppsym
23480 cat <<EOSH > Cppsym.try
23481 $startsh
23482 cat <<'EOCP' > try.c
23483 #include <stdio.h>
23484 #if cpp_stuff == 1
23485 #define STRINGIFY(a)    "a"
23486 #endif
23487 #if cpp_stuff == 42
23488 #define StGiFy(a)  #a
23489 #define STRINGIFY(a)    StGiFy(a)
23490 #endif
23491 #if $cpp_stuff != 1 && $cpp_stuff != 42
23492 #   include "Bletch: How does this C preprocessor stringify macros?"
23493 #endif
23494 int main() {
23495 EOCP
23496 $awk \\
23497 EOSH
23498 cat <<'EOSH' >> Cppsym.try
23499 'length($1) > 0 {
23500     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23501     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23502     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23503     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23504 }'       >> try.c
23505 echo 'return 0;}' >> try.c
23506 EOSH
23507 cat <<EOSH >> Cppsym.try
23508 ccflags="$ccflags"
23509 case "$osname-$gccversion" in
23510 irix-) ccflags="\$ccflags -woff 1178" ;;
23511 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23512 esac
23513 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23514 EOSH
23515 chmod +x Cppsym.try
23516 $eunicefix Cppsym.try
23517 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23518 : Add in any Linux cpp "predefined macros":
23519 case "$osname::$gccversion" in
23520   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23521     tHdrH=_tmpHdr
23522     rm -f $tHdrH'.h' $tHdrH
23523     touch $tHdrH'.h'
23524     # Filter out macro arguments, such as Linux's __INT8_C(c)
23525     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23526        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23527        if [ -s $tHdrH'_cppsym.real' ]; then
23528           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23529        fi
23530     fi
23531     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23532   ;;
23533 esac
23534 : now check the C compiler for additional symbols
23535 postprocess_cc_v=''
23536 case "$osname" in
23537 aix) postprocess_cc_v="|$tr , ' '" ;;
23538 esac
23539 $cat >ccsym <<EOS
23540 $startsh
23541 $cat >tmp.c <<EOF
23542 extern int foo;
23543 EOF
23544 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23545 do
23546         case "\$i" in
23547         -D*) echo "\$i" | $sed 's/^-D//';;
23548         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23549         esac
23550 done
23551 $rm_try
23552 EOS
23553 postprocess_cc_v=''
23554 chmod +x ccsym
23555 $eunicefix ccsym
23556 ./ccsym > ccsym1.raw
23557 if $test -s ccsym1.raw; then
23558     $sort ccsym1.raw | $uniq >ccsym.raw
23559 else
23560     mv ccsym1.raw ccsym.raw
23561 fi
23562
23563 $awk '/\=/ { print $0; next }
23564         { print $0"=1" }' ccsym.raw >ccsym.list
23565 $comm -13 Cppsym.true ccsym.list >ccsym.own
23566 $comm -12 Cppsym.true ccsym.list >ccsym.com
23567 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23568 also=''
23569 if $test -z ccsym.raw; then
23570         echo "Your C compiler doesn't seem to define any symbols!" >&4
23571         echo " "
23572         echo "However, your C preprocessor defines the following symbols:"
23573         $cat Cppsym.true
23574         ccsymbols=''
23575         cppsymbols=`$cat Cppsym.true`
23576         cppsymbols=`echo $cppsymbols`
23577         cppccsymbols="$cppsymbols"
23578 else
23579         if $test -s ccsym.com; then
23580                 echo "Your C compiler and pre-processor define these symbols:"
23581                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23582                 also='also '
23583                 symbols='ones'
23584                 cppccsymbols=`$cat ccsym.com`
23585                 cppccsymbols=`echo $cppccsymbols`
23586                 $test "$silent" || sleep 1
23587         fi
23588         if $test -s ccsym.cpp; then
23589                 $test "$also" && echo " "
23590                 echo "Your C pre-processor ${also}defines the following symbols:"
23591                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23592                 also='further '
23593                 cppsymbols=`$cat ccsym.cpp`
23594                 cppsymbols=`echo $cppsymbols`
23595                 $test "$silent" || sleep 1
23596         fi
23597         if $test -s ccsym.own; then
23598                 $test "$also" && echo " "
23599                 echo "Your C compiler ${also}defines the following cpp symbols:"
23600                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23601                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23602                 ccsymbols=`$cat ccsym.own`
23603                 ccsymbols=`echo $ccsymbols`
23604                 $test "$silent" || sleep 1
23605         fi
23606 fi
23607
23608 : add -D_FORTIFY_SOURCE if feasible and not already there
23609 case "$gccversion" in
23610 [45].*) case "$optimize$ccflags" in
23611         *-O*)   case "$ccflags$cppsymbols" in
23612                 *_FORTIFY_SOURCE=*) # Don't add it again.
23613                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23614                         ;;
23615                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23616                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23617                         ;;
23618                 esac
23619                 ;;
23620         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23621                 ;;
23622         esac
23623         ;;
23624 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23625         ;;
23626 esac
23627
23628 : see if this is a termio system
23629 val="$undef"
23630 val2="$undef"
23631 val3="$undef"
23632 if $test `./findhdr termios.h`; then
23633     set tcsetattr i_termios
23634     eval $inlibc
23635     val3="$i_termios"
23636 fi
23637 echo " "
23638 case "$val3" in
23639     "$define") echo "You have POSIX termios.h... good!" >&4;;
23640     *)  if ./Cppsym pyr; then
23641             case "`$run /bin/universe`" in
23642                 ucb) if $test `./findhdr sgtty.h`; then
23643                         val2="$define"
23644                         echo "<sgtty.h> found." >&4
23645                     else
23646                         echo "System is pyramid with BSD universe."
23647                         ./warn "<sgtty.h> not found--you could have problems."
23648                     fi;;
23649                 *)  if $test `./findhdr termio.h`; then
23650                         val="$define"
23651                         echo "<termio.h> found." >&4
23652                     else
23653                         echo "System is pyramid with USG universe."
23654                         ./warn "<termio.h> not found--you could have problems."
23655                     fi;;
23656             esac
23657         elif ./usg; then
23658             if $test `./findhdr termio.h`; then
23659                 echo "<termio.h> found." >&4
23660                 val="$define"
23661             elif $test `./findhdr sgtty.h`; then
23662                 echo "<sgtty.h> found." >&4
23663                 val2="$define"
23664             else
23665                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23666             fi
23667         else
23668             if $test `./findhdr sgtty.h`; then
23669                 echo "<sgtty.h> found." >&4
23670                 val2="$define"
23671             elif $test `./findhdr termio.h`; then
23672                 echo "<termio.h> found." >&4
23673                 val="$define"
23674             else
23675                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23676             fi
23677         fi;;
23678 esac
23679 set i_termio; eval $setvar
23680 val=$val2; set i_sgtty; eval $setvar
23681 val=$val3; set i_termios; eval $setvar
23682
23683 : see if stdbool is available
23684 : we want a real compile instead of Inhdr because some Solaris systems
23685 : have stdbool.h, but it can only be used if the compiler indicates it
23686 : is sufficiently c99-compliant.
23687 echo " "
23688 $cat >try.c <<EOCP
23689 #include <stdio.h>
23690 #include <stdbool.h>
23691 int func(bool x)
23692 {
23693     return x ? 1 : 0;
23694 }
23695 int main(int argc, char **argv)
23696 {
23697     return func(0);
23698 }
23699 EOCP
23700 set try
23701 if eval $compile; then
23702         echo "<stdbool.h> found." >&4
23703         val="$define"
23704 else
23705         echo "<stdbool.h> NOT found." >&4
23706         val="$undef"
23707 fi
23708 $rm_try
23709 set i_stdbool
23710 eval $setvar
23711
23712 : see if stddef is available
23713 set stddef.h i_stddef
23714 eval $inhdr
23715
23716 : see if stdint is available
23717 set stdint.h i_stdint
23718 eval $inhdr
23719
23720 : see if sys/access.h is available
23721 set sys/access.h i_sysaccess
23722 eval $inhdr
23723
23724 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23725 set sys/filio.h i_sysfilio
23726 eval $inhdr
23727 echo " "
23728 if $test `./findhdr sys/ioctl.h`; then
23729         val="$define"
23730         echo '<sys/ioctl.h> found.' >&4
23731 else
23732         val="$undef"
23733         if $test $i_sysfilio = "$define"; then
23734             echo '<sys/ioctl.h> NOT found.' >&4
23735         else
23736                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23737                 $test $i_termio = "$define" && xxx="termio.h"
23738                 $test $i_termios = "$define" && xxx="termios.h"
23739 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23740         fi
23741 fi
23742 set i_sysioctl
23743 eval $setvar
23744
23745 : see if socket ioctl defs are in sys/sockio.h
23746 echo " "
23747 xxx=`./findhdr sys/sockio.h`
23748 if $test "$xxx"; then
23749         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23750                 val="$define"
23751                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23752         else
23753                 val="$undef"
23754                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23755         fi
23756 else
23757         val="$undef"
23758         $cat <<EOM
23759 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23760 EOM
23761 fi
23762 set i_syssockio
23763 eval $setvar
23764
23765 : see if this is a syslog.h system
23766 set syslog.h i_syslog
23767 eval $inhdr
23768
23769 : see if this is a sys/mode.h system
23770 set sys/mode.h i_sysmode
23771 eval $inhdr
23772
23773 : see if there is a sys/poll.h file
23774 set sys/poll.h i_syspoll
23775 eval $inhdr
23776
23777 : see if sys/resource.h has to be included
23778 set sys/resource.h i_sysresrc
23779 eval $inhdr
23780
23781 : see if sys/security.h is available
23782 set sys/security.h i_syssecrt
23783 eval $inhdr
23784
23785 : see if this is a sys/statvfs.h system
23786 set sys/statvfs.h i_sysstatvfs
23787 eval $inhdr
23788
23789 : see if this is a sys/un.h system
23790 set sys/un.h i_sysun
23791 eval $inhdr
23792
23793 : see if this is a sys/utsname.h system
23794 set sys/utsname.h i_sysutsname
23795 eval $inhdr
23796
23797 : see if this is a syswait system
23798 set sys/wait.h i_syswait
23799 eval $inhdr
23800
23801 : see if this is a ustat.h system
23802 set ustat.h i_ustat
23803 eval $inhdr
23804
23805 : see if this is an utime system
23806 set utime.h i_utime
23807 eval $inhdr
23808
23809 : see if this is a vfork system
23810 case "$d_vfork" in
23811 "$define")
23812         set vfork.h i_vfork
23813         eval $inhdr
23814         ;;
23815 *)
23816         i_vfork="$undef"
23817         ;;
23818 esac
23819
23820 : Check extensions
23821 echo " "
23822 echo "Looking for extensions..." >&4
23823 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23824 : contain old or inaccurate or duplicate values.
23825 nonxs_extensions=''
23826 xs_extensions=''
23827 : We do not use find because it might not be available.
23828 : We do not just use MANIFEST because the user may have dropped
23829 : some additional extensions into the source tree and expect them
23830 : to be built.
23831
23832 : Function to recursively find available extensions, ignoring DynaLoader
23833 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23834 : In 5.10.1 and later, extensions are stored in directories
23835 : like File-Glob instead of the older File/Glob/.
23836 find_extensions='
23837     for xxx in *; do
23838         case "$xxx" in
23839             DynaLoader|dynaload) ;;
23840             *)
23841             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23842             case "$this_ext" in
23843                 Scalar/List/Utils) this_ext="List/Util" ;;
23844                 PathTools)         this_ext="Cwd"       ;;
23845             esac;
23846             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23847             if $contains " $this_ext " "$tdir/$$.tmp"; then
23848                 echo >&4;
23849                 echo "Duplicate directories detected for extension $xxx" >&4;
23850                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23851                 case "$knowitall" in
23852                 "") dflt=y;;
23853                 *) dflt=n;;
23854                 esac;
23855                 . ../UU/myread;
23856                 case "$ans" in
23857                 n*|N*) ;;
23858                 *) echo >&4;
23859                     echo "Ok.  Stopping Configure." >&4;
23860                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23861                     exit 1;;
23862                 esac;
23863                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23864             fi;
23865             $ls -1 "$xxx" > "$tdir/$$.tmp";
23866             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23867                 xs_extensions="$xs_extensions $this_ext";
23868             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23869                 xs_extensions="$xs_extensions $this_ext";
23870             elif $test -d "$xxx"; then
23871                 nonxs_extensions="$nonxs_extensions $this_ext";
23872             fi;
23873             $rm -f "$tdir/$$.tmp";
23874             ;;
23875         esac;
23876     done'
23877 tdir=`pwd`
23878 cd "$rsrc/cpan"
23879 set X
23880 shift
23881 eval $find_extensions
23882 cd "$rsrc/dist"
23883 set X
23884 shift
23885 eval $find_extensions
23886 cd "$rsrc/ext"
23887 set X
23888 shift
23889 eval $find_extensions
23890 set X $xs_extensions
23891 shift
23892 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23893 set X $nonxs_extensions
23894 shift
23895 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23896 cd "$tdir"
23897 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23898
23899 : Now see which are supported on this system.
23900 avail_ext=''
23901 for xxx in $xs_extensions ; do
23902         case "$xxx" in
23903         Amiga*)
23904                 case "$osname" in
23905                 amigaos) avail_ext="$avail_ext $xxx" ;;
23906                 esac
23907                 ;;
23908         DB_File|db_file)
23909                 case "$i_db" in
23910                 $define) avail_ext="$avail_ext $xxx" ;;
23911                 esac
23912                 ;;
23913         GDBM_File|gdbm_fil)
23914                 case "$i_gdbm" in
23915                 $define) avail_ext="$avail_ext $xxx" ;;
23916                 esac
23917                 ;;
23918         I18N/Langinfo|i18n_lan)
23919                 case "$i_langinfo$d_nl_langinfo" in
23920                 $define$define) avail_ext="$avail_ext $xxx" ;;
23921                 esac
23922                 ;;
23923         IPC/SysV|ipc/sysv)
23924                 : XXX Do we need a useipcsysv variable here
23925                 case "${d_msg}${d_sem}${d_shm}" in
23926                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23927                 esac
23928                 ;;
23929         NDBM_File|ndbm_fil)
23930                 case "$d_ndbm" in
23931                 $define)
23932                     case "$osname-$use64bitint" in
23933                     hpux-define)
23934                         case "$libs" in
23935                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23936                         esac
23937                         ;;
23938                     *) avail_ext="$avail_ext $xxx" ;;
23939                     esac
23940                     ;;
23941                 esac
23942                 ;;
23943         ODBM_File|odbm_fil)
23944                 case "${i_dbm}${i_rpcsvcdbm}" in
23945                 *"${define}"*)
23946                     case "$d_cplusplus" in
23947                     define) ;; # delete as a function name will not work
23948                     *)  case "$osname-$use64bitint" in
23949                         hpux-define)
23950                             case "$libs" in
23951                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23952                             esac
23953                             ;;
23954                         *) avail_ext="$avail_ext $xxx" ;;
23955                         esac
23956                         ;;
23957                     esac
23958                     ;;
23959                 esac
23960                 ;;
23961         Opcode|opcode)
23962                 case "$useopcode" in
23963                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23964                 esac
23965                 ;;
23966         POSIX|posix)
23967                 case "$useposix" in
23968                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23969                 esac
23970                 ;;
23971         Socket|socket)
23972                 case "$d_socket" in
23973                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23974                 esac
23975                 ;;
23976         Sys/Syslog|sys/syslog)
23977                 case $osname in
23978                         amigaos) ;; # not really very useful on AmigaOS
23979                         *)
23980                         : XXX syslog requires socket
23981                         case "$d_socket" in
23982                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23983                         esac
23984                         ;;
23985                 esac
23986                 ;;
23987         Thread|thread)
23988                 case "$usethreads" in
23989                 true|$define|y)
23990                         case "$use5005threads" in
23991                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23992                         esac
23993                 esac
23994                 ;;
23995         threads|threads/shared)
23996                 # threads and threads::shared are special cases.
23997                 # To stop people from asking "Perl 5.8.0 was supposed
23998                 # to have this new fancy threads implementation but my
23999                 # perl doesn't have it" and from people trying to
24000                 # (re)install the threads module using CPAN.pm and
24001                 # CPAN.pm then offering to reinstall Perl 5.8.0,
24002                 # the threads.pm and threads/shared.pm will always be
24003                 # there, croaking informatively ("you need to rebuild
24004                 # all of Perl with threads, sorry") when threads haven't
24005                 # been compiled in.
24006                 # --jhi
24007                 avail_ext="$avail_ext $xxx"
24008                 ;;
24009         VMS*)
24010                 ;;
24011         Win32*)
24012                 case "$osname" in
24013                 cygwin) avail_ext="$avail_ext $xxx" ;;
24014                 esac
24015                 ;;
24016         XS/APItest|xs/apitest)
24017                 # This is just for testing.  Skip it unless we have dynamic loading.
24018
24019                 case "$usedl" in
24020                 $define) avail_ext="$avail_ext $xxx" ;;
24021                 esac
24022                 ;;
24023         XS/Typemap|xs/typemap)
24024                 # This is just for testing.  Skip it unless we have dynamic loading.
24025                 case "$usedl" in
24026                 $define) avail_ext="$avail_ext $xxx" ;;
24027                 esac
24028                 ;;
24029         *)      avail_ext="$avail_ext $xxx"
24030                 ;;
24031         esac
24032 done
24033
24034 set X $avail_ext
24035 shift
24036 avail_ext="$*"
24037
24038 case "$onlyextensions" in
24039 '') ;;
24040 *)  keepextensions=''
24041     echo "You have requested that only certain extensions be included..." >&4
24042     for i in $onlyextensions; do
24043         case " $avail_ext " in
24044         *" $i "*)
24045             echo "Keeping extension $i."
24046             keepextensions="$keepextensions $i"
24047             ;;
24048         *) echo "Ignoring extension $i." ;;
24049         esac
24050     done
24051     avail_ext="$keepextensions"
24052     ;;
24053 esac
24054
24055 case "$noextensions" in
24056 '') ;;
24057 *)  keepextensions=''
24058     echo "You have requested that certain extensions be ignored..." >&4
24059     for i in $avail_ext; do
24060         case " $noextensions " in
24061         *" $i "*) echo "Ignoring extension $i." ;;
24062         *) echo "Keeping extension $i.";
24063            keepextensions="$keepextensions $i"
24064            ;;
24065         esac
24066     done
24067     avail_ext="$keepextensions"
24068     ;;
24069 esac
24070
24071 : Now see which nonxs extensions are supported on this system.
24072 : For now assume all are.
24073 nonxs_ext=''
24074 for xxx in $nonxs_extensions ; do
24075         case "$xxx" in
24076         VMS*)
24077                 ;;
24078         *)      nonxs_ext="$nonxs_ext $xxx"
24079                 ;;
24080         esac
24081 done
24082
24083 set X $nonxs_ext
24084 shift
24085 nonxs_ext="$*"
24086
24087 case $usedl in
24088 $define)
24089         $cat <<EOM
24090 A number of extensions are supplied with $package.  You may choose to
24091 compile these extensions for dynamic loading (the default), compile
24092 them into the $package executable (static loading), or not include
24093 them at all.  Answer "none" to include no extensions.
24094 Note that DynaLoader is always built and need not be mentioned here.
24095
24096 EOM
24097         case "$dynamic_ext" in
24098         '')
24099                 : Exclude those listed in static_ext
24100                 dflt=''
24101                 for xxx in $avail_ext; do
24102                         case " $static_ext " in
24103                         *" $xxx "*) ;;
24104                         *) dflt="$dflt $xxx" ;;
24105                         esac
24106                 done
24107                 set X $dflt
24108                 shift
24109                 dflt="$*"
24110                 ;;
24111         *)      dflt="$dynamic_ext"
24112                 # Perhaps we are reusing an old out-of-date config.sh.
24113                 case "$hint" in
24114                 previous)
24115                         if test X"$dynamic_ext" != X"$avail_ext"; then
24116                                 $cat <<EOM
24117 NOTICE:  Your previous config.sh list may be incorrect.
24118 The extensions now available to you are
24119         ${avail_ext}
24120 but the default list from your previous config.sh is
24121         ${dynamic_ext}
24122
24123 EOM
24124                         fi
24125                         ;;
24126                 esac
24127                 ;;
24128         esac
24129         case "$dflt" in
24130         '')     dflt=none;;
24131         esac
24132         rp="What extensions do you wish to load dynamically?"
24133         . ./myread
24134         case "$ans" in
24135         none) dynamic_ext=' ' ;;
24136         *) dynamic_ext="$ans" ;;
24137         esac
24138
24139         case "$static_ext" in
24140         '')
24141                 : Exclude those already listed in dynamic linking
24142                 dflt=''
24143                 for xxx in $avail_ext; do
24144                         case " $dynamic_ext " in
24145                         *" $xxx "*) ;;
24146                         *) dflt="$dflt $xxx" ;;
24147                         esac
24148                 done
24149                 set X $dflt
24150                 shift
24151                 dflt="$*"
24152                 ;;
24153         *)  dflt="$static_ext"
24154                 ;;
24155         esac
24156
24157         case "$dflt" in
24158         '')     dflt=none;;
24159         esac
24160         rp="What extensions do you wish to load statically?"
24161         . ./myread
24162         case "$ans" in
24163         none) static_ext=' ' ;;
24164         *) static_ext="$ans" ;;
24165         esac
24166         ;;
24167 *)
24168         $cat <<EOM
24169 A number of extensions are supplied with $package.  Answer "none"
24170 to include no extensions.
24171 Note that DynaLoader is always built and need not be mentioned here.
24172
24173 EOM
24174         case "$static_ext" in
24175         '') dflt="$avail_ext" ;;
24176         *)      dflt="$static_ext"
24177                 # Perhaps we are reusing an old out-of-date config.sh.
24178                 case "$hint" in
24179                 previous)
24180                         if test X"$static_ext" != X"$avail_ext"; then
24181                                 $cat <<EOM
24182 NOTICE:  Your previous config.sh list may be incorrect.
24183 The extensions now available to you are
24184         ${avail_ext}
24185 but the default list from your previous config.sh is
24186         ${static_ext}
24187
24188 EOM
24189                         fi
24190                         ;;
24191                 esac
24192                 ;;
24193         esac
24194         : Exclude those that are not xs extensions
24195         case "$dflt" in
24196         '')     dflt=none;;
24197         esac
24198         rp="What extensions do you wish to include?"
24199         . ./myread
24200         case "$ans" in
24201         none) static_ext=' ' ;;
24202         *) static_ext="$ans" ;;
24203         esac
24204         ;;
24205 esac
24206 #
24207 # Encode is a special case.  If we are building Encode as a static
24208 # extension, we need to explicitly list its subextensions as well.
24209 # For other nested extensions, this is handled automatically by
24210 # the appropriate Makefile.PL.
24211 case " $static_ext " in
24212         *" Encode "*) # Add the subextensions of Encode
24213         cd "$rsrc/cpan"
24214         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
24215                 static_ext="$static_ext Encode/$xxx"
24216                 known_extensions="$known_extensions Encode/$xxx"
24217         done
24218         cd "$tdir"
24219         ;;
24220 esac
24221
24222 set X $dynamic_ext $static_ext $nonxs_ext
24223 shift
24224 extensions="$*"
24225
24226 # Sanity check:  We require an extension suitable for use with
24227 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
24228 # should show up as failures in the test suite, but it's helpful to
24229 # catch them now.) The 'extensions' list is normally sorted
24230 # alphabetically, so we need to accept either
24231 #    DB_File ... Fcntl ... IO  ....
24232 # or something like
24233 #    Fcntl ... NDBM_File ... IO  ....
24234 case " $extensions"  in
24235 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
24236 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
24237 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
24238 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
24239    echo "WARNING: The Perl you are building will be quite crippled." >& 4
24240    ;;
24241 esac
24242
24243 : Remove libraries needed only for extensions
24244 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
24245 : The exception is SunOS 4.x, which needs them.
24246 case "${osname}X${osvers}" in
24247 sunos*X4*)
24248     perllibs="$libs"
24249     ;;
24250 *) case "$usedl" in
24251     $define|true|[yY]*)
24252             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
24253             shift
24254             perllibs="$*"
24255             ;;
24256     *)  perllibs="$libs"
24257             ;;
24258     esac
24259     ;;
24260 esac
24261
24262 : Remove build directory name from cppstdin so it can be used from
24263 : either the present location or the final installed location.
24264 echo " "
24265 : Get out of the UU directory to get correct path name.
24266 cd ..
24267 case "$cppstdin" in
24268 `pwd`/cppstdin)
24269         echo "Stripping down cppstdin path name"
24270         cppstdin=cppstdin
24271         ;;
24272 esac
24273 cd UU
24274
24275 : end of configuration questions
24276 echo " "
24277 echo "End of configuration questions."
24278 echo " "
24279
24280 : back to where it started
24281 if test -d ../UU; then
24282         cd ..
24283 fi
24284
24285 : configuration may be unconditionally patched via a 'config.arch' file
24286 if $test -f config.arch; then
24287         echo "I see a config.arch file, loading it." >&4
24288         . ./config.arch
24289 fi
24290
24291 : configuration may be patched via a 'config.over' file
24292 if $test -f config.over; then
24293         echo " "
24294         dflt=y
24295         rp='I see a config.over file.  Do you wish to load it?'
24296         . UU/myread
24297         case "$ans" in
24298         n*) echo "OK, I'll ignore it.";;
24299         *)      . ./config.over
24300                 echo "Configuration override changes have been loaded."
24301                 ;;
24302         esac
24303 fi
24304
24305 : in case they want portability, strip down executable paths
24306 case "$d_portable" in
24307 "$define")
24308         echo " "
24309         echo "Stripping down executable paths..." >&4
24310         for file in $loclist $trylist; do
24311                 eval temp=\$$file
24312                 eval $file=`basename $temp`
24313         done
24314         ;;
24315 esac
24316
24317 : create config.sh file
24318 echo " "
24319 echo "Creating config.sh..." >&4
24320 $spitshell <<EOT >config.sh
24321 $startsh
24322 #
24323 # This file was produced by running the Configure script. It holds all the
24324 # definitions figured out by Configure. Should you modify one of these values,
24325 # do not forget to propagate your changes by running "Configure -der". You may
24326 # instead choose to run each of the .SH files by yourself, or "Configure -S".
24327 #
24328
24329 # Package name      : $package
24330 # Source directory  : $src
24331 # Configuration time: $cf_time
24332 # Configured by     : $cf_by
24333 # Target system     : $myuname
24334
24335 EOT
24336 : Add in command line options if available
24337 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24338
24339 $spitshell <<EOT >>config.sh
24340
24341 Author='$Author'
24342 Date='$Date'
24343 Header='$Header'
24344 Id='$Id'
24345 Locker='$Locker'
24346 Log='$Log'
24347 RCSfile='$RCSfile'
24348 Revision='$Revision'
24349 Source='$Source'
24350 State='$State'
24351 _a='$_a'
24352 _exe='$_exe'
24353 _o='$_o'
24354 afs='$afs'
24355 afsroot='$afsroot'
24356 alignbytes='$alignbytes'
24357 ansi2knr='$ansi2knr'
24358 aphostname='$aphostname'
24359 api_revision='$api_revision'
24360 api_subversion='$api_subversion'
24361 api_version='$api_version'
24362 api_versionstring='$api_versionstring'
24363 ar='$ar'
24364 archlib='$archlib'
24365 archlibexp='$archlibexp'
24366 archname64='$archname64'
24367 archname='$archname'
24368 archobjs='$archobjs'
24369 asctime_r_proto='$asctime_r_proto'
24370 awk='$awk'
24371 baserev='$baserev'
24372 bash='$bash'
24373 bin='$bin'
24374 bin_ELF='$bin_ELF'
24375 binexp='$binexp'
24376 bison='$bison'
24377 byacc='$byacc'
24378 byteorder='$byteorder'
24379 c='$c'
24380 castflags='$castflags'
24381 cat='$cat'
24382 cc='$cc'
24383 cccdlflags='$cccdlflags'
24384 ccdlflags='$ccdlflags'
24385 ccflags='$ccflags'
24386 ccflags_uselargefiles='$ccflags_uselargefiles'
24387 ccname='$ccname'
24388 ccsymbols='$ccsymbols'
24389 ccversion='$ccversion'
24390 cf_by='$cf_by'
24391 cf_email='$cf_email'
24392 cf_time='$cf_time'
24393 charbits='$charbits'
24394 charsize='$charsize'
24395 chgrp='$chgrp'
24396 chmod='$chmod'
24397 chown='$chown'
24398 clocktype='$clocktype'
24399 comm='$comm'
24400 compress='$compress'
24401 contains='$contains'
24402 cp='$cp'
24403 cpio='$cpio'
24404 cpp='$cpp'
24405 cpp_stuff='$cpp_stuff'
24406 cppccsymbols='$cppccsymbols'
24407 cppflags='$cppflags'
24408 cpplast='$cpplast'
24409 cppminus='$cppminus'
24410 cpprun='$cpprun'
24411 cppstdin='$cppstdin'
24412 cppsymbols='$cppsymbols'
24413 crypt_r_proto='$crypt_r_proto'
24414 cryptlib='$cryptlib'
24415 csh='$csh'
24416 ctermid_r_proto='$ctermid_r_proto'
24417 ctime_r_proto='$ctime_r_proto'
24418 d_Gconvert='$d_Gconvert'
24419 d_PRIEUldbl='$d_PRIEUldbl'
24420 d_PRIFUldbl='$d_PRIFUldbl'
24421 d_PRIGUldbl='$d_PRIGUldbl'
24422 d_PRIXU64='$d_PRIXU64'
24423 d_PRId64='$d_PRId64'
24424 d_PRIeldbl='$d_PRIeldbl'
24425 d_PRIfldbl='$d_PRIfldbl'
24426 d_PRIgldbl='$d_PRIgldbl'
24427 d_PRIi64='$d_PRIi64'
24428 d_PRIo64='$d_PRIo64'
24429 d_PRIu64='$d_PRIu64'
24430 d_PRIx64='$d_PRIx64'
24431 d_SCNfldbl='$d_SCNfldbl'
24432 d__fwalk='$d__fwalk'
24433 d_access='$d_access'
24434 d_accessx='$d_accessx'
24435 d_acosh='$d_acosh'
24436 d_aintl='$d_aintl'
24437 d_alarm='$d_alarm'
24438 d_archlib='$d_archlib'
24439 d_asctime64='$d_asctime64'
24440 d_asctime_r='$d_asctime_r'
24441 d_asinh='$d_asinh'
24442 d_atanh='$d_atanh'
24443 d_atolf='$d_atolf'
24444 d_atoll='$d_atoll'
24445 d_attribute_deprecated='$d_attribute_deprecated'
24446 d_attribute_format='$d_attribute_format'
24447 d_attribute_malloc='$d_attribute_malloc'
24448 d_attribute_nonnull='$d_attribute_nonnull'
24449 d_attribute_noreturn='$d_attribute_noreturn'
24450 d_attribute_pure='$d_attribute_pure'
24451 d_attribute_unused='$d_attribute_unused'
24452 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24453 d_backtrace='$d_backtrace'
24454 d_bcmp='$d_bcmp'
24455 d_bcopy='$d_bcopy'
24456 d_bsd='$d_bsd'
24457 d_bsdgetpgrp='$d_bsdgetpgrp'
24458 d_bsdsetpgrp='$d_bsdsetpgrp'
24459 d_builtin_choose_expr='$d_builtin_choose_expr'
24460 d_builtin_expect='$d_builtin_expect'
24461 d_bzero='$d_bzero'
24462 d_c99_variadic_macros='$d_c99_variadic_macros'
24463 d_casti32='$d_casti32'
24464 d_castneg='$d_castneg'
24465 d_cbrt='$d_cbrt'
24466 d_charvspr='$d_charvspr'
24467 d_chown='$d_chown'
24468 d_chroot='$d_chroot'
24469 d_chsize='$d_chsize'
24470 d_class='$d_class'
24471 d_clearenv='$d_clearenv'
24472 d_closedir='$d_closedir'
24473 d_cmsghdr_s='$d_cmsghdr_s'
24474 d_const='$d_const'
24475 d_copysign='$d_copysign'
24476 d_copysignl='$d_copysignl'
24477 d_cplusplus='$d_cplusplus'
24478 d_crypt='$d_crypt'
24479 d_crypt_r='$d_crypt_r'
24480 d_csh='$d_csh'
24481 d_ctermid='$d_ctermid'
24482 d_ctermid_r='$d_ctermid_r'
24483 d_ctime64='$d_ctime64'
24484 d_ctime_r='$d_ctime_r'
24485 d_cuserid='$d_cuserid'
24486 d_dbl_dig='$d_dbl_dig'
24487 d_dbminitproto='$d_dbminitproto'
24488 d_difftime64='$d_difftime64'
24489 d_difftime='$d_difftime'
24490 d_dir_dd_fd='$d_dir_dd_fd'
24491 d_dirfd='$d_dirfd'
24492 d_dirnamlen='$d_dirnamlen'
24493 d_dladdr='$d_dladdr'
24494 d_dlerror='$d_dlerror'
24495 d_dlopen='$d_dlopen'
24496 d_dlsymun='$d_dlsymun'
24497 d_dosuid='$d_dosuid'
24498 d_double_has_inf='$d_double_has_inf'
24499 d_double_has_nan='$d_double_has_nan'
24500 d_double_has_negative_zero='$d_double_has_negative_zero'
24501 d_double_has_subnormals='$d_double_has_subnormals'
24502 d_double_style_cray='$d_double_style_cray'
24503 d_double_style_ibm='$d_double_style_ibm'
24504 d_double_style_ieee='$d_double_style_ieee'
24505 d_double_style_vax='$d_double_style_vax'
24506 d_drand48_r='$d_drand48_r'
24507 d_drand48proto='$d_drand48proto'
24508 d_dup2='$d_dup2'
24509 d_duplocale='$d_duplocale'
24510 d_eaccess='$d_eaccess'
24511 d_endgrent='$d_endgrent'
24512 d_endgrent_r='$d_endgrent_r'
24513 d_endhent='$d_endhent'
24514 d_endhostent_r='$d_endhostent_r'
24515 d_endnent='$d_endnent'
24516 d_endnetent_r='$d_endnetent_r'
24517 d_endpent='$d_endpent'
24518 d_endprotoent_r='$d_endprotoent_r'
24519 d_endpwent='$d_endpwent'
24520 d_endpwent_r='$d_endpwent_r'
24521 d_endsent='$d_endsent'
24522 d_endservent_r='$d_endservent_r'
24523 d_eofnblk='$d_eofnblk'
24524 d_erf='$d_erf'
24525 d_erfc='$d_erfc'
24526 d_eunice='$d_eunice'
24527 d_exp2='$d_exp2'
24528 d_expm1='$d_expm1'
24529 d_faststdio='$d_faststdio'
24530 d_fchdir='$d_fchdir'
24531 d_fchmod='$d_fchmod'
24532 d_fchown='$d_fchown'
24533 d_fcntl='$d_fcntl'
24534 d_fcntl_can_lock='$d_fcntl_can_lock'
24535 d_fd_macros='$d_fd_macros'
24536 d_fd_set='$d_fd_set'
24537 d_fdclose='$d_fdclose'
24538 d_fdim='$d_fdim'
24539 d_fds_bits='$d_fds_bits'
24540 d_fegetround='$d_fegetround'
24541 d_fgetpos='$d_fgetpos'
24542 d_finite='$d_finite'
24543 d_finitel='$d_finitel'
24544 d_flexfnam='$d_flexfnam'
24545 d_flock='$d_flock'
24546 d_flockproto='$d_flockproto'
24547 d_fma='$d_fma'
24548 d_fmax='$d_fmax'
24549 d_fmin='$d_fmin'
24550 d_fork='$d_fork'
24551 d_fp_class='$d_fp_class'
24552 d_fp_classify='$d_fp_classify'
24553 d_fp_classl='$d_fp_classl'
24554 d_fpathconf='$d_fpathconf'
24555 d_fpclass='$d_fpclass'
24556 d_fpclassify='$d_fpclassify'
24557 d_fpclassl='$d_fpclassl'
24558 d_fpgetround='$d_fpgetround'
24559 d_fpos64_t='$d_fpos64_t'
24560 d_freelocale='$d_freelocale'
24561 d_frexpl='$d_frexpl'
24562 d_fs_data_s='$d_fs_data_s'
24563 d_fseeko='$d_fseeko'
24564 d_fsetpos='$d_fsetpos'
24565 d_fstatfs='$d_fstatfs'
24566 d_fstatvfs='$d_fstatvfs'
24567 d_fsync='$d_fsync'
24568 d_ftello='$d_ftello'
24569 d_ftime='$d_ftime'
24570 d_futimes='$d_futimes'
24571 d_gai_strerror='$d_gai_strerror'
24572 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24573 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24574 d_getaddrinfo='$d_getaddrinfo'
24575 d_getcwd='$d_getcwd'
24576 d_getespwnam='$d_getespwnam'
24577 d_getfsstat='$d_getfsstat'
24578 d_getgrent='$d_getgrent'
24579 d_getgrent_r='$d_getgrent_r'
24580 d_getgrgid_r='$d_getgrgid_r'
24581 d_getgrnam_r='$d_getgrnam_r'
24582 d_getgrps='$d_getgrps'
24583 d_gethbyaddr='$d_gethbyaddr'
24584 d_gethbyname='$d_gethbyname'
24585 d_gethent='$d_gethent'
24586 d_gethname='$d_gethname'
24587 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24588 d_gethostbyname_r='$d_gethostbyname_r'
24589 d_gethostent_r='$d_gethostent_r'
24590 d_gethostprotos='$d_gethostprotos'
24591 d_getitimer='$d_getitimer'
24592 d_getlogin='$d_getlogin'
24593 d_getlogin_r='$d_getlogin_r'
24594 d_getmnt='$d_getmnt'
24595 d_getmntent='$d_getmntent'
24596 d_getnameinfo='$d_getnameinfo'
24597 d_getnbyaddr='$d_getnbyaddr'
24598 d_getnbyname='$d_getnbyname'
24599 d_getnent='$d_getnent'
24600 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24601 d_getnetbyname_r='$d_getnetbyname_r'
24602 d_getnetent_r='$d_getnetent_r'
24603 d_getnetprotos='$d_getnetprotos'
24604 d_getpagsz='$d_getpagsz'
24605 d_getpbyname='$d_getpbyname'
24606 d_getpbynumber='$d_getpbynumber'
24607 d_getpent='$d_getpent'
24608 d_getpgid='$d_getpgid'
24609 d_getpgrp2='$d_getpgrp2'
24610 d_getpgrp='$d_getpgrp'
24611 d_getppid='$d_getppid'
24612 d_getprior='$d_getprior'
24613 d_getprotobyname_r='$d_getprotobyname_r'
24614 d_getprotobynumber_r='$d_getprotobynumber_r'
24615 d_getprotoent_r='$d_getprotoent_r'
24616 d_getprotoprotos='$d_getprotoprotos'
24617 d_getprpwnam='$d_getprpwnam'
24618 d_getpwent='$d_getpwent'
24619 d_getpwent_r='$d_getpwent_r'
24620 d_getpwnam_r='$d_getpwnam_r'
24621 d_getpwuid_r='$d_getpwuid_r'
24622 d_getsbyname='$d_getsbyname'
24623 d_getsbyport='$d_getsbyport'
24624 d_getsent='$d_getsent'
24625 d_getservbyname_r='$d_getservbyname_r'
24626 d_getservbyport_r='$d_getservbyport_r'
24627 d_getservent_r='$d_getservent_r'
24628 d_getservprotos='$d_getservprotos'
24629 d_getspnam='$d_getspnam'
24630 d_getspnam_r='$d_getspnam_r'
24631 d_gettimeod='$d_gettimeod'
24632 d_gmtime64='$d_gmtime64'
24633 d_gmtime_r='$d_gmtime_r'
24634 d_gnulibc='$d_gnulibc'
24635 d_grpasswd='$d_grpasswd'
24636 d_hasmntopt='$d_hasmntopt'
24637 d_htonl='$d_htonl'
24638 d_hypot='$d_hypot'
24639 d_ilogb='$d_ilogb'
24640 d_ilogbl='$d_ilogbl'
24641 d_inc_version_list='$d_inc_version_list'
24642 d_index='$d_index'
24643 d_inetaton='$d_inetaton'
24644 d_inetntop='$d_inetntop'
24645 d_inetpton='$d_inetpton'
24646 d_int64_t='$d_int64_t'
24647 d_ip_mreq='$d_ip_mreq'
24648 d_ip_mreq_source='$d_ip_mreq_source'
24649 d_ipv6_mreq='$d_ipv6_mreq'
24650 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24651 d_isascii='$d_isascii'
24652 d_isblank='$d_isblank'
24653 d_isfinite='$d_isfinite'
24654 d_isfinitel='$d_isfinitel'
24655 d_isinf='$d_isinf'
24656 d_isinfl='$d_isinfl'
24657 d_isless='$d_isless'
24658 d_isnan='$d_isnan'
24659 d_isnanl='$d_isnanl'
24660 d_isnormal='$d_isnormal'
24661 d_j0='$d_j0'
24662 d_j0l='$d_j0l'
24663 d_killpg='$d_killpg'
24664 d_lc_monetary_2008='$d_lc_monetary_2008'
24665 d_lchown='$d_lchown'
24666 d_ldbl_dig='$d_ldbl_dig'
24667 d_ldexpl='$d_ldexpl'
24668 d_lgamma='$d_lgamma'
24669 d_lgamma_r='$d_lgamma_r'
24670 d_libm_lib_version='$d_libm_lib_version'
24671 d_libname_unique='$d_libname_unique'
24672 d_link='$d_link'
24673 d_llrint='$d_llrint'
24674 d_llrintl='$d_llrintl'
24675 d_llround='$d_llround'
24676 d_llroundl='$d_llroundl'
24677 d_localtime64='$d_localtime64'
24678 d_localtime_r='$d_localtime_r'
24679 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24680 d_locconv='$d_locconv'
24681 d_lockf='$d_lockf'
24682 d_log1p='$d_log1p'
24683 d_log2='$d_log2'
24684 d_logb='$d_logb'
24685 d_long_double_style_ieee='$d_long_double_style_ieee'
24686 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24687 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24688 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24689 d_long_double_style_vax='$d_long_double_style_vax'
24690 d_longdbl='$d_longdbl'
24691 d_longlong='$d_longlong'
24692 d_lrint='$d_lrint'
24693 d_lrintl='$d_lrintl'
24694 d_lround='$d_lround'
24695 d_lroundl='$d_lroundl'
24696 d_lseekproto='$d_lseekproto'
24697 d_lstat='$d_lstat'
24698 d_madvise='$d_madvise'
24699 d_malloc_good_size='$d_malloc_good_size'
24700 d_malloc_size='$d_malloc_size'
24701 d_mblen='$d_mblen'
24702 d_mbstowcs='$d_mbstowcs'
24703 d_mbtowc='$d_mbtowc'
24704 d_memchr='$d_memchr'
24705 d_memcmp='$d_memcmp'
24706 d_memcpy='$d_memcpy'
24707 d_memmem='$d_memmem'
24708 d_memmove='$d_memmove'
24709 d_memset='$d_memset'
24710 d_mkdir='$d_mkdir'
24711 d_mkdtemp='$d_mkdtemp'
24712 d_mkfifo='$d_mkfifo'
24713 d_mkstemp='$d_mkstemp'
24714 d_mkstemps='$d_mkstemps'
24715 d_mktime64='$d_mktime64'
24716 d_mktime='$d_mktime'
24717 d_mmap='$d_mmap'
24718 d_modfl='$d_modfl'
24719 d_modflproto='$d_modflproto'
24720 d_mprotect='$d_mprotect'
24721 d_msg='$d_msg'
24722 d_msg_ctrunc='$d_msg_ctrunc'
24723 d_msg_dontroute='$d_msg_dontroute'
24724 d_msg_oob='$d_msg_oob'
24725 d_msg_peek='$d_msg_peek'
24726 d_msg_proxy='$d_msg_proxy'
24727 d_msgctl='$d_msgctl'
24728 d_msgget='$d_msgget'
24729 d_msghdr_s='$d_msghdr_s'
24730 d_msgrcv='$d_msgrcv'
24731 d_msgsnd='$d_msgsnd'
24732 d_msync='$d_msync'
24733 d_munmap='$d_munmap'
24734 d_mymalloc='$d_mymalloc'
24735 d_nan='$d_nan'
24736 d_ndbm='$d_ndbm'
24737 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24738 d_nearbyint='$d_nearbyint'
24739 d_newlocale='$d_newlocale'
24740 d_nextafter='$d_nextafter'
24741 d_nexttoward='$d_nexttoward'
24742 d_nice='$d_nice'
24743 d_nl_langinfo='$d_nl_langinfo'
24744 d_nv_preserves_uv='$d_nv_preserves_uv'
24745 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24746 d_off64_t='$d_off64_t'
24747 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24748 d_oldpthreads='$d_oldpthreads'
24749 d_oldsock='$d_oldsock'
24750 d_open3='$d_open3'
24751 d_pathconf='$d_pathconf'
24752 d_pause='$d_pause'
24753 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24754 d_phostname='$d_phostname'
24755 d_pipe='$d_pipe'
24756 d_poll='$d_poll'
24757 d_portable='$d_portable'
24758 d_prctl='$d_prctl'
24759 d_prctl_set_name='$d_prctl_set_name'
24760 d_printf_format_null='$d_printf_format_null'
24761 d_procselfexe='$d_procselfexe'
24762 d_pseudofork='$d_pseudofork'
24763 d_pthread_atfork='$d_pthread_atfork'
24764 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24765 d_pthread_yield='$d_pthread_yield'
24766 d_ptrdiff_t='$d_ptrdiff_t'
24767 d_pwage='$d_pwage'
24768 d_pwchange='$d_pwchange'
24769 d_pwclass='$d_pwclass'
24770 d_pwcomment='$d_pwcomment'
24771 d_pwexpire='$d_pwexpire'
24772 d_pwgecos='$d_pwgecos'
24773 d_pwpasswd='$d_pwpasswd'
24774 d_pwquota='$d_pwquota'
24775 d_qgcvt='$d_qgcvt'
24776 d_quad='$d_quad'
24777 d_querylocale='$d_querylocale'
24778 d_random_r='$d_random_r'
24779 d_re_comp='$d_re_comp'
24780 d_readdir64_r='$d_readdir64_r'
24781 d_readdir='$d_readdir'
24782 d_readdir_r='$d_readdir_r'
24783 d_readlink='$d_readlink'
24784 d_readv='$d_readv'
24785 d_recvmsg='$d_recvmsg'
24786 d_regcmp='$d_regcmp'
24787 d_regcomp='$d_regcomp'
24788 d_remainder='$d_remainder'
24789 d_remquo='$d_remquo'
24790 d_rename='$d_rename'
24791 d_rewinddir='$d_rewinddir'
24792 d_rint='$d_rint'
24793 d_rmdir='$d_rmdir'
24794 d_round='$d_round'
24795 d_safebcpy='$d_safebcpy'
24796 d_safemcpy='$d_safemcpy'
24797 d_sanemcmp='$d_sanemcmp'
24798 d_sbrkproto='$d_sbrkproto'
24799 d_scalbn='$d_scalbn'
24800 d_scalbnl='$d_scalbnl'
24801 d_sched_yield='$d_sched_yield'
24802 d_scm_rights='$d_scm_rights'
24803 d_seekdir='$d_seekdir'
24804 d_select='$d_select'
24805 d_sem='$d_sem'
24806 d_semctl='$d_semctl'
24807 d_semctl_semid_ds='$d_semctl_semid_ds'
24808 d_semctl_semun='$d_semctl_semun'
24809 d_semget='$d_semget'
24810 d_semop='$d_semop'
24811 d_sendmsg='$d_sendmsg'
24812 d_setegid='$d_setegid'
24813 d_seteuid='$d_seteuid'
24814 d_setgrent='$d_setgrent'
24815 d_setgrent_r='$d_setgrent_r'
24816 d_setgrps='$d_setgrps'
24817 d_sethent='$d_sethent'
24818 d_sethostent_r='$d_sethostent_r'
24819 d_setitimer='$d_setitimer'
24820 d_setlinebuf='$d_setlinebuf'
24821 d_setlocale='$d_setlocale'
24822 d_setlocale_r='$d_setlocale_r'
24823 d_setnent='$d_setnent'
24824 d_setnetent_r='$d_setnetent_r'
24825 d_setpent='$d_setpent'
24826 d_setpgid='$d_setpgid'
24827 d_setpgrp2='$d_setpgrp2'
24828 d_setpgrp='$d_setpgrp'
24829 d_setprior='$d_setprior'
24830 d_setproctitle='$d_setproctitle'
24831 d_setprotoent_r='$d_setprotoent_r'
24832 d_setpwent='$d_setpwent'
24833 d_setpwent_r='$d_setpwent_r'
24834 d_setregid='$d_setregid'
24835 d_setresgid='$d_setresgid'
24836 d_setresuid='$d_setresuid'
24837 d_setreuid='$d_setreuid'
24838 d_setrgid='$d_setrgid'
24839 d_setruid='$d_setruid'
24840 d_setsent='$d_setsent'
24841 d_setservent_r='$d_setservent_r'
24842 d_setsid='$d_setsid'
24843 d_setvbuf='$d_setvbuf'
24844 d_shm='$d_shm'
24845 d_shmat='$d_shmat'
24846 d_shmatprototype='$d_shmatprototype'
24847 d_shmctl='$d_shmctl'
24848 d_shmdt='$d_shmdt'
24849 d_shmget='$d_shmget'
24850 d_sigaction='$d_sigaction'
24851 d_siginfo_si_addr='$d_siginfo_si_addr'
24852 d_siginfo_si_band='$d_siginfo_si_band'
24853 d_siginfo_si_errno='$d_siginfo_si_errno'
24854 d_siginfo_si_fd='$d_siginfo_si_fd'
24855 d_siginfo_si_pid='$d_siginfo_si_pid'
24856 d_siginfo_si_status='$d_siginfo_si_status'
24857 d_siginfo_si_uid='$d_siginfo_si_uid'
24858 d_siginfo_si_value='$d_siginfo_si_value'
24859 d_signbit='$d_signbit'
24860 d_sigprocmask='$d_sigprocmask'
24861 d_sigsetjmp='$d_sigsetjmp'
24862 d_sin6_scope_id='$d_sin6_scope_id'
24863 d_sitearch='$d_sitearch'
24864 d_snprintf='$d_snprintf'
24865 d_sockaddr_in6='$d_sockaddr_in6'
24866 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24867 d_sockatmark='$d_sockatmark'
24868 d_sockatmarkproto='$d_sockatmarkproto'
24869 d_socket='$d_socket'
24870 d_socklen_t='$d_socklen_t'
24871 d_sockpair='$d_sockpair'
24872 d_socks5_init='$d_socks5_init'
24873 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24874 d_sqrtl='$d_sqrtl'
24875 d_srand48_r='$d_srand48_r'
24876 d_srandom_r='$d_srandom_r'
24877 d_sresgproto='$d_sresgproto'
24878 d_sresuproto='$d_sresuproto'
24879 d_stat='$d_stat'
24880 d_statblks='$d_statblks'
24881 d_statfs_f_flags='$d_statfs_f_flags'
24882 d_statfs_s='$d_statfs_s'
24883 d_static_inline='$d_static_inline'
24884 d_statvfs='$d_statvfs'
24885 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24886 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24887 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24888 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24889 d_stdio_stream_array='$d_stdio_stream_array'
24890 d_stdiobase='$d_stdiobase'
24891 d_stdstdio='$d_stdstdio'
24892 d_strchr='$d_strchr'
24893 d_strcoll='$d_strcoll'
24894 d_strctcpy='$d_strctcpy'
24895 d_strerrm='$d_strerrm'
24896 d_strerror='$d_strerror'
24897 d_strerror_l='$d_strerror_l'
24898 d_strerror_r='$d_strerror_r'
24899 d_strftime='$d_strftime'
24900 d_strlcat='$d_strlcat'
24901 d_strlcpy='$d_strlcpy'
24902 d_strtod='$d_strtod'
24903 d_strtol='$d_strtol'
24904 d_strtold='$d_strtold'
24905 d_strtoll='$d_strtoll'
24906 d_strtoq='$d_strtoq'
24907 d_strtoul='$d_strtoul'
24908 d_strtoull='$d_strtoull'
24909 d_strtouq='$d_strtouq'
24910 d_strxfrm='$d_strxfrm'
24911 d_suidsafe='$d_suidsafe'
24912 d_symlink='$d_symlink'
24913 d_syscall='$d_syscall'
24914 d_syscallproto='$d_syscallproto'
24915 d_sysconf='$d_sysconf'
24916 d_sysernlst='$d_sysernlst'
24917 d_syserrlst='$d_syserrlst'
24918 d_system='$d_system'
24919 d_tcgetpgrp='$d_tcgetpgrp'
24920 d_tcsetpgrp='$d_tcsetpgrp'
24921 d_telldir='$d_telldir'
24922 d_telldirproto='$d_telldirproto'
24923 d_tgamma='$d_tgamma'
24924 d_time='$d_time'
24925 d_timegm='$d_timegm'
24926 d_times='$d_times'
24927 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24928 d_tm_tm_zone='$d_tm_tm_zone'
24929 d_tmpnam_r='$d_tmpnam_r'
24930 d_trunc='$d_trunc'
24931 d_truncate='$d_truncate'
24932 d_truncl='$d_truncl'
24933 d_ttyname_r='$d_ttyname_r'
24934 d_tzname='$d_tzname'
24935 d_u32align='$d_u32align'
24936 d_ualarm='$d_ualarm'
24937 d_umask='$d_umask'
24938 d_uname='$d_uname'
24939 d_union_semun='$d_union_semun'
24940 d_unordered='$d_unordered'
24941 d_unsetenv='$d_unsetenv'
24942 d_uselocale='$d_uselocale'
24943 d_usleep='$d_usleep'
24944 d_usleepproto='$d_usleepproto'
24945 d_ustat='$d_ustat'
24946 d_vendorarch='$d_vendorarch'
24947 d_vendorbin='$d_vendorbin'
24948 d_vendorlib='$d_vendorlib'
24949 d_vendorscript='$d_vendorscript'
24950 d_vfork='$d_vfork'
24951 d_void_closedir='$d_void_closedir'
24952 d_voidsig='$d_voidsig'
24953 d_voidtty='$d_voidtty'
24954 d_volatile='$d_volatile'
24955 d_vprintf='$d_vprintf'
24956 d_vsnprintf='$d_vsnprintf'
24957 d_wait4='$d_wait4'
24958 d_waitpid='$d_waitpid'
24959 d_wcscmp='$d_wcscmp'
24960 d_wcstombs='$d_wcstombs'
24961 d_wcsxfrm='$d_wcsxfrm'
24962 d_wctomb='$d_wctomb'
24963 d_writev='$d_writev'
24964 d_xenix='$d_xenix'
24965 date='$date'
24966 db_hashtype='$db_hashtype'
24967 db_prefixtype='$db_prefixtype'
24968 db_version_major='$db_version_major'
24969 db_version_minor='$db_version_minor'
24970 db_version_patch='$db_version_patch'
24971 default_inc_excludes_dot='$default_inc_excludes_dot'
24972 direntrytype='$direntrytype'
24973 dlext='$dlext'
24974 dlsrc='$dlsrc'
24975 doubleinfbytes='$doubleinfbytes'
24976 doublekind='$doublekind'
24977 doublemantbits='$doublemantbits'
24978 doublenanbytes='$doublenanbytes'
24979 doublesize='$doublesize'
24980 drand01='$drand01'
24981 drand48_r_proto='$drand48_r_proto'
24982 dtrace='$dtrace'
24983 dtraceobject='$dtraceobject'
24984 dtracexnolibs='$dtracexnolibs'
24985 dynamic_ext='$dynamic_ext'
24986 eagain='$eagain'
24987 ebcdic='$ebcdic'
24988 echo='$echo'
24989 egrep='$egrep'
24990 emacs='$emacs'
24991 endgrent_r_proto='$endgrent_r_proto'
24992 endhostent_r_proto='$endhostent_r_proto'
24993 endnetent_r_proto='$endnetent_r_proto'
24994 endprotoent_r_proto='$endprotoent_r_proto'
24995 endpwent_r_proto='$endpwent_r_proto'
24996 endservent_r_proto='$endservent_r_proto'
24997 eunicefix='$eunicefix'
24998 exe_ext='$exe_ext'
24999 expr='$expr'
25000 extensions='$extensions'
25001 extern_C='$extern_C'
25002 extras='$extras'
25003 fflushNULL='$fflushNULL'
25004 fflushall='$fflushall'
25005 find='$find'
25006 firstmakefile='$firstmakefile'
25007 flex='$flex'
25008 fpossize='$fpossize'
25009 fpostype='$fpostype'
25010 freetype='$freetype'
25011 from='$from'
25012 full_ar='$full_ar'
25013 full_csh='$full_csh'
25014 full_sed='$full_sed'
25015 gccansipedantic='$gccansipedantic'
25016 gccosandvers='$gccosandvers'
25017 gccversion='$gccversion'
25018 getgrent_r_proto='$getgrent_r_proto'
25019 getgrgid_r_proto='$getgrgid_r_proto'
25020 getgrnam_r_proto='$getgrnam_r_proto'
25021 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
25022 gethostbyname_r_proto='$gethostbyname_r_proto'
25023 gethostent_r_proto='$gethostent_r_proto'
25024 getlogin_r_proto='$getlogin_r_proto'
25025 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
25026 getnetbyname_r_proto='$getnetbyname_r_proto'
25027 getnetent_r_proto='$getnetent_r_proto'
25028 getprotobyname_r_proto='$getprotobyname_r_proto'
25029 getprotobynumber_r_proto='$getprotobynumber_r_proto'
25030 getprotoent_r_proto='$getprotoent_r_proto'
25031 getpwent_r_proto='$getpwent_r_proto'
25032 getpwnam_r_proto='$getpwnam_r_proto'
25033 getpwuid_r_proto='$getpwuid_r_proto'
25034 getservbyname_r_proto='$getservbyname_r_proto'
25035 getservbyport_r_proto='$getservbyport_r_proto'
25036 getservent_r_proto='$getservent_r_proto'
25037 getspnam_r_proto='$getspnam_r_proto'
25038 gidformat='$gidformat'
25039 gidsign='$gidsign'
25040 gidsize='$gidsize'
25041 gidtype='$gidtype'
25042 glibpth='$glibpth'
25043 gmake='$gmake'
25044 gmtime_r_proto='$gmtime_r_proto'
25045 gnulibc_version='$gnulibc_version'
25046 grep='$grep'
25047 groupcat='$groupcat'
25048 groupstype='$groupstype'
25049 gzip='$gzip'
25050 h_fcntl='$h_fcntl'
25051 h_sysfile='$h_sysfile'
25052 hint='$hint'
25053 hostcat='$hostcat'
25054 hostgenerate='$hostgenerate'
25055 hostosname='$hostosname'
25056 hostperl='$hostperl'
25057 html1dir='$html1dir'
25058 html1direxp='$html1direxp'
25059 html3dir='$html3dir'
25060 html3direxp='$html3direxp'
25061 i16size='$i16size'
25062 i16type='$i16type'
25063 i32size='$i32size'
25064 i32type='$i32type'
25065 i64size='$i64size'
25066 i64type='$i64type'
25067 i8size='$i8size'
25068 i8type='$i8type'
25069 i_arpainet='$i_arpainet'
25070 i_assert='$i_assert'
25071 i_bfd='$i_bfd'
25072 i_bsdioctl='$i_bsdioctl'
25073 i_crypt='$i_crypt'
25074 i_db='$i_db'
25075 i_dbm='$i_dbm'
25076 i_dirent='$i_dirent'
25077 i_dlfcn='$i_dlfcn'
25078 i_execinfo='$i_execinfo'
25079 i_fcntl='$i_fcntl'
25080 i_fenv='$i_fenv'
25081 i_float='$i_float'
25082 i_fp='$i_fp'
25083 i_fp_class='$i_fp_class'
25084 i_gdbm='$i_gdbm'
25085 i_gdbm_ndbm='$i_gdbm_ndbm'
25086 i_gdbmndbm='$i_gdbmndbm'
25087 i_grp='$i_grp'
25088 i_ieeefp='$i_ieeefp'
25089 i_inttypes='$i_inttypes'
25090 i_langinfo='$i_langinfo'
25091 i_libutil='$i_libutil'
25092 i_limits='$i_limits'
25093 i_locale='$i_locale'
25094 i_machcthr='$i_machcthr'
25095 i_malloc='$i_malloc'
25096 i_mallocmalloc='$i_mallocmalloc'
25097 i_math='$i_math'
25098 i_memory='$i_memory'
25099 i_mntent='$i_mntent'
25100 i_ndbm='$i_ndbm'
25101 i_netdb='$i_netdb'
25102 i_neterrno='$i_neterrno'
25103 i_netinettcp='$i_netinettcp'
25104 i_niin='$i_niin'
25105 i_poll='$i_poll'
25106 i_prot='$i_prot'
25107 i_pthread='$i_pthread'
25108 i_pwd='$i_pwd'
25109 i_quadmath='$i_quadmath'
25110 i_rpcsvcdbm='$i_rpcsvcdbm'
25111 i_sgtty='$i_sgtty'
25112 i_shadow='$i_shadow'
25113 i_socks='$i_socks'
25114 i_stdarg='$i_stdarg'
25115 i_stdbool='$i_stdbool'
25116 i_stddef='$i_stddef'
25117 i_stdint='$i_stdint'
25118 i_stdlib='$i_stdlib'
25119 i_string='$i_string'
25120 i_sunmath='$i_sunmath'
25121 i_sysaccess='$i_sysaccess'
25122 i_sysdir='$i_sysdir'
25123 i_sysfile='$i_sysfile'
25124 i_sysfilio='$i_sysfilio'
25125 i_sysin='$i_sysin'
25126 i_sysioctl='$i_sysioctl'
25127 i_syslog='$i_syslog'
25128 i_sysmman='$i_sysmman'
25129 i_sysmode='$i_sysmode'
25130 i_sysmount='$i_sysmount'
25131 i_sysndir='$i_sysndir'
25132 i_sysparam='$i_sysparam'
25133 i_syspoll='$i_syspoll'
25134 i_sysresrc='$i_sysresrc'
25135 i_syssecrt='$i_syssecrt'
25136 i_sysselct='$i_sysselct'
25137 i_syssockio='$i_syssockio'
25138 i_sysstat='$i_sysstat'
25139 i_sysstatfs='$i_sysstatfs'
25140 i_sysstatvfs='$i_sysstatvfs'
25141 i_systime='$i_systime'
25142 i_systimek='$i_systimek'
25143 i_systimes='$i_systimes'
25144 i_systypes='$i_systypes'
25145 i_sysuio='$i_sysuio'
25146 i_sysun='$i_sysun'
25147 i_sysutsname='$i_sysutsname'
25148 i_sysvfs='$i_sysvfs'
25149 i_syswait='$i_syswait'
25150 i_termio='$i_termio'
25151 i_termios='$i_termios'
25152 i_time='$i_time'
25153 i_unistd='$i_unistd'
25154 i_ustat='$i_ustat'
25155 i_utime='$i_utime'
25156 i_values='$i_values'
25157 i_varargs='$i_varargs'
25158 i_varhdr='$i_varhdr'
25159 i_vfork='$i_vfork'
25160 i_xlocale='$i_xlocale'
25161 ignore_versioned_solibs='$ignore_versioned_solibs'
25162 inc_version_list='$inc_version_list'
25163 inc_version_list_init='$inc_version_list_init'
25164 incpath='$incpath'
25165 incpth='$incpth'
25166 inews='$inews'
25167 initialinstalllocation='$initialinstalllocation'
25168 installarchlib='$installarchlib'
25169 installbin='$installbin'
25170 installhtml1dir='$installhtml1dir'
25171 installhtml3dir='$installhtml3dir'
25172 installman1dir='$installman1dir'
25173 installman3dir='$installman3dir'
25174 installprefix='$installprefix'
25175 installprefixexp='$installprefixexp'
25176 installprivlib='$installprivlib'
25177 installscript='$installscript'
25178 installsitearch='$installsitearch'
25179 installsitebin='$installsitebin'
25180 installsitehtml1dir='$installsitehtml1dir'
25181 installsitehtml3dir='$installsitehtml3dir'
25182 installsitelib='$installsitelib'
25183 installsiteman1dir='$installsiteman1dir'
25184 installsiteman3dir='$installsiteman3dir'
25185 installsitescript='$installsitescript'
25186 installstyle='$installstyle'
25187 installusrbinperl='$installusrbinperl'
25188 installvendorarch='$installvendorarch'
25189 installvendorbin='$installvendorbin'
25190 installvendorhtml1dir='$installvendorhtml1dir'
25191 installvendorhtml3dir='$installvendorhtml3dir'
25192 installvendorlib='$installvendorlib'
25193 installvendorman1dir='$installvendorman1dir'
25194 installvendorman3dir='$installvendorman3dir'
25195 installvendorscript='$installvendorscript'
25196 intsize='$intsize'
25197 issymlink='$issymlink'
25198 ivdformat='$ivdformat'
25199 ivsize='$ivsize'
25200 ivtype='$ivtype'
25201 known_extensions='$known_extensions'
25202 ksh='$ksh'
25203 ld='$ld'
25204 ld_can_script='$ld_can_script'
25205 lddlflags='$lddlflags'
25206 ldflags='$ldflags'
25207 ldflags_uselargefiles='$ldflags_uselargefiles'
25208 ldlibpthname='$ldlibpthname'
25209 less='$less'
25210 lib_ext='$lib_ext'
25211 libc='$libc'
25212 libperl='$libperl'
25213 libpth='$libpth'
25214 libs='$libs'
25215 libsdirs='$libsdirs'
25216 libsfiles='$libsfiles'
25217 libsfound='$libsfound'
25218 libspath='$libspath'
25219 libswanted='$libswanted'
25220 libswanted_uselargefiles='$libswanted_uselargefiles'
25221 line='$line'
25222 lint='$lint'
25223 lkflags='$lkflags'
25224 ln='$ln'
25225 lns='$lns'
25226 localtime_r_proto='$localtime_r_proto'
25227 locincpth='$locincpth'
25228 loclibpth='$loclibpth'
25229 longdblinfbytes='$longdblinfbytes'
25230 longdblkind='$longdblkind'
25231 longdblmantbits='$longdblmantbits'
25232 longdblnanbytes='$longdblnanbytes'
25233 longdblsize='$longdblsize'
25234 longlongsize='$longlongsize'
25235 longsize='$longsize'
25236 lp='$lp'
25237 lpr='$lpr'
25238 ls='$ls'
25239 lseeksize='$lseeksize'
25240 lseektype='$lseektype'
25241 mail='$mail'
25242 mailx='$mailx'
25243 make='$make'
25244 make_set_make='$make_set_make'
25245 mallocobj='$mallocobj'
25246 mallocsrc='$mallocsrc'
25247 malloctype='$malloctype'
25248 man1dir='$man1dir'
25249 man1direxp='$man1direxp'
25250 man1ext='$man1ext'
25251 man3dir='$man3dir'
25252 man3direxp='$man3direxp'
25253 man3ext='$man3ext'
25254 mips_type='$mips_type'
25255 mistrustnm='$mistrustnm'
25256 mkdir='$mkdir'
25257 mmaptype='$mmaptype'
25258 modetype='$modetype'
25259 more='$more'
25260 multiarch='$multiarch'
25261 mv='$mv'
25262 myarchname='$myarchname'
25263 mydomain='$mydomain'
25264 myhostname='$myhostname'
25265 myuname='$myuname'
25266 n='$n'
25267 need_va_copy='$need_va_copy'
25268 netdb_hlen_type='$netdb_hlen_type'
25269 netdb_host_type='$netdb_host_type'
25270 netdb_name_type='$netdb_name_type'
25271 netdb_net_type='$netdb_net_type'
25272 nm='$nm'
25273 nm_opt='$nm_opt'
25274 nm_so_opt='$nm_so_opt'
25275 nonxs_ext='$nonxs_ext'
25276 nroff='$nroff'
25277 nvEUformat='$nvEUformat'
25278 nvFUformat='$nvFUformat'
25279 nvGUformat='$nvGUformat'
25280 nv_overflows_integers_at='$nv_overflows_integers_at'
25281 nv_preserves_uv_bits='$nv_preserves_uv_bits'
25282 nveformat='$nveformat'
25283 nvfformat='$nvfformat'
25284 nvgformat='$nvgformat'
25285 nvmantbits='$nvmantbits'
25286 nvsize='$nvsize'
25287 nvtype='$nvtype'
25288 o_nonblock='$o_nonblock'
25289 obj_ext='$obj_ext'
25290 old_pthread_create_joinable='$old_pthread_create_joinable'
25291 optimize='$optimize'
25292 orderlib='$orderlib'
25293 osname='$osname'
25294 osvers='$osvers'
25295 otherlibdirs='$otherlibdirs'
25296 package='$package'
25297 pager='$pager'
25298 passcat='$passcat'
25299 patchlevel='$patchlevel'
25300 path_sep='$path_sep'
25301 perl5='$perl5'
25302 perl='$perl'
25303 perl_patchlevel='$perl_patchlevel'
25304 perl_static_inline='$perl_static_inline'
25305 perladmin='$perladmin'
25306 perllibs='$perllibs'
25307 perlpath='$perlpath'
25308 pg='$pg'
25309 phostname='$phostname'
25310 pidtype='$pidtype'
25311 plibpth='$plibpth'
25312 pmake='$pmake'
25313 pr='$pr'
25314 prefix='$prefix'
25315 prefixexp='$prefixexp'
25316 privlib='$privlib'
25317 privlibexp='$privlibexp'
25318 procselfexe='$procselfexe'
25319 prototype='$prototype'
25320 ptrsize='$ptrsize'
25321 quadkind='$quadkind'
25322 quadtype='$quadtype'
25323 randbits='$randbits'
25324 randfunc='$randfunc'
25325 random_r_proto='$random_r_proto'
25326 randseedtype='$randseedtype'
25327 ranlib='$ranlib'
25328 rd_nodata='$rd_nodata'
25329 readdir64_r_proto='$readdir64_r_proto'
25330 readdir_r_proto='$readdir_r_proto'
25331 revision='$revision'
25332 rm='$rm'
25333 rm_try='$rm_try'
25334 rmail='$rmail'
25335 run='$run'
25336 runnm='$runnm'
25337 sGMTIME_max='$sGMTIME_max'
25338 sGMTIME_min='$sGMTIME_min'
25339 sLOCALTIME_max='$sLOCALTIME_max'
25340 sLOCALTIME_min='$sLOCALTIME_min'
25341 sPRIEUldbl='$sPRIEUldbl'
25342 sPRIFUldbl='$sPRIFUldbl'
25343 sPRIGUldbl='$sPRIGUldbl'
25344 sPRIXU64='$sPRIXU64'
25345 sPRId64='$sPRId64'
25346 sPRIeldbl='$sPRIeldbl'
25347 sPRIfldbl='$sPRIfldbl'
25348 sPRIgldbl='$sPRIgldbl'
25349 sPRIi64='$sPRIi64'
25350 sPRIo64='$sPRIo64'
25351 sPRIu64='$sPRIu64'
25352 sPRIx64='$sPRIx64'
25353 sSCNfldbl='$sSCNfldbl'
25354 sched_yield='$sched_yield'
25355 scriptdir='$scriptdir'
25356 scriptdirexp='$scriptdirexp'
25357 sed='$sed'
25358 seedfunc='$seedfunc'
25359 selectminbits='$selectminbits'
25360 selecttype='$selecttype'
25361 sendmail='$sendmail'
25362 setgrent_r_proto='$setgrent_r_proto'
25363 sethostent_r_proto='$sethostent_r_proto'
25364 setlocale_r_proto='$setlocale_r_proto'
25365 setnetent_r_proto='$setnetent_r_proto'
25366 setprotoent_r_proto='$setprotoent_r_proto'
25367 setpwent_r_proto='$setpwent_r_proto'
25368 setservent_r_proto='$setservent_r_proto'
25369 sh='$sh'
25370 shar='$shar'
25371 sharpbang='$sharpbang'
25372 shmattype='$shmattype'
25373 shortsize='$shortsize'
25374 shrpenv='$shrpenv'
25375 shsharp='$shsharp'
25376 sig_count='$sig_count'
25377 sig_name='$sig_name'
25378 sig_name_init='$sig_name_init'
25379 sig_num='$sig_num'
25380 sig_num_init='$sig_num_init'
25381 sig_size='$sig_size'
25382 signal_t='$signal_t'
25383 sitearch='$sitearch'
25384 sitearchexp='$sitearchexp'
25385 sitebin='$sitebin'
25386 sitebinexp='$sitebinexp'
25387 sitehtml1dir='$sitehtml1dir'
25388 sitehtml1direxp='$sitehtml1direxp'
25389 sitehtml3dir='$sitehtml3dir'
25390 sitehtml3direxp='$sitehtml3direxp'
25391 sitelib='$sitelib'
25392 sitelib_stem='$sitelib_stem'
25393 sitelibexp='$sitelibexp'
25394 siteman1dir='$siteman1dir'
25395 siteman1direxp='$siteman1direxp'
25396 siteman3dir='$siteman3dir'
25397 siteman3direxp='$siteman3direxp'
25398 siteprefix='$siteprefix'
25399 siteprefixexp='$siteprefixexp'
25400 sitescript='$sitescript'
25401 sitescriptexp='$sitescriptexp'
25402 sizesize='$sizesize'
25403 sizetype='$sizetype'
25404 sleep='$sleep'
25405 smail='$smail'
25406 so='$so'
25407 sockethdr='$sockethdr'
25408 socketlib='$socketlib'
25409 socksizetype='$socksizetype'
25410 sort='$sort'
25411 spackage='$spackage'
25412 spitshell='$spitshell'
25413 srand48_r_proto='$srand48_r_proto'
25414 srandom_r_proto='$srandom_r_proto'
25415 src='$src'
25416 ssizetype='$ssizetype'
25417 st_ino_sign='$st_ino_sign'
25418 st_ino_size='$st_ino_size'
25419 startperl='$startperl'
25420 startsh='$startsh'
25421 static_ext='$static_ext'
25422 stdchar='$stdchar'
25423 stdio_base='$stdio_base'
25424 stdio_bufsiz='$stdio_bufsiz'
25425 stdio_cnt='$stdio_cnt'
25426 stdio_filbuf='$stdio_filbuf'
25427 stdio_ptr='$stdio_ptr'
25428 stdio_stream_array='$stdio_stream_array'
25429 strerror_r_proto='$strerror_r_proto'
25430 strings='$strings'
25431 submit='$submit'
25432 subversion='$subversion'
25433 sysman='$sysman'
25434 sysroot='$sysroot'
25435 tail='$tail'
25436 tar='$tar'
25437 targetarch='$targetarch'
25438 targetdir='$targetdir'
25439 targetenv='$targetenv'
25440 targethost='$targethost'
25441 targetmkdir='$targetmkdir'
25442 targetport='$targetport'
25443 targetsh='$targetsh'
25444 tbl='$tbl'
25445 tee='$tee'
25446 test='$test'
25447 timeincl='$timeincl'
25448 timetype='$timetype'
25449 tmpnam_r_proto='$tmpnam_r_proto'
25450 to='$to'
25451 touch='$touch'
25452 tr='$tr'
25453 trnl='$trnl'
25454 troff='$troff'
25455 ttyname_r_proto='$ttyname_r_proto'
25456 u16size='$u16size'
25457 u16type='$u16type'
25458 u32size='$u32size'
25459 u32type='$u32type'
25460 u64size='$u64size'
25461 u64type='$u64type'
25462 u8size='$u8size'
25463 u8type='$u8type'
25464 uidformat='$uidformat'
25465 uidsign='$uidsign'
25466 uidsize='$uidsize'
25467 uidtype='$uidtype'
25468 uname='$uname'
25469 uniq='$uniq'
25470 uquadtype='$uquadtype'
25471 use5005threads='$use5005threads'
25472 use64bitall='$use64bitall'
25473 use64bitint='$use64bitint'
25474 usecbacktrace='$usecbacktrace'
25475 usecrosscompile='$usecrosscompile'
25476 usedevel='$usedevel'
25477 usedl='$usedl'
25478 usedtrace='$usedtrace'
25479 usefaststdio='$usefaststdio'
25480 useithreads='$useithreads'
25481 usekernprocpathname='$usekernprocpathname'
25482 uselargefiles='$uselargefiles'
25483 uselongdouble='$uselongdouble'
25484 usemallocwrap='$usemallocwrap'
25485 usemorebits='$usemorebits'
25486 usemultiplicity='$usemultiplicity'
25487 usemymalloc='$usemymalloc'
25488 usenm='$usenm'
25489 usensgetexecutablepath='$usensgetexecutablepath'
25490 useopcode='$useopcode'
25491 useperlio='$useperlio'
25492 useposix='$useposix'
25493 usequadmath='$usequadmath'
25494 usereentrant='$usereentrant'
25495 userelocatableinc='$userelocatableinc'
25496 useshrplib='$useshrplib'
25497 usesitecustomize='$usesitecustomize'
25498 usesocks='$usesocks'
25499 usethreads='$usethreads'
25500 usevendorprefix='$usevendorprefix'
25501 useversionedarchname='$useversionedarchname'
25502 usevfork='$usevfork'
25503 usrinc='$usrinc'
25504 uuname='$uuname'
25505 uvXUformat='$uvXUformat'
25506 uvoformat='$uvoformat'
25507 uvsize='$uvsize'
25508 uvtype='$uvtype'
25509 uvuformat='$uvuformat'
25510 uvxformat='$uvxformat'
25511 vaproto='$vaproto'
25512 vendorarch='$vendorarch'
25513 vendorarchexp='$vendorarchexp'
25514 vendorbin='$vendorbin'
25515 vendorbinexp='$vendorbinexp'
25516 vendorhtml1dir='$vendorhtml1dir'
25517 vendorhtml1direxp='$vendorhtml1direxp'
25518 vendorhtml3dir='$vendorhtml3dir'
25519 vendorhtml3direxp='$vendorhtml3direxp'
25520 vendorlib='$vendorlib'
25521 vendorlib_stem='$vendorlib_stem'
25522 vendorlibexp='$vendorlibexp'
25523 vendorman1dir='$vendorman1dir'
25524 vendorman1direxp='$vendorman1direxp'
25525 vendorman3dir='$vendorman3dir'
25526 vendorman3direxp='$vendorman3direxp'
25527 vendorprefix='$vendorprefix'
25528 vendorprefixexp='$vendorprefixexp'
25529 vendorscript='$vendorscript'
25530 vendorscriptexp='$vendorscriptexp'
25531 version='$version'
25532 version_patchlevel_string='$version_patchlevel_string'
25533 versiononly='$versiononly'
25534 vi='$vi'
25535 xlibpth='$xlibpth'
25536 yacc='$yacc'
25537 yaccflags='$yaccflags'
25538 zcat='$zcat'
25539 zip='$zip'
25540 EOT
25541
25542 : add special variables
25543 $test -f $src/patchlevel.h && \
25544 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25545 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25546 echo "PERL_CONFIG_SH=true" >>config.sh
25547
25548 : propagate old symbols
25549 if $test -f UU/config.sh; then
25550         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25551         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25552                 config.sh config.sh UU/oldconfig.sh |\
25553                 $sort | $uniq -u >UU/oldsyms
25554         set X `$cat UU/oldsyms`
25555         shift
25556         case $# in
25557         0) ;;
25558         *)
25559                 $cat <<EOM
25560 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25561 EOM
25562                 echo ": Variables propagated from previous config.sh file." >>config.sh
25563                 for sym in `$cat UU/oldsyms`; do
25564                         echo "    Propagating $hint variable "'$'"$sym..."
25565                         eval 'tmp="$'"${sym}"'"'
25566                         echo "$tmp" | \
25567                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25568                 done
25569                 ;;
25570         esac
25571 fi
25572
25573 : preserve RCS keywords in files with variable substitution, grrr
25574 Id='$Id'
25575
25576 : Finish up by extracting the .SH files
25577 case "$alldone" in
25578 exit)
25579         echo "Stopping at your request, leaving temporary files around."
25580         exit 0
25581         ;;
25582 cont)
25583         ;;
25584 '')
25585         dflt=''
25586         nostick=true
25587         $cat <<EOM
25588
25589 If you'd like to make any changes to the config.sh file before I begin
25590 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25591
25592 EOM
25593         rp="Press return or use a shell escape to edit config.sh:"
25594         . UU/myread
25595         nostick=''
25596         case "$ans" in
25597         '') ;;
25598         *) : in case they cannot read
25599                 sh 1>&4 -c "$ans";;
25600         esac
25601         ;;
25602 esac
25603
25604 : if this fails, just run all the .SH files by hand
25605 . ./config.sh
25606
25607 echo " "
25608 exec 1>&4
25609 pwd=`pwd`
25610 . ./UU/extract
25611 cd "$pwd"
25612
25613 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25614         dflt=y
25615         case "$silent" in
25616         true) ;;
25617         *)
25618                 $cat <<EOM
25619
25620 Now you need to generate make dependencies by running "$make depend".
25621 You might prefer to run it in background: "$make depend > makedepend.out &"
25622 It can take a while, so you might not want to run it right now.
25623
25624 EOM
25625                 ;;
25626         esac
25627         rp="Run $make depend now?"
25628         . UU/myread
25629         case "$ans" in
25630         y*)
25631                 $make depend && echo "Now you must run '$make'."
25632                 ;;
25633         *)
25634                 echo "You must run '$make depend' then '$make'."
25635                 ;;
25636         esac
25637 elif test -f [Mm]akefile; then
25638         echo " "
25639         echo "Now you must run a $make."
25640 else
25641         echo "Configure done."
25642 fi
25643
25644 if $test -f Policy.sh; then
25645     $cat <<EOM
25646
25647 If you compile $package on a different machine or from a different object
25648 directory, copy the Policy.sh file from this object directory to the
25649 new one before you run Configure -- this will help you with most of
25650 the policy defaults.
25651
25652 EOM
25653 fi
25654 if $test -f UU/config.msg; then
25655     echo "Hmm.  I also noted the following information while running:"
25656     echo " "
25657     $cat UU/config.msg >&4
25658 fi
25659 $rm -f kit*isdone ark*isdone
25660 $rm -rf UU
25661
25662 : End of Configure
25663